diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-22 08:26:02 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-22 08:26:02 +0200 |
commit | d0d9e6261110e680447c7473bf42072b285c38e9 (patch) | |
tree | d21646a1215294c55b16639565b605cdeaad6616 /tests | |
parent | a86ac461fd7a379b732602df0debe553751e1505 (diff) | |
download | libssh-d0d9e6261110e680447c7473bf42072b285c38e9.tar.gz libssh-d0d9e6261110e680447c7473bf42072b285c38e9.tar.xz libssh-d0d9e6261110e680447c7473bf42072b285c38e9.zip |
tests: Fix torture test with zlib support.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client/torture_algorithms.c | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/tests/client/torture_algorithms.c b/tests/client/torture_algorithms.c index 6bec543..6a44ecf 100644 --- a/tests/client/torture_algorithms.c +++ b/tests/client/torture_algorithms.c @@ -99,22 +99,33 @@ static void torture_algorithms_zlib(void **state) { assert_true(rc == SSH_OK); rc = ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "zlib"); +#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) assert_true(rc == SSH_OK); +#else + assert_true(rc == SSH_ERROR); +#endif rc = ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "zlib"); +#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) assert_true(rc == SSH_OK); +#else + assert_true(rc == SSH_ERROR); +#endif rc = ssh_connect(session); +#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) if (ssh_get_openssh_version(session)) { assert_false(rc == SSH_OK); - } else { - assert_true(rc == SSH_OK); + ssh_disconnect(session); + return; + } +#endif + assert_true(rc == SSH_OK); - rc = ssh_userauth_none(session, NULL); - if (rc != SSH_OK) { - rc = ssh_get_error_code(session); - assert_true(rc == SSH_REQUEST_DENIED); - } + rc = ssh_userauth_none(session, NULL); + if (rc != SSH_OK) { + rc = ssh_get_error_code(session); + assert_true(rc == SSH_REQUEST_DENIED); } ssh_disconnect(session); @@ -128,12 +139,21 @@ static void torture_algorithms_zlib_openssh(void **state) { assert_true(rc == SSH_OK); rc = ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "zlib@openssh.com"); +#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) assert_true(rc == SSH_OK); +#else + assert_true(rc == SSH_ERROR); +#endif rc = ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "zlib@openssh.com"); +#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) assert_true(rc == SSH_OK); +#else + assert_true(rc == SSH_ERROR); +#endif rc = ssh_connect(session); +#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) if (ssh_get_openssh_version(session)) { assert_true(rc==SSH_OK); rc = ssh_userauth_none(session, NULL); @@ -141,9 +161,13 @@ static void torture_algorithms_zlib_openssh(void **state) { rc = ssh_get_error_code(session); assert_true(rc == SSH_REQUEST_DENIED); } - } else { - assert_false(rc == SSH_OK); + ssh_disconnect(session); + return; } + assert_false(rc == SSH_OK); +#else + assert_true(rc == SSH_OK); +#endif ssh_disconnect(session); } |