]> granicus.if.org Git - apache/commitdiff
Enable the option to support anonymous shared memory in mod_ldap.
authorGraham Leggett <minfrin@apache.org>
Wed, 26 May 2004 11:48:19 +0000 (11:48 +0000)
committerGraham Leggett <minfrin@apache.org>
Wed, 26 May 2004 11:48:19 +0000 (11:48 +0000)
This makes the cache work on Linux again.
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103772 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_ldap.xml
modules/experimental/util_ldap.c
modules/experimental/util_ldap_cache.c

diff --git a/CHANGES b/CHANGES
index 953f6c5d1dcb486b2de0d435965bf9437102f383..5a74c84398a3d3bb6124086870611fe459250caa 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Enable the option to support anonymous shared memory in mod_ldap.
+     This makes the cache work on Linux again. [Graham Leggett]
+
   *) Allow LimitRequestBody to be reset to unlimited. PR 29106
      [AndrĂ© Malo]
 
index 40a39c51a16f11da90ccb951cab4001201985b61..c1b3b579f28615d20814d83d3f8a46db645be895 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
-<!-- $Revision: 1.11 $ -->
+<!-- $Revision: 1.12 $ -->
 
 <!--
  Copyright 2002-2004 The Apache Software Foundation
@@ -248,7 +248,8 @@ by other LDAP modules</description>
 
 <usage>
     <p>Specifies the directory path and file name of the shared memory
-    cache file. If not set, shared memory caching will not be used.</p>
+    cache file. If not set, anonymous shared memory will be used if the
+    platform supports it.</p>
 </usage>
 </directivesynopsis>
 
index eec58e939b0b1c8102146576313e1abaf4186b40..e5a32e0f517377d9244954944da01c566fce3a65 100644 (file)
@@ -1164,13 +1164,15 @@ static int util_ldap_post_config(apr_pool_t *p, apr_pool_t *plog,
     server_rec *s_vhost;
     util_ldap_state_t *st_vhost;
     
-    /* initializing cache if file is here and we already don't have shm addr*/
-    if (st->cache_file && !st->cache_shm) {
+    /* initializing cache if shared memory size is not zero and we already don't have shm address */
+    if (!st->cache_shm && st->cache_bytes > 0) {
 #endif
         result = util_ldap_cache_init(p, st);
-        apr_strerror(result, buf, sizeof(buf));
-        ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, result, s,
-                     "LDAP cache init: %s", buf);
+        if (result != APR_SUCCESS) {
+            apr_strerror(result, buf, sizeof(buf));
+            ap_log_error(APLOG_MARK, APLOG_ERR, result, s,
+                         "LDAP cache: error while creating a shared memory segment: %s", buf);
+        }
 
 #if APR_HAS_SHARED_MEMORY
         /* merge config in all vhost */
@@ -1188,7 +1190,7 @@ static int util_ldap_post_config(apr_pool_t *p, apr_pool_t *plog,
         }
     }
     else {
-        ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0 , s, "LDAP cache: Unable to init Shared Cache: no file");
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "LDAP cache: LDAPSharedCacheSize is zero, disabling shared memory cache");
     }
 #endif
     
index 66206079cc87c4c4178a915da26ad6f3f794bb34..a8c8127479b7074af6322ac6ca4081542ecc0b5d 100644 (file)
@@ -267,12 +267,8 @@ 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;
 
-    if (!st->cache_file) {
-       return -1;
-    }
-
     result = apr_shm_create(&st->cache_shm, st->cache_bytes, st->cache_file, st->pool);
-    if (result == EEXIST) {
+    if (result == APR_EEXIST) {
         /*
          * The cache could have already been created (i.e. we may be a child process).  See
          * if we can attach to the existing shared memory