1 /* result.c - shell backend result reading function */
6 #include <sys/socket.h>
10 extern Entry *str2entry();
13 read_and_send_results(
29 /* read in the result and send it along */
30 buf = (char *) ch_malloc( BUFSIZ );
34 while ( fgets( line, sizeof(line), fp ) != NULL ) {
35 Debug( LDAP_DEBUG_SHELL, "shell search reading line (%s)\n",
37 /* ignore lines beginning with DEBUG: */
38 if ( strncasecmp( line, "DEBUG:", 6 ) == 0 ) {
42 while ( bp + len - buf > bsize ) {
44 buf = (char *) ch_realloc( buf, bsize );
49 /* line marked the end of an entry or result */
50 if ( *line == '\n' ) {
51 if ( strncasecmp( buf, "RESULT", 6 ) == 0 ) {
55 if ( (e = str2entry( buf )) == NULL ) {
56 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n",
59 send_search_entry( be, conn, op, e, attrs,
67 (void) str2result( buf, &err, &matched, &info );
69 /* otherwise, front end will send this result */
70 if ( err != 0 || op->o_tag != LDAP_REQ_BIND ) {
71 send_ldap_result( conn, op, err, matched, info );
87 for ( i = 0; be->be_suffix[i] != NULL; i++ ) {
88 fprintf( fp, "suffix: %s\n", be->be_suffix[i] );