]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
idmap_rfc2307: Don't stop after 30 entries
authorVolker Lendecke <vl@samba.org>
Fri, 31 Mar 2017 15:20:07 +0000 (15:20 +0000)
committerKarolin Seeger <kseeger@samba.org>
Tue, 16 May 2017 07:15:06 +0000 (09:15 +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>
(cherry picked from commit 54a0e7e3d7332f420f36a3a20dd62156e6adea46)

source3/winbindd/idmap_rfc2307.c

index 34cc5cd179f7184a786435698524f4a4bdb3c623..fcb950d4538b42d871edd01acd3227a8e3078d2c 100644 (file)
@@ -521,10 +521,7 @@ static struct id_map* idmap_rfc2307_find_map(struct idmap_rfc2307_map *maps,
 
        DEBUG(10, ("Looking for name %s, type %d\n", name, type));
 
-       for (i = 0; i < IDMAP_LDAP_MAX_IDS; i++) {
-               if (maps[i].map == NULL) { /* end of the run */
-                       return NULL;
-               }
+       for (i = 0; maps[i].map != NULL; i++) {
                DEBUG(10, ("Entry %d: name %s, type %d\n",
                           i, maps[i].name, maps[i].type));
                if (type == maps[i].type && strcmp(name, maps[i].name) == 0) {