hash_domain_sid UINT32_MAX
authorStefan Metzmacher <metze@samba.org>
Thu, 21 Mar 2019 15:35:58 +0000 (16:35 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 15 Oct 2019 07:36:38 +0000 (09:36 +0200)
source3/winbindd/idmap_hash/idmap_hash.c

index 120d22097f4e017d58af9acc29eb13be1c1eb5c2..ef630be1c9adf9d1f01a6ab913a94f7e846a114a 100644 (file)
@@ -42,8 +42,9 @@ static uint32_t hash_domain_sid(const struct dom_sid *sid)
 {
        uint32_t hash;
 
-       if (sid->num_auths != 4)
-               return 0;
+       if (sid->num_auths != 4) {
+               return UINT32_MAX;
+       }
 
        /* XOR the last three subauths */
 
@@ -163,8 +164,10 @@ static NTSTATUS idmap_hash_initialize(struct idmap_domain *dom)
                        continue;
                }
 
-               if ((hash = hash_domain_sid(&dom_list[i].sid)) == 0)
+               hash = hash_domain_sid(&dom_list[i].sid);
+               if (hash == UINT32_MAX) {
                        continue;
+               }
 
                DBG_INFO("Adding %s (%s) -> %d\n",
                         dom_list[i].domain_name,
@@ -271,8 +274,8 @@ static NTSTATUS idmap_hash_sid_to_id(struct sid_hash_table *hashed_domains,
        h_domain = hash_domain_sid(&sid);
        h_rid = hash_rid(rid);
 
-       /* Check that both hashes are non-zero*/
-       if (h_domain == 0) {
+       /* Check that both hashes are valid */
+       if (h_domain == UINT32_MAX) {
                return NT_STATUS_NONE_MAPPED;
        }
        if (h_rid == 0) {