You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jk...@apache.org on 2014/03/11 09:52:54 UTC

svn commit: r1576233 - in /httpd/httpd/trunk: docs/log-message-tags/next-number modules/aaa/mod_authn_socache.c

Author: jkaluza
Date: Tue Mar 11 08:52:54 2014
New Revision: 1576233

URL: http://svn.apache.org/r1576233
Log:
mod_authn_socache.c: fix creation of default socache_instance.

In pre_config, default socache_provider is created, but socache_instance
initialization is missing. This leads to crash on startup if default
socache_provider is used (AuthnCacheSOCache is not called) and
AuthnCacheEnable or AuthnCacheProvideFor is used.

This problem has been introduced in r1531961.

Modified:
    httpd/httpd/trunk/docs/log-message-tags/next-number
    httpd/httpd/trunk/modules/aaa/mod_authn_socache.c

Modified: httpd/httpd/trunk/docs/log-message-tags/next-number
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/next-number?rev=1576233&r1=1576232&r2=1576233&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
+++ httpd/httpd/trunk/docs/log-message-tags/next-number Tue Mar 11 08:52:54 2014
@@ -1 +1 @@
-2612
+2613

Modified: httpd/httpd/trunk/modules/aaa/mod_authn_socache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_authn_socache.c?rev=1576233&r1=1576232&r2=1576233&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_authn_socache.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_authn_socache.c Tue Mar 11 08:52:54 2014
@@ -86,6 +86,7 @@ static int authn_cache_post_config(apr_p
 {
     apr_status_t rv;
     static struct ap_socache_hints authn_cache_hints = {64, 32, 60000000};
+    const char *errmsg;
 
     if (!configured) {
         return OK;    /* don't waste the overhead of creating mutex & cache */
@@ -98,6 +99,20 @@ static int authn_cache_post_config(apr_p
         return 500; /* An HTTP status would be a misnomer! */
     }
 
+    /* We have socache_provider, but do not have socache_instance. This should
+     * happen only when using "default" socache_provider, so create default
+     * socache_instance in this case. */
+    if (socache_instance == NULL) {
+        errmsg = socache_provider->create(&socache_instance, NULL,
+                                          ptmp, pconf);
+        if (errmsg) {
+            ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, plog, APLOGNO(02612)
+                        "failed to create mod_socache_shmcb socache "
+                        "instance: %s", errmsg);
+            return 500;
+        }
+    }
+
     rv = ap_global_mutex_create(&authn_cache_mutex, NULL,
                                 authn_cache_id, NULL, s, pconf, 0);
     if (rv != APR_SUCCESS) {