auth: better message, remove unsightly perl warning on bad command
This commit is contained in:
parent
c66e1ad732
commit
1b9969f3d6
|
@ -5,6 +5,8 @@
|
||||||
# - comments in the normal shell-ish style; no surprises there
|
# - comments in the normal shell-ish style; no surprises there
|
||||||
# - there are no continuation lines of any kind
|
# - there are no continuation lines of any kind
|
||||||
# - user/repo names as simple as possible
|
# - user/repo names as simple as possible
|
||||||
|
# (usernames: only alphanumerics, ".", "_", "-";
|
||||||
|
# reponames: same, plus "/", but not at the start)
|
||||||
|
|
||||||
# objectives, over and above gitosis:
|
# objectives, over and above gitosis:
|
||||||
# - simpler syntax
|
# - simpler syntax
|
||||||
|
|
|
@ -56,11 +56,6 @@ my $user=$ENV{GL_USER}=shift; # there; now that's available everywhere!
|
||||||
my $cmd = $ENV{SSH_ORIGINAL_COMMAND}
|
my $cmd = $ENV{SSH_ORIGINAL_COMMAND}
|
||||||
or die "no SSH_ORIGINAL_COMMAND? I'm not a shell, $user!\n";
|
or die "no SSH_ORIGINAL_COMMAND? I'm not a shell, $user!\n";
|
||||||
|
|
||||||
# this check is largely for comic value if someone tries something outrageous;
|
|
||||||
# $cmd gets split and the pieces examined more thoroughly later anyway
|
|
||||||
die "$cmd??? you're a funny guy...\n"
|
|
||||||
if $cmd =~ /[<>&|;\n]/;
|
|
||||||
|
|
||||||
# split into command and arguments; the pattern allows old style as well as
|
# split into command and arguments; the pattern allows old style as well as
|
||||||
# new style: "git-subcommand arg" or "git subcommand arg", just like gitosis
|
# new style: "git-subcommand arg" or "git subcommand arg", just like gitosis
|
||||||
# does, although I'm not sure how necessary that is
|
# does, although I'm not sure how necessary that is
|
||||||
|
@ -70,9 +65,10 @@ die "$cmd??? you're a funny guy...\n"
|
||||||
# including the single quotes
|
# including the single quotes
|
||||||
|
|
||||||
my ($verb, $repo) = ($cmd =~ /^\s*(git\s+\S+|\S+)\s+'\/?(.*).git'/);
|
my ($verb, $repo) = ($cmd =~ /^\s*(git\s+\S+|\S+)\s+'\/?(.*).git'/);
|
||||||
die "Sorry, I don't like the command you gave me: $cmd\n"
|
die "bad command: $cmd. Make sure the repo name is exactly\n" .
|
||||||
unless ( ( $verb =~ $R_COMMANDS or $verb =~ $W_COMMANDS )
|
"as in your config (no extra stuff before the name), plus a \".git\" at the end\n"
|
||||||
and $repo =~ $REPONAME_PATT );
|
unless ( $verb and ( $verb =~ $R_COMMANDS or $verb =~ $W_COMMANDS )
|
||||||
|
and $repo and $repo =~ $REPONAME_PATT );
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# first level permissions check
|
# first level permissions check
|
||||||
|
|
Loading…
Reference in a new issue