3 * Copyright 1999, John C. Quillan, All rights reserved.
5 * Redistribution and use in source and binary forms are permitted only
6 * as authorized by the OpenLDAP Public License. A copy of this
7 * license is available at http://www.OpenLDAP.org/license.html or
8 * in file LICENSE in the top-level directory of the distribution.
14 /* #include <ac/types.h>
15 #include <ac/socket.h>
22 #include "perl_back.h"
24 /**********************************************************
28 **********************************************************/
48 char *matched = NULL, *info = NULL;
49 PerlBackend *perl_back = (PerlBackend *)be->be_private;
55 ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
61 XPUSHs( perl_back->pb_obj_ref );
62 XPUSHs(sv_2mortal(newSVpv( filterstr , 0)));
63 XPUSHs(sv_2mortal(newSViv( sizelimit )));
64 XPUSHs(sv_2mortal(newSViv( timelimit )));
65 XPUSHs(sv_2mortal(newSViv( attrsonly )));
67 for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
68 XPUSHs(sv_2mortal(newSVpv( attrs[i] , 0)));
72 count = perl_call_method("search", G_ARRAY );
77 croak("Big trouble in back_search\n") ;
82 for ( i = 1; i < count; i++ ) {
86 if ( (e = str2entry( buf )) == NULL ) {
87 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n", buf, 0, 0 );
90 send_search_entry( be, conn, op,
91 e, attrs, attrsonly, NULL );
99 * We grab the return code last because the stack comes
100 * from perl in reverse order.
102 * ex perl: return ( 0, $res_1, $res_2 );
104 * ex stack: <$res_2> <$res_1> <0>
111 PUTBACK; FREETMPS; LEAVE;
114 ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
116 if( return_code != 0 ) {
117 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
118 NULL, NULL, NULL, NULL );
121 send_ldap_result( conn, op, LDAP_SUCCESS,
122 NULL, NULL, NULL, NULL );