[Date Prev][Date Next] [Chronological] [Thread] [Top]

slight fix: Removing deleted entry's id from Parent's children list



I wrote this under the stable snapshot, and devel had changed quite
a bit, so I missed a couple of things.  The correct patch for delete.c
is below.



--- delete.c.orig       Mon Nov  9 13:53:29 1998
+++ delete.c    Tue Nov 10 12:59:43 1998
@@ -23,7 +23,8 @@
 {
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
        char            *matched = NULL;
-       Entry           *e;
+        char            *pdn = NULL;
+       Entry           *e, *p;
 
        Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn, 0, 0);
 
@@ -66,6 +67,13 @@
                e->e_rdwr.readers_reading, e->e_rdwr.writer_writing, 0);
 
        /* XXX delete from parent's id2children entry XXX */
+       pdn = dn_parent( be, dn );
+       matched = NULL;
+       p = dn2entry_r( be, pdn, &matched );
+       if ( id2children_remove( be, p, e ) != 0 ) {
+               send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "","" );
+                goto error_return;
+       }
 
        /* delete from dn2id mapping */
        if ( dn2id_delete( be, e->e_dn ) != 0 ) {
@@ -87,6 +95,8 @@
 
        /* free entry and writer lock */
        cache_return_entry_w( &li->li_cache, e );
+        if ( p )
+            cache_return_entry_r( &li->li_cache, p );
 
        send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
 
@@ -95,6 +105,8 @@
 error_return:;
        /* free entry and writer lock */
        cache_return_entry_w( &li->li_cache, e );
+        if ( p )
+            cache_return_entry_r( &li->li_cache, p );
 
        return( -1 );
 }


  o    _______________  Gary Williams        SAS Institute Inc.
 /\_  _|             |  sasgwi@unx.sas.com   SAS Campus Dr.
_\__`[_______________|  919-677-8000 x4059   Cary, NC 27513
] [ \, ][         ][