From 76fa06662a5f2f736b17d54eba61d66af6ac397cf7b18851e98ffb16d0beb4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 9 Jan 2018 17:42:56 +0000 Subject: [PATCH] Accepting request 563117 from home:pmonrealgonzalez:branches:network - Fix: Stop file upload after errors [bsc#1062063] - Added patches: * rsync-send_error_to_sender.patch * rsync-avoid-uploading-after-error.patch OBS-URL: https://build.opensuse.org/request/show/563117 OBS-URL: https://build.opensuse.org/package/show/network/rsync?expand=0&rev=63 --- rsync-avoid-uploading-after-error.patch | 13 +++++ rsync-send_error_to_sender.patch | 68 +++++++++++++++++++++++++ rsync.changes | 8 +++ rsync.spec | 7 ++- 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 rsync-avoid-uploading-after-error.patch create mode 100644 rsync-send_error_to_sender.patch diff --git a/rsync-avoid-uploading-after-error.patch b/rsync-avoid-uploading-after-error.patch new file mode 100644 index 0000000..6de8649 --- /dev/null +++ b/rsync-avoid-uploading-after-error.patch @@ -0,0 +1,13 @@ +https://bugzilla.samba.org/show_bug.cgi?id=12525#c1 + +--- cleanup.c.orig 2017-01-18 14:53:35.000000000 +0100 ++++ cleanup.c 2017-01-18 14:56:58.000000000 +0100 +@@ -255,7 +255,7 @@ + } + if (!am_sender) + io_flush(MSG_FLUSH); /* Be sure to send all messages */ +- noop_io_until_death(); ++ /* noop_io_until_death(); */ + } + else if (!am_sender) + io_flush(MSG_FLUSH); /* Be sure to send all messages */ diff --git a/rsync-send_error_to_sender.patch b/rsync-send_error_to_sender.patch new file mode 100644 index 0000000..dea0dbf --- /dev/null +++ b/rsync-send_error_to_sender.patch @@ -0,0 +1,68 @@ +https://bugzilla.samba.org/show_bug.cgi?id=12522#c2 + +--- rsync.h.orig 2017-01-16 18:59:44.580812000 +0100 ++++ rsync.h 2017-01-16 18:59:51.814260000 +0100 +@@ -166,6 +166,7 @@ + #define ATTRS_REPORT (1<<0) + #define ATTRS_SKIP_MTIME (1<<1) + ++#define MSG_FLUSH 2 + #define FULL_FLUSH 1 + #define NORMAL_FLUSH 0 + +--- io.c.orig 2015-08-08 21:47:03.000000000 +0200 ++++ io.c 2017-01-16 19:01:07.000000000 +0100 +@@ -1985,10 +1985,11 @@ + void io_flush(int flush_it_all) + { + if (iobuf.out.len > iobuf.out_empty_len) { +- if (flush_it_all) /* FULL_FLUSH: flush everything in the output buffers */ ++ if (flush_it_all == FULL_FLUSH) /* flush everything in the output buffers */ + perform_io(iobuf.out.size - iobuf.out_empty_len, PIO_NEED_OUTROOM); +- else /* NORMAL_FLUSH: flush at least 1 byte */ ++ else if (flush_it_all == NORMAL_FLUSH) /* flush at least 1 byte */ + perform_io(iobuf.out.size - iobuf.out.len + 1, PIO_NEED_OUTROOM); ++ /* MSG_FLUSH: flush iobuf.msg only */ + } + if (iobuf.msg.len) + perform_io(iobuf.msg.size, PIO_NEED_MSGROOM); +--- cleanup.c.orig 2015-08-08 21:47:03.000000000 +0200 ++++ cleanup.c 2017-01-18 14:53:35.000000000 +0100 +@@ -26,6 +26,7 @@ + extern int am_server; + extern int am_daemon; + extern int am_receiver; ++extern int am_sender; + extern int io_error; + extern int keep_partial; + extern int got_xfer_error; +@@ -243,15 +244,21 @@ + switch_step++; + + if (exit_code && exit_code != RERR_SOCKETIO && exit_code != RERR_STREAMIO && exit_code != RERR_SIGNAL1 +- && exit_code != RERR_TIMEOUT && !shutting_down && (protocol_version >= 31 || am_receiver)) { +- if (line > 0) { +- if (DEBUG_GTE(EXIT, 3)) { +- rprintf(FINFO, "[%s] sending MSG_ERROR_EXIT with exit_code %d\n", +- who_am_i(), exit_code); ++ && exit_code != RERR_TIMEOUT && !shutting_down) { ++ if (protocol_version >= 31 || am_receiver) { ++ if (line > 0) { ++ if (DEBUG_GTE(EXIT, 3)) { ++ rprintf(FINFO, "[%s] sending MSG_ERROR_EXIT with exit_code %d\n", ++ who_am_i(), exit_code); ++ } ++ send_msg_int(MSG_ERROR_EXIT, exit_code); + } +- send_msg_int(MSG_ERROR_EXIT, exit_code); ++ if (!am_sender) ++ io_flush(MSG_FLUSH); /* Be sure to send all messages */ ++ noop_io_until_death(); + } +- noop_io_until_death(); ++ else if (!am_sender) ++ io_flush(MSG_FLUSH); /* Be sure to send all messages */ + } + + /* FALLTHROUGH */ + diff --git a/rsync.changes b/rsync.changes index d45559f..da963ab 100644 --- a/rsync.changes +++ b/rsync.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Jan 9 17:07:12 UTC 2018 - pmonrealgonzalez@suse.com + +- Fix: Stop file upload after errors [bsc#1062063] +- Added patches: + * rsync-send_error_to_sender.patch + * rsync-avoid-uploading-after-error.patch + ------------------------------------------------------------------- Tue Nov 28 16:18:45 UTC 2017 - pmonrealgonzalez@suse.com diff --git a/rsync.spec b/rsync.spec index b760832..b870bed 100644 --- a/rsync.spec +++ b/rsync.spec @@ -1,7 +1,7 @@ # # spec file for package rsync # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -42,6 +42,9 @@ Patch1: rsync-add_back_use_slp_directive.patch Patch2: rsync-both-compressions.patch #PATCH-FIX-UPSTREAM CVE-2017-16548 bsc#1066644 Missing trailing '\0' check could lead to remote DoS Patch3: rsync-CVE-2017-16548.patch +#PATCH-FIX-UPSTREAM bcs#1062063 rsync doesn't stop on errors +Patch4: rsync-send_error_to_sender.patch +Patch5: rsync-avoid-uploading-after-error.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: libacl-devel @@ -76,6 +79,8 @@ patch -p1 < patches/time-limit.diff %patch0 -p1 %patch2 -p1 %patch3 -p1 +%patch4 +%patch5 %build autoreconf -fiv