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