subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r1067180 - in /subversion/trunk/subversion: include/private/ libsvn_subr/ mod_dav_svn/ mod_dav_svn/reports/
Date Fri, 04 Feb 2011 14:09:06 GMT
Author: cmpilato
Date: Fri Feb  4 14:09:06 2011
New Revision: 1067180

URL: http://svn.apache.org/viewvc?rev=1067180&view=rev
Log:
Continue replacing deprecated svn_path_* function calls.

* subversion/include/private/svn_fspath.h,
* subversion/libsvn_subr/dirent_uri.c
  (svn_urlpath__internal_style): New function.

* subversion/mod_dav_svn/mod_dav_svn.c (SVNPath_cmd, SVNParentPath_cmd,
  dav_svn_get_repos_path),
* subversion/mod_dav_svn/reports/update.c (get_from_path_map,
  dav_svn__update_report),
* subversion/mod_dav_svn/util.c (dav_svn__test_canonical)
* subversion/mod_dav_svn/repos.c (get_parent_path, deliver)
* subversion/mod_dav_svn/activity.c (activity_pathname)
* subversion/mod_dav_svn/merge.c (do_resources):
    Replace usages of deprecated svn_path_* functions.

* subversion/mod_dav_svn/reports/deleted-rev.c
  (dav_svn__get_deleted_rev_report),
* subversion/mod_dav_svn/reports/get-locations.c
  (dav_svn__get_locations_report),
* subversion/mod_dav_svn/reports/get-location-segments.c
  (dav_svn__get_location_segments_report),
* subversion/mod_dav_svn/reports/log.c (dav_svn__log_report),
* subversion/mod_dav_svn/reports/mergeinfo.c (dav_svn__get_mergeinfo_report),
* subversion/mod_dav_svn/reports/file-revs.c (dav_svn__file_revs_report):
    Replace usages of deprecated svn_path_* functions, and add input
    validation where missing and needed.

  

Modified:
    subversion/trunk/subversion/include/private/svn_fspath.h
    subversion/trunk/subversion/libsvn_subr/dirent_uri.c
    subversion/trunk/subversion/mod_dav_svn/activity.c
    subversion/trunk/subversion/mod_dav_svn/merge.c
    subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
    subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c
    subversion/trunk/subversion/mod_dav_svn/reports/file-revs.c
    subversion/trunk/subversion/mod_dav_svn/reports/get-location-segments.c
    subversion/trunk/subversion/mod_dav_svn/reports/get-locations.c
    subversion/trunk/subversion/mod_dav_svn/reports/log.c
    subversion/trunk/subversion/mod_dav_svn/reports/mergeinfo.c
    subversion/trunk/subversion/mod_dav_svn/reports/update.c
    subversion/trunk/subversion/mod_dav_svn/repos.c
    subversion/trunk/subversion/mod_dav_svn/util.c

Modified: subversion/trunk/subversion/include/private/svn_fspath.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_fspath.h?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_fspath.h (original)
+++ subversion/trunk/subversion/include/private/svn_fspath.h Fri Feb  4 14:09:06 2011
@@ -194,6 +194,10 @@ svn_fspath__get_longest_ancestor(const c
 const char *
 svn_urlpath__canonicalize(const char *uri, apr_pool_t *pool);
 
+/* Like svn_relpath_internal_style(), but for urlpaths. */
+const char *
+svn_urlpath__internal_style(const char *uri, apr_pool_t *pool);
+
 
 #ifdef __cplusplus
 }

Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Fri Feb  4 14:09:06 2011
@@ -2589,3 +2589,14 @@ svn_urlpath__canonicalize(const char *ur
     }
   return uri;
 }
+
+const char *
+svn_urlpath__internal_style(const char *uri,
+                            apr_pool_t *pool)
+{
+  return svn_urlpath__canonicalize(
+             svn_relpath_internal_style(
+                 svn_relpath_canonicalize(uri + 1, pool),
+                 pool),
+             pool);
+}

Modified: subversion/trunk/subversion/mod_dav_svn/activity.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/activity.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/activity.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/activity.c Fri Feb  4 14:09:06 2011
@@ -59,9 +59,9 @@ escape_activity(const char *activity_id,
 static const char *
 activity_pathname(const dav_svn_repos *repos, const char *activity_id)
 {
-  return svn_path_join(repos->activities_db,
-                       escape_activity(activity_id, repos->pool),
-                       repos->pool);
+  return svn_dirent_join(repos->activities_db,
+                         escape_activity(activity_id, repos->pool),
+                         repos->pool);
 }
 
 /* Return the transaction name of the activity stored in file

Modified: subversion/trunk/subversion/mod_dav_svn/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/merge.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/merge.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/merge.c Fri Feb  4 14:09:06 2011
@@ -36,6 +36,7 @@
 
 #include "dav_svn.h"
 
+#include "private/svn_fspath.h"
 
 /* #################################################################
 
@@ -184,7 +185,7 @@ do_resources(const dav_svn_repos *repos,
              (and then remember that you sent it).  Allocate parent in
              pool, not subpool, because it stays in the sent hash
              afterwards. */
-          const char *parent = svn_path_dirname(path, pool);
+          const char *parent = svn_fspath__dirname(path, pool);
           if (! apr_hash_get(sent, parent, APR_HASH_KEY_STRING))
             {
               SVN_ERR(send_response(repos, root, parent,

Modified: subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c Fri Feb  4 14:09:06 2011
@@ -368,8 +368,7 @@ SVNPath_cmd(cmd_parms *cmd, void *config
   if (conf->fs_parent_path != NULL)
     return "SVNPath cannot be defined at same time as SVNParentPath.";
 
-  conf->fs_path = svn_path_internal_style(apr_pstrdup(cmd->pool, arg1),
-                                          cmd->pool);
+  conf->fs_path = svn_urlpath__internal_style(arg1, cmd->pool);
 
   return NULL;
 }
@@ -383,8 +382,7 @@ SVNParentPath_cmd(cmd_parms *cmd, void *
   if (conf->fs_path != NULL)
     return "SVNParentPath cannot be defined at same time as SVNPath.";
 
-  conf->fs_parent_path = svn_path_internal_style(apr_pstrdup(cmd->pool, arg1),
-                                                 cmd->pool);
+  conf->fs_parent_path = svn_urlpath__internal_style(arg1, cmd->pool);
 
   return NULL;
 }
@@ -484,7 +482,7 @@ dav_svn_get_repos_path(request_rec *r,
 
   /* Construct the full path from the parent path base directory
      and the repository name. */
-  *repos_path = svn_path_join(fs_parent_path, repos_name, r->pool);
+  *repos_path = svn_urlpath__join(fs_parent_path, repos_name, r->pool);
   return NULL;
 }
 

Modified: subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/deleted-rev.c Fri Feb  4 14:09:06 2011
@@ -32,6 +32,7 @@
 #include "svn_dav.h"
 #include "svn_pools.h"
 
+#include "private/svn_fspath.h"
 #include "private/svn_dav_protocol.h"
 
 #include "../dav_svn.h"
@@ -84,11 +85,18 @@ dav_svn__get_deleted_rev_report(const da
           rel_path = dav_xml_get_cdata(child, resource->pool, 0);
           if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
             return derr;
+          /* Force REL_PATH to be a relative path, not an fspath. */
+          rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+          /* Append REL_PATH to the base FS path to get an absolute
+             repository path. */
+          abs_path = svn_fspath__join(resource->info->repos_path, rel_path,
+                                      resource->pool);
         }
     }
 
-    /* Check that all parameters are present. */
-  if (! (rel_path
+  /* Check that all parameters are present and valid. */
+  if (! (abs_path
          && SVN_IS_VALID_REVNUM(peg_rev)
          && SVN_IS_VALID_REVNUM(end_rev)))
     {
@@ -98,11 +106,6 @@ dav_svn__get_deleted_rev_report(const da
                                     SVN_DAV_ERROR_TAG);
     }
 
-  /* Append the relative path to the base FS path to get an absolute
-     repository path. */
-  abs_path = svn_path_join(resource->info->repos_path, rel_path,
-                           resource->pool);
-
   /* Do what we actually came here for: Find the rev abs_path was deleted. */
   err = svn_repos_deleted_rev(resource->info->repos->fs,
                               abs_path, peg_rev, end_rev,

Modified: subversion/trunk/subversion/mod_dav_svn/reports/file-revs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/file-revs.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/file-revs.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/file-revs.c Fri Feb  4 14:09:06 2011
@@ -31,7 +31,9 @@
 #include "svn_base64.h"
 #include "svn_props.h"
 #include "svn_dav.h"
+
 #include "private/svn_log.h"
+#include "private/svn_fspath.h"
 
 #include "../dav_svn.h"
 
@@ -236,7 +238,7 @@ dav_svn__file_revs_report(const dav_reso
   int ns;
   struct file_rev_baton frb;
   dav_svn__authz_read_baton arb;
-  const char *path = NULL;
+  const char *abs_path = NULL;
 
   /* These get determined from the request document. */
   svn_revnum_t start = SVN_INVALID_REVNUM;
@@ -279,12 +281,25 @@ dav_svn__file_revs_report(const dav_reso
           const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
           if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
             return derr;
-          path = svn_path_join(resource->info->repos_path, rel_path,
-                               resource->pool);
+
+          /* Force REL_PATH to be a relative path, not an fspath. */
+          rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+          /* Append the REL_PATH to the base FS path to get an
+             absolute repository path. */
+          abs_path = svn_fspath__join(resource->info->repos_path, rel_path,
+                                      resource->pool);
         }
       /* else unknown element; skip it */
     }
 
+  /* Check that all parameters are present and valid. */
+  if (! abs_path)
+    return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
+                                  "Not all parameters passed.",
+                                  SVN_DAV_ERROR_NAMESPACE,
+                                  SVN_DAV_ERROR_TAG);
+
   frb.bb = apr_brigade_create(resource->pool,
                               output->c->bucket_alloc);
   frb.output = output;
@@ -295,7 +310,7 @@ dav_svn__file_revs_report(const dav_reso
 
   /* Get the revisions and send them. */
   serr = svn_repos_get_file_revs2(resource->info->repos->repos,
-                                  path, start, end, include_merged_revisions,
+                                  abs_path, start, end, include_merged_revisions,
                                   dav_svn__authz_read_func(&arb), &arb,
                                   file_rev_handler, &frb, resource->pool);
 
@@ -332,7 +347,7 @@ dav_svn__file_revs_report(const dav_reso
 
   /* We've detected a 'high level' svn action to log. */
   dav_svn__operational_log(resource->info,
-                           svn_log__get_file_revs(path, start, end,
+                           svn_log__get_file_revs(abs_path, start, end,
                                                   include_merged_revisions,
                                                   resource->pool));
 

Modified: subversion/trunk/subversion/mod_dav_svn/reports/get-location-segments.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/get-location-segments.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/get-location-segments.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/get-location-segments.c Fri Feb  4 14:09:06
2011
@@ -40,6 +40,8 @@
 #include "svn_dav.h"
 #include "svn_base64.h"
 
+#include "private/svn_fspath.h"
+
 #include "../dav_svn.h"
 
 
@@ -113,7 +115,7 @@ dav_svn__get_location_segments_report(co
   apr_bucket_brigade *bb;
   int ns;
   apr_xml_elem *child;
-  const char *path = NULL;
+  const char *abs_path;
   svn_revnum_t peg_revision = SVN_INVALID_REVNUM;
   svn_revnum_t start_rev = SVN_INVALID_REVNUM;
   svn_revnum_t end_rev = SVN_INVALID_REVNUM;
@@ -156,16 +158,22 @@ dav_svn__get_location_segments_report(co
         }
       else if (strcmp(child->name, "path") == 0)
         {
-          path = dav_xml_get_cdata(child, resource->pool, 0);
-          if ((derr = dav_svn__test_canonical(path, resource->pool)))
+          const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
+          if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
             return derr;
-          path = svn_path_join(resource->info->repos_path, path,
-                               resource->pool);
+
+          /* Force REL_PATH to be a relative path, not an fspath. */
+          rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+          /* Append the REL_PATH to the base FS path to get an
+             absolute repository path. */
+          abs_path = svn_fspath__join(resource->info->repos_path, rel_path,
+                                      resource->pool);
         }
     }
 
-  /* Check our inputs. */
-  if (! path)
+  /* Check that all parameters are present and valid. */
+  if (! abs_path)
     return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
                                   "Not all parameters passed.",
                                   SVN_DAV_ERROR_NAMESPACE,
@@ -199,7 +207,7 @@ dav_svn__get_location_segments_report(co
   location_segment_baton.output = output;
   location_segment_baton.bb = bb;
   if ((serr = svn_repos_node_location_segments(resource->info->repos->repos,
-                                               path, peg_revision,
+                                               abs_path, peg_revision,
                                                start_rev, end_rev,
                                                location_segment_receiver,
                                                &location_segment_baton,

Modified: subversion/trunk/subversion/mod_dav_svn/reports/get-locations.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/get-locations.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/get-locations.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/get-locations.c Fri Feb  4 14:09:06 2011
@@ -39,6 +39,8 @@
 #include "svn_dav.h"
 #include "svn_base64.h"
 
+#include "private/svn_fspath.h"
+
 #include "../dav_svn.h"
 
 
@@ -90,8 +92,7 @@ dav_svn__get_locations_report(const dav_
   dav_svn__authz_read_baton arb;
 
   /* The parameters to do the operation on. */
-  const char *relative_path = NULL;
-  const char *abs_path;
+  const char *abs_path = NULL;
   svn_revnum_t peg_revision = SVN_INVALID_REVNUM;
   apr_array_header_t *location_revisions;
 
@@ -134,26 +135,26 @@ dav_svn__get_locations_report(const dav_
         }
       else if (strcmp(child->name, "path") == 0)
         {
-          relative_path = dav_xml_get_cdata(child, resource->pool, 0);
-          if ((derr = dav_svn__test_canonical(relative_path, resource->pool)))
+          const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
+          if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
             return derr;
-        }
-    }
 
-  /* Now we should have the parameters ready - let's
-     check if they are all present. */
-  if (! (relative_path && SVN_IS_VALID_REVNUM(peg_revision)))
-    {
-      return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
-                                    "Not all parameters passed.",
-                                    SVN_DAV_ERROR_NAMESPACE,
-                                    SVN_DAV_ERROR_TAG);
+          /* Force REL_PATH to be a relative path, not an fspath. */
+          rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+          /* Append the REL_PATH to the base FS path to get an absolute
+             repository path. */
+          abs_path = svn_fspath__join(resource->info->repos_path, rel_path,
+                                      resource->pool);
+        }
     }
 
-  /* Append the relative path to the base FS path to get an absolute
-     repository path. */
-  abs_path = svn_path_join(resource->info->repos_path, relative_path,
-                           resource->pool);
+  /* Check that all parameters are present and valid. */
+  if (! (abs_path && SVN_IS_VALID_REVNUM(peg_revision)))
+    return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
+                                  "Not all parameters passed.",
+                                  SVN_DAV_ERROR_NAMESPACE,
+                                  SVN_DAV_ERROR_TAG);
 
   /* Build an authz read baton */
   arb.r = resource->info->r;

Modified: subversion/trunk/subversion/mod_dav_svn/reports/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/log.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/log.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/log.c Fri Feb  4 14:09:06 2011
@@ -37,6 +37,7 @@
 #include "svn_props.h"
 
 #include "private/svn_log.h"
+#include "private/svn_fspath.h"
 
 #include "../dav_svn.h"
 
@@ -359,8 +360,14 @@ dav_svn__log_report(const dav_resource *
           const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
           if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
             return derr;
-          target = svn_path_join(resource->info->repos_path, rel_path,
-                                 resource->pool);
+
+          /* Force REL_PATH to be a relative path, not an fspath. */
+          rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+          /* Append the REL_PATH to the base FS path to get an
+             absolute repository path. */
+          target = svn_fspath__join(resource->info->repos_path, rel_path,
+                                    resource->pool);
           APR_ARRAY_PUSH(paths, const char *) = target;
         }
       /* else unknown element; skip it */

Modified: subversion/trunk/subversion/mod_dav_svn/reports/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/mergeinfo.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/mergeinfo.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/mergeinfo.c Fri Feb  4 14:09:06 2011
@@ -34,6 +34,8 @@
 #include "svn_xml.h"
 #include "svn_path.h"
 #include "svn_dav.h"
+
+#include "private/svn_fspath.h"
 #include "private/svn_dav_protocol.h"
 #include "private/svn_log.h"
 #include "private/svn_mergeinfo_private.h"
@@ -96,8 +98,14 @@ dav_svn__get_mergeinfo_report(const dav_
           const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
           if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
             return derr;
-          target = svn_path_join(resource->info->repos_path, rel_path,
-                                 resource->pool);
+
+          /* Force REL_PATH to be a relative path, not an fspath. */
+          rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+          /* Append the REL_PATH to the base FS path to get an
+             absolute repository path. */
+          target = svn_fspath__join(resource->info->repos_path, rel_path,
+                                    resource->pool);
           (*((const char **)(apr_array_push(paths)))) = target;
         }
       else if (strcmp(child->name, SVN_DAV__VALIDATE_INHERITED) == 0)

Modified: subversion/trunk/subversion/mod_dav_svn/reports/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/update.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/update.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/update.c Fri Feb  4 14:09:06 2011
@@ -38,6 +38,7 @@
 #include "svn_path.h"
 #include "svn_dav.h"
 #include "svn_props.h"
+
 #include "private/svn_log.h"
 #include "private/svn_fspath.h"
 
@@ -155,7 +156,7 @@ get_from_path_map(apr_hash_t *hash, cons
           /* we found a mapping ... but of one of PATH's parents.
              soooo, we get to re-append the chunks of PATH that we
              broke off to the REPOS_PATH we found. */
-          return svn_path_join(repos_path, path + my_path->len + 1, pool);
+          return svn_fspath__join(repos_path, path + my_path->len + 1, pool);
         }
     }
   while (! svn_path_is_empty(my_path->data)
@@ -316,12 +317,16 @@ add_helper(svn_boolean_t is_dir,
                                       DAV_SVN__BUILD_URI_BC,
                                       revision, real_path,
                                       0 /* add_href */, pool);
+          bc_url = svn_urlpath__canonicalize(bc_url, pool);
 
           /* ugh, build_uri ignores the path and just builds the root
              of the baseline collection.  we have to tack the
              real_path on manually, ignoring its leading slash. */
           if (real_path && (! svn_path_is_empty(real_path)))
-            bc_url = svn_path_url_add_component(bc_url, real_path+1, pool);
+            bc_url = svn_urlpath__join(bc_url,
+                                       svn_path_uri_encode(real_path + 1,
+                                                           pool),
+                                       pool);
 
           /* make sure that the BC_URL is xml attribute safe. */
           bc_url = apr_xml_quote_string(pool, bc_url, 1);
@@ -1069,14 +1074,14 @@ dav_svn__update_report(const dav_resourc
         {
           /* if the src is split into anchor/target, so must the
              telescoping dst_path be. */
-          uc.dst_path = svn_path_dirname(dst_path, resource->pool);
+          uc.dst_path = svn_fspath__dirname(dst_path, resource->pool);
 
           /* Also, the svn_repos_dir_delta2() is going to preserve our
              target's name, so we need a pathmap entry for that. */
           if (! uc.pathmap)
             uc.pathmap = apr_hash_make(resource->pool);
           add_to_path_map(uc.pathmap,
-                          svn_path_join(src_path, target, resource->pool),
+                          svn_fspath__join(src_path, target, resource->pool),
                           dst_path);
         }
       else
@@ -1240,8 +1245,8 @@ dav_svn__update_report(const dav_resourc
                 const char *this_path;
                 if (! uc.pathmap)
                   uc.pathmap = apr_hash_make(resource->pool);
-                this_path = svn_path_join_many(apr_hash_pool_get(uc.pathmap),
-                                               src_path, target, path, NULL);
+                this_path = svn_fspath__join(src_path, target, resource->pool);
+                this_path = svn_fspath__join(this_path, path, resource->pool);
                 add_to_path_map(uc.pathmap, this_path, linkpath);
               }
           }
@@ -1268,7 +1273,7 @@ dav_svn__update_report(const dav_resourc
     const char *action, *spath;
 
     if (target)
-      spath = svn_path_join(src_path, target, resource->pool);
+      spath = svn_fspath__join(src_path, target, resource->pool);
     else
       spath = src_path;
 

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Fri Feb  4 14:09:06 2011
@@ -2289,9 +2289,13 @@ get_resource(request_rec *r,
 }
 
 
-/* Helper func:  return the parent of PATH, allocated in POOL. */
+/* Helper func:  return the parent of PATH, allocated in POOL.  If
+   IS_URLPATH is set, PATH is a urlpath; otherwise, it's either a
+   relpath or an fspath. */
 static const char *
-get_parent_path(const char *path, apr_pool_t *pool)
+get_parent_path(const char *path,
+                svn_boolean_t is_urlpath,
+                apr_pool_t *pool)
 {
   apr_size_t len;
   char *tmp = apr_pstrdup(pool, path);
@@ -2303,8 +2307,11 @@ get_parent_path(const char *path, apr_po
       /* Remove any trailing slash; else svn_path_dirname() asserts. */
       if (tmp[len-1] == '/')
         tmp[len-1] = '\0';
-
-      return svn_path_dirname(tmp, pool);
+     
+      if (is_urlpath)
+        return svn_urlpath__dirname(tmp, pool);
+      else
+        return svn_fspath__dirname(tmp, pool);
     }
 
   return path;
@@ -2340,19 +2347,20 @@ get_parent_resource(const dav_resource *
       parent->versioned = 1;
       parent->hooks = resource->hooks;
       parent->pool = resource->pool;
-      parent->uri = get_parent_path(resource->uri, resource->pool);
+      parent->uri = get_parent_path(resource->uri, TRUE, resource->pool);
       parent->info = parentinfo;
 
       parentinfo->pool = resource->info->pool;
       parentinfo->uri_path =
         svn_stringbuf_create(get_parent_path(resource->info->uri_path->data,
-                                             resource->pool), resource->pool);
+                                             TRUE, resource->pool),
+                             resource->pool);
       parentinfo->repos = resource->info->repos;
       parentinfo->root = resource->info->root;
       parentinfo->r = resource->info->r;
       parentinfo->svn_client_options = resource->info->svn_client_options;
       parentinfo->repos_path = get_parent_path(resource->info->repos_path,
-                                               resource->pool);
+                                               FALSE, resource->pool);
 
       *parent_resource = parent;
       break;
@@ -3316,8 +3324,8 @@ deliver(const dav_resource *resource, ap
              looking at a parent-path listing. */
           if (SVN_IS_VALID_REVNUM(dir_rev))
             {
-              repos_relpath = svn_path_join(resource->info->repos_path,
-                                            name, entry_pool);
+              repos_relpath = svn_fspath__join(resource->info->repos_path,
+                                               name, entry_pool);
               if (! dav_svn__allow_read(resource->info->r,
                                         resource->info->repos,
                                         repos_relpath,

Modified: subversion/trunk/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/util.c?rev=1067180&r1=1067179&r2=1067180&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/util.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/util.c Fri Feb  4 14:09:06 2011
@@ -36,7 +36,7 @@
 #include "svn_base64.h"
 
 #include "dav_svn.h"
-
+#include "private/svn_fspath.h"
 
 dav_error *
 dav_svn__new_error(apr_pool_t *pool,
@@ -489,9 +489,15 @@ dav_svn__brigade_printf(apr_bucket_briga
 dav_error *
 dav_svn__test_canonical(const char *path, apr_pool_t *pool)
 {
-  if (svn_path_is_canonical(path, pool))
+  if (path[0] == '\0')
     return NULL;
-
+  if (svn_path_is_url(path) && svn_uri_is_canonical(path, pool))
+    return NULL;
+  if ((path[0] == '/') && svn_fspath__is_canonical(path))
+    return NULL;
+  if (svn_relpath_is_canonical(path, pool))
+    return NULL;
+      
   /* Otherwise, generate a generic HTTP_BAD_REQUEST error. */
   return dav_svn__new_error_tag
     (pool, HTTP_BAD_REQUEST, 0,



Mime
View raw message