]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r225753 from trunk:
authorJoe Orton <jorton@apache.org>
Fri, 5 Aug 2005 14:06:46 +0000 (14:06 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 5 Aug 2005 14:06:46 +0000 (14:06 +0000)
* modules/ldap/util_ldap_cache.c (util_ldap_cache_init): Use the
actual available size of the shm segment not the requested size.
Ensure the requested size is aligned.  Check errors from apr_rmm_init.

Reviewed by: jorton, minfrin, bnicholes

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@230474 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/experimental/util_ldap_cache.c

diff --git a/CHANGES b/CHANGES
index e66414ec985d34d8be281ff1022823487e40d73b..6cf4d938602da810623703cada77afc543d2567a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,7 @@ Changes with Apache 2.0.55
   *) mod_proxy: Fix over-eager handling of '%' for reverse proxies.
      PR 15207.  [Jim Jagielski]
 
-  *) mod_ldap: Fix a possible crash in shared memory cache handling.
+  *) mod_ldap: Fix various shared memory cache handling bugs.
      PR 34209.  [Joe Orton]
 
   *) Fix a file descriptor leak when starting piped loggers.  PR 33748. 
diff --git a/STATUS b/STATUS
index 3339e9cce864ca483575f8e4936ff439a5e124ae..407082c2c68fd7099470b034c9e0af3b4f81ae45 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -370,11 +370,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK:
         http://svn.apache.org/viewcvs.cgi?rev=209539&view=rev
         +1: pquerna
 
-     *) mod_ldap: Use the correct shm segment size, fail on
-        apr_rmm_init errors.
-        http://svn.apache.org/viewcvs?rev=225753&view=rev
-        +1: jorton, minfrin, bnicholes
-
      *) mod_ldap: Initialize mutex permissions properly so that
         locking actually works.
         http://svn.apache.org/viewcvs?rev=105412&view=rev
index 012c2927d94ef79ef76f7329ee6590d08ef6e867..ca856890772204212fb79d57f60f4fe1b41e6440 100644 (file)
@@ -397,8 +397,11 @@ apr_status_t util_ldap_cache_init(apr_pool_t *pool, util_ldap_state_t *st)
 {
 #if APR_HAS_SHARED_MEMORY
     apr_status_t result;
+    apr_size_t size;
 
-    result = apr_shm_create(&st->cache_shm, st->cache_bytes, st->cache_file, st->pool);
+    size = APR_ALIGN_DEFAULT(st->cache_bytes);
+
+    result = apr_shm_create(&st->cache_shm, size, st->cache_file, st->pool);
     if (result == APR_EEXIST) {
         /*
          * The cache could have already been created (i.e. we may be a child process).  See
@@ -410,8 +413,17 @@ apr_status_t util_ldap_cache_init(apr_pool_t *pool, util_ldap_state_t *st)
         return result;
     }
 
+    /* Determine the usable size of the shm segment. */
+    size = apr_shm_size_get(st->cache_shm);
+
     /* This will create a rmm "handler" to get into the shared memory area */
-    apr_rmm_init(&st->cache_rmm, NULL, (void *)apr_shm_baseaddr_get(st->cache_shm), st->cache_bytes, st->pool);
+    result = apr_rmm_init(&st->cache_rmm, NULL, 
+                          apr_shm_baseaddr_get(st->cache_shm), size, 
+                          st->pool);
+    if (result != APR_SUCCESS) {
+        return result;
+    }
+
 #endif
 
     apr_pool_cleanup_register(st->pool, st , util_ldap_cache_module_kill, apr_pool_cleanup_null);