mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
tests: Set explicit kex algorithm
without explicitly setting the algorithms, they might be set by some other configuration file, for example crypto policies pulled from `/etc/libssh/libssh_server.config` during RPM build. Log also the generated configuration file and change the other case to use standard logging mechanism instead of fprintf. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Pavol Žáčik <pzacik@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -263,7 +263,7 @@ static void test_algorithm_no_hmac_overlap(void **state, const char *algorithm)
|
|||||||
s = tss->state;
|
s = tss->state;
|
||||||
assert_non_null(s);
|
assert_non_null(s);
|
||||||
|
|
||||||
/* Prepare key files */
|
/* Prepare config file */
|
||||||
snprintf(config_content,
|
snprintf(config_content,
|
||||||
sizeof(config_content),
|
sizeof(config_content),
|
||||||
"HostKey %s\nCiphers %s\nMACs %s\n",
|
"HostKey %s\nCiphers %s\nMACs %s\n",
|
||||||
@@ -274,9 +274,10 @@ static void test_algorithm_no_hmac_overlap(void **state, const char *algorithm)
|
|||||||
assert_non_null(s->srv_config);
|
assert_non_null(s->srv_config);
|
||||||
torture_write_file(s->srv_config, config_content);
|
torture_write_file(s->srv_config, config_content);
|
||||||
|
|
||||||
fprintf(stderr, "Config file %s content: \n\n%s\n", s->srv_config,
|
SSH_LOG(SSH_LOG_TRACE,
|
||||||
|
"Config file %s content: \n\n%s\n",
|
||||||
|
s->srv_config,
|
||||||
config_content);
|
config_content);
|
||||||
fflush(stderr);
|
|
||||||
|
|
||||||
/* Start server */
|
/* Start server */
|
||||||
rc = start_server(state);
|
rc = start_server(state);
|
||||||
@@ -354,12 +355,28 @@ static void test_kex_self_compat(void **state, const char *kex)
|
|||||||
struct test_server_st *tss = *state;
|
struct test_server_st *tss = *state;
|
||||||
struct torture_state *s = NULL;
|
struct torture_state *s = NULL;
|
||||||
ssh_session session = NULL;
|
ssh_session session = NULL;
|
||||||
|
char config_content[4096];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
assert_non_null(tss);
|
assert_non_null(tss);
|
||||||
s = tss->state;
|
s = tss->state;
|
||||||
assert_non_null(s);
|
assert_non_null(s);
|
||||||
|
|
||||||
|
/* Prepare config file */
|
||||||
|
snprintf(config_content,
|
||||||
|
sizeof(config_content),
|
||||||
|
"HostKey %s\nKexAlgorithms %s\n",
|
||||||
|
tss->rsa_hostkey,
|
||||||
|
kex);
|
||||||
|
|
||||||
|
assert_non_null(s->srv_config);
|
||||||
|
torture_write_file(s->srv_config, config_content);
|
||||||
|
|
||||||
|
SSH_LOG(SSH_LOG_TRACE,
|
||||||
|
"Config file %s content: \n\n%s\n",
|
||||||
|
s->srv_config,
|
||||||
|
config_content);
|
||||||
|
|
||||||
rc = start_server(state);
|
rc = start_server(state);
|
||||||
assert_int_equal(rc, 0);
|
assert_int_equal(rc, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user