From: Kurt Zeilenga Date: Fri, 1 Nov 2002 18:21:02 +0000 (+0000) Subject: Add "unlimit" X-Git-Tag: OPENLDAP_REL_ENG_2_1_9~45 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=330bba62022af4a0621738649828c0ca0ca1ddfd;p=openldap Add "unlimit" --- diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index 8dc2ce3adc..107135f9d5 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -712,11 +712,16 @@ 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 +.B sizelimit {|unlimited} .TP .B sizelimit size[.{soft|hard|unchecked}]= [...] Specify the maximum number of entries to return from a search operation. The default size limit is 500. +Use +.B -1 +or +.B unlimited +to specify no limits. The second format allows a fine grain setting of the size limits. Extra args can be added on the same line. See @@ -740,12 +745,17 @@ meaningful if you are using Kerberos authentication. Specify the maximum size of the primary thread pool. The default is 32. .TP -.B timelimit +.B timelimit {|unlimited} .TP .B timelimit time[.{soft|hard}]= [...] Specify the maximum number of seconds (in real time) .B slapd will spend answering a search request. The default time limit is 3600. +Use +.B -1 +or +.B unlimited +to specify no limits. The second format allows a fine grain setting of the time limits. Extra args can be added on the same line. See diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 80ea143703..2cc941023a 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -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 ); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG( CONFIG, CRIT, + "%s: line %d: unable " + "to parse value \"%s\" in \"sizelimit " + "\" line.\n", fname, lineno, cargv[i] ); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: unable " + "to parse value \"%s\" " + "in \"sizelimit " + "\" line\n", + fname, lineno, cargv[i] ); +#endif + return( 1 ); + } + } else { - lim->lms_s_soft = atoi( cargv[i] ); - lim->lms_s_hard = 0; - } + if ( strcasecmp( cargv[i], "unlimited" ) == 0 ) { + lim->lms_s_soft = -1; + } else { + char *next; - if ( rc ) { + 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 value \"%s\" in \"sizelimit " - "\" line.\n", fname, lineno, cargv[i] ); + LDAP_LOG( CONFIG, CRIT, + "%s: line %d: unable to parse limit \"%s\" in \"sizelimit \" " + "line.\n", fname, lineno, cargv[i] ); #else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: unable " - "to parse value \"%s\" " - "in \"sizelimit " - "\" line\n", - fname, lineno, cargv[i] ); + Debug( LDAP_DEBUG_ANY, + "%s: line %d: unable to parse limit \"%s\" in \"sizelimit \" 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 \" " + "line ignored.\n", fname, lineno, next ); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: trailing chars \"%s\" in \"sizelimit \" 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 ); + if ( rc ) { +#ifdef NEW_LOGGING + LDAP_LOG( CONFIG, CRIT, + "%s: line %d: unable to parse value \"%s\" " + "in \"timelimit \" line.\n", + fname, lineno, cargv[i] ); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: unable " + "to parse value \"%s\" " + "in \"timelimit " + "\" line\n", + fname, lineno, cargv[i] ); +#endif + return( 1 ); + } + } else { - lim->lms_t_soft = atoi( cargv[i] ); - lim->lms_t_hard = 0; - } + if ( strcasecmp( cargv[i], "unlimited" ) == 0 ) { + lim->lms_t_soft = -1; + } else { + char *next; - if ( rc ) { + 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 value \"%s\" " - "in \"timelimit \" line.\n", - fname, lineno, cargv[i] ); + LDAP_LOG( CONFIG, CRIT, + "%s: line %d: unable to parse limit \"%s\" in \"timelimit \" " + "line.\n", fname, lineno, cargv[i] ); #else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: unable " - "to parse value \"%s\" " - "in \"timelimit " - "\" line\n", - fname, lineno, cargv[i] ); + Debug( LDAP_DEBUG_ANY, + "%s: line %d: unable to parse limit \"%s\" in \"timelimit \" 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 \" " + "line ignored.\n", fname, lineno, next ); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: trailing chars \"%s\" in \"timelimit \" line ignored\n", + fname, lineno, next ); #endif + } + } + lim->lms_t_hard = 0; } }