Fix nil dereference in adding service account (#21235)

Fixes #21234
This commit is contained in:
Taran Pelkey
2025-04-24 14:14:00 -04:00
committed by GitHub
parent 427826abc5
commit 18aceae620

View File

@@ -2959,7 +2959,7 @@ func commonAddServiceAccount(r *http.Request, ldap bool) (context.Context, auth.
denyOnly := (targetUser == cred.AccessKey || targetUser == cred.ParentUser)
if ldap && !denyOnly {
res, _ := globalIAMSys.LDAPConfig.GetValidatedDNForUsername(targetUser)
if res.NormDN == cred.ParentUser {
if res != nil && res.NormDN == cred.ParentUser {
denyOnly = true
}
}