From 8270633eeb3383d52454d30c15704cb8c5d8085f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 3 May 2023 13:05:35 +0000 Subject: [PATCH] example, tests: fix ssh2 to correctly return failure Before this patch ssh2 and test_ssh2 returned success even if the session failed at `libssh2_session_handshake()` or after. This patch depends on cda41f7cb87c3af5258ba48ccef19d3efdbd3d3b, that fixed running test_ssh2 on Windows via sshd_fixture. Cherry-picked from #1017 --- example/ssh2.c | 2 ++ tests/test_ssh2.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/example/ssh2.c b/example/ssh2.c index a3b9ecec..11b34c7e 100644 --- a/example/ssh2.c +++ b/example/ssh2.c @@ -137,6 +137,8 @@ int main(int argc, char *argv[]) goto shutdown; } + rc = 1; + /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the diff --git a/tests/test_ssh2.c b/tests/test_ssh2.c index 90f19117..a637cdc9 100644 --- a/tests/test_ssh2.c +++ b/tests/test_ssh2.c @@ -157,6 +157,8 @@ int main(int argc, char *argv[]) } while(1); } + rc = 1; + /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the