Skip to content

Commit

Permalink
Merge pull request #227 from stephdl/protectAllowGroups
Browse files Browse the repository at this point in the history
AllowGroups must be an object NethServer/dev#6075
  • Loading branch information
stephdl committed Mar 2, 2020
2 parents b4ee2cd + 16b3fa3 commit dabd5fb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions api/system-openssh/update
Expand Up @@ -42,15 +42,16 @@ foreach my $prop (qw(
}

my $AllowGroups = '';
foreach my $g (keys $data->{'props'}{'AllowGroups'} ) {
if ($data->{'props'}{'AllowGroups'}{$g} eq 'ssh') {
my $obj = $data->{'props'}{'AllowGroups'} || {};
foreach my $g (keys $obj) {
if ($obj->{$g} eq 'ssh') {
$AllowGroups .= "$g,";
} elsif ($data->{'props'}{'AllowGroups'}{$g} eq 'sftp') {
} elsif ($obj->{$g} eq 'sftp') {
$AllowGroups .= "$g:sftp,";
}
}
}
chop $AllowGroups;
$cdb->set_prop('sshd', 'AllowGroups', $AllowGroups);
$cdb->set_prop('sshd', 'AllowGroups', $AllowGroups) if(ref($data->{'props'}{'AllowGroups'}) eq 'HASH');

esmith::event::set_json_log(1);
my $success = esmith::event::event_signal('nethserver-openssh-save');
Expand Down

0 comments on commit dabd5fb

Please sign in to comment.