You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/11/07 22:29:20 UTC

svn commit: r331600 - in /httpd/httpd/branches/2.2.x: CHANGES modules/dav/main/mod_dav.h modules/dav/main/util.c

Author: jorton
Date: Mon Nov  7 13:29:16 2005
New Revision: 331600

URL: http://svn.apache.org/viewcvs?rev=331600&view=rev
Log:
Merge r329562 from trunk:

Fix handling of unknown state tokens in If headers:

* modules/dav/main/mod_dav.h: Add dav_if_unknown to dav_if_state_type
enum.

* modules/dav/main/util.c (dav_add_if_state): Set returned type to
dav_if_unknown for an unknown state token.
(dav_validate_resource_state): Evaluate dav_if_unknown to fail
match unless in a Not condition.

PR: 37288

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/modules/dav/main/mod_dav.h
    httpd/httpd/branches/2.2.x/modules/dav/main/util.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/CHANGES?rev=331600&r1=331599&r2=331600&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Mon Nov  7 13:29:16 2005
@@ -1,8 +1,11 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.1.10
 
+  *) mod_dav: Fix handling of unknown state tokens in If: headers.
+     PR: 37288.  [Joe Orton]
+
   *) Strip out Experimental MPMs that have gone nowhere since 2.0
-     (perchild, threadpool, leader) [Nick Kew]
+     (perchild, threadpool, leader).  [Nick Kew]
 
 Changes with Apache 2.1.9
 

Modified: httpd/httpd/branches/2.2.x/modules/dav/main/mod_dav.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/dav/main/mod_dav.h?rev=331600&r1=331599&r2=331600&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/dav/main/mod_dav.h (original)
+++ httpd/httpd/branches/2.2.x/modules/dav/main/mod_dav.h Mon Nov  7 13:29:16 2005
@@ -686,7 +686,8 @@
 typedef enum
 {
     dav_if_etag,
-    dav_if_opaquelock
+    dav_if_opaquelock,
+    dav_if_unknown /* the "unknown" state type; always matches false. */   
 } dav_if_state_type;
 
 typedef struct dav_if_state_list

Modified: httpd/httpd/branches/2.2.x/modules/dav/main/util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/dav/main/util.c?rev=331600&r1=331599&r2=331600&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/dav/main/util.c (original)
+++ httpd/httpd/branches/2.2.x/modules/dav/main/util.c Mon Nov  7 13:29:16 2005
@@ -539,11 +539,11 @@
 
         if ((err = (*locks_hooks->parse_locktoken)(p, state_token,
                                                    &new_sl->locktoken)) != NULL) {
-            /* In cases where the state token is invalid, we'll just skip
-             * it rather than return 400.
-             */
+            /* If the state token cannot be parsed, treat it as an
+             * unknown state; this will evaluate to "false" later
+             * during If header validation. */
             if (err->error_id == DAV_ERR_LOCK_UNK_STATE_TOKEN) {
-                return NULL;
+                new_sl->type = dav_if_unknown;
             }
             else {
                 /* ### maybe add a higher-level description */
@@ -1198,6 +1198,18 @@
                     goto state_list_failed;
                 }
 
+                break;
+
+            case dav_if_unknown:
+                /* Request is predicated on some unknown state token,
+                 * which must be presumed to *not* match, so fail
+                 * unless this is a Not condition. */
+                
+                if (state_list->condition == DAV_IF_COND_NORMAL) {
+                    reason = 
+                        "an unknown state token was supplied";
+                    goto state_list_failed;
+                }
                 break;
 
             } /* switch */