mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
tests: Do not parse configuration file in torture_knownhosts
The test might fail if there is a local configuration file that changes the location of the known_hosts file. The test should not be affected by configuration files present in the testing environment. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@@ -307,6 +307,7 @@ static void torture_knownhosts_other_auto(void **state) {
|
|||||||
char tmp_file[1024] = {0};
|
char tmp_file[1024] = {0};
|
||||||
char *known_hosts_file = NULL;
|
char *known_hosts_file = NULL;
|
||||||
int rc;
|
int rc;
|
||||||
|
bool process_config = false;
|
||||||
|
|
||||||
snprintf(tmp_file,
|
snprintf(tmp_file,
|
||||||
sizeof(tmp_file),
|
sizeof(tmp_file),
|
||||||
@@ -344,6 +345,9 @@ static void torture_knownhosts_other_auto(void **state) {
|
|||||||
|
|
||||||
s->ssh.session = session;
|
s->ssh.session = session;
|
||||||
|
|
||||||
|
rc = ssh_options_set(session, SSH_OPTIONS_PROCESS_CONFIG, &process_config);
|
||||||
|
assert_ssh_return_code(session, rc);
|
||||||
|
|
||||||
rc = ssh_options_set(session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER);
|
rc = ssh_options_set(session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER);
|
||||||
assert_ssh_return_code(session, rc);
|
assert_ssh_return_code(session, rc);
|
||||||
|
|
||||||
@@ -368,6 +372,7 @@ static void torture_knownhosts_conflict(void **state) {
|
|||||||
char *known_hosts_file = NULL;
|
char *known_hosts_file = NULL;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int rc;
|
int rc;
|
||||||
|
bool process_config = false;
|
||||||
|
|
||||||
snprintf(tmp_file,
|
snprintf(tmp_file,
|
||||||
sizeof(tmp_file),
|
sizeof(tmp_file),
|
||||||
@@ -411,6 +416,9 @@ static void torture_knownhosts_conflict(void **state) {
|
|||||||
|
|
||||||
s->ssh.session = session;
|
s->ssh.session = session;
|
||||||
|
|
||||||
|
rc = ssh_options_set(session, SSH_OPTIONS_PROCESS_CONFIG, &process_config);
|
||||||
|
assert_ssh_return_code(session, rc);
|
||||||
|
|
||||||
ssh_options_set(session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER);
|
ssh_options_set(session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER);
|
||||||
ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file);
|
ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file);
|
||||||
rc = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, "rsa-sha2-256");
|
rc = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, "rsa-sha2-256");
|
||||||
|
|||||||
Reference in New Issue
Block a user