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

@ -5,6 +5,7 @@ Long: doh-cert-status
Help: Verify DoH server cert status OCSP-staple
Added: 7.76.0
Category: dns tls
Protocols: DNS
Multi: boolean
See-also:
- doh-insecure

View file

@ -5,6 +5,7 @@ Long: doh-insecure
Help: Allow insecure DoH server connections
Added: 7.76.0
Category: dns tls
Protocols: DNS
Multi: boolean
See-also:
- doh-url

View file

@ -6,6 +6,7 @@ Arg: <URL>
Help: Resolve hostnames over DoH
Added: 7.62.0
Category: dns
Protocols: DNS
Multi: single
See-also:
- doh-insecure

View file

@ -4,6 +4,7 @@ SPDX-License-Identifier: curl
Long: follow
Help: Follow redirects per spec
Category: http
Protocols: HTTP
Added: 8.16.0
Multi: boolean
See-also:

View file

@ -3,7 +3,7 @@ c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Long: form-escape
Help: Escape form fields using backslash
Protocols: HTTP imap smtp
Protocols: HTTP IMAP SMTP
Added: 7.81.0
Category: http upload post
Multi: single

View file

@ -6,7 +6,6 @@ Arg: <string>
Help: Set IP Type of Service or Traffic Class
Added: 8.9.0
Category: connection
Protocols: All
Multi: single
See-also:
- tcp-nodelay

View file

@ -3,7 +3,7 @@ c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Long: key
Arg: <key>
Protocols: TLS SSH
Protocols: TLS SCP SFTP
Help: Private key filename
Category: tls ssh
Added: 7.9.3

View file

@ -4,7 +4,7 @@ SPDX-License-Identifier: curl
Long: pass
Arg: <phrase>
Help: Passphrase for the private key
Protocols: SSH TLS
Protocols: TLS SCP SFTP
Category: ssh tls auth
Added: 7.9.3
Multi: single

View file

@ -4,6 +4,7 @@ SPDX-License-Identifier: curl
Long: sasl-authzid
Arg: <identity>
Help: Identity for SASL PLAIN authentication
Protocols: LDAP IMAP POP3 SMTP
Added: 7.66.0
Category: auth
Multi: single

View file

@ -3,6 +3,7 @@ c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Long: sasl-ir
Help: Initial response in SASL authentication
Protocols: LDAP IMAP POP3 SMTP
Added: 7.31.0
Category: auth
Multi: boolean

View file

@ -5,6 +5,7 @@ Long: socks5-gssapi-nec
Help: Compatibility with NEC SOCKS5 server
Added: 7.19.4
Category: proxy auth
Protocols: GSS/kerberos
Multi: boolean
See-also:
- socks5

View file

@ -5,6 +5,7 @@ Long: socks5-gssapi
Help: Enable GSS-API auth for SOCKS5 proxies
Added: 7.55.0
Category: proxy auth
Protocols: GSS/kerberos
Multi: boolean
See-also:
- socks5

View file

@ -6,6 +6,7 @@ Short: t
Arg: <opt=val>
Help: Set telnet option
Category: telnet
Protocols: TELNET
Added: 7.7
Multi: append
See-also:

View file

@ -4,6 +4,7 @@ SPDX-License-Identifier: curl
Long: upload-flags
Arg: <flags>
Help: IMAP upload behavior
Protocols: IMAP
Category: curl output
Added: 8.13.0
Multi: single

View file

@ -4,7 +4,6 @@ SPDX-License-Identifier: curl
Long: url-query
Arg: <data>
Help: Add a URL query part
Protocols: all
Added: 7.87.0
Category: http post upload
Multi: append

View file

@ -6,7 +6,6 @@ Arg: <priority>
Help: Set VLAN priority
Added: 8.9.0
Category: connection
Protocols: All
Multi: single
See-also:
- ip-tos

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) {