From: Jan Kaluža Date: Tue, 11 Mar 2014 08:52:54 +0000 (+0000) Subject: mod_authn_socache.c: fix creation of default socache_instance. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d21bbd537c1507c71b478bcd540be1566c6b27c6;p=thirdparty%2Fapache%2Fhttpd.git 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1576233 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/log-message-tags/next-number b/docs/log-message-tags/next-number index 23c0538a792..4b430fcbd14 100644 --- a/docs/log-message-tags/next-number +++ b/docs/log-message-tags/next-number @@ -1 +1 @@ -2612 +2613 diff --git a/modules/aaa/mod_authn_socache.c b/modules/aaa/mod_authn_socache.c index 73c327411ee..317648f525f 100644 --- a/modules/aaa/mod_authn_socache.c +++ b/modules/aaa/mod_authn_socache.c @@ -86,6 +86,7 @@ static int authn_cache_post_config(apr_pool_t *pconf, apr_pool_t *plog, { 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_pool_t *pconf, apr_pool_t *plog, 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) {