diff options
author | 2010-02-18 19:20:46 +0530 | |
---|---|---|
committer | 2010-02-18 19:20:46 +0530 | |
commit | 1de9e963f0abf9d971689a88c6c646481a57b61a (patch) | |
tree | 45f8fd71aa41f4d5ee04f3bb019dccb90dda2b29 | |
parent | Merge branch 'teemu/topic/expand_all_repos' into pu (diff) | |
download | gitolite-gentoo-1de9e963f0abf9d971689a88c6c646481a57b61a.tar.gz gitolite-gentoo-1de9e963f0abf9d971689a88c6c646481a57b61a.tar.bz2 gitolite-gentoo-1de9e963f0abf9d971689a88c6c646481a57b61a.zip |
auth: behave better when no argument supplied to wild commands
expand gets a default '.*' argument
others die with an error message
-rwxr-xr-x | src/gl-auth-command | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gl-auth-command b/src/gl-auth-command index f7f415a..db16113 100755 --- a/src/gl-auth-command +++ b/src/gl-auth-command @@ -103,7 +103,7 @@ unless ($ENV{SSH_ORIGINAL_COMMAND}) { # get and set perms for actual repo created by wildcard-autoviv # ---------------------------------------------------------------------------- -my $CUSTOM_COMMANDS=qr/^\s*(expand|(get|set)(perms|desc))\s/; +my $CUSTOM_COMMANDS=qr/^\s*(expand|(get|set)(perms|desc))\b/; # note that all the subs called here chdir somewhere else and do not come # back; they all blithely take advantage of the fact that processing custom @@ -112,7 +112,9 @@ my $CUSTOM_COMMANDS=qr/^\s*(expand|(get|set)(perms|desc))\s/; if ($ENV{SSH_ORIGINAL_COMMAND} =~ $CUSTOM_COMMANDS) { die "wildrepos disabled, sorry\n" unless $GL_WILDREPOS; my $cmd = $ENV{SSH_ORIGINAL_COMMAND}; - my ($verb, $repo) = ($cmd =~ /^\s*(\S+)\s+\/?(.*?)(?:.git)?$/); + my ($verb, $repo) = ($cmd =~ /^\s*(\S+)(?:\s+\/?(.*?)(?:.git)?)?$/); + # deal with "no argument" cases + $verb eq 'expand' ? $repo = '.*' : die "$verb needs an argument\n" unless $repo; if ($repo =~ $REPONAME_PATT and $verb =~ /getperms|setperms/) { # with an actual reponame, you can "getperms" or "setperms" get_set_perms($repo_base_abs, $repo, $verb, $user); |