tool_getparam: add --knownhosts

To allow users to specify a known hosts file that is not the default
one: ~/.ssh/known_hosts

URL: https://github.com/curl/curl/discussions/18784
Closes #18859
This commit is contained in:
Daniel Stenberg 2025-10-05 23:19:13 +02:00
parent 762ce8801b
commit aae18c4bdc
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
11 changed files with 48 additions and 14 deletions

View file

@ -196,6 +196,7 @@ static const struct LongShort aliases[]= {
{"keepalive-time", ARG_STRG, ' ', C_KEEPALIVE_TIME},
{"key", ARG_FILE, ' ', C_KEY},
{"key-type", ARG_STRG|ARG_TLS, ' ', C_KEY_TYPE},
{"knownhosts", ARG_FILE, ' ', C_KNOWNHOSTS},
{"krb", ARG_STRG|ARG_DEPR, ' ', C_KRB},
{"krb4", ARG_STRG|ARG_DEPR, ' ', C_KRB4},
{"libcurl", ARG_STRG, ' ', C_LIBCURL},
@ -2224,6 +2225,9 @@ static ParameterError opt_file(struct OperationConfig *config,
case C_KEY: /* --key */
err = getstr(&config->key, nextarg, DENY_BLANK);
break;
case C_KNOWNHOSTS: /* --knownhosts */
err = getstr(&config->knownhosts, nextarg, DENY_BLANK);
break;
case C_NETRC_FILE: /* --netrc-file */
err = getstr(&config->netrc_file, nextarg, DENY_BLANK);
break;