From 3f1297f363552083397c206d2dcb512e7a5e5f8e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Apr 2014 18:56:21 +0200 Subject: [PATCH] autorid: introduce idmap_autorid_domsid_is_for_alloc() Currently, this checks if the sid is a wellknown domain sid. But the code reads more nicely and more domains might be added in the future. Signed-off-by: Michael Adam Reviewed-by: Stefan Metzmacher --- source3/winbindd/idmap_autorid.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index af0288bac7f..530a7201974 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -402,6 +402,18 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc(struct idmap_domain *dom, } +static bool idmap_autorid_domsid_is_for_alloc(struct dom_sid *sid) +{ + bool match; + + match = sid_check_is_wellknown_domain(sid, NULL); + if (match) { + return true; + } + + return false; +} + static NTSTATUS idmap_autorid_sid_to_id(struct idmap_tdb_common_context *common, struct idmap_domain *dom, struct id_map *map) @@ -429,8 +441,8 @@ static NTSTATUS idmap_autorid_sid_to_id(struct idmap_tdb_common_context *common, return NT_STATUS_NONE_MAPPED; } - if (sid_check_is_wellknown_domain(&domainsid, NULL)) { - DEBUG(10, ("SID %s is well-known, using pool\n", + if (idmap_autorid_domsid_is_for_alloc(&domainsid)) { + DEBUG(10, ("SID %s is for ALLOC range.\n", sid_string_dbg(map->sid))); return idmap_autorid_sid_to_id_alloc(dom, map, common); -- 2.11.4.GIT