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>
Этот коммит содержится в:
родитель
945829a5dd
Коммит
bab2c775da
@ -181,7 +181,7 @@ if (CLIENT_TESTING OR SERVER_TESTING)
|
|||||||
# ssh_ping
|
# ssh_ping
|
||||||
add_executable(ssh_ping ssh_ping.c)
|
add_executable(ssh_ping ssh_ping.c)
|
||||||
target_compile_options(ssh_ping PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
target_compile_options(ssh_ping PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(ssh_ping ssh::ssh)
|
target_link_libraries(ssh_ping ssh::static)
|
||||||
|
|
||||||
# homedir will be used in passwd
|
# homedir will be used in passwd
|
||||||
set(HOMEDIR ${CMAKE_CURRENT_BINARY_DIR}/home)
|
set(HOMEDIR ${CMAKE_CURRENT_BINARY_DIR}/home)
|
||||||
|
@ -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.
|
clients must be made or how a client should react.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
|
#include <libssh/kex.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *banner = NULL;
|
const char *banner = NULL;
|
||||||
ssh_session session = NULL;
|
ssh_session session = NULL;
|
||||||
|
const char *hostkeys = NULL;
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
|
|
||||||
bool process_config = false;
|
bool process_config = false;
|
||||||
@ -32,6 +36,8 @@ int main(int argc, char **argv)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssh_init();
|
||||||
|
|
||||||
session = ssh_new();
|
session = ssh_new();
|
||||||
if (session == NULL) {
|
if (session == NULL) {
|
||||||
goto out;
|
goto out;
|
||||||
@ -54,6 +60,13 @@ int main(int argc, char **argv)
|
|||||||
goto out;
|
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);
|
rc = ssh_connect(session);
|
||||||
if (rc != SSH_OK) {
|
if (rc != SSH_OK) {
|
||||||
fprintf(stderr, "Connection failed : %s\n", ssh_get_error(session));
|
fprintf(stderr, "Connection failed : %s\n", ssh_get_error(session));
|
||||||
@ -71,6 +84,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
ssh_free(session);
|
ssh_free(session);
|
||||||
|
ssh_finalize();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user