[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: super-lightweight virtual host support for svnserve

From: David Glasser <glasser_at_davidglasser.net>
Date: Thu, 24 Jul 2008 16:02:00 -0700

On Thu, Jul 24, 2008 at 3:32 PM, David Glasser <glasser_at_davidglasser.net> wrote:
> Quick idea: super-lightweight virtual host support for svnserve.
>
> Currently, subversion/svnserve/serve.c(find_repos) just skips over the
> given hostname.
>
> Proposal: if you run
>
> $ svnserve -r /svn-servers --virtual-host
>
> then svn://my.server.org/some/repo looks for a repo at
> /svn-servers/my.server.org/some/repo. You perhaps would fill your -r
> path with symlinks.
>
> The hostname would not contain slashes by definition and would be
> explicitly checked to make sure it isn't "." or "..".
>
> I suspect the patch comes in at under 30 lines, mostly command-line processing.
>
> Seem worthwhile?

Patch attached. Note that I don't check for "." so a crafty client
could see repositories that you put directly in the -r directory; I
don't think this is a big deal. (But it can't escape from the -r
directory.)

[[[
Add a lightweight --virtual-host feature to svnserve; if specified,
the provided hostname is used as part of the path to the repository.

* subversion/svnserve/serve.c
  (find_repos): Only skip host if vhost is not set.
  (serve): Copy vhost from server params to server baton.

* subversion/svnserve/main.c
  (SVNSERVE_OPT_VIRTUAL_HOST): New.
  (svnserve__options): Add "virtual-host" option.
  (main): Parse --virtual-host.

* subversion/svnserve/server.h
  (server_baton_t): Add vhost field.
  (serve_params_t): Add vhost field.
]]]

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-07-25 01:02:18 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.