1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

CVE-2021-20251 s4-rpc_server: Check badPwdCount update return status

If the account has been locked out in the meantime (indicated by
NT_STATUS_ACCOUNT_LOCKED_OUT), we should return the appropriate error
code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14611

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit a268a1a0e3)
This commit is contained in:
Joseph Sutton 2022-07-09 15:55:02 +12:00 committed by Jule Anger
parent 74d8c3d584
commit 96c24b58b8

View File

@ -534,7 +534,11 @@ failed:
/* Only update the badPwdCount if we found the user */
if (NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) {
authsam_update_bad_pwd_count(sam_ctx, msg, ldb_get_default_basedn(sam_ctx));
NTSTATUS bad_pwd_status = authsam_update_bad_pwd_count(
sam_ctx, msg, ldb_get_default_basedn(sam_ctx));
if (NT_STATUS_EQUAL(bad_pwd_status, NT_STATUS_ACCOUNT_LOCKED_OUT)) {
status = bad_pwd_status;
}
} else if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
/* Don't give the game away: (don't allow anonymous users to prove the existence of usernames) */
status = NT_STATUS_WRONG_PASSWORD;