summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2019-03-21 16:54:31 +0100
committerJule Anger <janger@samba.org>2023-04-05 10:40:13 +0000
commiteb4129d3cc75833554f26f31ef91b164d9a3b2e8 (patch)
tree53e0fa068e5a1fe4ddc23c829fb6150664502c4d
parente79be5ed069cb4efda859792b43fe7d4c044c2a7 (diff)
downloadsamba-eb4129d3cc75833554f26f31ef91b164d9a3b2e8.tar.gz
idmap_hash: only return ID_REQUIRE_TYPE if we don't know about the domain yet
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> (cherry picked from commit ede88d9f83fb77fa8eff226fb6a85ac71e415098)
-rw-r--r--source3/winbindd/idmap_hash/idmap_hash.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source3/winbindd/idmap_hash/idmap_hash.c b/source3/winbindd/idmap_hash/idmap_hash.c
index ed20a5e8bed..fb900617ec3 100644
--- a/source3/winbindd/idmap_hash/idmap_hash.c
+++ b/source3/winbindd/idmap_hash/idmap_hash.c
@@ -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;