Back to index

openldap  2.4.31
modrdn.c
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  *
00004  * Copyright 1999-2012 The OpenLDAP Foundation.
00005  * Portions Copyright 1999 John C. Quillan.
00006  * Portions Copyright 2002 myinternet Limited.
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted only as authorized by the OpenLDAP
00011  * Public License.
00012  *
00013  * A copy of this license is available in file LICENSE in the
00014  * top-level directory of the distribution or, alternatively, at
00015  * <http://www.OpenLDAP.org/license.html>.
00016  */
00017 
00018 #include "perl_back.h"
00019 
00020 int
00021 perl_back_modrdn(
00022        Operation     *op,
00023        SlapReply     *rs )
00024 {
00025        PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
00026        int count;
00027 
00028        PERL_SET_CONTEXT( PERL_INTERPRETER );
00029        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
00030 
00031        {
00032               dSP; ENTER; SAVETMPS;
00033               
00034               PUSHMARK(sp) ;
00035               XPUSHs( perl_back->pb_obj_ref );
00036               XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , op->o_req_dn.bv_len )));
00037               XPUSHs(sv_2mortal(newSVpv( op->orr_newrdn.bv_val , op->orr_newrdn.bv_len )));
00038               XPUSHs(sv_2mortal(newSViv( op->orr_deleteoldrdn )));
00039               if ( op->orr_newSup != NULL ) {
00040                      XPUSHs(sv_2mortal(newSVpv( op->orr_newSup->bv_val , op->orr_newSup->bv_len )));
00041               }
00042               PUTBACK ;
00043 
00044               count = call_method("modrdn", G_SCALAR);
00045 
00046               SPAGAIN ;
00047 
00048               if (count != 1) {
00049                      croak("Big trouble in back_modrdn\n") ;
00050               }
00051                                                   
00052               rs->sr_err = POPi;
00053 
00054               PUTBACK; FREETMPS; LEAVE ;
00055        }
00056 
00057        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
00058        
00059        send_ldap_result( op, rs );
00060 
00061        Debug( LDAP_DEBUG_ANY, "Perl MODRDN\n", 0, 0, 0 );
00062        return( 0 );
00063 }