modrdn.c revision 1.1 1 1.1 lukem /* $OpenLDAP: pkg/ldap/servers/slapd/back-perl/modrdn.c,v 1.22.2.3 2008/02/11 23:26:47 kurt Exp $ */
2 1.1 lukem /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3 1.1 lukem *
4 1.1 lukem * Copyright 1999-2008 The OpenLDAP Foundation.
5 1.1 lukem * Portions Copyright 1999 John C. Quillan.
6 1.1 lukem * Portions Copyright 2002 myinternet Limited.
7 1.1 lukem * All rights reserved.
8 1.1 lukem *
9 1.1 lukem * Redistribution and use in source and binary forms, with or without
10 1.1 lukem * modification, are permitted only as authorized by the OpenLDAP
11 1.1 lukem * Public License.
12 1.1 lukem *
13 1.1 lukem * A copy of this license is available in file LICENSE in the
14 1.1 lukem * top-level directory of the distribution or, alternatively, at
15 1.1 lukem * <http://www.OpenLDAP.org/license.html>.
16 1.1 lukem */
17 1.1 lukem
18 1.1 lukem #include "perl_back.h"
19 1.1 lukem
20 1.1 lukem int
21 1.1 lukem perl_back_modrdn(
22 1.1 lukem Operation *op,
23 1.1 lukem SlapReply *rs )
24 1.1 lukem {
25 1.1 lukem PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
26 1.1 lukem int count;
27 1.1 lukem
28 1.1 lukem #if defined(HAVE_WIN32_ASPERL) || defined(USE_ITHREADS)
29 1.1 lukem PERL_SET_CONTEXT( PERL_INTERPRETER );
30 1.1 lukem #endif
31 1.1 lukem
32 1.1 lukem ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
33 1.1 lukem
34 1.1 lukem {
35 1.1 lukem dSP; ENTER; SAVETMPS;
36 1.1 lukem
37 1.1 lukem PUSHMARK(sp) ;
38 1.1 lukem XPUSHs( perl_back->pb_obj_ref );
39 1.1 lukem XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , 0 )));
40 1.1 lukem XPUSHs(sv_2mortal(newSVpv( op->orr_newrdn.bv_val , 0 )));
41 1.1 lukem XPUSHs(sv_2mortal(newSViv( op->orr_deleteoldrdn )));
42 1.1 lukem if ( op->orr_newSup != NULL ) {
43 1.1 lukem XPUSHs(sv_2mortal(newSVpv( op->orr_newSup->bv_val , 0 )));
44 1.1 lukem }
45 1.1 lukem PUTBACK ;
46 1.1 lukem
47 1.1 lukem #ifdef PERL_IS_5_6
48 1.1 lukem count = call_method("modrdn", G_SCALAR);
49 1.1 lukem #else
50 1.1 lukem count = perl_call_method("modrdn", G_SCALAR);
51 1.1 lukem #endif
52 1.1 lukem
53 1.1 lukem SPAGAIN ;
54 1.1 lukem
55 1.1 lukem if (count != 1) {
56 1.1 lukem croak("Big trouble in back_modrdn\n") ;
57 1.1 lukem }
58 1.1 lukem
59 1.1 lukem rs->sr_err = POPi;
60 1.1 lukem
61 1.1 lukem PUTBACK; FREETMPS; LEAVE ;
62 1.1 lukem }
63 1.1 lukem
64 1.1 lukem ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
65 1.1 lukem
66 1.1 lukem send_ldap_result( op, rs );
67 1.1 lukem
68 1.1 lukem Debug( LDAP_DEBUG_ANY, "Perl MODRDN\n", 0, 0, 0 );
69 1.1 lukem return( 0 );
70 1.1 lukem }
71