httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1180384 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_authn_socache.xml modules/aaa/mod_authn_socache.c
Date Sat, 08 Oct 2011 14:51:37 GMT
Author: niq
Date: Sat Oct  8 14:51:35 2011
New Revision: 1180384

URL: http://svn.apache.org/viewvc?rev=1180384&view=rev
Log:
mod_authn_socache: fix it to enable initialisation to work if configured
only in .htaccess context, and provide a toggle for that.
PR 51991

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=1180384&r1=1180383&r2=1180384&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Oct  8 14:51:35 2011
@@ -137,6 +137,10 @@ Changes with Apache 2.3.15
   *) mod_deflate: Fix endless loop if first bucket is metadata. PR 51590.
      [Torsten Foertsch <torsten foertsch gmx net>]
 
+  *) mod_authn_socache: Fix to work in .htaccess if not configured anywhere
+     in httpd.conf, and introduce an AuthnCacheEnable directive.
+     PR 51991 [Nick Kew]
+
 Changes with Apache 2.3.14
 
   *) mod_proxy_ajp: Improve trace logging.  [Rainer Jung]

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=1180384&r1=1180383&r2=1180384&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_authn_socache.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_authn_socache.xml Sat Oct  8 14:51:35 2011
@@ -94,6 +94,23 @@ the load on backends</description>
 </section>
 
 <directivesynopsis>
+<name>AuthnCacheEnable</name>
+<description>Enable Authn caching configured anywhere</description>
+<syntax>AuthnCacheEnable</syntax>
+<contextlist><context>server config</context></contextlist>
+<override>None</override>
+
+<usage>
+    <p>This directive is not normally necessary: it is implied if
+    authentication cacheing is enabled anywhere in <var>httpd.conf</var>.
+    However, if it is not enabled anywhere in <var>httpd.conf</var>
+    it will by default not be initialised, and is therefore not
+    available in a <var>.htaccess</var> context.  This directive
+    ensures it is initialised so it can be used in <var>.htaccess</var>.</p>
+</usage>
+</directivesynopsis>
+
+<directivesynopsis>
 <name>AuthnCacheSOCache</name>
 <description>Select socache backend provider to use</description>
 <syntax>AuthnCacheSOCache <var>provider-name</var></syntax>

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=1180384&r1=1180383&r2=1180384&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_authn_socache.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_authn_socache.c Sat Oct  8 14:51:35 2011
@@ -151,6 +151,13 @@ static const char *authn_cache_socache(c
     return errmsg;
 }
 
+static const char *authn_cache_enable(cmd_parms *cmd, void *CFG)
+{
+    const char *errmsg = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    configured = 1;
+    return errmsg;
+}
+
 static const char *const directory = "directory";
 static void* authn_cache_dircfg_create(apr_pool_t *pool, char *s)
 {
@@ -205,6 +212,8 @@ static const command_rec authn_cache_cmd
     /* global stuff: cache and mutex */
     AP_INIT_TAKE1("AuthnCacheSOCache", authn_cache_socache, NULL, RSRC_CONF,
                   "socache provider for authn cache"),
+    AP_INIT_NO_ARGS("AuthnCacheEnable", authn_cache_enable, NULL, RSRC_CONF,
+                    "enable socache configuration in htaccess even if not enabled anywhere
else"),
     /* per-dir stuff */
     AP_INIT_ITERATE("AuthnCacheProvideFor", authn_cache_setprovider, NULL,
                     OR_AUTHCFG, "Determine what authn providers to cache for"),
@@ -250,7 +259,7 @@ static void ap_authn_cache_store(request
 
     /* first check whether we're cacheing for this module */
     dcfg = ap_get_module_config(r->per_dir_config, &authn_socache_module);
-    if (!dcfg->providers) {
+    if (!configured || !dcfg->providers) {
         return;
     }
     for (i = 0; i < dcfg->providers->nelts; ++i) {
@@ -327,7 +336,7 @@ static authn_status check_password(reque
     unsigned char val[MAX_VAL_LEN];
     unsigned int vallen = MAX_VAL_LEN - 1;
     dcfg = ap_get_module_config(r->per_dir_config, &authn_socache_module);
-    if (!dcfg->providers) {
+    if (!configured || !dcfg->providers) {
         return AUTH_USER_NOT_FOUND;
     }
     key = construct_key(r, dcfg->context, user, NULL);
@@ -372,7 +381,7 @@ static authn_status get_realm_hash(reque
     unsigned char val[MAX_VAL_LEN];
     unsigned int vallen = MAX_VAL_LEN - 1;
     dcfg = ap_get_module_config(r->per_dir_config, &authn_socache_module);
-    if (!dcfg->providers) {
+    if (!configured || !dcfg->providers) {
         return AUTH_USER_NOT_FOUND;
     }
     key = construct_key(r, dcfg->context, user, realm);



Mime
View raw message