auth: Use "all_zero" where appropriate
authorVolker Lendecke <vl@samba.org>
Sat, 31 Dec 2016 12:45:51 +0000 (12:45 +0000)
committerRalph Boehme <slow@samba.org>
Tue, 3 Jan 2017 15:04:28 +0000 (16:04 +0100)
... Saves a few bytes of footprint

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/auth/check_samsec.c

index cbcde08412895831c1c05e538e146df3873c9f97..53b6da53dc17642724bbd04a3e1ed8b7075970e6 100644 (file)
@@ -322,7 +322,6 @@ static bool need_to_increment_bad_pw_count(
        username = pdb_get_username(sampass);
 
        for (i=1; i < MIN(MIN(3, policy_pwhistory_len), pwhistory_len); i++) {
-               static const uint8_t zero16[SALTED_MD5_HASH_LEN];
                const uint8_t *salt;
                const uint8_t *nt_pw;
                NTSTATUS status;
@@ -332,12 +331,12 @@ static bool need_to_increment_bad_pw_count(
                salt = &pwhistory[i*PW_HISTORY_ENTRY_LEN];
                nt_pw = salt + PW_HISTORY_SALT_LEN;
 
-               if (memcmp(zero16, nt_pw, NT_HASH_LEN) == 0) {
+               if (all_zero(nt_pw, NT_HASH_LEN)) {
                        /* skip zero password hash */
                        continue;
                }
 
-               if (memcmp(zero16, salt, PW_HISTORY_SALT_LEN) != 0) {
+               if (!all_zero(salt, PW_HISTORY_SALT_LEN)) {
                        /* skip nonzero salt (old format entry) */
                        continue;
                }