]> git.sur5r.net Git - openldap/commitdiff
Catch nextid failures.
authorKurt Zeilenga <kurt@openldap.org>
Tue, 12 Sep 2000 21:16:03 +0000 (21:16 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 12 Sep 2000 21:16:03 +0000 (21:16 +0000)
servers/slapd/back-ldbm/add.c
servers/slapd/back-ldbm/nextid.c

index 1577c74bede1d4e7a5e96d4b8c4c46f2fa1c3b18..1b36200c8839720646eb0e883cc61ae1477b1b3a 100644 (file)
@@ -191,6 +191,26 @@ ldbm_back_add(
 
        e->e_id = next_id( be );
 
+       if( e->e_id == NOID ) {
+               if( p != NULL) {
+                       /* free parent and writer lock */
+                       cache_return_entry_w( &li->li_cache, p ); 
+               }
+
+               if ( rootlock ) {
+                       /* release root lock */
+                       ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
+               }
+
+               Debug( LDAP_DEBUG_ANY, "ldbm_add: next_id failed\n",
+                       0, 0, 0 );
+
+               send_ldap_result( conn, op, LDAP_OTHER,
+                       NULL, "next_id add failed", NULL, NULL );
+
+               return( -1 );
+       }
+
        /*
         * Try to add the entry to the cache, assign it a new dnid.
         */
index c92cbaab780948148f1e5826a435af8067c995b0..2ea984a852eafe51c3cacba92c49ca91385ecf52 100644 (file)
@@ -123,5 +123,4 @@ next_id( Backend *be )
 
        ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
        return id;
-
 }