diff options
author | Stefan Metzmacher <metze@samba.org> | 2019-03-21 16:54:31 +0100 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2023-03-30 15:10:10 +0000 |
commit | 13a593254afa9cfdfbcefb51da88b1a8309ef723 (patch) | |
tree | e515ee22ced279d52d5a23ff724942f76bbf3e41 | |
parent | e5c9a3597af05da7236e284422adca5294ff31c4 (diff) | |
download | samba-13a593254afa9cfdfbcefb51da88b1a8309ef723.tar.gz |
idmap_hash: return ID_REQUIRE_TYPE only if there's a chance to get a mapping later
If we are going to return ID_UNMAPPED later anyway, there's no need to
defer that decision by returning ID_REQUIRE_TYPE first.
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 42dcb3db05530179a991fe58e7b96b52bbbcc607)
-rw-r--r-- | source3/winbindd/idmap_hash/idmap_hash.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/source3/winbindd/idmap_hash/idmap_hash.c b/source3/winbindd/idmap_hash/idmap_hash.c index 726338473ea..ed20a5e8bed 100644 --- a/source3/winbindd/idmap_hash/idmap_hash.c +++ b/source3/winbindd/idmap_hash/idmap_hash.c @@ -261,6 +261,24 @@ static NTSTATUS idmap_hash_sid_to_id(struct sid_hash_table *hashed_domains, uint32_t rid; uint32_t h_domain, h_rid; + id->status = ID_UNMAPPED; + + sid_copy(&sid, id->sid); + sid_split_rid(&sid, &rid); + + h_domain = hash_domain_sid(&sid); + h_rid = hash_rid(rid); + + /* Check that both hashes are non-zero*/ + if (h_domain == 0) { + /* keep ID_UNMAPPED */ + return NT_STATUS_OK; + } + if (h_rid == 0) { + /* keep ID_UNMAPPED */ + return NT_STATUS_OK; + } + if (id->xid.type == ID_TYPE_NOT_SPECIFIED) { /* * idmap_hash used to bounce back the requested type, @@ -280,24 +298,6 @@ static NTSTATUS idmap_hash_sid_to_id(struct sid_hash_table *hashed_domains, return NT_STATUS_OK; } - id->status = ID_UNMAPPED; - - sid_copy(&sid, id->sid); - sid_split_rid(&sid, &rid); - - h_domain = hash_domain_sid(&sid); - h_rid = hash_rid(rid); - - /* Check that both hashes are non-zero*/ - if (h_domain == 0) { - /* keep ID_UNMAPPED */ - return NT_STATUS_OK; - } - if (h_rid == 0) { - /* keep ID_UNMAPPED */ - return NT_STATUS_OK; - } - /* * idmap_hash used to bounce back the requested type, * which was ID_TYPE_UID, ID_TYPE_GID or |