[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#7444) Check the return value of ldap_pvt_thread_set_concurrency

Full_Name: Tianyin Xu
Version: 2.4.33
OS: Ubuntu 12.04 (actually doesn't matter)
Submission from: (NULL) (2607:f720:1300:1241:590b:49c:889f:7b21)

Hi, all,

Still the verbosity idea. In the current version of slapd, when handling users'
"concurrency" setting, slapd does not check the return value of
"ldap_pvt_thread_set_concurrency" (essentially the return value of
"pthread_setconcurrency") to see whether the setting is successful or not.

So when the user setting is inappropriate (i.e., too big), slapd says nothing.
But users have no way to be aware of such configuration failure. I suggest to
check and notify users in this case.

Here's the patch: 

--- ../openldap-2.4.33/servers/slapd/bconfig.c      2012-10-10
05:18:49.000000000 -0700
+++ servers/slapd/bconfig.c     2012-11-16 14:52:37.211421828 -0800
@@ -1530,7 +1530,14 @@
                case CFG_CONCUR:
-                       ldap_pvt_thread_set_concurrency(c->value_int);
+                        if(ldap_pvt_thread_set_concurrency(c->value_int) != 0)
+                               snprintf( c->cr_msg, sizeof( c->cr_msg ),
+                                         "concurrency=%d is not valid; using
the default setting",
+                                         c->value_int );
+                                Debug(LDAP_DEBUG_ANY, "%s: %s.\n", c->log,
c->cr_msg, 0 );
+                       }
                case CFG_THREADS: