Skip to content

Commit

Permalink
backport of commit 2f8e59c
Browse files Browse the repository at this point in the history
  • Loading branch information
davidadeleon authored Oct 11, 2023
1 parent 4ab5192 commit 7d51eed
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 7d51eed

Please sign in to comment.