aboutsummaryrefslogtreecommitdiff
path: root/tests/client
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2014-02-04 22:28:30 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2014-02-04 22:28:30 +0100
commitfdc660f313a1e8d692c1131d8ac35e83288c0d85 (patch)
treee356243f01b04e91e09fc4eb3a81e0ba9802aff1 /tests/client
parent57418dd2cc1d929c99e88f23eb9fd06fc28040b1 (diff)
downloadlibssh-fdc660f313a1e8d692c1131d8ac35e83288c0d85.tar.gz
libssh-fdc660f313a1e8d692c1131d8ac35e83288c0d85.tar.xz
libssh-fdc660f313a1e8d692c1131d8ac35e83288c0d85.zip
knownhosts: detect variations of ecdsa
Diffstat (limited to 'tests/client')
-rw-r--r--tests/client/torture_knownhosts.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/client/torture_knownhosts.c b/tests/client/torture_knownhosts.c
index e8100719..df99ae90 100644
--- a/tests/client/torture_knownhosts.c
+++ b/tests/client/torture_knownhosts.c
@@ -23,6 +23,7 @@
#include "torture.h"
#include "session.c"
+#include "known_hosts.c"
#define KNOWNHOSTFILES "libssh_torture_knownhosts"
#define BADRSA "AAAAB3NzaC1yc2EAAAADAQABAAABAQChm5" \
@@ -255,8 +256,7 @@ static void torture_knownhosts_precheck(void **state) {
ssh_session session = *state;
FILE *file;
int rc;
- int dsa;
- int rsa;
+ char **kex;
rc = ssh_options_set(session, SSH_OPTIONS_HOST, "localhost");
assert_true(rc == SSH_OK);
@@ -270,14 +270,14 @@ static void torture_knownhosts_precheck(void **state) {
fprintf(file, "localhost ssh-dss %s\n", BADDSA);
fclose(file);
- rc = ssh_knownhosts_algorithms(session);
- assert_true(rc != SSH_ERROR);
- dsa = 1 << SSH_KEYTYPE_DSS;
- rsa = 1 << SSH_KEYTYPE_RSA;
- assert_true(rc & dsa);
- assert_true(rc & rsa);
- /* nothing else than dsa and rsa */
- assert_true((rc & (dsa | rsa)) == rc);
+ kex = ssh_knownhosts_algorithms(session);
+ assert_true(kex != NULL);
+ assert_string_equal(kex[0],"ssh-rsa");
+ assert_string_equal(kex[1],"ssh-dss");
+ assert_true(kex[2]==NULL);
+ free(kex[1]);
+ free(kex[0]);
+ free(kex);
}
int torture_run_tests(void) {