]> git.sur5r.net Git - openldap/commitdiff
ITS#2368 - fix deleting key from range IDL
authorHoward Chu <hyc@openldap.org>
Wed, 12 Mar 2003 21:18:39 +0000 (21:18 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 12 Mar 2003 21:18:39 +0000 (21:18 +0000)
servers/slapd/back-bdb/idl.c

index 0b38ae96b104882303e013b61ee92ebb026aa4c6..5d7f321857e43aca864e412703ecded9c8b110ee 100644 (file)
@@ -850,20 +850,17 @@ bdb_idl_delete_key(
                        /* It's a range, see if we need to rewrite
                         * the boundaries
                         */
-                       hi = 0;
                        data.data = &lo;
                        rc = cursor->c_get( cursor, key, &data, DB_NEXT_DUP );
                        if ( rc != 0 ) {
                                err = "c_get lo";
                                goto fail;
                        }
-                       if ( id > lo ) {
-                               data.data = &hi;
-                               rc = cursor->c_get( cursor, key, &data, DB_NEXT_DUP );
-                               if ( rc != 0 ) {
-                                       err = "c_get hi";
-                                       goto fail;
-                               }
+                       data.data = &hi;
+                       rc = cursor->c_get( cursor, key, &data, DB_NEXT_DUP );
+                       if ( rc != 0 ) {
+                               err = "c_get hi";
+                               goto fail;
                        }
                        if ( id == lo || id == hi ) {
                                if ( id == lo ) {
@@ -881,6 +878,12 @@ bdb_idl_delete_key(
                                                goto fail;
                                        }
                                } else {
+                                       if ( id == lo ) {
+                                               /* reposition on lo slot */
+                                               data.data = &lo;
+                                               cursor->c_get( cursor, key, &data, DB_PREV );
+                                               lo = id;
+                                       }
                                        rc = cursor->c_del( cursor, 0 );
                                        if ( rc != 0 ) {
                                                err = "c_del";