View | Details | Raw Unified | Return to bug 150293
Collapse All | Expand All

(-)/home/admin/joehorn/wget/Makefile (-1 / +1 lines)
Lines 7-13 Link Here
7
7
8
PORTNAME=	wget
8
PORTNAME=	wget
9
DISTVERSION=	1.12
9
DISTVERSION=	1.12
10
PORTREVISION=	1
10
PORTREVISION=	2
11
CATEGORIES=	ftp www ipv6
11
CATEGORIES=	ftp www ipv6
12
MASTER_SITES=	${MASTER_SITE_GNU}
12
MASTER_SITES=	${MASTER_SITE_GNU}
13
MASTER_SITE_SUBDIR=	wget
13
MASTER_SITE_SUBDIR=	wget
(-)/home/admin/joehorn/wget/files/patch-NEWS (+12 lines)
Line 0 Link Here
1
--- NEWS.orig	2010-09-05 09:02:34.000000000 +0800
2
+++ NEWS	2010-09-05 09:03:05.000000000 +0800
3
@@ -6,6 +6,9 @@
4
 
5
 Please send GNU Wget bug reports to <bug-wget@gnu.org>.
6
 
7
+** By default, on server redirects, use the original URL to get the
8
+   local file name. Close CVE-2010-2252.
9
+
10
 * Changes in Wget 1.12
11
 
12
 ** Mailing list MOVED to bug-wget@gnu.org
(-)/home/admin/joehorn/wget/files/patch-doc_wget.texi (+27 lines)
Line 0 Link Here
1
--- doc/wget.texi.orig	2009-09-05 05:22:04.000000000 +0800
2
+++ doc/wget.texi	2010-09-05 09:33:57.000000000 +0800
3
@@ -1487,6 +1487,13 @@
4
 @code{Content-Disposition} headers to describe what the name of a
5
 downloaded file should be.
6
 
7
+@cindex Trust server names
8
+@item --trust-server-names
9
+
10
+If this is set to on, on a redirect the last component of the
11
+redirection URL will be used as the local file name.  By default it is
12
+used the last component in the original URL.
13
+
14
 @cindex authentication
15
 @item --auth-no-challenge
16
 
17
@@ -2799,6 +2806,10 @@
18
 Turn on recognition of the (non-standard) @samp{Content-Disposition}
19
 HTTP header---if set to @samp{on}, the same as @samp{--content-disposition}.
20
 
21
+@item trust_server_names = on/off
22
+If set to on, use the last component of a redirection URL for the local
23
+file name.
24
+
25
 @item continue = on/off
26
 If set to on, force continuation of preexistent partially retrieved
27
 files.  See @samp{-c} before setting it.
(-)/home/admin/joehorn/wget/files/patch-src__ChangeLog (+21 lines)
Line 0 Link Here
1
--- src/ChangeLog.orig	2010-09-05 09:08:31.000000000 +0800
2
+++ src/ChangeLog	2010-09-05 09:09:32.000000000 +0800
3
@@ -1,3 +1,18 @@
4
+2010-07-28  Giuseppe Scrivano  <address@hidden>
5
+
6
+	* http.h (http_loop): Add new argument `original_url'
7
+	* http.c (http_loop): Add new argument `original_url'.  Use
8
+	`original_url' to get a filename if `trustservernames' is false.
9
+
10
+	* init.c (commands): Add "trustservernames".
11
+
12
+	* options.h (library): Add variable `trustservernames'.
13
+
14
+	* main.c (option_data): Add trust-server-names.
15
+	(print_help): Describe --trust-server-names.
16
+
17
+	* retr.c (retrieve_url): Pass new argument to `http_loop'.
18
+
19
 2009-09-22  Micah Cowan  <micah@cowan.name>
20
 
21
 	* openssl.c (ssl_check_certificate): Avoid reusing the same buffer
(-)/home/admin/joehorn/wget/files/patch-src__http.c (+33 lines)
Line 0 Link Here
1
--- src/http.c.orig	2010-09-05 09:10:47.000000000 +0800
2
+++ src/http.c	2010-09-05 09:14:13.000000000 +0800
3
@@ -2410,8 +2410,9 @@
4
 /* The genuine HTTP loop!  This is the part where the retrieval is
5
    retried, and retried, and retried, and...  */
6
 uerr_t
7
-http_loop (struct url *u, char **newloc, char **local_file, const char *referer,
8
-           int *dt, struct url *proxy, struct iri *iri)
9
+http_loop (struct url *u, struct url *original_url, char **newloc,
10
+           char **local_file, const char *referer, int *dt, struct url *proxy,
11
+           struct iri *iri)
12
 {
13
   int count;
14
   bool got_head = false;         /* used for time-stamping and filename detection */
15
@@ -2457,7 +2458,8 @@
16
     }
17
   else if (!opt.content_disposition)
18
     {
19
-      hstat.local_file = url_file_name (u);
20
+      hstat.local_file = 
21
+	url_file_name (opt.trustservernames ? u : original_url);
22
       got_name = true;
23
     }
24
 
25
@@ -2497,7 +2499,7 @@
26
 
27
   /* Send preliminary HEAD request if -N is given and we have an existing
28
    * destination file. */
29
-  file_name = url_file_name (u);
30
+  file_name = url_file_name (opt.trustservernames ? u : original_url);
31
   if (opt.timestamping
32
       && !opt.content_disposition
33
       && file_exists_p (file_name))
(-)/home/admin/joehorn/wget/files/patch-src__http.h (+13 lines)
Line 0 Link Here
1
--- src/http.h.orig	2010-09-05 08:46:50.000000000 +0800
2
+++ src/http.h	2010-09-05 08:48:09.000000000 +0800
3
@@ -33,8 +33,8 @@
4
 
5
 struct url;
6
 
7
-uerr_t http_loop (struct url *, char **, char **, const char *, int *,
8
-		  struct url *, struct iri *);
9
+uerr_t http_loop (struct url *, struct url *, char **, char **, const char *,
10
+		  int *, struct url *, struct iri *);
11
 void save_cookies (void);
12
 void http_cleanup (void);
13
 time_t http_atotm (const char *);
(-)/home/admin/joehorn/wget/files/patch-src__init.c (+10 lines)
Line 0 Link Here
1
--- src/init.c.orig	2010-09-05 09:16:42.000000000 +0800
2
+++ src/init.c	2010-09-05 09:17:35.000000000 +0800
3
@@ -243,6 +243,7 @@
4
   { "timeout",          NULL,                   cmd_spec_timeout },
5
   { "timestamping",     &opt.timestamping,      cmd_boolean },
6
   { "tries",            &opt.ntry,              cmd_number_inf },
7
+  { "trustservernames", &opt.trustservernames,  cmd_boolean },
8
   { "useproxy",         &opt.use_proxy,         cmd_boolean },
9
   { "user",             &opt.user,              cmd_string },
10
   { "useragent",        NULL,                   cmd_spec_useragent },
(-)/home/admin/joehorn/wget/files/patch-src__main.c (+19 lines)
Line 0 Link Here
1
--- src/main.c.orig	2010-09-05 09:18:44.000000000 +0800
2
+++ src/main.c	2010-09-05 09:21:33.000000000 +0800
3
@@ -266,6 +266,7 @@
4
     { "timeout", 'T', OPT_VALUE, "timeout", -1 },
5
     { "timestamping", 'N', OPT_BOOLEAN, "timestamping", -1 },
6
     { "tries", 't', OPT_VALUE, "tries", -1 },
7
+    { "trust-server-names", 0, OPT_BOOLEAN, "trustservernames", -1 },
8
     { "user", 0, OPT_VALUE, "user", -1 },
9
     { "user-agent", 'U', OPT_VALUE, "useragent", -1 },
10
     { "verbose", 'v', OPT_BOOLEAN, "verbose", -1 },
11
@@ -675,6 +676,8 @@
12
     N_("\
13
   -I,  --include-directories=LIST  list of allowed directories.\n"),
14
     N_("\
15
+  --trust-server-names  use the name specified by the redirection url last component.\n"),
16
+    N_("\
17
   -X,  --exclude-directories=LIST  list of excluded directories.\n"),
18
     N_("\
19
   -np, --no-parent                 don't ascend to the parent directory.\n"),
(-)/home/admin/joehorn/wget/files/patch-src__options.h (+10 lines)
Line 0 Link Here
1
--- src/options.h.orig	2010-09-05 09:22:48.000000000 +0800
2
+++ src/options.h	2010-09-05 09:23:12.000000000 +0800
3
@@ -242,6 +242,7 @@
4
   char *encoding_remote;
5
   char *locale;
6
 
7
+  bool trustservernames;
8
 #ifdef __VMS
9
   int ftp_stmlf;                /* Force Stream_LF format for binary FTP. */
10
 #endif /* def __VMS */
(-)/home/admin/joehorn/wget/files/patch-src__retr.c (+12 lines)
Line 0 Link Here
1
--- src/retr.c.orig	2010-09-05 08:51:29.000000000 +0800
2
+++ src/retr.c	2010-09-05 08:52:15.000000000 +0800
3
@@ -689,7 +689,8 @@
4
 #endif
5
       || (proxy_url && proxy_url->scheme == SCHEME_HTTP))
6
     {
7
-      result = http_loop (u, &mynewloc, &local_file, refurl, dt, proxy_url, iri);
8
+      result = http_loop (u, orig_parsed, &mynewloc, &local_file, refurl, dt,
9
+			  proxy_url, iri);
10
     }
11
   else if (u->scheme == SCHEME_FTP)
12
     {

Return to bug 150293