From 8fe33a96616a8e715a79c2513904784c78cbfb74 Mon Sep 17 00:00:00 2001 From: mickae1 Date: Mon, 5 Dec 2022 14:24:02 +0100 Subject: [PATCH] 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 --- .mailmap | 1 + lib/vssh/libssh2.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.mailmap b/.mailmap index cda33ffae9..5c0c9df123 100644 --- a/.mailmap +++ b/.mailmap @@ -100,3 +100,4 @@ zhanghu on xiaomi Philip Heiduck <47042125+pheiduck@users.noreply.github.com> bsergean on github Stefan Eissing +Michael Musset diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index d23926dbc0..ce9229f8fa 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -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; } -- 2.47.3