]> git.sur5r.net Git - openldap/blob - servers/slapd/back-perl/delete.c
Implemented the open, init functions correctly
[openldap] / servers / slapd / back-perl / delete.c
1 /*
2  *       Copyright 1999, John C. Quillan, All rights reserved.
3  *
4  *       Redistribution and use in source and binary forms are permitted only
5  *       as authorized by the OpenLDAP Public License.  A copy of this
6  *       license is available at http://www.OpenLDAP.org/license.html or
7  *       in file LICENSE in the top-level directory of the distribution.
8  */
9
10 #include "portable.h"
11
12 #include <stdio.h>
13 /* #include <ac/types.h>
14 #include <ac/socket.h>
15 */
16
17 #include <EXTERN.h>
18 #include <perl.h>
19
20 #include "slap.h"
21 #include "perl_back.h"
22
23 perl_back_delete(
24         Backend *be,
25         Connection      *conn,
26         Operation       *op,
27         char    *dn
28 )
29 {
30         int len;
31         int count;
32         int return_code;
33
34         PerlBackend *perl_back = (PerlBackend *) be->be_private;
35
36         ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
37
38         {
39                 dSP; ENTER; SAVETMPS;
40
41                 PUSHMARK(sp);
42                 XPUSHs( perl_back->pb_obj_ref );
43                 XPUSHs(sv_2mortal(newSVpv( dn , 0 )));
44
45                 PUTBACK;
46
47                 count = perl_call_method("delete", G_SCALAR);
48
49                 SPAGAIN;
50
51                 if (count != 1) {
52                         croak("Big trouble in perl-back_delete\n");
53                 }
54                                                          
55                 return_code = POPi;
56
57                 PUTBACK; FREETMPS; LEAVE;
58         }
59
60         ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
61
62         if( return_code != 0 ) {
63                 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
64
65         } else {
66                 send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
67         }
68
69         Debug( LDAP_DEBUG_ANY, "Here DELETE\n", 0, 0, 0 );
70         return( 0 );
71 }