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