You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2011/07/26 17:52:41 UTC

svn commit: r1151143 - in /httpd/httpd/trunk: CHANGES modules/aaa/mod_allowmethods.c

Author: rjung
Date: Tue Jul 26 15:52:40 2011
New Revision: 1151143

URL: http://svn.apache.org/viewvc?rev=1151143&view=rev
Log:
mod_allowmethods: Correct Merging of "reset" and do
not allow an empty parameter list for the
AllowMethods directive.

Furthermore switch from AP_MODULE_DECLARE_DATA
to AP_DECLARE_MODULE (the module was brought in
after the big logging refactoring).

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/aaa/mod_allowmethods.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1151143&r1=1151142&r2=1151143&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Jul 26 15:52:40 2011
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.14
 
+  *) mod_allowmethods: Correct Merging of "reset" and do not allow an
+     empty parameter list for the AllowMethods directive. [Rainer Jung]
+
   *) configure: Update selection of modules for 'all' and 'most'. 'all' will
      now enable all modules except for example and test modules. Make the
      selection for 'most' more useful (including ssl and proxy). Both 'all'

Modified: httpd/httpd/trunk/modules/aaa/mod_allowmethods.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_allowmethods.c?rev=1151143&r1=1151142&r2=1151143&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_allowmethods.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_allowmethods.c Tue Jul 26 15:52:40 2011
@@ -44,6 +44,7 @@
  */
 
 typedef struct am_conf_t {
+  int allowed_set;
   apr_int64_t allowed;
 } am_conf_t;
 
@@ -80,6 +81,7 @@ static void *am_create_conf(apr_pool_t *
   am_conf_t *conf = apr_pcalloc(p, sizeof(am_conf_t));
   
   conf->allowed = 0;
+  conf->allowed_set = 0;
   return conf;
 }
 
@@ -88,7 +90,13 @@ static void* am_merge_conf(apr_pool_t* p
   am_conf_t* add = (am_conf_t*) b;
   am_conf_t* conf = apr_palloc(pool, sizeof(am_conf_t));
   
-  conf->allowed = add->allowed ? add->allowed : base->allowed;
+  if (add->allowed_set) {
+      conf->allowed = add->allowed;
+      conf->allowed_set = add->allowed_set;
+  } else {
+      conf->allowed = base->allowed;
+      conf->allowed_set = base->allowed_set;
+  }
 
   return conf;
 }
@@ -97,9 +105,13 @@ static const char *am_allowmethods(cmd_p
 {
   int i;
   am_conf_t* conf = (am_conf_t*) d;
+  if (argc == 0) {
+      return "AllowMethods: No method or 'reset' keyword given";
+  }
   if (argc == 1) {
     if (strcasecmp("reset", argv[0]) == 0) {
       conf->allowed = 0;
+      conf->allowed_set = 1;
       return NULL;
     }
   }
@@ -113,6 +125,7 @@ static const char *am_allowmethods(cmd_p
 
     conf->allowed |= (AP_METHOD_BIT << m);
   }
+  conf->allowed_set = 1;
   return NULL;
 }
 
@@ -128,7 +141,7 @@ static const command_rec am_cmds[] = {
   {NULL}
 };
 
-module AP_MODULE_DECLARE_DATA allowmethods_module = {
+AP_DECLARE_MODULE(allowmethods) = {
   STANDARD20_MODULE_STUFF,
   am_create_conf,
   am_merge_conf,