Skip to content

Commit

Permalink
remove restriction on @ in setup -pk
Browse files Browse the repository at this point in the history
  • Loading branch information
sitaramc committed Feb 28, 2013
1 parent 0458bdf commit 744335d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/Gitolite/Setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,16 @@ sub args {

if ($pubkey) {
$pubkey =~ /\.pub$/ or _die "'$pubkey' name does not end in .pub";
$pubkey =~ /\@/ and _die "'$pubkey' name contains '\@'";
tsh_try("cat $pubkey") or _die "'$pubkey' not a readable file";
tsh_lines() == 1 or _die "'$pubkey' must have exactly one line";
tsh_try("ssh-keygen -l -f $pubkey") or _die "'$pubkey' does not seem to be a valid ssh pubkey file";

$admin = $pubkey;
$admin =~ s(.*/)();
$admin =~ s/\.pub$//;
# next 2 lines duplicated from args() in ssh-authkeys
$admin =~ s(.*/)(); # foo/bar/baz.pub -> baz.pub
$admin =~ s/(\@[^.]+)?\.pub$//; # baz.pub, baz@home.pub -> baz
$pubkey =~ /\@/ and print STDERR "NOTE: the admin username is '$admin'\n";

}

return ( $admin || '', $pubkey || '', $h_only || 0, $argv );
Expand Down

0 comments on commit 744335d

Please sign in to comment.