subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@apache.org
Subject svn commit: r1144316 - in /subversion/trunk/subversion/libsvn_repos: commit.c fs-wrap.c
Date Fri, 08 Jul 2011 14:02:42 GMT
Author: philip
Date: Fri Jul  8 14:02:42 2011
New Revision: 1144316

URL: http://svn.apache.org/viewvc?rev=1144316&view=rev
Log:
Fix issue 3953, mod_dav_svn failing to reject bogus mergeinfo on commit.
Move server-side mergeinfo validation so that all RA layers use it.

* subversion/libsvn_repos/commit.c
  (verify_mergeinfo): Delete, move to fs-wrap.c.
  (change_file_prop, change_dir_prop): Don't verify mergeinfo.

* subversion/libsvn_repos/commit.c
  (verify_mergeinfo): New, copied from commit.c.
  (svn_repos_fs_change_node_prop): Verify mergeinfo.

Modified:
    subversion/trunk/subversion/libsvn_repos/commit.c
    subversion/trunk/subversion/libsvn_repos/fs-wrap.c

Modified: subversion/trunk/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1144316&r1=1144315&r2=1144316&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/commit.c (original)
+++ subversion/trunk/subversion/libsvn_repos/commit.c Fri Jul  8 14:02:42 2011
@@ -531,39 +531,6 @@ open_file(const char *path,
 }
 
 
-/* Verify the mergeinfo property value VALUE and return an error if it
- * is invalid. The PATH on which that property is set is used for error
- * messages only.  Use SCRATCH_POOL for temporary allocations. */
-static svn_error_t *
-verify_mergeinfo(const svn_string_t *value,
-                 const char *path,
-                 apr_pool_t *scratch_pool)
-{
-  svn_error_t *err;
-  svn_mergeinfo_t mergeinfo;
-
-  /* It's okay to delete svn:mergeinfo. */
-  if (value == NULL)
-    return SVN_NO_ERROR;
-
-  /* Mergeinfo is UTF-8 encoded so the number of bytes returned by strlen()
-   * should match VALUE->LEN. Prevents trailing garbage in the property. */
-  if (strlen(value->data) != value->len)
-    return svn_error_createf(SVN_ERR_MERGEINFO_PARSE_ERROR, NULL,
-                             _("Commit rejected because mergeinfo on '%s' "
-                               "contains unexpected string terminator"),
-                             path);
-
-  err = svn_mergeinfo_parse(&mergeinfo, value->data, scratch_pool);
-  if (err)
-    return svn_error_createf(err->apr_err, err,
-                             _("Commit rejected because mergeinfo on '%s' "
-                               "is syntactically invalid"),
-                             path);
-  return SVN_NO_ERROR;
-}
-
-
 static svn_error_t *
 change_file_prop(void *file_baton,
                  const char *name,
@@ -577,9 +544,6 @@ change_file_prop(void *file_baton,
   SVN_ERR(check_authz(eb, fb->path, eb->txn_root,
                       svn_authz_write, pool));
 
-  if (value && strcmp(name, SVN_PROP_MERGEINFO) == 0)
-    SVN_ERR(verify_mergeinfo(value, fb->path, pool));
-
   return svn_repos_fs_change_node_prop(eb->txn_root, fb->path,
                                        name, value, pool);
 }
@@ -638,9 +602,6 @@ change_dir_prop(void *dir_baton,
         return out_of_date(db->path, svn_node_dir);
     }
 
-  if (value && strcmp(name, SVN_PROP_MERGEINFO) == 0)
-    SVN_ERR(verify_mergeinfo(value, db->path, pool));
-
   return svn_repos_fs_change_node_prop(eb->txn_root, db->path,
                                        name, value, pool);
 }

Modified: subversion/trunk/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/fs-wrap.c?rev=1144316&r1=1144315&r2=1144316&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/trunk/subversion/libsvn_repos/fs-wrap.c Fri Jul  8 14:02:42 2011
@@ -215,6 +215,39 @@ svn_repos__validate_prop(const char *nam
 }
 
 
+/* Verify the mergeinfo property value VALUE and return an error if it
+ * is invalid. The PATH on which that property is set is used for error
+ * messages only.  Use SCRATCH_POOL for temporary allocations. */
+static svn_error_t *
+verify_mergeinfo(const svn_string_t *value,
+                 const char *path,
+                 apr_pool_t *scratch_pool)
+{
+  svn_error_t *err;
+  svn_mergeinfo_t mergeinfo;
+
+  /* It's okay to delete svn:mergeinfo. */
+  if (value == NULL)
+    return SVN_NO_ERROR;
+
+  /* Mergeinfo is UTF-8 encoded so the number of bytes returned by strlen()
+   * should match VALUE->LEN. Prevents trailing garbage in the property. */
+  if (strlen(value->data) != value->len)
+    return svn_error_createf(SVN_ERR_MERGEINFO_PARSE_ERROR, NULL,
+                             _("Commit rejected because mergeinfo on '%s' "
+                               "contains unexpected string terminator"),
+                             path);
+
+  err = svn_mergeinfo_parse(&mergeinfo, value->data, scratch_pool);
+  if (err)
+    return svn_error_createf(err->apr_err, err,
+                             _("Commit rejected because mergeinfo on '%s' "
+                               "is syntactically invalid"),
+                             path);
+  return SVN_NO_ERROR;
+}
+
+
 svn_error_t *
 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
                               const char *path,
@@ -222,6 +255,9 @@ svn_repos_fs_change_node_prop(svn_fs_roo
                               const svn_string_t *value,
                               apr_pool_t *pool)
 {
+  if (value && strcmp(name, SVN_PROP_MERGEINFO) == 0)
+    SVN_ERR(verify_mergeinfo(value, path, pool));
+
   /* Validate the property, then call the wrapped function. */
   SVN_ERR(svn_repos__validate_prop(name, value, pool));
   return svn_fs_change_node_prop(root, path, name, value, pool);



Mime
View raw message