3 * Copyright 1999-2003 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 * Copyright 1999, John C. Quillan, All rights reserved.
8 * Portions Copyright 2002, myinternet Limited. All rights reserved.
10 * Redistribution and use in source and binary forms are permitted only
11 * as authorized by the OpenLDAP Public License. A copy of this
12 * license is available at http://www.OpenLDAP.org/license.html or
13 * in file LICENSE in the top-level directory of the distribution.
21 #ifdef HAVE_WIN32_ASPERL
22 #include "asperl_undefs.h"
28 #include "perl_back.h"
30 /**********************************************************
34 **********************************************************/
40 PerlBackend *perl_back = (PerlBackend *)op->o_bd->be_private;
47 ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
53 XPUSHs( perl_back->pb_obj_ref );
54 XPUSHs(sv_2mortal(newSVpv( op->o_req_ndn.bv_val , 0)));
55 XPUSHs(sv_2mortal(newSViv( op->ors_scope )));
56 XPUSHs(sv_2mortal(newSViv( op->ors_deref )));
57 XPUSHs(sv_2mortal(newSViv( op->ors_slimit )));
58 XPUSHs(sv_2mortal(newSViv( op->ors_tlimit )));
59 XPUSHs(sv_2mortal(newSVpv( op->ors_filterstr.bv_val , 0)));
60 XPUSHs(sv_2mortal(newSViv( op->ors_attrsonly )));
62 for ( an = op->ors_attrs; an && an->an_name.bv_val; an++ ) {
63 XPUSHs(sv_2mortal(newSVpv( an->an_name.bv_val , 0)));
68 count = call_method("search", G_ARRAY );
70 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 );
91 if (perl_back->pb_filter_search_results)
92 send_entry = (test_filter( op, e, op->ors_filter ) == LDAP_COMPARE_TRUE);
98 rs->sr_attrs = op->ors_attrs;
99 send_search_entry( op, rs );
108 * We grab the return code last because the stack comes
109 * from perl in reverse order.
111 * ex perl: return ( 0, $res_1, $res_2 );
113 * ex stack: <$res_2> <$res_1> <0>
120 PUTBACK; FREETMPS; LEAVE;
123 ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
125 send_ldap_result( op, rs );