1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-10 13:38:04 -05:00

curl: only warn not fail, if not finding the home dir

... as there's no good reason to error out completely.

Reported-by: Andreas Fischer
Fixes #6200
Closes #6201
This commit is contained in:
Daniel Stenberg 2020-11-13 00:37:21 +01:00
parent 71ec4e7d76
commit 0362944a2e
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1711,30 +1711,25 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(config->path_as_is) if(config->path_as_is)
my_setopt(curl, CURLOPT_PATH_AS_IS, 1L); my_setopt(curl, CURLOPT_PATH_AS_IS, 1L);
if(built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) { if((built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) &&
if(!config->insecure_ok) { !config->insecure_ok) {
char *home; char *home = homedir(NULL);
char *file; if(home) {
result = CURLE_FAILED_INIT; char *file = aprintf("%s/.ssh/known_hosts", home);
home = homedir(NULL); if(file) {
if(home) { /* new in curl 7.19.6 */
file = aprintf("%s/.ssh/known_hosts", home); result = res_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file);
if(file) { curl_free(file);
/* new in curl 7.19.6 */ if(result == CURLE_UNKNOWN_OPTION)
result = res_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file); /* libssh2 version older than 1.1.1 */
curl_free(file); result = CURLE_OK;
if(result == CURLE_UNKNOWN_OPTION)
/* libssh2 version older than 1.1.1 */
result = CURLE_OK;
}
Curl_safefree(home);
}
else {
errorf(global, "Failed to figure out user's home dir!");
} }
Curl_safefree(home);
if(result) if(result)
break; break;
} }
else
warnf(global, "No home dir, couldn't find known_hosts file!");
} }
if(config->no_body || config->remote_time) { if(config->no_body || config->remote_time) {