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 ) {
47 buf = (char *) ch_realloc( buf, bsize );
52 /* line marked the end of an entry or result */
53 if ( *line == '\n' ) {
54 if ( strncasecmp( buf, "RESULT", 6 ) == 0 ) {
58 if ( (e = str2entry( buf )) == NULL ) {
59 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n",
62 send_search_entry( be, conn, op, e, attrs,
70 (void) str2result( buf, &err, &matched, &info );
72 /* otherwise, front end will send this result */
73 if ( err != 0 || op->o_tag != LDAP_REQ_BIND ) {
74 send_ldap_result( conn, op, err, matched, info, NULL, NULL );
90 for ( i = 0; be->be_suffix[i] != NULL; i++ ) {
91 fprintf( fp, "suffix: %s\n", be->be_suffix[i] );