summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-03-06 12:45:58 +0000
committerCoprDistGit <infra@openeuler.org>2025-03-06 12:45:58 +0000
commit29311bd313bb2c07206bdf645351e4d961e4121b (patch)
tree04371f9ea25c5f1cd8e5faf4ae29e73928bbba41
parent7680c5cf722d4f937df89f4a01a614630a795a97 (diff)
automatic import of wgetopeneuler24.03_LTS_SP1
-rw-r--r--.gitignore2
-rw-r--r--backport-CVE-2024-10524.patch191
-rw-r--r--backport-CVE-2024-38428.patch76
-rw-r--r--backport-src-url.c-maybe_prepend_scheme-Print-message-only-in.patch26
-rw-r--r--sources2
-rw-r--r--wget.spec127
6 files changed, 424 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..e2da0ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/backport-wget-1.17-path.patch
+/wget-1.21.4.tar.gz
diff --git a/backport-CVE-2024-10524.patch b/backport-CVE-2024-10524.patch
new file mode 100644
index 0000000..36759ff
--- /dev/null
+++ b/backport-CVE-2024-10524.patch
@@ -0,0 +1,191 @@
+From c419542d956a2607bbce5df64b9d378a8588d778 Mon Sep 17 00:00:00 2001
+From: Tim Rühsen <tim.ruehsen@gmx.de>
+Date: Sun, 27 Oct 2024 19:53:14 +0100
+Subject: Fix CVE-2024-10524 (drop support for shorthand URLs)
+
+* doc/wget.texi: Add documentation for removed support for shorthand URLs.
+* src/html-url.c (src/html-url.c): Call maybe_prepend_scheme.
+* src/main.c (main): Likewise.
+* src/retr.c (getproxy): Likewise.
+* src/url.c: Rename definition of rewrite_shorthand_url to maybe_prepend_scheme,
+ add new function is_valid_port.
+* src/url.h: Rename declaration of rewrite_shorthand_url to maybe_prepend_scheme.
+
+Reported-by: Goni Golan <gonig@jfrog.com>
+---
+ doc/wget.texi | 12 ++++--------
+ src/html-url.c | 2 +-
+ src/main.c | 2 +-
+ src/retr.c | 2 +-
+ src/url.c | 57 ++++++++++++++++++---------------------------------------
+ src/url.h | 2 +-
+ 6 files changed, 26 insertions(+), 51 deletions(-)
+
+diff --git a/doc/wget.texi b/doc/wget.texi
+index 1d026d72..d46da375 100644
+--- a/doc/wget.texi
++++ b/doc/wget.texi
+@@ -314,8 +314,8 @@ for text files. Here is an example:
+ ftp://host/directory/file;type=a
+ @end example
+
+-Two alternative variants of @sc{url} specification are also supported,
+-because of historical (hysterical?) reasons and their widespreaded use.
++The two alternative variants of @sc{url} specifications are no longer
++supported because of security considerations:
+
+ @sc{ftp}-only syntax (supported by @code{NcFTP}):
+ @example
+@@ -327,12 +327,8 @@ host:/dir/file
+ host[:port]/dir/file
+ @end example
+
+-These two alternative forms are deprecated, and may cease being
+-supported in the future.
+-
+-If you do not understand the difference between these notations, or do
+-not know which one to use, just use the plain ordinary format you use
+-with your favorite browser, like @code{Lynx} or @code{Netscape}.
++These two alternative forms have been deprecated long time ago,
++and support is removed with version 1.22.0.
+
+ @c man begin OPTIONS
+
+diff --git a/src/html-url.c b/src/html-url.c
+index 8e960092..99914943 100644
+--- a/src/html-url.c
++++ b/src/html-url.c
+@@ -932,7 +932,7 @@ get_urls_file (const char *file, bool *read_again)
+ url_text = merged;
+ }
+
+- new_url = rewrite_shorthand_url (url_text);
++ new_url = maybe_prepend_scheme (url_text);
+ if (new_url)
+ {
+ xfree (url_text);
+diff --git a/src/main.c b/src/main.c
+index 77b1a0b6..6858d2da 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -2126,7 +2126,7 @@ only if outputting to a regular file.\n"));
+ struct iri *iri = iri_new ();
+ struct url *url_parsed;
+
+- t = rewrite_shorthand_url (argv[optind]);
++ t = maybe_prepend_scheme (argv[optind]);
+ if (!t)
+ t = argv[optind];
+
+diff --git a/src/retr.c b/src/retr.c
+index 5422963c..26eb9f17 100644
+--- a/src/retr.c
++++ b/src/retr.c
+@@ -1546,7 +1546,7 @@ getproxy (struct url *u)
+
+ /* Handle shorthands. `rewritten_storage' is a kludge to allow
+ getproxy() to return static storage. */
+- rewritten_url = rewrite_shorthand_url (proxy);
++ rewritten_url = maybe_prepend_scheme (proxy);
+ if (rewritten_url)
+ return rewritten_url;
+
+diff --git a/src/url.c b/src/url.c
+index 07c3bc87..2f27c48a 100644
+--- a/src/url.c
++++ b/src/url.c
+@@ -594,60 +594,39 @@ parse_credentials (const char *beg, const char *end, char **user, char **passwd)
+ return true;
+ }
+
+-/* Used by main.c: detect URLs written using the "shorthand" URL forms
+- originally popularized by Netscape and NcFTP. HTTP shorthands look
+- like this:
+-
+- www.foo.com[:port]/dir/file -> http://www.foo.com[:port]/dir/file
+- www.foo.com[:port] -> http://www.foo.com[:port]
+-
+- FTP shorthands look like this:
+-
+- foo.bar.com:dir/file -> ftp://foo.bar.com/dir/file
+- foo.bar.com:/absdir/file -> ftp://foo.bar.com//absdir/file
++static bool is_valid_port(const char *p)
++{
++ unsigned port = (unsigned) atoi (p);
++ if (port == 0 || port > 65535)
++ return false;
+
+- If the URL needs not or cannot be rewritten, return NULL. */
++ int digits = strspn (p, "0123456789");
++ return digits && (p[digits] == '/' || p[digits] == '\0');
++}
+
++/* Prepend "http://" to url if scheme is missing, otherwise return NULL. */
+ char *
+-rewrite_shorthand_url (const char *url)
++maybe_prepend_scheme (const char *url)
+ {
+- const char *p;
+- char *ret;
+-
+ if (url_scheme (url) != SCHEME_INVALID)
+ return NULL;
+
+- /* Look for a ':' or '/'. The former signifies NcFTP syntax, the
+- latter Netscape. */
+- p = strpbrk (url, ":/");
++ const char *p = strchr (url, ':');
+ if (p == url)
+ return NULL;
+
+ /* If we're looking at "://", it means the URL uses a scheme we
+ don't support, which may include "https" when compiled without
+- SSL support. Don't bogusly rewrite such URLs. */
++ SSL support. Don't bogusly prepend "http://" to such URLs. */
+ if (p && p[0] == ':' && p[1] == '/' && p[2] == '/')
+ return NULL;
+
+- if (p && *p == ':')
+- {
+- /* Colon indicates ftp, as in foo.bar.com:path. Check for
+- special case of http port number ("localhost:10000"). */
+- int digits = strspn (p + 1, "0123456789");
+- if (digits && (p[1 + digits] == '/' || p[1 + digits] == '\0'))
+- goto http;
+-
+- /* Turn "foo.bar.com:path" to "ftp://foo.bar.com/path". */
+- if ((ret = aprintf ("ftp://%s", url)) != NULL)
+- ret[6 + (p - url)] = '/';
+- }
+- else
+- {
+- http:
+- /* Just prepend "http://" to URL. */
+- ret = aprintf ("http://%s", url);
+- }
+- return ret;
++ if (p && p[0] == ':' && !is_valid_port (p + 1))
++ return NULL;
++
++
++ fprintf(stderr, "Prepended http:// to '%s'\n", url);
++ return aprintf ("http://%s", url);
+ }
+
+ static void split_path (const char *, char **, char **);
+diff --git a/src/url.h b/src/url.h
+index 2dfbf30b..7796a21c 100644
+--- a/src/url.h
++++ b/src/url.h
+@@ -128,7 +128,7 @@ char *uri_merge (const char *, const char *);
+
+ int mkalldirs (const char *);
+
+-char *rewrite_shorthand_url (const char *);
++char *maybe_prepend_scheme (const char *);
+ bool schemes_are_similar_p (enum url_scheme a, enum url_scheme b);
+
+ bool are_urls_equal (const char *u1, const char *u2);
+--
+cgit v1.2.3-70-g09d2
+
diff --git a/backport-CVE-2024-38428.patch b/backport-CVE-2024-38428.patch
new file mode 100644
index 0000000..9140205
--- /dev/null
+++ b/backport-CVE-2024-38428.patch
@@ -0,0 +1,76 @@
+From ed0c7c7e0e8f7298352646b2fd6e06a11e242ace Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
+Date: Sun, 2 Jun 2024 12:40:16 +0200
+Subject: Properly re-implement userinfo parsing (rfc2396)
+
+* src/url.c (url_skip_credentials): Properly re-implement userinfo parsing (rfc2396)
+
+The reason why the implementation is based on RFC 2396, an outdated standard,
+is that the whole file is based on that RFC, and mixing standard here might be
+dangerous.
+
+---
+ src/url.c | 40 ++++++++++++++++++++++++++++++++++------
+ 1 file changed, 34 insertions(+), 6 deletions(-)
+
+diff --git a/src/url.c b/src/url.c
+index 2ff0b55..0acd3f3 100644
+--- a/src/url.c
++++ b/src/url.c
+@@ -41,6 +41,7 @@ as that of the covered work. */
+ #include "url.h"
+ #include "host.h" /* for is_valid_ipv6_address */
+ #include "c-strcase.h"
++#include "c-ctype.h"
+
+ #ifdef HAVE_ICONV
+ # include <iconv.h>
+@@ -526,12 +527,39 @@ scheme_leading_string (enum url_scheme scheme)
+ static const char *
+ url_skip_credentials (const char *url)
+ {
+- /* Look for '@' that comes before terminators, such as '/', '?',
+- '#', or ';'. */
+- const char *p = (const char *)strpbrk (url, "@/?#;");
+- if (!p || *p != '@')
+- return url;
+- return p + 1;
++ /*
++ * This whole file implements https://www.rfc-editor.org/rfc/rfc2396 .
++ * RFC 2396 is outdated since 2005 and needs a rewrite or a thorough re-visit.
++ *
++ * The RFC says
++ * server = [ [ userinfo "@" ] hostport ]
++ * userinfo = *( unreserved | escaped | ";" | ":" | "&" | "=" | "+" | "$" | "," )
++ * unreserved = alphanum | mark
++ * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
++ */
++ static const char *allowed = "-_.!~*'();:&=+$,";
++
++ for (const char *p = url; *p; p++)
++ {
++ if (c_isalnum(*p))
++ continue;
++
++ if (strchr(allowed, *p))
++ continue;
++
++ if (*p == '%' && c_isxdigit(p[1]) && c_isxdigit(p[2]))
++ {
++ p += 2;
++ continue;
++ }
++
++ if (*p == '@')
++ return p + 1;
++
++ break;
++ }
++
++ return url;
+ }
+
+ /* Parse credentials contained in [BEG, END). The region is expected
+--
+2.33.0
+
diff --git a/backport-src-url.c-maybe_prepend_scheme-Print-message-only-in.patch b/backport-src-url.c-maybe_prepend_scheme-Print-message-only-in.patch
new file mode 100644
index 0000000..8e8e216
--- /dev/null
+++ b/backport-src-url.c-maybe_prepend_scheme-Print-message-only-in.patch
@@ -0,0 +1,26 @@
+From d98df662121977f3d3ba69d0cfbd4d3322714f2d Mon Sep 17 00:00:00 2001
+From: Darshit Shah <darnir@gnu.org>
+Date: Fri, 15 Nov 2024 22:28:41 +0100
+Subject: [PATCH] * src/url.c (maybe_prepend_scheme): Print message only in
+ verbose mode
+
+---
+ src/url.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/url.c b/src/url.c
+index 2f27c48a..913db4f1 100644
+--- a/src/url.c
++++ b/src/url.c
+@@ -625,7 +625,7 @@ maybe_prepend_scheme (const char *url)
+ return NULL;
+
+
+- fprintf(stderr, "Prepended http:// to '%s'\n", url);
++ logprintf (LOG_VERBOSE, _ ("Prepended http:// to '%s'\n"), url);
+ return aprintf ("http://%s", url);
+ }
+
+--
+2.23.0
+
diff --git a/sources b/sources
new file mode 100644
index 0000000..0575619
--- /dev/null
+++ b/sources
@@ -0,0 +1,2 @@
+817627c75c626274297c4ad1d188499d backport-wget-1.17-path.patch
+e7f7ca2f215b711f76584756ebd3c853 wget-1.21.4.tar.gz
diff --git a/wget.spec b/wget.spec
new file mode 100644
index 0000000..964a998
--- /dev/null
+++ b/wget.spec
@@ -0,0 +1,127 @@
+Name: wget
+Version: 1.21.4
+Release: 3
+Summary: A package for retrieving files using HTTP, HTTPS, FTP and FTPS the most widely-used Internet protocols.
+License: GPL-3.0-or-later AND LGPL-2.1-or-later
+Url: http://www.gnu.org/software/wget/
+Source: https://ftp.gnu.org/gnu/wget/wget-%{version}.tar.gz
+
+Patch0: backport-wget-1.17-path.patch
+Patch1: backport-CVE-2024-38428.patch
+Patch2: backport-CVE-2024-10524.patch
+Patch3: backport-src-url.c-maybe_prepend_scheme-Print-message-only-in.patch
+
+Provides: webclient bundled(gnulib)
+BuildRequires: make perl-HTTP-Daemon python3 libuuid-devel perl-podlators libpsl-devel libmetalink-devel
+BuildRequires: gnutls-devel pkgconfig texinfo gettext autoconf libidn2-devel gpgme-devel zlib-devel
+BuildRequires: gcc
+
+%description
+GNU Wget is a free software package for retrieving files using HTTP, HTTPS,
+FTP and FTPS the most widely-used Internet protocols. It is a non-interactive
+commandline tool, so it may easily be called from scripts, cron jobs, terminals
+without X-Windows support, etc.
+
+%package help
+Summary: help package for %{name}
+
+%description help
+This is the help package for %{name}. It includes some doc
+files and man, info files.
+
+%prep
+%autosetup -p1
+
+%build
+%configure --with-ssl=gnutls --with-libpsl --enable-largefile --enable-opie --enable-digest --enable-ntlm --enable-nls --enable-ipv6 --disable-rpath --with-metalink --disable-year2038
+
+%make_build
+
+%install
+%make_install CFLAGS="$RPM_OPT_FLAGS"
+%find_lang %{name}
+%find_lang %{name}-gnulib
+rm -f %{buildroot}%{_infodir}/dir
+
+%check
+make check
+
+%files -f %{name}.lang -f %{name}-gnulib.lang
+%doc AUTHORS COPYING
+%config(noreplace) %{_sysconfdir}/wgetrc
+%{_bindir}/wget
+
+%files help
+%doc MAILING-LIST NEWS README doc/sample.wgetrc
+%{_mandir}/man1/wget.*
+%{_infodir}/*
+
+%changelog
+* Thu Nov 21 2024 Han Jinpeng <hanjinpeng@kylinos.cn> -1.21.4-3
+- Type:CVE
+- ID:CVE-2024-10524
+- SUG:NA
+- DESC: fix CVE-2024-10524 and also fix Print message issue
+
+* Sun Jun 16 2024 xuchenchen <xuchenchen@kylinos.cn> -1.21.4-2
+- Type:CVES
+- ID:NA
+- SUG:NA
+- DESC:backport CVE-2024-38428
+
+* Fri Jul 28 2023 xingwei <xingwei14@h-partners.com> - 1.21.4-1
+- Type:requirements
+- ID:NA
+- SUG:NA
+- DESC:update wget to 1.21.4
+
+* Fri Feb 03 2023 xingwei <xingwei14@h-partners.com> - 1.21.3-1
+- Type:requirements
+- ID:NA
+- SUG:NA
+- DESC:update wget to 1.21.3
+
+* Sat Oct 22 2022 gaihuiying <eaglegai@163.com> - 1.21.2-2
+- Type:bugfix
+- ID:NA
+- SUG:NA
+- DESC:fix find_cell(): wget killed by SIGSEGV
+
+* Tue Mar 22 2022 xihaochen <xihaochen@huawei.com> - 1.21.2-1
+- Type:requirements
+- ID:NA
+- SUG:NA
+- DESC:update wget to 1.21.2
+
+* Fri Jul 30 2021 gaihuiying <gaihuiying1@huawei.com> - 1.20.3-5
+- Type:bugfix
+- ID:NA
+- SUG:NA
+- DESC:fix build error with gcc10
+
+* Thu May 27 2021 lijingyuan <lijingyuan3@huawei.com> - 1.20.3-4
+- Type:bugfix
+- ID:NA
+- SUG:NA
+- DESC:Add the compilation dependency of gcc.
+
+* Tue Dec 15 2020 xihaochen <xihaochen@huawei.com> - 1.20.3-3
+- Type:requirement
+- ID:NA
+- SUG:NA
+- DESC:update source url
+
+* Thu Apr 23 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.20.3-2
+- Type:bugfix
+- ID:NA
+- SUG:NA
+- DESC:Sanitize input param dl_total_time
+
+* Sat Jan 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.20.3-1
+- Type:NA
+- ID:NA
+- SUG:NA
+- DESC:Package upgrade
+
+* Sat Sep 14 2019 huzhiyu<huzhiyu1@huawei.com> - 1.19.5-6
+- Package init