Fix nil pointer deref in PeerPolicyMappingHandler (#20913)

The following lines will attempt to de-reference the nil value. Instead just return the error at once.
This commit is contained in:
Klaus Post 2025-02-10 08:35:13 -08:00 committed by GitHub
parent f00c8c4cce
commit e30f1ad7bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1441,7 +1441,7 @@ func (c *SiteReplicationSys) PeerPolicyMappingHandler(ctx context.Context, mappi
if foundGroupDN, underBaseDN, err = globalIAMSys.LDAPConfig.GetValidatedGroupDN(nil, entityName); err != nil {
iamLogIf(ctx, err)
} else if foundGroupDN == nil || !underBaseDN {
err = errNoSuchGroup
return wrapSRErr(errNoSuchGroup)
}
entityName = foundGroupDN.NormDN
} else {
@ -1449,7 +1449,7 @@ func (c *SiteReplicationSys) PeerPolicyMappingHandler(ctx context.Context, mappi
if foundUserDN, err = globalIAMSys.LDAPConfig.GetValidatedDNForUsername(entityName); err != nil {
iamLogIf(ctx, err)
} else if foundUserDN == nil {
err = errNoSuchUser
return wrapSRErr(errNoSuchUser)
}
entityName = foundUserDN.NormDN
}