]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
idmap_hash: only return ID_REQUIRE_TYPE if we don't know about the domain yet
authorStefan Metzmacher <metze@samba.org>
Thu, 21 Mar 2019 15:54:31 +0000 (16:54 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 10 Mar 2023 10:38:37 +0000 (10:38 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15319

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/idmap_hash/idmap_hash.c

index ed20a5e8bedc82860683de77bf4cd4370a89e4dd..fb900617ec399db926ae63edaca0728a748c442d 100644 (file)
@@ -279,6 +279,14 @@ static NTSTATUS idmap_hash_sid_to_id(struct sid_hash_table *hashed_domains,
                return NT_STATUS_OK;
        }
 
+       /*
+        * If the domain hash already exists find a SID in the table,
+        * just return the mapping.
+        */
+       if (hashed_domains[h_domain].sid != NULL) {
+               goto return_mapping;
+       }
+
        if (id->xid.type == ID_TYPE_NOT_SPECIFIED) {
                /*
                 * idmap_hash used to bounce back the requested type,
@@ -313,6 +321,7 @@ static NTSTATUS idmap_hash_sid_to_id(struct sid_hash_table *hashed_domains,
         * random mix of ID_TYPE_UID, ID_TYPE_GID or
         * ID_TYPE_BOTH.
         */
+return_mapping:
        id->xid.type = ID_TYPE_BOTH;
        id->xid.id = combine_hashes(h_domain, h_rid);
        id->status = ID_MAPPED;