You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Glasser <gl...@davidglasser.net> on 2008/07/24 22:32:05 UTC
super-lightweight virtual host support for svnserve
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?
--dave
--
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: super-lightweight virtual host support for svnserve
Posted by Eric Gillespie <ep...@pretzelnet.org>.
David Glasser <gl...@davidglasser.net> writes:
> > Seem worthwhile?
Yeah, simple and useful. I like it.
> 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.)
Hmm. Where would you document this? I think you should just
disallow the '.'.
--
Eric Gillespie <*> epg@pretzelnet.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: super-lightweight virtual host support for svnserve
Posted by David Glasser <gl...@davidglasser.net>.
On Thu, Jul 24, 2008 at 3:32 PM, David Glasser <gl...@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/