2 * Copyright 1999, John C. Quillan, All rights reserved.
4 * Redistribution and use in source and binary forms are permitted only
5 * as authorized by the OpenLDAP Public License. A copy of this
6 * license is available at http://www.OpenLDAP.org/license.html or
7 * in file LICENSE in the top-level directory of the distribution.
13 /* #include <ac/types.h>
14 #include <ac/socket.h>
21 #include "perl_back.h"
23 /**********************************************************
27 **********************************************************/
47 char *matched = NULL, *info = NULL;
48 PerlBackend *perl_back = (PerlBackend *)be->be_private;
54 ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
60 XPUSHs( perl_back->pb_obj_ref );
61 XPUSHs(sv_2mortal(newSVpv( filterstr , 0)));
62 XPUSHs(sv_2mortal(newSViv( sizelimit )));
63 XPUSHs(sv_2mortal(newSViv( timelimit )));
64 XPUSHs(sv_2mortal(newSViv( attrsonly )));
66 for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
67 XPUSHs(sv_2mortal(newSVpv( attrs[i] , 0)));
71 count = perl_call_method("search", G_ARRAY );
76 croak("Big trouble in back_search\n") ;
81 for ( i = 1; i < count; i++ ) {
85 if ( (e = str2entry( buf )) == NULL ) {
86 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n", buf, 0, 0 );
89 send_search_entry( be,
102 * We grab the return code last because the stack comes
103 * from perl in reverse order.
105 * ex perl: return ( 0, $res_1, $res_2 );
107 * ex stack: <$res_2> <$res_1> <0>
114 PUTBACK; FREETMPS; LEAVE;
117 ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
119 if( return_code != 0 ) {
120 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
123 send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );