diff options
Diffstat (limited to 'modules/experimental/util_ldap.c')
-rw-r--r-- | modules/experimental/util_ldap.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/modules/experimental/util_ldap.c b/modules/experimental/util_ldap.c index 3af630bca4..9a74445784 100644 --- a/modules/experimental/util_ldap.c +++ b/modules/experimental/util_ldap.c @@ -43,6 +43,11 @@ #error mod_ldap requires APR-util to have LDAP support built in #endif +#if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE) +#include "unixd.h" +#define UTIL_LDAP_SET_MUTEX_PERMS +#endif + /* defines for certificate file types */ #define LDAP_CA_TYPE_UNKNOWN 0 @@ -325,7 +330,7 @@ LDAP_DECLARE(int) util_ldap_connection_open(request_rec *r, } if (st->connectionTimeout >= 0) { - rc = ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, (void *)&timeOut); + rc = ldap_set_option(ldc->ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *)&timeOut); if (APR_SUCCESS != rc) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "LDAP: Could not set the connection timeout" ); @@ -1466,6 +1471,15 @@ static int util_ldap_post_config(apr_pool_t *p, apr_pool_t *plog, return result; } +#ifdef UTIL_LDAP_SET_MUTEX_PERMS + result = unixd_set_global_mutex_perms(st->util_ldap_cache_lock); + if (result != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_CRIT, result, s, + "LDAP cache: failed to set mutex permissions"); + return result; + } +#endif + /* merge config in all vhost */ s_vhost = s->next; while (s_vhost) { @@ -1650,8 +1664,9 @@ static int util_ldap_post_config(apr_pool_t *p, apr_pool_t *plog, static void util_ldap_child_init(apr_pool_t *p, server_rec *s) { apr_status_t sts; - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(s->module_config, &ldap_module); + util_ldap_state_t *st = ap_get_module_config(s->module_config, &ldap_module); + + if (!st->util_ldap_cache_lock) return; sts = apr_global_mutex_child_init(&st->util_ldap_cache_lock, st->lock_file, p); if (sts != APR_SUCCESS) { |