From bc00f0444dd2a9d4399dbe901aaa7545edc6e250 Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Tue, 23 Jun 2020 19:09:23 +0200 Subject: [PATCH] Do not parse configuration files in torture_knownhosts test --- ...9.4-do-not-parse-config-during-tests.patch | 58 +++++++++++++++++++ libssh.spec | 2 + 2 files changed, 60 insertions(+) create mode 100644 libssh-0.9.4-do-not-parse-config-during-tests.patch diff --git a/libssh-0.9.4-do-not-parse-config-during-tests.patch b/libssh-0.9.4-do-not-parse-config-during-tests.patch new file mode 100644 index 0000000..ac5ee0d --- /dev/null +++ b/libssh-0.9.4-do-not-parse-config-during-tests.patch @@ -0,0 +1,58 @@ +From f10d80047c660e33f5c365bf3cf436a0c2a300f1 Mon Sep 17 00:00:00 2001 +From: Anderson Toshiyuki Sasaki +Date: Tue, 23 Jun 2020 18:31:47 +0200 +Subject: [PATCH] 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 +Reviewed-by: Jakub Jelen +--- + tests/client/torture_knownhosts.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/tests/client/torture_knownhosts.c b/tests/client/torture_knownhosts.c +index fcc54846..55aee217 100644 +--- a/tests/client/torture_knownhosts.c ++++ b/tests/client/torture_knownhosts.c +@@ -307,6 +307,7 @@ static void torture_knownhosts_other_auto(void **state) { + char tmp_file[1024] = {0}; + char *known_hosts_file = NULL; + int rc; ++ bool process_config = false; + + snprintf(tmp_file, + sizeof(tmp_file), +@@ -344,6 +345,9 @@ static void torture_knownhosts_other_auto(void **state) { + + 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); + assert_ssh_return_code(session, rc); + +@@ -368,6 +372,7 @@ static void torture_knownhosts_conflict(void **state) { + char *known_hosts_file = NULL; + FILE *file; + int rc; ++ bool process_config = false; + + snprintf(tmp_file, + sizeof(tmp_file), +@@ -411,6 +416,9 @@ static void torture_knownhosts_conflict(void **state) { + + 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_KNOWNHOSTS, known_hosts_file); + rc = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, "rsa-sha2-256"); +-- +2.26.2 + diff --git a/libssh.spec b/libssh.spec index a5d5497..e17b890 100644 --- a/libssh.spec +++ b/libssh.spec @@ -15,6 +15,7 @@ Patch0: libssh-0.9.4-enable-sshd-sha1-algorithms.patch Patch1: libssh-0.9.4-fix-version.patch Patch2: libssh-0.9.4-do-not-return-error-server-closed-channel.patch Patch3: libssh-0.9.4-add-cve-2019-14889-test.patch +Patch4: libssh-0.9.4-do-not-parse-config-during-tests.patch BuildRequires: cmake BuildRequires: gcc-c++ @@ -142,6 +143,7 @@ popd * Mon Jun 22 2020 Anderson Sasaki - 0.9.4-3 - Do not return error when server properly closed the channel (#1849069) - Add a test for CVE-2019-14889 +- Do not parse configuration file in torture_knownhosts test * Wed Apr 15 2020 Anderson Sasaki - 0.9.4-2 - Added patch to fix returned version