]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/delete.c
trim listed modules
[openldap] / servers / slapd / delete.c
index 722359ae06e9b99979f80249c9ce8475ef45047e..e31c51bbdb79b7b263f7cd044a0207a34080c171 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -90,9 +90,14 @@ do_delete(
        op->o_bd = frontendDB;
        rs->sr_err = frontendDB->be_delete( op, rs );
 
-cleanup:;
-       slap_graduate_commit_csn( op );
+#ifdef LDAP_X_TXN
+       if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
+               /* skip cleanup */
+               return rs->sr_err;
+       }
+#endif
 
+cleanup:;
        op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
        op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
        return rs->sr_err;
@@ -103,7 +108,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
 {
        struct berval   pdn = BER_BVNULL;
        int             manageDSAit;
-       BackendDB *op_be;
+       BackendDB       *op_be, *bd = op->o_bd;
        
        manageDSAit = get_manageDSAit( op );
 
@@ -114,23 +119,19 @@ fe_op_delete( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
+               op->o_bd = bd;
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
 
                if (!rs->sr_ref) rs->sr_ref = default_referral;
                if ( rs->sr_ref != NULL ) {
                        rs->sr_err = LDAP_REFERRAL;
-
-                       op->o_bd = frontendDB;
                        send_ldap_result( op, rs );
-                       op->o_bd = NULL;
 
                        if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
                } else {
-                       op->o_bd = frontendDB;
                        send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                                "no global superior knowledge" );
-                       op->o_bd = NULL;
                }
                goto cleanup;
        }
@@ -161,10 +162,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
        if ( op->o_bd->be_delete ) {
                /* do the update here */
                int repl_user = be_isupdate( op );
-#ifndef SLAPD_MULTIMASTER
-               if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif
-               {
+               if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user ) {
                        struct berval   org_req_dn = BER_BVNULL;
                        struct berval   org_req_ndn = BER_BVNULL;
                        struct berval   org_dn = BER_BVNULL;
@@ -174,16 +172,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
 
                        op->o_bd = op_be;
 
-                       if ( !repl_user ) {
-                               struct berval csn = BER_BVNULL;
-                               char csnbuf[LDAP_LUTIL_CSNSTR_BUFSIZE];
-                               slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 1 );
-                       }
-
-#ifdef SLAPD_MULTIMASTER
-                       if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
-#endif
-                       {
+                       if ( !op->o_bd->be_update_ndn.bv_len || !repl_user ) {
                                cb.sc_next = op->o_callback;
                                op->o_callback = &cb;
                        }
@@ -204,7 +193,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
                        {
                                op->o_delete_glue_parent = 0;
                                if ( !be_issuffix( op->o_bd, &op->o_req_ndn )) {
-                                       slap_callback cb = { NULL };
+                                       slap_callback cb = { NULL, NULL, NULL, NULL };
                                        cb.sc_response = slap_null_cb;
                                        dnParent( &op->o_req_ndn, &pdn );
                                        op->o_req_dn = pdn;
@@ -223,7 +212,6 @@ fe_op_delete( Operation *op, SlapReply *rs )
                        op->o_req_ndn = org_req_ndn;
                        op->o_delete_glue_parent = 0;
 
-#ifndef SLAPD_MULTIMASTER
                } else {
                        BerVarray defref = op->o_bd->be_update_refs
                                ? op->o_bd->be_update_refs : default_referral;
@@ -242,7 +230,6 @@ fe_op_delete( Operation *op, SlapReply *rs )
                                        LDAP_UNWILLING_TO_PERFORM,
                                        "shadow context; no update referral" );
                        }
-#endif
                }
 
        } else {
@@ -251,5 +238,6 @@ fe_op_delete( Operation *op, SlapReply *rs )
        }
 
 cleanup:;
+       op->o_bd = bd;
        return rs->sr_err;
 }