Skip to content

Commit

Permalink
avoid frivolous logs for expired credentials (minio#18767)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Jan 9, 2024
1 parent a89e0ba commit f02d282
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -1358,9 +1358,15 @@ func (sys *IAMSys) updateGroupMembershipsForLDAP(ctx context.Context) {
// DN to ldap username mapping for each LDAP user
parentUserToLDAPUsernameMap := make(map[string]string)
for _, cred := range allCreds {
// Expired credentials don't need parent user updates.
if cred.IsExpired() {
continue
}

if !sys.LDAPConfig.IsLDAPUserDN(cred.ParentUser) {
continue
}

// Check if this is the first time we are
// encountering this LDAP user.
if _, ok := parentUserToCredsMap[cred.ParentUser]; !ok {
Expand Down Expand Up @@ -1425,6 +1431,11 @@ func (sys *IAMSys) updateGroupMembershipsForLDAP(ctx context.Context) {
continue
}

// Expired credentials don't need group membership updates.
if cred.IsExpired() {
continue
}

cred.Groups = currGroups
if err := sys.store.UpdateUserIdentity(ctx, cred); err != nil {
// Log and continue error - perhaps it'll work the next time.
Expand Down

0 comments on commit f02d282

Please sign in to comment.