diff options
Diffstat (limited to 'meta/recipes-extended/wget/wget/Fix-timestamping-and-continue-behaviour-with-ftp-pro.patch')
-rw-r--r-- | meta/recipes-extended/wget/wget/Fix-timestamping-and-continue-behaviour-with-ftp-pro.patch | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/meta/recipes-extended/wget/wget/Fix-timestamping-and-continue-behaviour-with-ftp-pro.patch b/meta/recipes-extended/wget/wget/Fix-timestamping-and-continue-behaviour-with-ftp-pro.patch new file mode 100644 index 0000000000..a63b6c22cc --- /dev/null +++ b/meta/recipes-extended/wget/wget/Fix-timestamping-and-continue-behaviour-with-ftp-pro.patch | |||
@@ -0,0 +1,108 @@ | |||
1 | From 0e6d6ca963f13e0c4d239cd9e7aea62d176da8eb Mon Sep 17 00:00:00 2001 | ||
2 | From: Nikolay Merinov <kim.roader@gmail.com> | ||
3 | Date: Fri, 17 Apr 2015 23:32:30 +0500 | ||
4 | Subject: [PATCH] Fix timestamping and continue behaviour with ftp protocol. | ||
5 | |||
6 | * src/ftp.c (ftp_loop_internal): Add option `force_full_retrieve' that force to | ||
7 | retrieve full file. | ||
8 | (ftp_retrieve_list): Pass `true' as `force_full_retrieve' option to | ||
9 | `ftp_loop_internal' if we want to download file with newer timestamp than local | ||
10 | copy. | ||
11 | |||
12 | Upstream-Status: Backport | ||
13 | In support of CVE-2016-4971 | ||
14 | Signed-off-by: Armin Kuster <akuster@mvista.com> | ||
15 | |||
16 | --- | ||
17 | src/ftp.c | 21 +++++++++++++-------- | ||
18 | 1 file changed, 13 insertions(+), 8 deletions(-) | ||
19 | |||
20 | Index: wget-1.16.3/src/ftp.c | ||
21 | =================================================================== | ||
22 | --- wget-1.16.3.orig/src/ftp.c | ||
23 | +++ wget-1.16.3/src/ftp.c | ||
24 | @@ -1540,7 +1540,8 @@ Error in server response, closing contro | ||
25 | This loop either gets commands from con, or (if ON_YOUR_OWN is | ||
26 | set), makes them up to retrieve the file given by the URL. */ | ||
27 | static uerr_t | ||
28 | -ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_file) | ||
29 | +ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_file, | ||
30 | + bool force_full_retrieve) | ||
31 | { | ||
32 | int count, orig_lp; | ||
33 | wgint restval, len = 0, qtyread = 0; | ||
34 | @@ -1642,6 +1643,8 @@ ftp_loop_internal (struct url *u, struct | ||
35 | /* Decide whether or not to restart. */ | ||
36 | if (con->cmd & DO_LIST) | ||
37 | restval = 0; | ||
38 | + else if (force_full_retrieve) | ||
39 | + restval = 0; | ||
40 | else if (opt.start_pos >= 0) | ||
41 | restval = opt.start_pos; | ||
42 | else if (opt.always_rest | ||
43 | @@ -1856,7 +1859,7 @@ ftp_get_listing (struct url *u, ccon *co | ||
44 | |||
45 | con->target = xstrdup (lf); | ||
46 | xfree (lf); | ||
47 | - err = ftp_loop_internal (u, NULL, con, NULL); | ||
48 | + err = ftp_loop_internal (u, NULL, con, NULL, false); | ||
49 | lf = xstrdup (con->target); | ||
50 | xfree (con->target); | ||
51 | con->target = old_target; | ||
52 | @@ -1901,6 +1904,7 @@ ftp_retrieve_list (struct url *u, struct | ||
53 | time_t tml; | ||
54 | bool dlthis; /* Download this (file). */ | ||
55 | const char *actual_target = NULL; | ||
56 | + bool force_full_retrieve = false; | ||
57 | |||
58 | /* Increase the depth. */ | ||
59 | ++depth; | ||
60 | @@ -1980,9 +1984,10 @@ ftp_retrieve_list (struct url *u, struct | ||
61 | Remote file no newer than local file %s -- not retrieving.\n"), quote (con->target)); | ||
62 | dlthis = false; | ||
63 | } | ||
64 | - else if (eq_size) | ||
65 | + else if (f->tstamp > tml) | ||
66 | { | ||
67 | - /* Remote file is newer or sizes cannot be matched */ | ||
68 | + /* Remote file is newer */ | ||
69 | + force_full_retrieve = true; | ||
70 | logprintf (LOG_VERBOSE, _("\ | ||
71 | Remote file is newer than local file %s -- retrieving.\n\n"), | ||
72 | quote (con->target)); | ||
73 | @@ -2051,7 +2056,7 @@ Already have correct symlink %s -> %s\n\ | ||
74 | else /* opt.retr_symlinks */ | ||
75 | { | ||
76 | if (dlthis) | ||
77 | - err = ftp_loop_internal (u, f, con, NULL); | ||
78 | + err = ftp_loop_internal (u, f, con, NULL, force_full_retrieve); | ||
79 | } /* opt.retr_symlinks */ | ||
80 | break; | ||
81 | case FT_DIRECTORY: | ||
82 | @@ -2062,7 +2067,7 @@ Already have correct symlink %s -> %s\n\ | ||
83 | case FT_PLAINFILE: | ||
84 | /* Call the retrieve loop. */ | ||
85 | if (dlthis) | ||
86 | - err = ftp_loop_internal (u, f, con, NULL); | ||
87 | + err = ftp_loop_internal (u, f, con, NULL, force_full_retrieve); | ||
88 | break; | ||
89 | case FT_UNKNOWN: | ||
90 | logprintf (LOG_NOTQUIET, _("%s: unknown/unsupported file type.\n"), | ||
91 | @@ -2368,7 +2373,7 @@ ftp_retrieve_glob (struct url *u, ccon * | ||
92 | { | ||
93 | /* Let's try retrieving it anyway. */ | ||
94 | con->st |= ON_YOUR_OWN; | ||
95 | - res = ftp_loop_internal (u, NULL, con, NULL); | ||
96 | + res = ftp_loop_internal (u, NULL, con, NULL, false); | ||
97 | return res; | ||
98 | } | ||
99 | |||
100 | @@ -2468,7 +2473,7 @@ ftp_loop (struct url *u, char **local_fi | ||
101 | ispattern ? GLOB_GLOBALL : GLOB_GETONE); | ||
102 | } | ||
103 | else | ||
104 | - res = ftp_loop_internal (u, NULL, &con, local_file); | ||
105 | + res = ftp_loop_internal (u, NULL, &con, local_file, false); | ||
106 | } | ||
107 | if (res == FTPOK) | ||
108 | res = RETROK; | ||