[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
This commit is contained in:
Glenn Strauss 2019-05-27 02:05:51 -04:00
parent 4ac239c401
commit ae9cafecea
2 changed files with 6 additions and 0 deletions

View File

@ -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 */

View File

@ -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 */