3 * Copyright 1999, John C. Quillan, All rights reserved.
4 * Portions Copyright 2002, myinternet Limited. All rights reserved.
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
17 #ifdef HAVE_WIN32_ASPERL
18 #include "asperl_undefs.h"
24 #include "perl_back.h"
26 /**********************************************************
30 **********************************************************/
43 struct berval *filterstr,
51 char *matched = NULL, *info = NULL;
52 PerlBackend *perl_back = (PerlBackend *)be->be_private;
59 ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
65 XPUSHs( perl_back->pb_obj_ref );
66 XPUSHs(sv_2mortal(newSVpv( nbase->bv_val , 0)));
67 XPUSHs(sv_2mortal(newSViv( scope )));
68 XPUSHs(sv_2mortal(newSViv( deref )));
69 XPUSHs(sv_2mortal(newSViv( sizelimit )));
70 XPUSHs(sv_2mortal(newSViv( timelimit )));
71 XPUSHs(sv_2mortal(newSVpv( filterstr->bv_val , 0)));
72 XPUSHs(sv_2mortal(newSViv( attrsonly )));
74 for ( an = attrs; an && an->an_name.bv_val; an++ ) {
75 XPUSHs(sv_2mortal(newSVpv( an->an_name.bv_val , 0)));
80 count = call_method("search", G_ARRAY );
82 count = perl_call_method("search", G_ARRAY );
88 croak("Big trouble in back_search\n") ;
93 for ( i = 1; i < count; i++ ) {
97 if ( (e = str2entry( buf )) == NULL ) {
98 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n", buf, 0, 0 );
103 if (perl_back->pb_filter_search_results)
104 send_entry = (test_filter( be, conn, op, e, filter ) == LDAP_COMPARE_TRUE);
109 send_search_entry( be, conn, op,
110 e, attrs, attrsonly, NULL );
119 * We grab the return code last because the stack comes
120 * from perl in reverse order.
122 * ex perl: return ( 0, $res_1, $res_2 );
124 * ex stack: <$res_2> <$res_1> <0>
131 PUTBACK; FREETMPS; LEAVE;
134 ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
136 send_ldap_result( conn, op, return_code,
137 NULL, NULL, NULL, NULL );