idmap_rfc2307: Don't stop after 30 entries
authorVolker Lendecke <vl@samba.org>
Fri, 31 Mar 2017 15:20:07 +0000 (15:20 +0000)
committerChristof Schmitt <cs@samba.org>
Mon, 8 May 2017 19:08:23 +0000 (21:08 +0200)
We start over again and again, so we need to search in the whole list.
This is a quick hack generating a bad O(n^2). The real fix is to
call idmap_rfc2307_find_map with "maps" starting at the right offset,
but that's an optimization for later when it's restructured

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
source3/winbindd/idmap_util.c

index 196b4adf24756351d5b8dd7911a184cc6d0fa289..fd2ae4a15acb5d46bf85b98031d9ee03c8663c31 100644 (file)
@@ -52,10 +52,7 @@ struct id_map *idmap_find_map_by_id(struct id_map **maps, enum id_type type,
 {
        int i;
 
-       for (i = 0; i < IDMAP_LDAP_MAX_IDS; i++) {
-               if (maps[i] == NULL) { /* end of the run */
-                       return NULL;
-               }
+       for (i = 0; maps[i] != NULL; i++) {
                if ((maps[i]->xid.type == type) && (maps[i]->xid.id == id)) {
                        return maps[i];
                }