1 /* result.c - shell backend result reading function */
10 #include <ac/unistd.h>
16 read_and_send_results(
32 /* read in the result and send it along */
33 buf = (char *) ch_malloc( BUFSIZ );
37 while ( fgets( line, sizeof(line), fp ) != NULL ) {
38 Debug( LDAP_DEBUG_SHELL, "shell search reading line (%s)\n",
40 /* ignore lines beginning with DEBUG: */
41 if ( strncasecmp( line, "DEBUG:", 6 ) == 0 ) {
45 while ( bp + len - buf > bsize ) {
46 size_t offset = bp - buf;
48 buf = (char *) ch_realloc( buf, bsize );
54 /* line marked the end of an entry or result */
55 if ( *line == '\n' ) {
56 if ( strncasecmp( buf, "RESULT", 6 ) == 0 ) {
60 if ( (e = str2entry( buf )) == NULL ) {
61 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n",
64 send_search_entry( be, conn, op, e, attrs,
72 (void) str2result( buf, &err, &matched, &info );
74 /* otherwise, front end will send this result */
75 if ( err != 0 || op->o_tag != LDAP_REQ_BIND ) {
76 send_ldap_result( conn, op, err, matched, info, NULL, NULL );
92 for ( i = 0; be->be_suffix[i] != NULL; i++ ) {
93 fprintf( fp, "suffix: %s\n", be->be_suffix[i] );