Skip to content

Commit

Permalink
ldap/bind/direct: return LDAPResultOperationsError on 5xx error
Browse files Browse the repository at this point in the history
  • Loading branch information
calbrecht committed Aug 12, 2024
1 parent b85d824 commit 7e11c4f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/outpost/ldap/bind/direct/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package direct

import (
"context"
"regexp"

"beryju.io/ldap"
"github.com/getsentry/sentry-go"
Expand Down Expand Up @@ -45,6 +46,10 @@ func (db *DirectBinder) Bind(username string, req *bind.Request) (ldap.LDAPResul
"app": db.si.GetAppSlug(),
}).Inc()
req.Log().WithError(err).Warning("failed to execute flow")
is_server_err, regex_err := regexp.MatchString(`\b5\d\d\b`, err.Error())
if regex_err == nil && is_server_err {
return ldap.LDAPResultOperationsError, nil
}
return ldap.LDAPResultInvalidCredentials, nil
}
if !passed {
Expand Down

0 comments on commit 7e11c4f

Please sign in to comment.