You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/08/09 09:27:01 UTC

svn commit: r231006 - in /httpd/httpd/branches/2.0.x: STATUS modules/experimental/util_ldap.c

Author: jorton
Date: Tue Aug  9 00:26:54 2005
New Revision: 231006

URL: http://svn.apache.org/viewcvs?rev=231006&view=rev
Log:
Merge r105412 from trunk:

* modules/ldap/util_ldap.c (util_ldap_child_init): Don't segfault if
the cache has been disabled (when _cache_lock == NULL).
(util_ldap_post_config): Set mutex permissions if necessary.

Reviewed by: jorton, minfrin, wrowe

Modified:
    httpd/httpd/branches/2.0.x/STATUS
    httpd/httpd/branches/2.0.x/modules/experimental/util_ldap.c

Modified: httpd/httpd/branches/2.0.x/STATUS
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/STATUS?rev=231006&r1=231005&r2=231006&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/STATUS (original)
+++ httpd/httpd/branches/2.0.x/STATUS Tue Aug  9 00:26:54 2005
@@ -312,13 +312,6 @@
         http://svn.apache.org/viewcvs.cgi?rev=209539&view=rev
         +1: pquerna
 
-     *) mod_ldap: Initialize mutex permissions properly so that
-        locking actually works.
-        http://svn.apache.org/viewcvs?rev=105412&view=rev
-        rediff for 2.0.x: http://people.apache.org/~jorton/ap_ldapmutex20.diff
-        +1: jorton, minfrin, wrowe
-        wrowe asks: where is AP_NEED_SET_MUTEX_PERMS when you need it?
-
 PATCHES TO BACKPORT THAT ARE ON HOLD OR NOT GOING ANYWHERE SOON:
 
     *) Remove LDAP toolkit specific code from util_ldap and mod_auth_ldap.

Modified: httpd/httpd/branches/2.0.x/modules/experimental/util_ldap.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/modules/experimental/util_ldap.c?rev=231006&r1=231005&r2=231006&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/modules/experimental/util_ldap.c (original)
+++ httpd/httpd/branches/2.0.x/modules/experimental/util_ldap.c Tue Aug  9 00:26:54 2005
@@ -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
@@ -1466,6 +1471,15 @@
             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 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) {