Fix error when validating DN that is not under base DN (#19971)

This commit is contained in:
Taran Pelkey
2024-06-22 01:35:35 -05:00
committed by GitHub
parent 5f6a25cdd0
commit 168ae81b1f

View File

@@ -98,7 +98,8 @@ func (l *Config) GetValidatedDNForUsername(username string) (*xldap.DNSearchResu
// under a configured base DN in the LDAP directory.
validDN, isUnderBaseDN, err := l.GetValidatedUserDN(conn, username)
if err == nil && !isUnderBaseDN {
return nil, fmt.Errorf("Unable to find user DN: %w", err)
// Not under any configured base DN, so treat as not found.
return nil, nil
}
return validDN, err
}