From bbbe0db326f6bfe6da9946f40c7fc0f0931ad3cb Mon Sep 17 00:00:00 2001
From: Pierangelo Masarati <ando@openldap.org>
Date: Fri, 7 May 2004 17:43:22 +0000
Subject: [PATCH] helper for unlimited time/size limits request

---
 clients/tools/ldapsearch.c | 14 ++++++++++++--
 doc/man/man1/ldapsearch.1  | 10 ++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c
index 91a4ce2dd6..27f38438e7 100644
--- a/clients/tools/ldapsearch.c
+++ b/clients/tools/ldapsearch.c
@@ -428,7 +428,12 @@ handle_private_option( int i )
 		urlpre = strdup( optarg );
 		break;
 	case 'l':	/* time limit */
-		timelimit = atoi( optarg );
+		if ( strcasecmp( optarg, "none" ) == 0 ) {
+			/* maxInt as per RFC 4.1.1. Message Envelope */
+			sizelimit = 2147483647;
+		} else {
+			timelimit = atoi( optarg );
+		}
 		if( timelimit < 0 ) {
 			fprintf( stderr, _("%s: invalid timelimit (%d) specified\n"),
 				prog, timelimit );
@@ -470,7 +475,12 @@ handle_private_option( int i )
 		++includeufn;
 		break;
 	case 'z':	/* size limit */
-		sizelimit = atoi( optarg );
+		if ( strcasecmp( optarg, "none" ) == 0 ) {
+			/* maxInt as per RFC 4.1.1. Message Envelope */
+			sizelimit = 2147483647;
+		} else {
+			sizelimit = atoi( optarg );
+		}
 		break;
 	default:
 		return 0;
diff --git a/doc/man/man1/ldapsearch.1 b/doc/man/man1/ldapsearch.1
index d687439979..fbdd2f53f5 100644
--- a/doc/man/man1/ldapsearch.1
+++ b/doc/man/man1/ldapsearch.1
@@ -227,6 +227,11 @@ timelimit of
 (zero) removes the
 .B ldap.conf
 limit.
+A timelimit of
+.I none
+uses
+.I maxInt
+(2147483647, RFC 2251) as timelimit.
 A server may impose a maximal timelimit which only
 the root user may override.
 .TP
@@ -237,6 +242,11 @@ of
 (zero) removes the 
 .B ldap.conf
 limit.
+A sizelimit of
+.I none
+uses
+.I maxInt
+(2147483647, RFC 2251) as sizelimit.
 A server may impose a maximal sizelimit which only
 the root user may override.
 .TP
-- 
GitLab