mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
fix panic when unlocking unlocked user (#23611)
This commit is contained in:
parent
813c786032
commit
2f8e59c856
1 changed files with 9 additions and 7 deletions
|
|
@ -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 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()
|
||||
if numLockedUsers == 0 {
|
||||
core.Logger().Info("user lockout(s) cleared")
|
||||
core.lockoutLoggerCancel()
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue