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