aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2016-11-08 08:16:20 +0100
committerAndreas Schneider <asn@cryptomilk.org>2016-11-08 08:16:20 +0100
commitf8ef200e7653f1124961659733a9f5d030351d93 (patch)
treee1986b00ce8a8efc4a5fc3ab46913d02bf3f49e8
parent3daf1760a18c091159338fc9077fa71bfbd726a1 (diff)
downloadlibssh-f8ef200e7653f1124961659733a9f5d030351d93.tar.gz
libssh-f8ef200e7653f1124961659733a9f5d030351d93.tar.xz
libssh-f8ef200e7653f1124961659733a9f5d030351d93.zip
tests: Fix session management of torture_knownhosts
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--tests/client/torture_knownhosts.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/client/torture_knownhosts.c b/tests/client/torture_knownhosts.c
index fb8ec462..00aa8269 100644
--- a/tests/client/torture_knownhosts.c
+++ b/tests/client/torture_knownhosts.c
@@ -250,7 +250,10 @@ static void torture_knownhosts_other_auto(void **state) {
ssh_free(session);
/* connect again and check host key */
- *state = session = ssh_new();
+ session = ssh_new();
+ assert_non_null(session);
+
+ s->ssh.session = session;
rc = ssh_options_set(session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER);
assert_int_equal(rc, SSH_OK);
@@ -265,8 +268,7 @@ static void torture_knownhosts_other_auto(void **state) {
rc = ssh_is_server_known(session);
assert_int_equal(rc, SSH_SERVER_KNOWN_OK);
- ssh_disconnect(session);
- ssh_free(session);
+ /* session will be freed by session_teardown() */
}
static void torture_knownhosts_conflict(void **state) {
@@ -310,7 +312,10 @@ static void torture_knownhosts_conflict(void **state) {
ssh_free(session);
/* connect again and check host key */
- *state = session = ssh_new();
+ session = ssh_new();
+ assert_non_null(session);
+
+ s->ssh.session = session;
ssh_options_set(session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER);
ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file);
@@ -323,8 +328,7 @@ static void torture_knownhosts_conflict(void **state) {
rc = ssh_is_server_known(session);
assert_int_equal(rc, SSH_SERVER_KNOWN_OK);
- ssh_disconnect(session);
- ssh_free(session);
+ /* session will be freed by session_teardown() */
}
static void torture_knownhosts_precheck(void **state) {