chiark
/
gitweb
/
~mdw
/
userv-utils
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6fe98f4
)
git-daemon: allow userv to decide which services to allow.
author
Tony Finch
<dot@dotat.at>
Tue, 30 Mar 2010 14:58:15 +0000
(14:58 +0000)
committer
Ian Jackson
<ian@liberator.relativity.greenend.org.uk>
Sat, 22 May 2010 14:54:41 +0000
(15:54 +0100)
git-daemon/git-daemon.pl
patch
|
blob
|
blame
|
history
diff --git
a/git-daemon/git-daemon.pl
b/git-daemon/git-daemon.pl
index 8e15517e041d46180fc7a8efdabe28891bc12b9e..1cd36a41187da077d18de7128524ee5745cc740b 100755
(executable)
--- 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;
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\""
}
$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";
$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 = (
syslog 'info', "$client userv $user git-upload-pack $uri";
my %vars = (
+ REQUEST_SERVICE => $service,
REQUEST_HOST => $host,
REQUEST_PATH => $path,
REQUEST_URI => $uri,
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
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
# end