idmap_hash: provide ID_TYPE_BOTH mappings also for unixids_to_sids
authorStefan Metzmacher <metze@samba.org>
Thu, 21 Mar 2019 15:38:35 +0000 (16:38 +0100)
committerJule Anger <janger@samba.org>
Wed, 5 Apr 2023 10:40:13 +0000 (10:40 +0000)
While sids_to_unixids returns ID_TYPE_BOTH mappings,
unixids_to_sids() returns the callers asked for, which
fills gencache with the non ID_TYPE_BOTH mappings.
As a result also the sids_to_unixids fast path via
gencache won't return ID_TYPE_BOTH mappings.

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 9a24570d3d69f51b6d50bb04b739815ec67c1a3d)

source3/winbindd/idmap_hash/idmap_hash.c

index d0bed7631a615e262d68b00f7b599f74bb5196d0..ec85119b0637df629c75b2b3fd2993fa33dd040c 100644 (file)
@@ -224,6 +224,7 @@ static NTSTATUS unixids_to_sids(struct idmap_domain *dom,
                if (!hashed_domains[h_domain].sid)
                        continue;
 
+               ids[i]->xid.type = ID_TYPE_BOTH;
                sid_compose(ids[i]->sid, hashed_domains[h_domain].sid, h_rid);
                ids[i]->status = ID_MAPPED;
        }