libssh2: return error when ssh_hostkeyfunc returns error

return CURLE_PEER_FAILED_VERIFICATION if verification with the callback
return a result different than CURLKHMATCH_OK

Closes #10034
This commit is contained in:
mickae1 2022-12-05 14:24:02 +01:00 committed by Daniel Stenberg
parent 2b584fffce
commit 8fe33a9661
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 5 additions and 0 deletions

View File

@ -100,3 +100,4 @@ zhanghu on xiaomi <zhanghu6@xiaomi.com>
Philip Heiduck <pheiduck@Philips-MBP.lan> <47042125+pheiduck@users.noreply.github.com>
bsergean on github <bsergean@gmail.com>
Stefan Eissing <stefan@eissing.org> <stefan.eissing@greenbytes.de>
Michael Musset <mickamusset@gmail.com>

View File

@ -791,10 +791,14 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
Curl_set_in_callback(data, false);
if(rc!= CURLKHMATCH_OK) {
state(data, SSH_SESSION_FREE);
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;
}
}
else {
state(data, SSH_SESSION_FREE);
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;
}
return CURLE_OK;
}