aboutsummaryrefslogtreecommitdiff
path: root/tests/ssh_ping.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2020-04-14 14:39:19 +0200
committerJakub Jelen <jjelen@redhat.com>2020-04-20 14:14:33 +0200
commitbab2c775da62663163c51d0aa21c7ed25345905a (patch)
treea618e1d3fff92ce1cb22a2d29626fe052b1f6944 /tests/ssh_ping.c
parent945829a5dd3d6d0a21d76cf67fc2998896af7f99 (diff)
downloadlibssh-bab2c775da62663163c51d0aa21c7ed25345905a.tar.gz
libssh-bab2c775da62663163c51d0aa21c7ed25345905a.tar.xz
libssh-bab2c775da62663163c51d0aa21c7ed25345905a.zip
Make the testing ping use all supported algorithms
Previously, it would use only the default set, which makes some tests failing including the DSA ones and disabled RSA with SHA1. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Diffstat (limited to 'tests/ssh_ping.c')
-rw-r--r--tests/ssh_ping.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ssh_ping.c b/tests/ssh_ping.c
index c3fc1f9a..bdb3cea0 100644
--- a/tests/ssh_ping.c
+++ b/tests/ssh_ping.c
@@ -14,15 +14,19 @@ The goal is to show the API in action. It's not a reference on how terminal
clients must be made or how a client should react.
*/
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <libssh/libssh.h>
+#include <libssh/kex.h>
int main(int argc, char **argv)
{
const char *banner = NULL;
ssh_session session = NULL;
+ const char *hostkeys = NULL;
int rc = 1;
bool process_config = false;
@@ -32,6 +36,8 @@ int main(int argc, char **argv)
goto out;
}
+ ssh_init();
+
session = ssh_new();
if (session == NULL) {
goto out;
@@ -54,6 +60,13 @@ int main(int argc, char **argv)
goto out;
}
+ /* Enable all supported algorithms (including DSA) */
+ hostkeys = ssh_kex_get_supported_method(SSH_HOSTKEYS);
+ rc = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, hostkeys);
+ if (rc < 0) {
+ goto out;
+ }
+
rc = ssh_connect(session);
if (rc != SSH_OK) {
fprintf(stderr, "Connection failed : %s\n", ssh_get_error(session));
@@ -71,6 +84,7 @@ int main(int argc, char **argv)
out:
ssh_free(session);
+ ssh_finalize();
return rc;
}