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