merge "allow full email addresses as usernames"
Merge branch 'pu'
This commit is contained in:
commit
38255e4096
4 changed files with 39 additions and 12 deletions
|
@ -24,9 +24,9 @@ $WARN = "\n\t\t***** WARNING *****\n ";
|
|||
$R_COMMANDS=qr/^(git[ -]upload-pack|git[ -]upload-archive)$/;
|
||||
$W_COMMANDS=qr/^git[ -]receive-pack$/;
|
||||
|
||||
# note that REPONAME_PATT allows a "/" also, which USERNAME_PATT doesn't
|
||||
$REPONAME_PATT=qr(^\@?[0-9a-zA-Z][0-9a-zA-Z._/-]*$); # very simple pattern
|
||||
$USERNAME_PATT=qr(^\@?[0-9a-zA-Z][0-9a-zA-Z._-]*$); # very simple pattern
|
||||
# note that REPONAME_PATT allows "/", while USERNAME_PATT allows "@"
|
||||
$REPONAME_PATT=qr(^\@?[0-9a-zA-Z][0-9a-zA-Z._/-]*$); # very simple pattern
|
||||
$USERNAME_PATT=qr(^\@?[0-9a-zA-Z][0-9a-zA-Z._\@-]*$); # very simple pattern
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# convenience subs
|
||||
|
|
|
@ -121,7 +121,7 @@ sub expand_list
|
|||
{
|
||||
# we test with the slightly more relaxed pattern here; we'll catch the
|
||||
# "/" in user name thing later; it doesn't affect security anyway
|
||||
die "$ABRT bad user or repo name $item\n" unless $item =~ $REPONAME_PATT;
|
||||
die "$ABRT bad user or repo name $item\n" unless $item =~ $REPONAME_PATT or $item =~ $USERNAME_PATT;
|
||||
if ($item =~ /^@/) # nested group
|
||||
{
|
||||
die "$ABRT undefined group $item\n" unless $groups{$item};
|
||||
|
@ -174,7 +174,6 @@ sub parse_conf_file
|
|||
# store the members of each group as hash key. Keep track of when
|
||||
# the group was *first* created by using $fragment as the *value*
|
||||
do { $groups{$1}{$_} ||= $fragment } for ( expand_list( split(' ', $2) ) );
|
||||
# again, we take the more "relaxed" pattern
|
||||
die "$ABRT bad group $1\n" unless $1 =~ $REPONAME_PATT;
|
||||
}
|
||||
# repo(s)
|
||||
|
@ -200,7 +199,7 @@ sub parse_conf_file
|
|||
# expand the user list, unless it is just "@all"
|
||||
@users = expand_list ( @users )
|
||||
unless (@users == 1 and $users[0] eq '@all');
|
||||
do { die "$ABRT bad username $_\n" unless $_ =~ $USERNAME_PATT } for @users;
|
||||
do { die "$ABRT bad username $_ PATT is $USERNAME_PATT,\n" unless $_ =~ $USERNAME_PATT } for @users;
|
||||
|
||||
# ok, we can finally populate the %repos hash
|
||||
for my $repo (@repos) # each repo in the current stanza
|
||||
|
@ -408,7 +407,7 @@ for my $pubkey (glob("*"))
|
|||
print STDERR "WARNING: pubkey files should end with \".pub\", ignoring $pubkey\n";
|
||||
next;
|
||||
}
|
||||
my $user = $pubkey; $user =~ s/(\@.+)?\.pub$//;
|
||||
my $user = $pubkey; $user =~ s/(\@[^.]+)?\.pub$//;
|
||||
# lint check 2
|
||||
print STDERR "WARNING: pubkey $pubkey exists but user $user not in config\n"
|
||||
unless $user_list{$user};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue