mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
core/login: fix potential deadlock for failed logins when user lockout is enabled (#25697)
* core: fix potential deadlock for failed logins * changelog
This commit is contained in:
3
changelog/25697.txt
Normal file
3
changelog/25697.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
core/login: Fixed a potential deadlock when a login fails and user lockout is enabled.
|
||||||
|
```
|
||||||
@@ -2440,6 +2440,8 @@ func (c *Core) LocalGetUserFailedLoginInfo(ctx context.Context, userKey FailedLo
|
|||||||
// LocalUpdateUserFailedLoginInfo updates the failed login information for a user based on alias name and mountAccessor
|
// LocalUpdateUserFailedLoginInfo updates the failed login information for a user based on alias name and mountAccessor
|
||||||
func (c *Core) LocalUpdateUserFailedLoginInfo(ctx context.Context, userKey FailedLoginUser, failedLoginInfo *FailedLoginInfo, deleteEntry bool) error {
|
func (c *Core) LocalUpdateUserFailedLoginInfo(ctx context.Context, userKey FailedLoginUser, failedLoginInfo *FailedLoginInfo, deleteEntry bool) error {
|
||||||
c.userFailedLoginInfoLock.Lock()
|
c.userFailedLoginInfoLock.Lock()
|
||||||
|
defer c.userFailedLoginInfoLock.Unlock()
|
||||||
|
|
||||||
switch deleteEntry {
|
switch deleteEntry {
|
||||||
case false:
|
case false:
|
||||||
// update entry in the map
|
// update entry in the map
|
||||||
@@ -2482,7 +2484,6 @@ func (c *Core) LocalUpdateUserFailedLoginInfo(ctx context.Context, userKey Faile
|
|||||||
// delete the entry from the map, if no key exists it is no-op
|
// delete the entry from the map, if no key exists it is no-op
|
||||||
delete(c.userFailedLoginInfo, userKey)
|
delete(c.userFailedLoginInfo, userKey)
|
||||||
}
|
}
|
||||||
c.userFailedLoginInfoLock.Unlock()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user