Project

General

Profile

Bug #2464 ยป 0001-Allow-libldap-to-recover-from-EINTR-signals.patch

patch - codehero, 2012-12-19 08:52

View differences:

src/http_auth.c
806 806
			return -1;
807 807
		}
808 808

  
809
		/* mod_cgi starts child processes, which will signal SIGCHILD when completed.
810
		 * If openldap receives this signal during a select call, it will be interrupted
811
		 * and cause the client to believe the server is down.
812
		 *
813
		 * Setting LDAP_OPT_RESTART will retry the select. In most cases the rate of invoked
814
		 * processes is limited by successful auths, so setting this should not cause any problems.
815
		 *
816
		 * NOTE: Watch out for libldap using sycalls without accounting for EINTR. */
817
		ret = 1;
818
		if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(ldap, LDAP_OPT_RESTART, &ret))) {
819
			log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
820

  
821
			ldap_unbind_s(ldap);
822

  
823
			return -1;
824
		}
825

  
809 826
		if (p->conf.auth_ldap_starttls == 1) {
810 827
	 		if (LDAP_OPT_SUCCESS != (ret = ldap_start_tls_s(ldap, NULL,  NULL))) {
811 828
	 			log_error_write(srv, __FILE__, __LINE__, "ss", "ldap startTLS failed:", ldap_err2string(ret));
    (1-1/1)