s3:auth:check_sam_security: introduce a bool var to control pad_pw_count incrementation
authorMichael Adam <obnox@samba.org>
Wed, 6 Jan 2010 15:35:44 +0000 (16:35 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 7 Jan 2010 15:51:18 +0000 (16:51 +0100)
This is a preparatory patch for the last part in fixing bug #4347 .

Michael

source3/auth/auth_sam.c

index e7b9f2b019098299184b1db59e17b1edc5d733b7..4c3f552ee607ce298ce4ea8521ef85dd7e6e0b20 100644 (file)
@@ -354,10 +354,16 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
        update_login_attempts_status = pdb_update_login_attempts(sampass, NT_STATUS_IS_OK(nt_status));
 
        if (!NT_STATUS_IS_OK(nt_status)) {
        update_login_attempts_status = pdb_update_login_attempts(sampass, NT_STATUS_IS_OK(nt_status));
 
        if (!NT_STATUS_IS_OK(nt_status)) {
+               bool increment_bad_pw_count = false;
+
                if (NT_STATUS_EQUAL(nt_status,NT_STATUS_WRONG_PASSWORD) && 
                    acct_ctrl & ACB_NORMAL &&
                    NT_STATUS_IS_OK(update_login_attempts_status)) 
                if (NT_STATUS_EQUAL(nt_status,NT_STATUS_WRONG_PASSWORD) && 
                    acct_ctrl & ACB_NORMAL &&
                    NT_STATUS_IS_OK(update_login_attempts_status)) 
-               {  
+               {
+                       increment_bad_pw_count = true;
+               }
+
+               if (increment_bad_pw_count) {
                        pdb_increment_bad_password_count(sampass);
                        updated_badpw = True;
                } else {
                        pdb_increment_bad_password_count(sampass);
                        updated_badpw = True;
                } else {