You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ch...@apache.org on 2013/10/14 18:08:41 UTC
svn commit: r1531961 - in /httpd/httpd/trunk: CHANGES
docs/manual/mod/mod_authn_socache.xml modules/aaa/mod_authn_socache.c
Author: chrisd
Date: Mon Oct 14 16:08:41 2013
New Revision: 1531961
URL: http://svn.apache.org/r1531961
Log:
Support optional initialization arguments for socache providers in
mod_authn_socache.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/docs/manual/mod/mod_authn_socache.xml
httpd/httpd/trunk/modules/aaa/mod_authn_socache.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1531961&r1=1531960&r2=1531961&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Oct 14 16:08:41 2013
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+ *) mod_authn_socache: Support optional initialization arguments for
+ socache providers. [Chris Darroch]
+
*) mod_session: Reset the max-age on session save. PR 47476. [Alexey
Varlamov <alexey.v.varlamov gmail com>]
Modified: httpd/httpd/trunk/docs/manual/mod/mod_authn_socache.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_authn_socache.xml?rev=1531961&r1=1531960&r2=1531961&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_authn_socache.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_authn_socache.xml Mon Oct 14 16:08:41 2013
@@ -115,16 +115,17 @@ AuthnCacheSOCache dbm
<directivesynopsis>
<name>AuthnCacheSOCache</name>
<description>Select socache backend provider to use</description>
-<syntax>AuthnCacheSOCache <var>provider-name</var></syntax>
+<syntax>AuthnCacheSOCache <var>provider-name[:provider-args]</var></syntax>
<contextlist><context>server config</context></contextlist>
<override>None</override>
<usage>
<p>This is a server-wide setting to select a provider for the
- <a href="../socache.html">shared object cache</a>.
- Values are "dbm", "dc", "memcache", or "shmcb", each subject to the
- appropriate module being loaded. If not set, your platform's
- default will be used.</p>
+ <a href="../socache.html">shared object cache</a>, followed by
+ optional arguments for that provider.
+ Some possible values for <var>provider-name</var> are "dbm", "dc",
+ "memcache", or "shmcb", each subject to the appropriate module
+ being loaded. If not set, your platform's default will be used.</p>
</usage>
</directivesynopsis>
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=1531961&r1=1531960&r2=1531961&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_authn_socache.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_authn_socache.c Mon Oct 14 16:08:41 2013
@@ -39,7 +39,7 @@ typedef struct authn_cache_dircfg {
const char *context;
} authn_cache_dircfg;
-/* FIXME: figure out usage of socache create vs init
+/* FIXME:
* I think the cache and mutex should be global
*/
static apr_global_mutex_t *authn_cache_mutex = NULL;
@@ -85,7 +85,6 @@ static int authn_cache_post_config(apr_p
apr_pool_t *ptmp, server_rec *s)
{
apr_status_t rv;
- const char *errmsg;
static struct ap_socache_hints authn_cache_hints = {64, 32, 60000000};
if (!configured) {
@@ -108,12 +107,6 @@ static int authn_cache_post_config(apr_p
}
apr_pool_cleanup_register(pconf, NULL, remove_lock, apr_pool_cleanup_null);
- errmsg = socache_provider->create(&socache_instance, NULL, ptmp, pconf);
- if (errmsg) {
- ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, plog, APLOGNO(01676) "%s", errmsg);
- return 500; /* An HTTP status would be a misnomer! */
- }
-
rv = socache_provider->init(socache_instance, authn_cache_id,
&authn_cache_hints, s, pconf);
if (rv != APR_SUCCESS) {
@@ -143,9 +136,22 @@ static const char *authn_cache_socache(c
const char *arg)
{
const char *errmsg = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+ const char *sep, *name;
+
if (errmsg)
return errmsg;
- socache_provider = ap_lookup_provider(AP_SOCACHE_PROVIDER_GROUP, arg,
+
+ /* Argument is of form 'name:args' or just 'name'. */
+ sep = ap_strchr_c(arg, ':');
+ if (sep) {
+ name = apr_pstrmemdup(cmd->pool, arg, sep - arg);
+ sep++;
+ }
+ else {
+ name = arg;
+ }
+
+ socache_provider = ap_lookup_provider(AP_SOCACHE_PROVIDER_GROUP, name,
AP_SOCACHE_PROVIDER_VERSION);
if (socache_provider == NULL) {
errmsg = apr_psprintf(cmd->pool,
@@ -153,6 +159,14 @@ static const char *authn_cache_socache(c
"to load the appropriate socache module "
"(mod_socache_%s?)", arg, arg);
}
+ else {
+ errmsg = socache_provider->create(&socache_instance, sep,
+ cmd->temp_pool, cmd->pool);
+ }
+
+ if (errmsg) {
+ errmsg = apr_psprintf(cmd->pool, "AuthnCacheSOCache: %s", errmsg);
+ }
return errmsg;
}