Skip to content

Commit

Permalink
backport of commit 2f8e59c (#23613)
Browse files Browse the repository at this point in the history
Co-authored-by: davidadeleon <[email protected]>
  • Loading branch information
1 parent 4ab5192 commit 5a6a777
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions vault/logical_system_user_lockout.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ func unlockUser(ctx context.Context, core *Core, mountAccessor string, aliasName
return err
}

// Check if we have no more locked users and cancel any running lockout logger
core.userFailedLoginInfoLock.RLock()
numLockedUsers := len(core.userFailedLoginInfo)
core.userFailedLoginInfoLock.RUnlock()

if numLockedUsers == 0 {
core.Logger().Info("user lockout(s) cleared")
core.lockoutLoggerCancel()
if core.lockoutLoggerCancel != nil {
// Check if we have no more locked users and cancel any running lockout logger
core.userFailedLoginInfoLock.RLock()
numLockedUsers := len(core.userFailedLoginInfo)
core.userFailedLoginInfoLock.RUnlock()

if numLockedUsers == 0 {
core.Logger().Info("user lockout(s) cleared")
core.lockoutLoggerCancel()
}
}

return nil
Expand Down

0 comments on commit 5a6a777

Please sign in to comment.