autorid: introduce idmap_autorid_domsid_is_for_alloc()
authorMichael Adam <obnox@samba.org>
Fri, 11 Apr 2014 16:56:21 +0000 (18:56 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 25 Apr 2014 13:35:09 +0000 (15:35 +0200)
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 <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/winbindd/idmap_autorid.c

index af0288bac7f60dab9f21db1e4d52d770d0b079a0..530a7201974a8416175844639b16b9df85d9287f 100644 (file)
@@ -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);