3 * Copyright 1999, John C. Quillan, All rights reserved.
4 * Portions Copyright 2002, myinternet pty ltd. 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.
15 /* #include <ac/types.h>
16 #include <ac/socket.h>
23 #include "perl_back.h"
25 /**********************************************************
29 **********************************************************/
42 struct berval *filterstr,
50 char *matched = NULL, *info = NULL;
51 PerlBackend *perl_back = (PerlBackend *)be->be_private;
58 ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
64 XPUSHs( perl_back->pb_obj_ref );
65 XPUSHs(sv_2mortal(newSVpv( nbase->bv_val , 0)));
66 XPUSHs(sv_2mortal(newSViv( scope )));
67 XPUSHs(sv_2mortal(newSViv( deref )));
68 XPUSHs(sv_2mortal(newSViv( sizelimit )));
69 XPUSHs(sv_2mortal(newSViv( timelimit )));
70 XPUSHs(sv_2mortal(newSVpv( filterstr->bv_val , 0)));
71 XPUSHs(sv_2mortal(newSViv( attrsonly )));
73 for ( an = attrs; an && an->an_name.bv_val; an++ ) {
74 XPUSHs(sv_2mortal(newSVpv( an->an_name.bv_val , 0)));
79 count = call_method("search", G_ARRAY );
81 count = perl_call_method("search", G_ARRAY );
87 croak("Big trouble in back_search\n") ;
92 for ( i = 1; i < count; i++ ) {
96 if ( (e = str2entry( buf )) == NULL ) {
97 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n", buf, 0, 0 );
102 if (perl_back->pb_filter_search_results)
103 send_entry = (test_filter( be, conn, op, e, filter ) == LDAP_COMPARE_TRUE);
108 send_search_entry( be, conn, op,
109 e, attrs, attrsonly, NULL );
118 * We grab the return code last because the stack comes
119 * from perl in reverse order.
121 * ex perl: return ( 0, $res_1, $res_2 );
123 * ex stack: <$res_2> <$res_1> <0>
130 PUTBACK; FREETMPS; LEAVE;
133 ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
135 send_ldap_result( conn, op, return_code,
136 NULL, NULL, NULL, NULL );