Merge pull request #63 from Alkorin/allowGroupWithDot

fix: Allow dot in group name as it is allowed in account
This commit is contained in:
Stéphane Lesimple 2020-11-23 19:14:53 +01:00 committed by GitHub
commit 81194268e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -561,7 +561,7 @@ sub is_valid_group {
elsif ($group =~ /^(key)?(private|root|user|self|legacy|osh)(-(gatekeeper|aclkeeper|owner))?$/) {
return R('KO_FORBIDDEN_NAME', msg => 'Forbidden group name');
}
elsif ($group =~ m/^([a-zA-Z0-9_-]+)$/) {
elsif ($group =~ m/^([a-zA-Z0-9._-]+)$/) {
$group = $1; # untainted
if ($groupType eq 'key' and $group !~ m/^key/) {
return R('KO_MISSING_PREFIX', msg => "The group $group should have a prefix (group type $groupType)");
@ -968,7 +968,7 @@ sub get_remote_accounts_from_realm {
my %accounts;
if (opendir(my $dh, "/home/allowkeeper/$sysaccount")) {
while (my $filename = readdir($dh)) {
next if $filename !~ /allowed_([a-zA-Z0-9_-]+)\./;
next if $filename !~ /allowed_([a-zA-Z0-9._-]+)\.(ip|partial|private)/;
$accounts{$1} = 1;
}
closedir($dh);

View file

@ -49,7 +49,7 @@ fi
# those vars are also used in all our modules
# shellcheck disable=SC2034
{
account1="testu_Ser1-"
account1="testu_Ser.1-"
account2="tesT-user2_"
account3=teStuser3
account4=TeStUsEr4