summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-01-07 01:42:56 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-15 11:54:51 +0000
commit95dce70489e658569bf144f7472bc1392b75b526 (patch)
tree7dfef3f59a2e3767804dc55c49281e6cbb49051b
parent38aa0fc8fb380fab20183a45d4139a1dc607749d (diff)
downloadpoky-95dce70489e658569bf144f7472bc1392b75b526.tar.gz
rsync: 3.1.1 -> 3.1.2
* Remove backport patches: - 0001-Complain-if-an-inc-recursive-path-is-not-right-for-i.patch - rsync.git-eac858085.patch (From OE-Core rev: 0e3b087f16e2d404803c2b85dd1cb24f4be3e5e6) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/rsync/rsync-3.1.1/0001-Complain-if-an-inc-recursive-path-is-not-right-for-i.patch136
-rw-r--r--meta/recipes-devtools/rsync/rsync-3.1.1/rsync.git-eac858085.patch102
-rw-r--r--meta/recipes-devtools/rsync/rsync_3.1.2.bb (renamed from meta/recipes-devtools/rsync/rsync_3.1.1.bb)6
3 files changed, 2 insertions, 242 deletions
diff --git a/meta/recipes-devtools/rsync/rsync-3.1.1/0001-Complain-if-an-inc-recursive-path-is-not-right-for-i.patch b/meta/recipes-devtools/rsync/rsync-3.1.1/0001-Complain-if-an-inc-recursive-path-is-not-right-for-i.patch
deleted file mode 100644
index 19e7f39167..0000000000
--- a/meta/recipes-devtools/rsync/rsync-3.1.1/0001-Complain-if-an-inc-recursive-path-is-not-right-for-i.patch
+++ /dev/null
@@ -1,136 +0,0 @@
1From 962f8b90045ab331fc04c9e65f80f1a53e68243b Mon Sep 17 00:00:00 2001
2From: Wayne Davison <wayned@samba.org>
3Date: Wed, 31 Dec 2014 12:41:03 -0800
4Subject: [PATCH] Complain if an inc-recursive path is not right for its dir.
5 This ensures that a malicious sender can't use a just-sent symlink as a
6 trasnfer path.
7
8Upstream-Status: BackPort
9CVE: CVE-2014-9512
10
11Fix the CVE-2014-9512, rsync 3.1.1 allows remote attackers to write to arbitrary
12files via a symlink attack on a file in the synchronization path.
13
14BackPort and fix this patch to make it able to apply to source code
15
16Signed-off-by: Roy Li <rongqing.li@windriver.com>
17---
18 flist.c | 22 ++++++++++++++++++++--
19 io.c | 2 +-
20 main.c | 4 ++--
21 rsync.c | 2 +-
22 proto.h | 2 +-
23 6 files changed, 31 insertions(+), 8 deletions(-)
24
25diff --git a/flist.c b/flist.c
26index c24672e..92e4b65 100644
27--- a/flist.c
28+++ b/flist.c
29@@ -2435,8 +2435,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
30 return flist;
31 }
32
33-struct file_list *recv_file_list(int f)
34+struct file_list *recv_file_list(int f, int dir_ndx)
35 {
36+ const char *good_dirname = NULL;
37 struct file_list *flist;
38 int dstart, flags;
39 int64 start_read;
40@@ -2492,6 +2493,23 @@ struct file_list *recv_file_list(int f)
41 flist_expand(flist, 1);
42 file = recv_file_entry(f, flist, flags);
43
44+ if (inc_recurse) {
45+ static const char empty_dir[] = "\0";
46+ const char *cur_dir = file->dirname ? file->dirname : empty_dir;
47+ if (relative_paths && *cur_dir == '/')
48+ cur_dir++;
49+ if (cur_dir != good_dirname) {
50+ const char *d = dir_ndx >= 0 ? f_name(dir_flist->files[dir_ndx], NULL) : empty_dir;
51+ if (strcmp(cur_dir, d) != 0) {
52+ rprintf(FERROR,
53+ "ABORTING due to invalid dir prefix from sender: %s (should be: %s)\n",
54+ cur_dir, d);
55+ exit_cleanup(RERR_PROTOCOL);
56+ }
57+ good_dirname = cur_dir;
58+ }
59+ }
60+
61 if (S_ISREG(file->mode)) {
62 /* Already counted */
63 } else if (S_ISDIR(file->mode)) {
64@@ -2615,7 +2633,7 @@ void recv_additional_file_list(int f)
65 rprintf(FINFO, "[%s] receiving flist for dir %d\n",
66 who_am_i(), ndx);
67 }
68- flist = recv_file_list(f);
69+ flist = recv_file_list(f, ndx);
70 flist->parent_ndx = ndx;
71 }
72 }
73diff --git a/io.c b/io.c
74index b9a9bd0..a868fa9 100644
75--- a/io.c
76+++ b/io.c
77@@ -1685,7 +1685,7 @@ void wait_for_receiver(void)
78 rprintf(FINFO, "[%s] receiving flist for dir %d\n",
79 who_am_i(), ndx);
80 }
81- flist = recv_file_list(iobuf.in_fd);
82+ flist = recv_file_list(iobuf.in_fd, ndx);
83 flist->parent_ndx = ndx;
84 #ifdef SUPPORT_HARD_LINKS
85 if (preserve_hard_links)
86diff --git a/main.c b/main.c
87index e7a13f7..713b818 100644
88--- a/main.c
89+++ b/main.c
90@@ -1009,7 +1009,7 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
91 filesfrom_fd = -1;
92 }
93
94- flist = recv_file_list(f_in);
95+ flist = recv_file_list(f_in, -1);
96 if (!flist) {
97 rprintf(FERROR,"server_recv: recv_file_list error\n");
98 exit_cleanup(RERR_FILESELECT);
99@@ -1183,7 +1183,7 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
100
101 if (write_batch && !am_server)
102 start_write_batch(f_in);
103- flist = recv_file_list(f_in);
104+ flist = recv_file_list(f_in, -1);
105 if (inc_recurse && file_total == 1)
106 recv_additional_file_list(f_in);
107
108diff --git a/rsync.c b/rsync.c
109index 68ff6b1..c3ecc51 100644
110--- a/rsync.c
111+++ b/rsync.c
112@@ -364,7 +364,7 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
113 }
114 /* Send all the data we read for this flist to the generator. */
115 start_flist_forward(ndx);
116- flist = recv_file_list(f_in);
117+ flist = recv_file_list(f_in, ndx);
118 flist->parent_ndx = ndx;
119 stop_flist_forward();
120 }
121diff --git a/proto.h b/proto.h
122index 22fc539..247c558 100644
123--- a/proto.h
124+++ b/proto.h
125@@ -89,7 +89,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
126 void unmake_file(struct file_struct *file);
127 void send_extra_file_list(int f, int at_least);
128 struct file_list *send_file_list(int f, int argc, char *argv[]);
129-struct file_list *recv_file_list(int f);
130+struct file_list *recv_file_list(int f, int dir_ndx);
131 void recv_additional_file_list(int f);
132 int flist_find(struct file_list *flist, struct file_struct *f);
133 int flist_find_ignore_dirness(struct file_list *flist, struct file_struct *f);
134--
1351.9.1
136
diff --git a/meta/recipes-devtools/rsync/rsync-3.1.1/rsync.git-eac858085.patch b/meta/recipes-devtools/rsync/rsync-3.1.1/rsync.git-eac858085.patch
deleted file mode 100644
index c86f478ef1..0000000000
--- a/meta/recipes-devtools/rsync/rsync-3.1.1/rsync.git-eac858085.patch
+++ /dev/null
@@ -1,102 +0,0 @@
1From eac858085e3ac94ec0ab5061d11f52652c90a869 Mon Sep 17 00:00:00 2001
2From: Wayne Davison <wayned@samba.org>
3Date: Mon, 11 May 2015 12:36:20 -0700
4Subject: [PATCH 1/1] Add compat flag to allow proper seed checksum order.
5 Fixes the equivalent of librsync's CVE-2014-8242 issue.
6
7Upstream-Status: Backport
8CVE: CVE-2014-8242
9
10Signed-off-by: Roy Li <rongqing.li@windriver.com>
11---
12 checksum.c | 17 +++++++++++++----
13 compat.c | 5 +++++
14 options.c | 1 +
15 3 files changed, 19 insertions(+), 4 deletions(-)
16
17diff --git a/checksum.c b/checksum.c
18index a1c2aa2..933b514 100644
19--- a/checksum.c
20+++ b/checksum.c
21@@ -23,6 +23,7 @@
22
23 extern int checksum_seed;
24 extern int protocol_version;
25+extern int proper_seed_order;
26
27 /*
28 a simple 32 bit checksum that can be upadted from either end
29@@ -54,10 +55,18 @@ void get_checksum2(char *buf, int32 len, char *sum)
30 if (protocol_version >= 30) {
31 uchar seedbuf[4];
32 md5_begin(&m);
33- md5_update(&m, (uchar *)buf, len);
34- if (checksum_seed) {
35- SIVALu(seedbuf, 0, checksum_seed);
36- md5_update(&m, seedbuf, 4);
37+ if (proper_seed_order) {
38+ if (checksum_seed) {
39+ SIVALu(seedbuf, 0, checksum_seed);
40+ md5_update(&m, seedbuf, 4);
41+ }
42+ md5_update(&m, (uchar *)buf, len);
43+ } else {
44+ md5_update(&m, (uchar *)buf, len);
45+ if (checksum_seed) {
46+ SIVALu(seedbuf, 0, checksum_seed);
47+ md5_update(&m, seedbuf, 4);
48+ }
49 }
50 md5_result(&m, (uchar *)sum);
51 } else {
52diff --git a/compat.c b/compat.c
53index 2454937..f89d466 100644
54--- a/compat.c
55+++ b/compat.c
56@@ -27,6 +27,7 @@ int inc_recurse = 0;
57 int compat_flags = 0;
58 int use_safe_inc_flist = 0;
59 int want_xattr_optim = 0;
60+int proper_seed_order = 0;
61
62 extern int am_server;
63 extern int am_sender;
64@@ -78,6 +79,7 @@ int filesfrom_convert = 0;
65 #define CF_SYMLINK_ICONV (1<<2)
66 #define CF_SAFE_FLIST (1<<3)
67 #define CF_AVOID_XATTR_OPTIM (1<<4)
68+#define CF_CHKSUM_SEED_FIX (1<<5)
69
70 static const char *client_info;
71
72@@ -271,12 +273,15 @@ void setup_protocol(int f_out,int f_in)
73 compat_flags |= CF_SAFE_FLIST;
74 if (local_server || strchr(client_info, 'x') != NULL)
75 compat_flags |= CF_AVOID_XATTR_OPTIM;
76+ if (local_server || strchr(client_info, 'C') != NULL)
77+ compat_flags |= CF_CHKSUM_SEED_FIX;
78 write_byte(f_out, compat_flags);
79 } else
80 compat_flags = read_byte(f_in);
81 /* The inc_recurse var MUST be set to 0 or 1. */
82 inc_recurse = compat_flags & CF_INC_RECURSE ? 1 : 0;
83 want_xattr_optim = protocol_version >= 31 && !(compat_flags & CF_AVOID_XATTR_OPTIM);
84+ proper_seed_order = compat_flags & CF_CHKSUM_SEED_FIX ? 1 : 0;
85 if (am_sender) {
86 receiver_symlink_times = am_server
87 ? strchr(client_info, 'L') != NULL
88diff --git a/options.c b/options.c
89index 19c2b7d..4128b59 100644
90--- a/options.c
91+++ b/options.c
92@@ -2503,6 +2503,7 @@ void server_options(char **args, int *argc_p)
93 #endif
94 argstr[x++] = 'f'; /* flist I/O-error safety support */
95 argstr[x++] = 'x'; /* xattr hardlink optimization not desired */
96+ argstr[x++] = 'C'; /* support checksum seed order fix */
97 }
98
99 if (x >= (int)sizeof argstr) { /* Not possible... */
100--
1011.9.1
102
diff --git a/meta/recipes-devtools/rsync/rsync_3.1.1.bb b/meta/recipes-devtools/rsync/rsync_3.1.2.bb
index c74cdda943..71c2045aed 100644
--- a/meta/recipes-devtools/rsync/rsync_3.1.1.bb
+++ b/meta/recipes-devtools/rsync/rsync_3.1.2.bb
@@ -2,12 +2,10 @@ require rsync.inc
2 2
3 3
4SRC_URI += "file://acinclude.m4 \ 4SRC_URI += "file://acinclude.m4 \
5 file://0001-Complain-if-an-inc-recursive-path-is-not-right-for-i.patch \
6 file://rsync.git-eac858085.patch \
7" 5"
8 6
9SRC_URI[md5sum] = "43bd6676f0b404326eee2d63be3cdcfe" 7SRC_URI[md5sum] = "0f758d7e000c0f7f7d3792610fad70cb"
10SRC_URI[sha256sum] = "7de4364fcf5fe42f3bdb514417f1c40d10bbca896abe7e7f2c581c6ea08a2621" 8SRC_URI[sha256sum] = "ecfa62a7fa3c4c18b9eccd8c16eaddee4bd308a76ea50b5c02a5840f09c0a1c2"
11 9
12PACKAGECONFIG ??= "acl attr" 10PACKAGECONFIG ??= "acl attr"
13PACKAGECONFIG[acl] = "--enable-acl-support,--disable-acl-support,acl," 11PACKAGECONFIG[acl] = "--enable-acl-support,--disable-acl-support,acl,"