Back to index

openldap  2.4.31
add.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_add(
00022        Operation     *op,
00023        SlapReply     *rs )
00024 {
00025        PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
00026        int len;
00027        int count;
00028 
00029        PERL_SET_CONTEXT( PERL_INTERPRETER );
00030        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
00031        ldap_pvt_thread_mutex_lock( &entry2str_mutex );
00032 
00033        {
00034               dSP; ENTER; SAVETMPS;
00035 
00036               PUSHMARK(sp);
00037               XPUSHs( perl_back->pb_obj_ref );
00038               XPUSHs(sv_2mortal(newSVpv( entry2str( op->ora_e, &len ), len )));
00039 
00040               PUTBACK;
00041 
00042               count = call_method("add", G_SCALAR);
00043 
00044               SPAGAIN;
00045 
00046               if (count != 1) {
00047                      croak("Big trouble in back_add\n");
00048               }
00049                                                   
00050               rs->sr_err = POPi;
00051 
00052               PUTBACK; FREETMPS; LEAVE;
00053        }
00054 
00055        ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
00056        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );       
00057 
00058        send_ldap_result( op, rs );
00059 
00060        Debug( LDAP_DEBUG_ANY, "Perl ADD\n", 0, 0, 0 );
00061        return( 0 );
00062 }