sshserver.pl: tidy up around AllowUsers setup

- drop redundant space-to-`?` replacement.
- add parentheses to silence code checker.
- tidy up comments.

Follow-up to e53523fef0 #14859

Closes #21442
This commit is contained in:
Viktor Szakats 2026-04-24 22:49:10 +02:00
parent f9d3f00c98
commit 4449110561
No known key found for this signature in database

View file

@ -588,15 +588,14 @@ push @cfgarr, "# $sshdverstr sshd configuration file for curl testing";
push @cfgarr, '#';
# AllowUsers and DenyUsers options should use lowercase on Windows
# and do not support quotes around values for some unknown reason.
# and do not support quotes around values for an unknown reason.
if($sshdid =~ /OpenSSH-Windows/) {
my $username_lc = lc $username;
push @cfgarr, "AllowUsers " . $username_lc =~ s/ /\?/gr;
push @cfgarr, "AllowUsers " . ($username_lc =~ s/ /\?/gr); # replace space with '?'
if(exists $ENV{USERDOMAIN}) {
my $userdomain_lc = lc $ENV{USERDOMAIN};
$username_lc = "$userdomain_lc\\$username_lc";
$username_lc =~ s/ /\?/g; # replace space with ?
push @cfgarr, "AllowUsers " . $username_lc =~ s/ /\?/gr;
push @cfgarr, "AllowUsers " . ($username_lc =~ s/ /\?/gr); # replace space with '?'
}
} else {
push @cfgarr, "AllowUsers $username";