managen: strict protocol check

- protocols MUST match one in the accept-list
- protocols are typically all uppercase
- drop All
- use SCP and SFTP instead of SSH
- add Protocols: to some options previously missing one

Closes #18675
This commit is contained in:
Daniel Stenberg 2025-09-22 08:33:20 +02:00
parent c4f9977c66
commit 1f0f0bdb19
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
17 changed files with 45 additions and 8 deletions

View file

@ -241,8 +241,38 @@ sub overrides {
}
}
my %protexists = (
'DNS' => 1,
'FILE' => 1,
'FTP' => 1,
'FTPS' => 1,
'GSS/kerberos' => 1,
'HTTP' => 1,
'HTTPS' => 1,
'IMAP' => 1,
'IPFS' => 1,
'LDAP' => 1,
'MQTT' => 1,
'POP3' => 1,
'SCP' => 1,
'SFTP' => 1,
'SMTP' => 1,
'SSL' => 2, # deprecated
'TELNET' => 1,
'TFTP' => 1,
'TLS' => 1,
);
sub protocols {
my ($manpage, $standalone, $data)=@_;
my ($f, $line, $manpage, $standalone, $data)=@_;
my @e = split(/ +/, $data);
for my $pr (@e) {
if(!$protexists{$pr}) {
print STDERR "$f:$line:1:ERROR: unrecognized protocol: $pr\n";
exit 2;
}
}
if($standalone) {
return ".SH \"PROTOCOLS\"\n$data\n";
}
@ -716,7 +746,7 @@ sub single {
}
my @leading;
if($protocols) {
push @leading, protocols($manpage, $standalone, $protocols);
push @leading, protocols($f, $line, $manpage, $standalone, $protocols);
}
if($standalone) {