07bcc2c05b
GNU wget 1.16 [CVE-2014-4877] [boo#902709] OBS-URL: https://build.opensuse.org/request/show/258883 OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=47
116 lines
3.6 KiB
Diff
116 lines
3.6 KiB
Diff
---
|
|
configure.ac | 16 ++++++++++++++++
|
|
src/Makefile.am | 2 +-
|
|
src/retr.c | 37 +++++++++++++++++++++++++++++++++++++
|
|
tests/Makefile.am | 1 +
|
|
4 files changed, 55 insertions(+), 1 deletion(-)
|
|
|
|
Index: wget-1.16/configure.ac
|
|
===================================================================
|
|
--- wget-1.16.orig/configure.ac 2014-10-29 20:41:01.000000000 +0000
|
|
+++ wget-1.16/configure.ac 2014-10-29 20:41:05.000000000 +0000
|
|
@@ -366,6 +366,22 @@ else
|
|
fi
|
|
|
|
|
|
+dnl
|
|
+dnl libproxy support
|
|
+dnl
|
|
+AC_ARG_ENABLE(libproxy,
|
|
+ [ --enable-libproxy libproxy support for system wide proxy configuration])
|
|
+if test "${enable_libproxy}" != "no"
|
|
+then
|
|
+ PKG_CHECK_MODULES([libproxy], [libproxy-1.0], [enable_libproxy=yes], [enable_libproxy=no])
|
|
+fi
|
|
+if test "${enable_libproxy}" = "yes"
|
|
+then
|
|
+ AC_SUBST(libproxy_CFLAGS)
|
|
+ AC_SUBST(libproxy_LIBS)
|
|
+ AC_DEFINE([HAVE_LIBPROXY], 1, [Define when using libproxy])
|
|
+fi
|
|
+
|
|
dnl **********************************************************************
|
|
dnl Checks for IPv6
|
|
dnl **********************************************************************
|
|
Index: wget-1.16/src/Makefile.am
|
|
===================================================================
|
|
--- wget-1.16.orig/src/Makefile.am 2014-10-29 20:41:01.000000000 +0000
|
|
+++ wget-1.16/src/Makefile.am 2014-10-29 20:41:05.000000000 +0000
|
|
@@ -37,7 +37,7 @@ endif
|
|
|
|
# The following line is losing on some versions of make!
|
|
DEFS += -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
|
|
-LIBS += $(LIBICONV) $(LIBINTL) $(LIB_CLOCK_GETTIME)
|
|
+LIBS += $(LIBICONV) $(LIBINTL) $(libproxy_LIBS) $(LIB_CLOCK_GETTIME)
|
|
|
|
EXTRA_DIST = css.l css.c css_.c build_info.c.in
|
|
|
|
Index: wget-1.16/src/retr.c
|
|
===================================================================
|
|
--- wget-1.16.orig/src/retr.c 2014-10-29 20:41:01.000000000 +0000
|
|
+++ wget-1.16/src/retr.c 2014-10-29 20:41:05.000000000 +0000
|
|
@@ -57,6 +57,10 @@ as that of the covered work. */
|
|
#include "html-url.h"
|
|
#include "iri.h"
|
|
|
|
+#ifdef HAVE_LIBPROXY
|
|
+#include "proxy.h"
|
|
+#endif
|
|
+
|
|
/* Total size of downloaded files. Used to enforce quota. */
|
|
SUM_SIZE_INT total_downloaded_bytes;
|
|
|
|
@@ -1266,7 +1270,40 @@ getproxy (struct url *u)
|
|
break;
|
|
}
|
|
if (!proxy || !*proxy)
|
|
+#ifdef HAVE_LIBPROXY
|
|
+ {
|
|
+ pxProxyFactory *pf = px_proxy_factory_new();
|
|
+ if (!pf)
|
|
+ {
|
|
+ debug_logprintf (_("Allocating memory for libproxy failed"));
|
|
+ return NULL;
|
|
+ }
|
|
+ int i;
|
|
+ char direct[] = "direct://";
|
|
+
|
|
+ debug_logprintf (_("asking libproxy about url '%s'\n"), u->url);
|
|
+ char **proxies = px_proxy_factory_get_proxies(pf, u->url);
|
|
+ if (proxies[0])
|
|
+ {
|
|
+ char *check = NULL;
|
|
+ asprintf(&check , "%s", proxies[0]);
|
|
+ debug_logprintf (_("libproxy suggest to use '%s'\n"), check);
|
|
+ if(strcmp(check ,direct) != 0)
|
|
+ {
|
|
+ asprintf(&proxy , "%s", proxies[0]);
|
|
+ debug_logprintf (_("case 2: libproxy setting to use '%s'\n"), proxy);
|
|
+ }
|
|
+ }
|
|
+ for(i=0;proxies[i];i++) free(proxies[i]);
|
|
+ free(proxies);
|
|
+ free(pf);
|
|
+
|
|
+ if (!proxy || !*proxy)
|
|
+ return NULL;
|
|
+ }
|
|
+#else
|
|
return NULL;
|
|
+#endif
|
|
|
|
/* Handle shorthands. `rewritten_storage' is a kludge to allow
|
|
getproxy() to return static storage. */
|
|
Index: wget-1.16/tests/Makefile.am
|
|
===================================================================
|
|
--- wget-1.16.orig/tests/Makefile.am 2014-10-29 20:41:40.000000000 +0000
|
|
+++ wget-1.16/tests/Makefile.am 2014-10-29 20:42:18.000000000 +0000
|
|
@@ -33,6 +33,7 @@
|
|
# Version: $(VERSION)
|
|
#
|
|
|
|
+LIBS += $(libproxy_LIBS)
|
|
|
|
../src/wget$(EXEEXT):
|
|
cd ../src && $(MAKE) $(AM_MAKEFLAGS)
|