From: Volker Lendecke Date: Sat, 31 Dec 2016 12:45:51 +0000 (+0000) Subject: samr3: Use "all_zero" where appropriate X-Git-Tag: samba-4.6.0rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80bb18d896a5609adb526a39c8512a4bc94cb409;p=thirdparty%2Fsamba.git samr3: Use "all_zero" where appropriate ... Saves a few bytes of footprint Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/rpc_server/samr/srv_samr_chgpasswd.c b/source3/rpc_server/samr/srv_samr_chgpasswd.c index ad4eaa72a01..ab9e92ace78 100644 --- a/source3/rpc_server/samr/srv_samr_chgpasswd.c +++ b/source3/rpc_server/samr/srv_samr_chgpasswd.c @@ -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.