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.
18 #undef _ /* #defined by both Perl and ac/localize.h */
20 #ifdef HAVE_WIN32_ASPERL
21 #include "asperl_undefs.h"
30 #include "perl_back.h"
32 /**********************************************************
36 **********************************************************/
42 PerlBackend *perl_back = (PerlBackend *)op->o_bd->be_private;
49 ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
55 XPUSHs( perl_back->pb_obj_ref );
56 XPUSHs(sv_2mortal(newSVpv( op->o_req_ndn.bv_val , 0)));
57 XPUSHs(sv_2mortal(newSViv( op->ors_scope )));
58 XPUSHs(sv_2mortal(newSViv( op->ors_deref )));
59 XPUSHs(sv_2mortal(newSViv( op->ors_slimit )));
60 XPUSHs(sv_2mortal(newSViv( op->ors_tlimit )));
61 XPUSHs(sv_2mortal(newSVpv( op->ors_filterstr.bv_val , 0)));
62 XPUSHs(sv_2mortal(newSViv( op->ors_attrsonly )));
64 for ( an = op->ors_attrs; an && an->an_name.bv_val; an++ ) {
65 XPUSHs(sv_2mortal(newSVpv( an->an_name.bv_val , 0)));
70 count = call_method("search", G_ARRAY );
72 count = perl_call_method("search", G_ARRAY );
78 croak("Big trouble in back_search\n") ;
83 for ( i = 1; i < count; i++ ) {
87 if ( (e = str2entry( buf )) == NULL ) {
88 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n", buf, 0, 0 );
93 if (perl_back->pb_filter_search_results)
94 send_entry = (test_filter( op, e, op->ors_filter ) == LDAP_COMPARE_TRUE);
100 rs->sr_attrs = op->ors_attrs;
101 send_search_entry( op, rs );
110 * We grab the return code last because the stack comes
111 * from perl in reverse order.
113 * ex perl: return ( 0, $res_1, $res_2 );
115 * ex stack: <$res_2> <$res_1> <0>
122 PUTBACK; FREETMPS; LEAVE;
125 ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
127 send_ldap_result( op, rs );