tool_getparam: fix --ftp-pasv

This boolean option was moved to the wrong handling function. Make it
an ARG_NONE and move it to the correct handler and add a test to
verify that the option works.

Follow-up to 698491f44

Reported-by: fjaell on github
Fixes #17545
Closes #17547
This commit is contained in:
Dan Fandrich 2025-06-06 10:21:09 -07:00
parent 900612df79
commit 5f805eec11
4 changed files with 66 additions and 6 deletions

View file

@ -153,7 +153,7 @@ static const struct LongShort aliases[]= {
{"ftp-alternative-to-user", ARG_STRG, ' ', C_FTP_ALTERNATIVE_TO_USER},
{"ftp-create-dirs", ARG_BOOL, ' ', C_FTP_CREATE_DIRS},
{"ftp-method", ARG_STRG, ' ', C_FTP_METHOD},
{"ftp-pasv", ARG_BOOL, ' ', C_FTP_PASV},
{"ftp-pasv", ARG_NONE, ' ', C_FTP_PASV},
{"ftp-port", ARG_STRG, 'P', C_FTP_PORT},
{"ftp-pret", ARG_BOOL, ' ', C_FTP_PRET},
{"ftp-skip-pasv-ip", ARG_BOOL, ' ', C_FTP_SKIP_PASV_IP},
@ -1703,6 +1703,9 @@ static ParameterError opt_none(struct GlobalConfig *global,
break;
case C_DUMP_CA_EMBED: /* --dump-ca-embed */
return PARAM_CA_EMBED_REQUESTED;
case C_FTP_PASV: /* --ftp-pasv */
tool_safefree(config->ftpport);
break;
case C_HTTP1_0: /* --http1.0 */
/* HTTP version 1.0 */
@ -2293,9 +2296,6 @@ static ParameterError opt_filestring(struct GlobalConfig *global,
case C_URL: /* --url */
err = parse_url(global, config, nextarg);
break;
case C_FTP_PASV: /* --ftp-pasv */
tool_safefree(config->ftpport);
break;
case C_SOCKS5: /* --socks5 */
/* socks5 proxy to use, and resolves the name locally and passes on the
resolved address */