From 9bc2cd3987b0bf5b86c2b9be417d7119f2e9d623 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 25 Aug 2006 16:20:48 +0000 Subject: [PATCH] allow continuous mode --- clients/tools/ldapsearch.c | 7 +++++-- doc/man/man1/ldapsearch.1 | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 8e0a632133..174633e410 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -979,9 +979,8 @@ getNextPage: attrs, attrsonly, NULL, NULL, NULL, -1 ); } else { - rc = 0; first = 1; - while ( rc == 0 && fgets( line, sizeof( line ), fp ) != NULL ) { + while ( fgets( line, sizeof( line ), fp ) != NULL ) { line[ strlen( line ) - 1 ] = '\0'; if ( !first ) { putchar( '\n' ); @@ -990,6 +989,10 @@ getNextPage: } rc = dosearch( ld, base, scope, filtpattern, line, attrs, attrsonly, NULL, NULL, NULL, -1 ); + + if ( rc != 0 && !contoper ) { + break; + } } if ( fp != stdin ) { fclose( fp ); diff --git a/doc/man/man1/ldapsearch.1 b/doc/man/man1/ldapsearch.1 index 65ed177d19..7d5997ae21 100644 --- a/doc/man/man1/ldapsearch.1 +++ b/doc/man/man1/ldapsearch.1 @@ -9,6 +9,8 @@ ldapsearch \- LDAP search tool [\c .BR \-n ] [\c +.BR \-c ] +[\c .BR \-u ] [\c .BR \-v ] @@ -106,6 +108,11 @@ If no \fIattrs\fP are listed, all user attributes are returned. If only Show what would be done, but don't actually perform the search. Useful for debugging in conjunction with -v. .TP +.B \-c +Continuous operation mode. Errors are reported, but ldapsearch will continue +with searches. The default is to exit after reporting an error. Only useful +in conjunction with -f. +.TP .B \-u Include the User Friendly Name form of the Distinguished Name (DN) in the output. @@ -172,6 +179,9 @@ Where it is desired that the search filter include a \fB%\fP character, the character should be encoded as \fB\\25\fP (see RFC 4515). If \fIfile\fP is a single \fI-\fP character, then the lines are read from standard input. +.B ldapsearch +will exit when the first non-successful search result is returned, +unless -c is used. .TP .B \-x Use simple authentication instead of SASL. -- 2.39.5