chiark
/
gitweb
/
~ian
/
userv-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changes to make it appear to work on chiark
[userv-utils.git]
/
git-daemon
/
git-service.in
diff --git
a/git-daemon/git-service.in
b/git-daemon/git-service.in
index 43ff340a70f58335f17ab65c9e48dd8c7d480d49..75e64d57a2ed142cf670e67277cf0fd2d40c210f 100755
(executable)
--- a/
git-daemon/git-service.in
+++ b/
git-daemon/git-service.in
@@
-9,30
+9,33
@@
use strict;
use warnings;
use strict;
use warnings;
+use POSIX;
use Sys::Syslog;
our ($client,$service,$specpath,$spechost,@opts);
${$::{$_}} = $ENV{"USERV_U_$_"}
use Sys::Syslog;
our ($client,$service,$specpath,$spechost,@opts);
${$::{$_}} = $ENV{"USERV_U_$_"}
- for qw(service
path host)
+ for qw(service
specpath spechost client);
-openlog "userv-$service", 'pid', 'daemon';
+openlog "userv-$service
:$ENV{USER}
", 'pid', 'daemon';
sub fail { syslog 'err', "$client @_"; exit }
@@READ_URLMAP@@
sub fail { syslog 'err', "$client @_"; exit }
@@READ_URLMAP@@
-fail "No
mapping for $uri ($ENV{USERV_USER})
" unless defined $serve_user;
+fail "No
user $ENV{USER} mapping for $uri
" unless defined $serve_user;
-$1 = undef;
-fail "Bad subdirectory $serve_dir" unless $serve_dir =~ m/$repo_regexp/o;
-our $dir = $1;
+$serve_dir = "$ENV{HOME}/$serve_dir" unless $serve_dir =~ m|^/|;
-$dir = "$ENV{HOME}/$dir" unless $dir =~ m|^/|;
+fail "Bad subdirectory $serve_repo" unless $serve_repo =~ m/$repo_regexp/o;
+fail "bad config - repo-regexp does not capture" unless defined $1;
+my $sani_repo= $1;
-$dir = "$dir/$repo" if defined $repo;
-$path = $check_export ? "$dir/git-daemon-export-ok" : $dir;
+my $dir = $serve_dir.(length $sani_repo ? "/$sani_repo" : '');
+
+my $path = $check_export ? "$dir/git-daemon-export-ok" : $dir;
fail "$! $path" unless -e $path;
fail "$! $path" unless -e $path;
-syslog 'notice', "$client $dir";
+
+syslog 'notice', "$client $uri $dir";
@opts = qw( --strict )
if @opts == 0 and $service eq 'git-upload-pack';
@opts = qw( --strict )
if @opts == 0 and $service eq 'git-upload-pack';