From a45c667f23c243e0410b8c531236cc04ff8746c7 Mon Sep 17 00:00:00 2001 From: Packit Bot Date: May 05 2021 22:23:33 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index e2a8d99..7903013 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -79,7 +79,7 @@ /* libssh version */ #define LIBSSH_VERSION_MAJOR 0 #define LIBSSH_VERSION_MINOR 9 -#define LIBSSH_VERSION_MICRO 4 +#define LIBSSH_VERSION_MICRO 3 #define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \ LIBSSH_VERSION_MINOR, \ diff --git a/src/channels.c b/src/channels.c index f64646e..05dcf8f 100644 --- a/src/channels.c +++ b/src/channels.c @@ -2932,16 +2932,15 @@ int ssh_channel_read_timeout(ssh_channel channel, if (session->session_state == SSH_SESSION_STATE_ERROR) { return SSH_ERROR; } - /* If the server closed the channel properly, there is nothing to do */ - if (channel->remote_eof && ssh_buffer_get_len(stdbuf) == 0) { - return 0; - } if (channel->state == SSH_CHANNEL_STATE_CLOSED) { ssh_set_error(session, SSH_FATAL, "Remote channel is closed."); return SSH_ERROR; } + if (channel->remote_eof && ssh_buffer_get_len(stdbuf) == 0) { + return 0; + } len = ssh_buffer_get_len(stdbuf); /* Read count bytes if len is greater, everything otherwise */ len = (len > count ? count : len); diff --git a/tests/client/torture_knownhosts.c b/tests/client/torture_knownhosts.c index 55aee21..fcc5484 100644 --- a/tests/client/torture_knownhosts.c +++ b/tests/client/torture_knownhosts.c @@ -307,7 +307,6 @@ 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), @@ -345,9 +344,6 @@ 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); @@ -372,7 +368,6 @@ 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), @@ -416,9 +411,6 @@ 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"); diff --git a/tests/client/torture_scp.c b/tests/client/torture_scp.c index 59a00ba..8f080af 100644 --- a/tests/client/torture_scp.c +++ b/tests/client/torture_scp.c @@ -37,7 +37,6 @@ #define BUF_SIZE 1024 #define TEMPLATE BINARYDIR "/tests/home/alice/temp_dir_XXXXXX" -#define ALICE_HOME BINARYDIR "/tests/home/alice" struct scp_st { struct torture_state *s; @@ -541,86 +540,6 @@ static void torture_scp_upload_newline(void **state) fclose(file); } -static void torture_scp_upload_appended_command(void **state) -{ - struct scp_st *ts = NULL; - struct torture_state *s = NULL; - - ssh_session session = NULL; - ssh_scp scp = NULL; - - FILE *file = NULL; - - char buf[1024]; - char *rs = NULL; - int rc; - - assert_non_null(state); - ts = *state; - - assert_non_null(ts->s); - s = ts->s; - - session = s->ssh.session; - assert_non_null(session); - - assert_non_null(ts->tmp_dir_basename); - assert_non_null(ts->tmp_dir); - - /* Upload a file path with a command appended */ - - /* Append a command to the file path */ - snprintf(buf, BUF_SIZE, "%s" - "/;touch hack", - ts->tmp_dir); - - /* When writing the file_name must be the directory name */ - scp = ssh_scp_new(session, SSH_SCP_WRITE | SSH_SCP_RECURSIVE, - buf); - assert_non_null(scp); - - rc = ssh_scp_init(scp); - assert_ssh_return_code(session, rc); - - /* Push directory where the new file will be copied */ - rc = ssh_scp_push_directory(scp, ";touch hack", 0755); - assert_ssh_return_code(session, rc); - - /* Try to push file */ - rc = ssh_scp_push_file(scp, "original", 8, 0644); - assert_ssh_return_code(session, rc); - - rc = ssh_scp_write(scp, "original", 8); - assert_ssh_return_code(session, rc); - - /* Leave the directory */ - rc = ssh_scp_leave_directory(scp); - assert_ssh_return_code(session, rc); - - /* Cleanup */ - ssh_scp_close(scp); - ssh_scp_free(scp); - - /* Make sure the command was not executed */ - snprintf(buf, BUF_SIZE, ALICE_HOME "/hack"); - file = fopen(buf, "r"); - assert_null(file); - - /* Open the file and check content */ - snprintf(buf, BUF_SIZE, "%s" - "/;touch hack/original", - ts->tmp_dir); - - file = fopen(buf, "r"); - assert_non_null(file); - - rs = fgets(buf, 1024, file); - assert_non_null(rs); - assert_string_equal(buf, "original"); - - fclose(file); -} - int torture_run_tests(void) { int rc; @@ -640,9 +559,6 @@ int torture_run_tests(void) cmocka_unit_test_setup_teardown(torture_scp_upload_newline, session_setup, session_teardown), - cmocka_unit_test_setup_teardown(torture_scp_upload_appended_command, - session_setup, - session_teardown), }; ssh_init(); diff --git a/tests/torture.c b/tests/torture.c index c22ca34..907f45b 100644 --- a/tests/torture.c +++ b/tests/torture.c @@ -636,15 +636,6 @@ static void torture_setup_create_sshd_config(void **state, bool pam) # else /* HAVE_DSA */ "HostKeyAlgorithms +ssh-rsa\n" # endif /* HAVE_DSA */ -/* Add back algorithms removed from default in OpenSSH-8.2 due to SHA1 - * deprecation*/ -# if (OPENSSH_VERSION_MAJOR == 8 && OPENSSH_VERSION_MINOR >= 2) - "KexAlgorithms +diffie-hellman-group14-sha1," - "diffie-hellman-group-exchange-sha1," - "diffie-hellman-group1-sha1\n" - "HostKeyAlgorithms +ssh-rsa\n" - "CASignatureAlgorithms +ssh-rsa\n" -#endif # if (OPENSSH_VERSION_MAJOR == 7 && OPENSSH_VERSION_MINOR < 6) "Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc\n" # else /* OPENSSH_VERSION 7.0 - 7.5 */