]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/delete.c
Added ppolicy_hide_lockout keyword
[openldap] / servers / slapd / delete.c
index e0a5c38fda7f6119645ac538f6486be96b36b491..1749c0975c5a5728e2d4cbf5cc2886bb76f28da7 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2003 The OpenLDAP Foundation.
+ * Copyright 1998-2004 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,7 @@
 #include "lutil.h"
 
 #ifdef LDAP_SLAPI
-#include "slapi.h"
+#include "slapi/slapi.h"
 #endif
 
 int
@@ -46,6 +46,12 @@ do_delete(
 )
 {
        struct berval dn = { 0, NULL };
+       struct berval pdn = { 0, NULL };
+       struct berval org_req_dn = { 0, NULL };
+       struct berval org_req_ndn = { 0, NULL };
+       struct berval org_dn = { 0, NULL };
+       struct berval org_ndn = { 0, NULL };
+       int     org_managedsait;
        int manageDSAit;
 
 #ifdef NEW_LOGGING
@@ -168,7 +174,7 @@ do_delete(
                slapi_pblock_set( pb, SLAPI_DELETE_TARGET, (void *)dn.bv_val );
                slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
 
-               rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_DELETE_FN, pb );
+               rs->sr_err = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_DELETE_FN, pb );
                if ( rs->sr_err < 0 ) {
                        /*
                         * A preoperation plugin failure will abort the
@@ -221,7 +227,41 @@ do_delete(
                                cb.sc_next = op->o_callback;
                                op->o_callback = &cb;
                        }
+
                        op->o_bd->be_delete( op, rs );
+
+                       org_req_dn = op->o_req_dn;
+                       org_req_ndn = op->o_req_ndn;
+                       org_dn = op->o_dn;
+                       org_ndn = op->o_ndn;
+                       org_managedsait = get_manageDSAit( op );
+                       op->o_dn = op->o_bd->be_rootdn;
+                       op->o_ndn = op->o_bd->be_rootndn;
+                       op->o_managedsait = 1;
+
+                       while ( rs->sr_err == LDAP_SUCCESS &&
+                                       op->o_delete_glue_parent ) {
+                               op->o_delete_glue_parent = 0;
+                               if ( !be_issuffix( op->o_bd, &op->o_req_ndn )) {
+                                       slap_callback cb = { NULL };
+                                       cb.sc_response = slap_null_cb;
+                                       dnParent( &op->o_req_ndn, &pdn );
+                                       op->o_req_dn = pdn;
+                                       op->o_req_ndn = pdn;
+                                       op->o_callback = &cb;
+                                       op->o_bd->be_delete( op, rs );
+                               } else {
+                                       break;
+                               }
+                       }
+
+                       op->o_managedsait = org_managedsait;
+                       op->o_dn = org_dn;
+                       op->o_ndn = org_ndn;
+                       op->o_req_dn = org_req_dn;
+                       op->o_req_ndn = org_req_ndn;
+                       op->o_delete_glue_parent = 0;
+
 #ifndef SLAPD_MULTIMASTER
                } else {
                        BerVarray defref = NULL;
@@ -258,7 +298,7 @@ do_delete(
        }
 
 #if defined( LDAP_SLAPI )
-       if ( pb && doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_DELETE_FN, pb ) < 0) {
+       if ( pb != NULL && slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_DELETE_FN, pb ) < 0) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO, "do_delete: delete postoperation plugins "
                                "failed\n", 0, 0, 0 );