aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-09-29 12:00:10 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-05 12:09:45 +0200
commit1ebfd3834a82b2a638377e3572c1039ded4562e9 (patch)
tree33de681c86eb6b4c96573ea317db5139b80f2e85
parent1eeeace9750581d9d0fef39c21f7c6e00dcb4fbd (diff)
downloadlibssh-1ebfd3834a82b2a638377e3572c1039ded4562e9.tar.gz
libssh-1ebfd3834a82b2a638377e3572c1039ded4562e9.tar.xz
libssh-1ebfd3834a82b2a638377e3572c1039ded4562e9.zip
tests: Support other openssh versions ...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> (cherry-picked from commit 6e7eae96)
-rw-r--r--tests/CMakeLists.txt8
-rw-r--r--tests/client/torture_session.c7
-rw-r--r--tests/torture.c17
3 files changed, 29 insertions, 3 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 04838f03..c0405f9c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -59,6 +59,14 @@ if (WITH_CLIENT_TESTING)
message(SEND_ERROR "Could not find sshd which is required for client testing")
endif()
+ find_program(SSH_EXECUTABLE NAMES ssh)
+ if (SSH_EXECUTABLE)
+ execute_process(COMMAND ${SSH_EXECUTABLE} -V ERROR_VARIABLE OPENSSH_VERSION_STR)
+ string(REGEX REPLACE "^OpenSSH_([0-9]).[0-9].*$" "\\1" OPENSSH_VERSION_MAJOR "${OPENSSH_VERSION_STR}")
+ string(REGEX REPLACE "^OpenSSH_[0-9].([0-9]).*$" "\\1" OPENSSH_VERSION_MINOR "${OPENSSH_VERSION_STR}")
+ add_definitions(-DOPENSSH_VERSION_MAJOR=${OPENSSH_VERSION_MAJOR} -DOPENSSH_VERSION_MINOR=${OPENSSH_VERSION_MINOR})
+ endif()
+
# homedir will be used in passwd
set(HOMEDIR ${CMAKE_CURRENT_BINARY_DIR}/home)
diff --git a/tests/client/torture_session.c b/tests/client/torture_session.c
index 94296a3f..bdc11af2 100644
--- a/tests/client/torture_session.c
+++ b/tests/client/torture_session.c
@@ -92,7 +92,12 @@ static void torture_channel_read_error(void **state) {
if (rc == SSH_ERROR)
break;
}
- assert_true(rc == SSH_ERROR);
+#if OPENSSH_VERSION_MAJOR == 6 && OPENSSH_VERSION_MINOR >= 7
+ /* With openssh 6.7 this doesn't produce and error anymore */
+ assert_int_equal(rc, SSH_OK);
+#else
+ assert_int_equal(rc, SSH_ERROR);
+#endif
ssh_channel_free(channel);
}
diff --git a/tests/torture.c b/tests/torture.c
index 738cacc9..30f9ab36 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -802,9 +802,22 @@ static void torture_setup_create_sshd_config(void **state)
"UsePrivilegeSeparation no\n"
"StrictModes no\n"
"\n"
- "Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc\n"
- "KexAlgorithms +diffie-hellman-group1-sha1\n"
+#if OPENSSH_VERSION_MAJOR == 6 && OPENSSH_VERSION_MINOR >= 7
"HostKeyAlgorithms +ssh-dss\n"
+ "Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc\n"
+ "KexAlgorithms +diffie-hellman-group1-sha1"
+#else
+ "Ciphers 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,"
+ "aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,"
+ "aes256-gcm@openssh.com,arcfour128,arcfour256,arcfour,"
+ "blowfish-cbc,cast128-cbc,chacha20-poly1305@openssh.com\n"
+ "KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,"
+ "ecdh-sha2-nistp384,ecdh-sha2-nistp521,"
+ "diffie-hellman-group-exchange-sha256,"
+ "diffie-hellman-group-exchange-sha1,"
+ "diffie-hellman-group14-sha1,"
+ "diffie-hellman-group1-sha1\n"
+#endif
"\n"
"AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES\n"
"AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT\n"