]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
kdc: 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>
source4/kdc/pac-glue.c

index 99140fc7f0b1929823da2e8af69d29c07166872f..079030ee5e81fde3c985ea598dbaf40f56fddfb5 100644 (file)
@@ -120,8 +120,6 @@ NTSTATUS samba_get_cred_info_ndr_blob(TALLOC_CTX *mem_ctx,
 {
        enum ndr_err_code ndr_err;
        NTSTATUS nt_status;
-       int ret;
-       static const struct samr_Password zero_hash;
        struct samr_Password *lm_hash = NULL;
        struct samr_Password *nt_hash = NULL;
        struct PAC_CREDENTIAL_NTLM_SECPKG ntlm_secpkg = {
@@ -142,8 +140,8 @@ NTSTATUS samba_get_cred_info_ndr_blob(TALLOC_CTX *mem_ctx,
 
        lm_hash = samdb_result_hash(mem_ctx, msg, "dBCSPwd");
        if (lm_hash != NULL) {
-               ret = memcmp(lm_hash->hash, zero_hash.hash, 16);
-               if (ret == 0) {
+               bool zero = all_zero(lm_hash->hash, 16);
+               if (zero) {
                        lm_hash = NULL;
                }
        }
@@ -157,8 +155,8 @@ NTSTATUS samba_get_cred_info_ndr_blob(TALLOC_CTX *mem_ctx,
 
        nt_hash = samdb_result_hash(mem_ctx, msg, "unicodePwd");
        if (nt_hash != NULL) {
-               ret = memcmp(nt_hash->hash, zero_hash.hash, 16);
-               if (ret == 0) {
+               bool zero = all_zero(nt_hash->hash, 16);
+               if (zero) {
                        nt_hash = NULL;
                }
        }