subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bre...@apache.org
Subject svn commit: r1537812 - in /subversion/trunk: subversion/mod_dav_svn/mod_dav_svn.c subversion/mod_dav_svn/repos.c tools/server-side/mod_dontdothat/mod_dontdothat.c
Date Fri, 01 Nov 2013 03:19:32 GMT
Author: breser
Date: Fri Nov  1 03:19:30 2013
New Revision: 1537812

URL: http://svn.apache.org/r1537812
Log:
Alter dav_svn_split_uri() so repos_path are fspaths with a leading slash.

This effectively reverts r1537700, but this solution can't be backported
since it may break users of dav_svn_split_uri() that assume it does not
provide paths with leading slashes.  mod_dontdothat made this assumption
so it's not unlikely if someone has written a 3rd party module for httpd
that it does so as well.

While the repos_path will have a leading slash it still isn't necessarily
canonical.

* subversion/mod_dav_svn/repos.c
  (dav_svn_split_uri): When copying into the repos_path step back one
    character to include the slash.

* subversion/mod_dav_svn/mod_dav_svn.c
  (dav_svn__translate_name): Revert r1537700 changes to this function.

* tools/server-side/mod_dontdothat/mod_dontdothat.c
  (is_this_legal): Canonicalize the path instead of just assuming that
    taking a leading slash is what is needed.

Modified:
    subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
    subversion/trunk/subversion/mod_dav_svn/repos.c
    subversion/trunk/tools/server-side/mod_dontdothat/mod_dontdothat.c

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=1537812&r1=1537811&r2=1537812&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c Fri Nov  1 03:19:30 2013
@@ -1100,7 +1100,7 @@ static int dav_svn__handler(request_rec 
  * that %f in logging formats will show as "svn:/path/to/repo/path/in/repo". */
 static int dav_svn__translate_name(request_rec *r)
 {
-  const char *fs_path, *repos_basename, *repos_path, *slash;
+  const char *fs_path, *repos_basename, *repos_path;
   const char *ignore_cleaned_uri, *ignore_relative_path;
   int ignore_had_slash;
   dav_error *err;
@@ -1128,17 +1128,9 @@ static int dav_svn__translate_name(reque
       fs_path = conf->fs_path;
     }
 
-  /* Avoid a trailing slash on the bogus path when repos_path is just "/" and
-   * ensure that there is always a slash between fs_path and repos_path as
-   * long as the repos_path is not an empty path. */
-  slash = "";
-  if (repos_path)
-    {
-      if ('/' == repos_path[0] && '\0' == repos_path[1])
-        repos_path = NULL;
-      else if ('/' != repos_path[0] && '\0' != repos_path[0])
-        slash = "/";
-    }
+  /* Avoid a trailing slash on the bogus path when repos_path is just "/" */
+  if (repos_path && '/' == repos_path[0] && '\0' == repos_path[1])
+    repos_path = NULL;
 
   /* Combine 'svn:', fs_path and repos_path to produce the bogus path we're
    * placing in r->filename.  We can't use our standard join helpers such
@@ -1148,7 +1140,7 @@ static int dav_svn__translate_name(reque
    * repository is 'trunk/c:hi' this results in a non canonical dirent on
    * Windows. Instead we just cat them together. */
   r->filename = apr_pstrcat(r->pool,
-                            "svn:", fs_path, slash, repos_path, SVN_VA_NULL);
+                            "svn:", fs_path, repos_path, SVN_VA_NULL);
 
   /* Leave a note to ourselves so that we know not to decline in the
    * map_to_storage hook. */

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1537812&r1=1537811&r2=1537812&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Fri Nov  1 03:19:30 2013
@@ -1413,7 +1413,7 @@ dav_svn_split_uri(request_rec *r,
                         else
                           {
                             /* Found a slash after the special components. */
-                            *repos_path = apr_pstrdup(r->pool, start);
+                            *repos_path = apr_pstrdup(r->pool, start - 1);
                           }
                       }
                     else
@@ -1439,7 +1439,7 @@ dav_svn_split_uri(request_rec *r,
       {
         /* There's no "!svn/" at all, so the relative path is already
            a valid path within the repository.  */
-        *repos_path = apr_pstrdup(r->pool, relative);
+        *repos_path = apr_pstrdup(r->pool, relative - 1);
       }
   }
 

Modified: subversion/trunk/tools/server-side/mod_dontdothat/mod_dontdothat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/mod_dontdothat/mod_dontdothat.c?rev=1537812&r1=1537811&r2=1537812&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/mod_dontdothat/mod_dontdothat.c (original)
+++ subversion/trunk/tools/server-side/mod_dontdothat/mod_dontdothat.c Fri Nov  1 03:19:30
2013
@@ -36,6 +36,7 @@
 #include "mod_dav_svn.h"
 #include "svn_string.h"
 #include "svn_config.h"
+#include "private/svn_fspath.h"
 
 module AP_MODULE_DECLARE_DATA dontdothat_module;
 
@@ -194,7 +195,7 @@ is_this_legal(dontdothat_filter_ctx *ctx
           if (! repos_path)
             repos_path = "";
 
-          repos_path = apr_psprintf(ctx->r->pool, "/%s", repos_path);
+          repos_path = svn_fspath__canonicalize(repos_path, ctx->r->pool);
 
           /* First check the special cases that are always legal... */
           for (idx = 0; idx < ctx->allow_recursive_ops->nelts; ++idx)



Mime
View raw message