2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1999-2005 The OpenLDAP Foundation.
5 * Portions Copyright 2001-2003 Pierangelo Masarati.
6 * Portions Copyright 1999-2003 Howard Chu.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by the Howard Chu for inclusion
19 * in OpenLDAP Software and subsequently enhanced by Pierangelo
27 #include <ac/string.h>
28 #include <ac/socket.h>
31 #include "../back-ldap/back-ldap.h"
32 #include "back-meta.h"
35 meta_back_delete( Operation *op, SlapReply *rs )
37 struct metainfo *li = ( struct metainfo * )op->o_bd->be_private;
40 struct berval mdn = BER_BVNULL;
43 lc = meta_back_getconn( op, rs, META_OP_REQUIRE_SINGLE,
44 &op->o_req_ndn, &candidate, LDAP_BACK_SENDERR );
45 if ( !lc || !meta_back_dobind( lc, op, LDAP_BACK_SENDERR ) ) {
49 if ( !meta_back_is_valid( lc, candidate ) ) {
50 rs->sr_err = LDAP_OTHER;
51 send_ldap_result( op, rs );
56 * Rewrite the compare dn, if needed
58 dc.rwmap = &li->targets[ candidate ]->mt_rwmap;
63 if ( ldap_back_dn_massage( &dc, &op->o_req_dn, &mdn ) ) {
64 send_ldap_result( op, rs );
68 (void)ldap_delete_ext_s( lc->mc_conns[ candidate ].msc_ld, mdn.bv_val,
71 if ( mdn.bv_val != op->o_req_dn.bv_val ) {
76 return meta_back_op_result( lc, op, rs );