Bug reproduced on Debian GNU/Linux 9 with trunk version as of
revision 1824204, building with default options.

When operating svnserve in virtual host mode (--virtual-host),
any attempt to access a repository through a URL that includes
a user name will fail:

$ mkdir -p /tmp/repos/localhost
$ svnadmin create /tmp/repos/localhost/Dev
$ svnserve -r /tmp/repos -d --virtual-host
$ svn ls svn://localhost/Dev
<works, returning empty result>
$ svn ls svn://foo@localhost/Dev
svn: E170013: Unable to connect to a repository at URL 'svn://foo@localhost/Dev'
svn: E210005: No repository found in 'svn://foo@localhost/Dev'

The reason for this is that svnserve will in this case include
the user name in the repository path, which can be shown
as follows:

$ ln -s localhost /tmp/repos/foo@localhost
$ svn ls svn://foo@localhost/Dev
<now works>
$ svn ls svn://bar@localhost/Dev
svn: E170013: Unable to connect to a repository at URL 'svn://bar@localhost/Dev'
svn: E210005: No repository found in 'svn://bar@localhost/Dev'

A simple fix is attached.

-- 
Thomas Quinot, Ph.D. ** qui...@adacore.com ** IT Lead Engineer
               AdaCore -- Paris, France -- New York, USA
[[[
Fix failure to find repo in virtual host mode if user name present

* subversion/svnserve/serve.c
  (find_repos): In vhost mode, skip past user name and password,
  if present.
]]]

Index: subversion/svnserve/serve.c
===================================================================
--- subversion/svnserve/serve.c	(revision 1824204)
+++ subversion/svnserve/serve.c	(working copy)
@@ -3806,12 +3806,21 @@ find_repos(const char *url,
     return svn_error_createf(SVN_ERR_BAD_URL, NULL,
                              "Non-svn URL passed to svn server: '%s'", url);
 
-  if (! vhost)
+  /* In virtual host mode, skip past any USER[:PASSWORD]@ part,
+     else skip past [USER[:PASSWORD]@]HOST/. */
+  if (vhost)
     {
+      const char *h_path = strchr(path, '@');
+      if (h_path != NULL)
+        path = h_path + 1;
+    }
+  else
+    {
       path = strchr(path, '/');
       if (path == NULL)
         path = "";
     }
+
   path = svn_relpath_canonicalize(path, scratch_pool);
   path = svn_path_uri_decode(path, scratch_pool);
 

Reply via email to