]> git.sur5r.net Git - openldap/blob - servers/slapd/back-perl/delete.c
check for update dn
[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         const char      *dn,
29         const char      *ndn
30 )
31 {
32         int len;
33         int count;
34         int return_code;
35
36         PerlBackend *perl_back = (PerlBackend *) be->be_private;
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( dn , 0 )));
46
47                 PUTBACK;
48
49                 count = perl_call_method("delete", G_SCALAR);
50
51                 SPAGAIN;
52
53                 if (count != 1) {
54                         croak("Big trouble in perl-back_delete\n");
55                 }
56                                                          
57                 return_code = POPi;
58
59                 PUTBACK; FREETMPS; LEAVE;
60         }
61
62         ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
63
64         if( return_code != 0 ) {
65                 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
66                         NULL, NULL, NULL, NULL );
67
68         } else {
69                 send_ldap_result( conn, op, LDAP_SUCCESS,
70                         NULL, NULL, NULL, NULL );
71         }
72
73         Debug( LDAP_DEBUG_ANY, "Here DELETE\n", 0, 0, 0 );
74         return( 0 );
75 }