]> git.sur5r.net Git - openldap/commitdiff
refuse illegal values for "threads" (ITS#4433)
authorPierangelo Masarati <ando@openldap.org>
Mon, 20 Mar 2006 12:12:28 +0000 (12:12 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 20 Mar 2006 12:12:28 +0000 (12:12 +0000)
doc/man/man5/slapd.conf.5
servers/slapd/bconfig.c

index ef6e5d30f7e6aa15fa95f939fb4cd2e2a5010b07..605ddd881cee70491410f1906c275d4db3eb7353 100644 (file)
@@ -893,7 +893,7 @@ The default is 4194303.
 .TP
 .B threads <integer>
 Specify the maximum size of the primary thread pool.
-The default is 16.
+The default is 16; the minimum value is 2.
 .TP
 .B timelimit {<integer>|unlimited}
 .TP
index 204d731d2cf35544354c1c82433bec951c2d7b90..49a2ce73704221176acb96ab0f621f4215bcb07e 100644 (file)
@@ -510,8 +510,13 @@ static ConfigTable config_back_cf_table[] = {
        { "syncrepl", NULL, 0, 0, 0, ARG_DB|ARG_MAGIC,
                &syncrepl_config, "( OLcfgDbAt:0.11 NAME 'olcSyncrepl' "
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
-       { "threads", "count", 2, 2, 0, ARG_INT|ARG_MAGIC|CFG_THREADS,
-               &config_generic, "( OLcfgGlAt:66 NAME 'olcThreads' "
+       { "threads", "count", 2, 2, 0,
+#ifdef NO_THREADS
+               ARG_IGNORED, NULL,
+#else
+               ARG_INT|ARG_MAGIC|CFG_THREADS, &config_generic,
+#endif
+               "( OLcfgGlAt:66 NAME 'olcThreads' "
                        "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
        { "timelimit", "limit", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
                &config_timelimit, "( OLcfgGlAt:67 NAME 'olcTimeLimit' "
@@ -1111,7 +1116,15 @@ config_generic(ConfigArgs *c) {
                        break;
 
                case CFG_THREADS:
-                       if ( c->value_int > 2 * SLAP_MAX_WORKER_THREADS ) {
+                       if ( c->value_int < 2 ) {
+                               snprintf( c->msg, sizeof( c->msg ),
+                                       "threads=%d smaller than minimum value 2",
+                                       c->value_int );
+                               Debug(LDAP_DEBUG_ANY, "%s: %s.\n",
+                                       c->log, c->msg, 0 );
+                               return 1;
+
+                       } else if ( c->value_int > 2 * SLAP_MAX_WORKER_THREADS ) {
                                snprintf( c->msg, sizeof( c->msg ),
                                        "warning, threads=%d larger than twice the default (2*%d=%d); YMMV",
                                        c->value_int, SLAP_MAX_WORKER_THREADS, 2 * SLAP_MAX_WORKER_THREADS );