summaryrefslogtreecommitdiff
path: root/git-daemon
diff options
context:
space:
mode:
authorTony Finch <dot@dotat.at>2010-03-30 14:58:15 +0000
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>2010-05-22 15:54:41 +0100
commit11f72b3fe66969b26652050089fa778ca3c474d4 (patch)
tree7da5a758c3939c81ac1afd41f4c750734ade2495 /git-daemon
parent6fe98f4a5ae10ba602534559e8685e7979f12be3 (diff)
downloaduserv-utils-11f72b3fe66969b26652050089fa778ca3c474d4.tar.gz
git-daemon: allow userv to decide which services to allow.
Diffstat (limited to 'git-daemon')
-rwxr-xr-xgit-daemon/git-daemon.pl9
1 files changed, 5 insertions, 4 deletions
diff --git a/git-daemon/git-daemon.pl b/git-daemon/git-daemon.pl
index 8e15517..1cd36a4 100755
--- a/git-daemon/git-daemon.pl
+++ b/git-daemon/git-daemon.pl
@@ -59,11 +59,11 @@ sub xread {
my $len_hex = xread 4;
fail "non-hex packet length" unless $len_hex =~ m{^[0-9a-fA-F]{4}$};
my $line = xread hex $len_hex;
-unless ($line =~ m{^git-upload-pack ([!-~]+)\0host=([!-~]+)\0$}) {
+unless ($line =~ m{^(git-[a-z-]+) ([!-~]+)\0host=([!-~]+)\0$}) {
$line =~ s/[^ -~]+/ /g;
fail "could not parse \"$line\""
}
-my ($path,$host) = ($1,$2);
+my ($service,$path,$host) = ($1,$2,3);
$path =~ s|^/||;
$_ = my $uri = "git://$host/$path";
@@ -72,6 +72,7 @@ fail "no user configured for $uri" unless defined $user;
syslog 'info', "$client userv $user git-upload-pack $uri";
my %vars = (
+ REQUEST_SERVICE => $service,
REQUEST_HOST => $host,
REQUEST_PATH => $path,
REQUEST_URI => $uri,
@@ -83,7 +84,7 @@ my %vars = (
my @opts = map "-D$_=$vars{$_}", grep defined $vars{$_}, sort keys %vars;
no warnings; # suppress errors to stderr
-exec 'userv', @opts, $user, 'git-upload-pack'
- or fail "exec userv @opts $user git-upload-pack: $!";
+exec 'userv', @opts, $user, $service
+ or fail "exec userv @opts $user $service: $!";
# end