summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-05-27 02:05:51 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2019-05-27 08:32:48 -0400
commitae9cafecea3ca0786dfad260ca064fc824e5ccc9 (patch)
tree97774e9bac40a66106248b8c2e0ddc2fc43889ac
parent4ac239c40193378ae09f28355530a3a04858065e (diff)
downloadlighttpd-git-ae9cafecea3ca0786dfad260ca064fc824e5ccc9.tar.gz
[mod_authn_ldap] ldap_set_option LDAP_OPT_RESTART (fixes #2940)
ldap_set_option LDAP_OPT_RESTART to handle EINTR on SIGCHLD from CGI (ldap uses poll(), which is not restartable with sigaction SA_RESTART) x-ref: "mod_authn_ldap/mod_cgi race condition, "Can't contact LDAP server"" https://redmine.lighttpd.net/issues/2940
-rw-r--r--src/mod_authn_ldap.c3
-rw-r--r--src/mod_vhostdb_ldap.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/mod_authn_ldap.c b/src/mod_authn_ldap.c
index 26191f5c..f95234bd 100644
--- a/src/mod_authn_ldap.c
+++ b/src/mod_authn_ldap.c
@@ -404,6 +404,9 @@ static LDAP * mod_authn_ldap_host_init(server *srv, plugin_config *s) {
return NULL;
}
+ /* restart ldap functions if interrupted by a signal, e.g. SIGCHLD */
+ ldap_set_option(ld, LDAP_OPT_RESTART, LDAP_OPT_ON);
+
if (s->auth_ldap_starttls) {
/* if no CA file is given, it is ok, as we will use encryption
* if the server requires a CAfile it will tell us */
diff --git a/src/mod_vhostdb_ldap.c b/src/mod_vhostdb_ldap.c
index e5362c40..234c2ba7 100644
--- a/src/mod_vhostdb_ldap.c
+++ b/src/mod_vhostdb_ldap.c
@@ -256,6 +256,9 @@ static LDAP * mod_authn_ldap_host_init(server *srv, vhostdb_config *s) {
return NULL;
}
+ /* restart ldap functions if interrupted by a signal, e.g. SIGCHLD */
+ ldap_set_option(ld, LDAP_OPT_RESTART, LDAP_OPT_ON);
+
if (s->starttls) {
/* if no CA file is given, it is ok, as we will use encryption
* if the server requires a CAfile it will tell us */