idmap: Use a range search in idmap_backends_unixid_to_sid
authorVolker Lendecke <vl@samba.org>
Tue, 18 Aug 2015 15:30:27 +0000 (17:30 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 24 Aug 2015 14:16:11 +0000 (16:16 +0200)
This obsoletes the domain name in the xid2sid calls

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11464

source3/winbindd/idmap.c

index 7b4a84d030f955da5375308cad6a54eaa0d77938..24277cac008ff460ece202fd37558953199ab18e 100644 (file)
@@ -507,6 +507,7 @@ NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id)
        struct idmap_domain *dom;
        struct id_map *maps[2];
        bool ok;
+       int i;
 
        ok = idmap_init();
        if (!ok) {
@@ -531,7 +532,16 @@ NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id)
                return NT_STATUS_OK;
        }
 
-       dom = idmap_find_domain(domname);
+       dom = default_idmap_domain;
+
+       for (i=0; i<num_domains; i++) {
+               if ((id->xid.id >= idmap_domains[i]->low_id) &&
+                   (id->xid.id <= idmap_domains[i]->high_id)) {
+                       dom = idmap_domains[i];
+                       break;
+               }
+       }
+
        if (dom == NULL) {
                return NT_STATUS_NONE_MAPPED;
        }