1 /* search.c - shell backend search function */
29 struct shellinfo *si = (struct shellinfo *) be->be_private;
33 if ( si->si_search == NULL ) {
34 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
35 "search not implemented", NULL, NULL );
39 if ( (op->o_private = (void *) forkandexec( si->si_search, &rfp, &wfp ))
41 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
42 "could not fork/exec", NULL, NULL );
46 /* write out the request to the search process */
47 fprintf( wfp, "SEARCH\n" );
48 fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
49 print_suffixes( wfp, be );
50 fprintf( wfp, "base: %s\n", base );
51 fprintf( wfp, "scope: %d\n", scope );
52 fprintf( wfp, "deref: %d\n", deref );
53 fprintf( wfp, "sizelimit: %d\n", size );
54 fprintf( wfp, "timelimit: %d\n", time );
55 fprintf( wfp, "filter: %s\n", filterstr );
56 fprintf( wfp, "attrsonly: %d\n", attrsonly ? 1 : 0 );
57 fprintf( wfp, "attrs:%s", attrs == NULL ? " all" : "" );
58 for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
59 fprintf( wfp, " %s", attrs[i] );
64 /* read in the results and send them along */
65 read_and_send_results( be, conn, op, rfp, attrs, attrsonly );