1 /* result.c - shell backend result reading function */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/string.h>
13 #include <ac/socket.h>
14 #include <ac/unistd.h>
20 read_and_send_results(
36 /* read in the result and send it along */
37 buf = (char *) ch_malloc( BUFSIZ );
41 while ( fgets( line, sizeof(line), fp ) != NULL ) {
42 Debug( LDAP_DEBUG_SHELL, "shell search reading line (%s)\n",
44 /* ignore lines beginning with DEBUG: */
45 if ( strncasecmp( line, "DEBUG:", 6 ) == 0 ) {
49 while ( bp + len - buf > bsize ) {
50 size_t offset = bp - buf;
52 buf = (char *) ch_realloc( buf, bsize );
58 /* line marked the end of an entry or result */
59 if ( *line == '\n' ) {
60 if ( strncasecmp( buf, "RESULT", 6 ) == 0 ) {
64 if ( (e = str2entry( buf )) == NULL ) {
65 Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n",
68 send_search_entry( be, conn, op, e, attrs,
76 (void) str2result( buf, &err, &matched, &info );
78 /* otherwise, front end will send this result */
79 if ( err != 0 || op->o_tag != LDAP_REQ_BIND ) {
80 send_ldap_result( conn, op, err, matched, info, NULL, NULL );
96 for ( i = 0; be->be_suffix[i] != NULL; i++ ) {
97 fprintf( fp, "suffix: %s\n", be->be_suffix[i] );