]> git.sur5r.net Git - openldap/commitdiff
delete from dn2id database bug in back-ldbm/idl.c (ITS#3046)
authorKurt Zeilenga <kurt@openldap.org>
Tue, 6 Apr 2004 21:54:07 +0000 (21:54 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 6 Apr 2004 21:54:07 +0000 (21:54 +0000)
Suggested fix provided by Wout van Albada

servers/slapd/back-ldbm/idl.c

index d592732e48651f5351df5c9f3f513034dd39a3e5..f19ece31d0c38743b405cf7c3c79334b4d21fe4d 100644 (file)
@@ -952,13 +952,16 @@ idl_delete_key (
           */
        cont_alloc( &data, &key );
 #ifndef USE_INDIRECT_NIDS
-       for ( nids = 0; !ID_BLOCK_NOID(idl, nids); nids++ )
-               ;       /* NULL */
+       for ( nids = 0; !ID_BLOCK_NOID(idl, nids); nids++ ) {
+               ;       /* Empty */
+       }
 
        for ( j = 0; j<nids; j++ ) 
 #else
        nids = ID_BLOCK_NIDS(idl);
-       for ( j = idl_find(idl, id); j >= 0; j = -1)    /* execute once */
+       j = idl_find(idl, id);
+       if ( ID_BLOCK_ID(idl, j) > id ) j--;
+       for (; j>=0; j = -1 ) /* execute once */
 #endif
        {
                ID_BLOCK *tmp;