]> git.sur5r.net Git - openldap/blob - servers/slapd/back-perl/delete.c
26e05363f3e0b4cac0c41c4465538d683757b2f0
[openldap] / servers / slapd / back-perl / delete.c
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1999-2003 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 /*
7  *       Copyright 1999, John C. Quillan, All rights reserved.
8  *       Portions Copyright 2002, myinternet Limited. All rights reserved.
9  *
10  *       Redistribution and use in source and binary forms are permitted only
11  *       as authorized by the OpenLDAP Public License.  A copy of this
12  *       license is available at http://www.OpenLDAP.org/license.html or
13  *       in file LICENSE in the top-level directory of the distribution.
14  */
15
16 #include "portable.h"
17
18 #include <stdio.h>
19
20 #include "slap.h"
21 #ifdef HAVE_WIN32_ASPERL
22 #include "asperl_undefs.h"
23 #endif
24
25 #include <EXTERN.h>
26 #include <perl.h>
27
28 #include "perl_back.h"
29
30 int
31 perl_back_delete(
32         Operation       *op,
33         SlapReply       *rs )
34 {
35         PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
36         int count;
37
38         ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
39
40         {
41                 dSP; ENTER; SAVETMPS;
42
43                 PUSHMARK(sp);
44                 XPUSHs( perl_back->pb_obj_ref );
45                 XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , 0 )));
46
47                 PUTBACK;
48
49 #ifdef PERL_IS_5_6
50                 count = call_method("delete", G_SCALAR);
51 #else
52                 count = perl_call_method("delete", G_SCALAR);
53 #endif
54
55                 SPAGAIN;
56
57                 if (count != 1) {
58                         croak("Big trouble in perl-back_delete\n");
59                 }
60
61                 rs->sr_err = POPi;
62
63                 PUTBACK; FREETMPS; LEAVE;
64         }
65
66         ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
67
68         send_ldap_result( op, rs );
69
70         Debug( LDAP_DEBUG_ANY, "Perl DELETE\n", 0, 0, 0 );
71         return( 0 );
72 }