use keyword "unlimited" instead of -1 for no limits

This commit is contained in:
Pierangelo Masarati 2002-10-31 09:57:24 +00:00
parent 5fe69447f8
commit 53e1930fd0
2 changed files with 94 additions and 34 deletions

View File

@ -712,7 +712,7 @@ Note that the
factor is measure of security provided by the underlying transport,
e.g. ldapi:// (and eventually IPSEC). It is not normally used.
.TP
.B sizelimit <integer>
.B sizelimit {<integer>|unlimited}
.TP
.B sizelimit size[.{soft|hard|unchecked}]=<integer> [...]
Specify the maximum number of entries to return from a search operation.
@ -740,7 +740,7 @@ meaningful if you are using Kerberos authentication.
Specify the maximum size of the primary thread pool.
The default is 32.
.TP
.B timelimit <integer>
.B timelimit {<integer>|unlimited}
.TP
.B timelimit time[.{soft|hard}]=<integer> [...]
Specify the maximum number of seconds (in real time)

View File

@ -664,25 +664,55 @@ read_config( const char *fname, int depth )
for ( i = 1; i < cargc; i++ ) {
if ( strncasecmp( cargv[i], "size", 4 ) == 0 ) {
rc = parse_limit( cargv[i], lim );
} else {
lim->lms_s_soft = atoi( cargv[i] );
lim->lms_s_hard = 0;
}
if ( rc ) {
if ( rc ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unable "
"to parse value \"%s\" in \"sizelimit "
"<limit>\" line.\n", fname, lineno, cargv[i] );
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unable "
"to parse value \"%s\" in \"sizelimit "
"<limit>\" line.\n", fname, lineno, cargv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable "
"to parse value \"%s\" "
"in \"sizelimit "
"<limit>\" line\n",
fname, lineno, cargv[i] );
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable "
"to parse value \"%s\" "
"in \"sizelimit "
"<limit>\" line\n",
fname, lineno, cargv[i] );
#endif
return( 1 );
}
} else {
if ( strcasecmp( cargv[i], "unlimited" ) == 0 ) {
lim->lms_s_soft = -1;
} else {
char *next;
lim->lms_s_soft = strtol( cargv[i] , &next, 0 );
if ( next == cargv[i] ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unable to parse limit \"%s\" in \"sizelimit <limit>\" "
"line.\n", fname, lineno, cargv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable to parse limit \"%s\" in \"sizelimit <limit>\" line\n",
fname, lineno, cargv[i] );
#endif
return( 1 );
} else if ( next[0] != '\0' ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: trailing chars \"%s\" in \"sizelimit <limit>\" "
"line ignored.\n", fname, lineno, next );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: trailing chars \"%s\" in \"sizelimit <limit>\" line ignored\n",
fname, lineno, next );
#endif
}
}
lim->lms_s_hard = 0;
}
}
@ -714,25 +744,55 @@ read_config( const char *fname, int depth )
for ( i = 1; i < cargc; i++ ) {
if ( strncasecmp( cargv[i], "time", 4 ) == 0 ) {
rc = parse_limit( cargv[i], lim );
} else {
lim->lms_t_soft = atoi( cargv[i] );
lim->lms_t_hard = 0;
}
if ( rc ) {
if ( rc ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unable to parse value \"%s\" "
"in \"timelimit <limit>\" line.\n",
fname, lineno, cargv[i] );
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unable to parse value \"%s\" "
"in \"timelimit <limit>\" line.\n",
fname, lineno, cargv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable "
"to parse value \"%s\" "
"in \"timelimit "
"<limit>\" line\n",
fname, lineno, cargv[i] );
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable "
"to parse value \"%s\" "
"in \"timelimit "
"<limit>\" line\n",
fname, lineno, cargv[i] );
#endif
return( 1 );
}
} else {
if ( strcasecmp( cargv[i], "unlimited" ) == 0 ) {
lim->lms_t_soft = -1;
} else {
char *next;
lim->lms_t_soft = strtol( cargv[i] , &next, 0 );
if ( next == cargv[i] ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unable to parse limit \"%s\" in \"timelimit <limit>\" "
"line.\n", fname, lineno, cargv[i] );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable to parse limit \"%s\" in \"timelimit <limit>\" line\n",
fname, lineno, cargv[i] );
#endif
return( 1 );
} else if ( next[0] != '\0' ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: trailing chars \"%s\" in \"timelimit <limit>\" "
"line ignored.\n", fname, lineno, next );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: trailing chars \"%s\" in \"timelimit <limit>\" line ignored\n",
fname, lineno, next );
#endif
}
}
lim->lms_t_hard = 0;
}
}