]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samr3: 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>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/rpc_server/samr/srv_samr_chgpasswd.c

index ad4eaa72a019ab4a351e8a4c3bb211453ffa6446..ab9e92ace78da7d735245ab062ff2045fc2f5798 100644 (file)
@@ -838,7 +838,6 @@ static bool password_in_history(uint8_t nt_pw[NT_HASH_LEN],
                                uint32_t pw_history_len,
                                const uint8_t *pw_history)
 {
-       static const uint8_t zero_md5_nt_pw[SALTED_MD5_HASH_LEN] = { 0, };
        int i;
 
        dump_data(100, nt_pw, NT_HASH_LEN);
@@ -852,15 +851,12 @@ static bool password_in_history(uint8_t nt_pw[NT_HASH_LEN],
                current_salt = &pw_history[i*PW_HISTORY_ENTRY_LEN];
                old_nt_pw_salted_md5_hash = current_salt + PW_HISTORY_SALT_LEN;
 
-               if (memcmp(zero_md5_nt_pw, old_nt_pw_salted_md5_hash,
-                          SALTED_MD5_HASH_LEN) == 0) {
+               if (all_zero(old_nt_pw_salted_md5_hash, SALTED_MD5_HASH_LEN)) {
                        /* Ignore zero valued entries. */
                        continue;
                }
 
-               if (memcmp(zero_md5_nt_pw, current_salt,
-                          PW_HISTORY_SALT_LEN) == 0)
-               {
+               if (all_zero(current_salt, PW_HISTORY_SALT_LEN)) {
                        /*
                         * New format: zero salt and then plain nt hash.
                         * Directly compare the hashes.