delete.c revision 1.1 1 1.1 lukem /* $OpenLDAP: pkg/ldap/servers/slapd/back-perl/delete.c,v 1.20.2.3 2008/02/11 23:26:47 kurt Exp $ */
2 1.1 lukem /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3 1.1 lukem *
4 1.1 lukem * Copyright 1999-2008 The OpenLDAP Foundation.
5 1.1 lukem * Portions Copyright 1999 John C. Quillan.
6 1.1 lukem * Portions Copyright 2002 myinternet Limited.
7 1.1 lukem * All rights reserved.
8 1.1 lukem *
9 1.1 lukem * Redistribution and use in source and binary forms, with or without
10 1.1 lukem * modification, are permitted only as authorized by the OpenLDAP
11 1.1 lukem * Public License.
12 1.1 lukem *
13 1.1 lukem * A copy of this license is available in file LICENSE in the
14 1.1 lukem * top-level directory of the distribution or, alternatively, at
15 1.1 lukem * <http://www.OpenLDAP.org/license.html>.
16 1.1 lukem */
17 1.1 lukem
18 1.1 lukem #include "perl_back.h"
19 1.1 lukem
20 1.1 lukem int
21 1.1 lukem perl_back_delete(
22 1.1 lukem Operation *op,
23 1.1 lukem SlapReply *rs )
24 1.1 lukem {
25 1.1 lukem PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
26 1.1 lukem int count;
27 1.1 lukem
28 1.1 lukem #if defined(HAVE_WIN32_ASPERL) || defined(USE_ITHREADS)
29 1.1 lukem PERL_SET_CONTEXT( PERL_INTERPRETER );
30 1.1 lukem #endif
31 1.1 lukem ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
32 1.1 lukem
33 1.1 lukem {
34 1.1 lukem dSP; ENTER; SAVETMPS;
35 1.1 lukem
36 1.1 lukem PUSHMARK(sp);
37 1.1 lukem XPUSHs( perl_back->pb_obj_ref );
38 1.1 lukem XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , 0 )));
39 1.1 lukem
40 1.1 lukem PUTBACK;
41 1.1 lukem
42 1.1 lukem #ifdef PERL_IS_5_6
43 1.1 lukem count = call_method("delete", G_SCALAR);
44 1.1 lukem #else
45 1.1 lukem count = perl_call_method("delete", G_SCALAR);
46 1.1 lukem #endif
47 1.1 lukem
48 1.1 lukem SPAGAIN;
49 1.1 lukem
50 1.1 lukem if (count != 1) {
51 1.1 lukem croak("Big trouble in perl-back_delete\n");
52 1.1 lukem }
53 1.1 lukem
54 1.1 lukem rs->sr_err = POPi;
55 1.1 lukem
56 1.1 lukem PUTBACK; FREETMPS; LEAVE;
57 1.1 lukem }
58 1.1 lukem
59 1.1 lukem ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
60 1.1 lukem
61 1.1 lukem send_ldap_result( op, rs );
62 1.1 lukem
63 1.1 lukem Debug( LDAP_DEBUG_ANY, "Perl DELETE\n", 0, 0, 0 );
64 1.1 lukem return( 0 );
65 1.1 lukem }
66