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