Accepting request 61373 from home:dimstar:branches:GNOME:Factory
OBS-URL: https://build.opensuse.org/request/show/61373 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/libproxy?expand=0&rev=58
This commit is contained in:
parent
a000d26581
commit
6a92ebcf4d
151
libproxy-backports.patch
Normal file
151
libproxy-backports.patch
Normal file
@ -0,0 +1,151 @@
|
||||
Index: libproxy/url.cpp
|
||||
===================================================================
|
||||
--- libproxy/url.cpp.orig
|
||||
+++ libproxy/url.cpp
|
||||
@@ -36,12 +36,9 @@
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
-#define pfsize(st) (st.st_size)
|
||||
#define close _close
|
||||
#define read _read
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
-#else
|
||||
-#define pfsize(st) (st.st_blksize * st.st_blocks)
|
||||
#endif
|
||||
|
||||
#include "url.hpp"
|
||||
@@ -56,13 +53,6 @@ using namespace std;
|
||||
// This is the maximum pac size (to avoid memory attacks)
|
||||
#define PAC_MAX_SIZE 102400
|
||||
|
||||
-const string url::GENERIC_DELIMITERS(":/?#[]@");
|
||||
-const string url::SUBCOMPONENT_DELIMITERS("!$&'()*+,;=");
|
||||
-const string url::ALLOWED_IN_USERINFO_ELEMENT(url::SUBCOMPONENT_DELIMITERS);
|
||||
-const string url::ALLOWED_IN_USERINFO(url::ALLOWED_IN_USERINFO_ELEMENT + ":");
|
||||
-const string url::ALLOWED_IN_PATH_ELEMENT(url::SUBCOMPONENT_DELIMITERS + ":@");
|
||||
-const string url::ALLOWED_IN_PATH(url::ALLOWED_IN_PATH_ELEMENT + "/");
|
||||
-
|
||||
static inline int get_default_port(string scheme) {
|
||||
struct servent *serv;
|
||||
size_t plus = scheme.find('+');
|
||||
@@ -109,8 +99,8 @@ bool url::is_valid(const string url_) {
|
||||
|
||||
string url::encode(const string &data, const string &valid_reserved) {
|
||||
ostringstream encoded;
|
||||
- for (int i=0; data[i]; i++) {
|
||||
- if (isalnum(data[i])
|
||||
+ for (unsigned int i=0; i < data.size(); i++) {
|
||||
+ if (isalnum((unsigned char)data[i])
|
||||
|| valid_reserved.find(data[i]) != string::npos
|
||||
|| string("-._~").find(data[i]) != string::npos)
|
||||
encoded << data[i];
|
||||
@@ -211,7 +201,8 @@ url::url(const string &url) throw(parse_
|
||||
host_start = userinfo_end + 1;
|
||||
|
||||
/* Check for IPv6 IP */
|
||||
- if (hier_part[host_start] == '[') {
|
||||
+ if (host_start < hier_part.size()
|
||||
+ && hier_part[host_start] == '[') {
|
||||
host_end = hier_part.find(']', host_start);
|
||||
if (host_end == string::npos)
|
||||
throw parse_error("Invalid URL: " + url);
|
||||
@@ -232,7 +223,7 @@ url::url(const string &url) throw(parse_
|
||||
/* Get port */
|
||||
m_port = get_default_port(m_scheme);
|
||||
|
||||
- if (host_end != hier_part.size()
|
||||
+ if (host_end < hier_part.size()
|
||||
&& hier_part[host_end] == ':') {
|
||||
size_t port_start = host_end + 1;
|
||||
m_port = atoi(hier_part.c_str() + port_start);
|
||||
@@ -400,10 +391,12 @@ char* url::get_pac() {
|
||||
struct stat st;
|
||||
if ((sock = ::open(m_path.c_str(), O_RDONLY)) < 0)
|
||||
return NULL;
|
||||
- if (!fstat(sock, &st) && pfsize(st) < PAC_MAX_SIZE) {
|
||||
- buffer = new char[pfsize(st)+1];
|
||||
- if (read(sock, buffer, pfsize(st)) == 0) {
|
||||
- delete buffer;
|
||||
+
|
||||
+ if (!fstat(sock, &st) && st.st_size < PAC_MAX_SIZE) {
|
||||
+ buffer = new char[st.st_size+1];
|
||||
+ memset(buffer, 0, st.st_size+1);
|
||||
+ if (read(sock, buffer, st.st_size) == 0) {
|
||||
+ delete[] buffer;
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
Index: libproxy/modules/config_gnome.cpp
|
||||
===================================================================
|
||||
--- libproxy/modules/config_gnome.cpp.orig
|
||||
+++ libproxy/modules/config_gnome.cpp
|
||||
@@ -102,10 +102,8 @@ static int popen2(const char *program, F
|
||||
if (dup2(rpipe[1], STDOUT_FILENO) != STDOUT_FILENO) _exit(2);
|
||||
|
||||
// Close unneeded fds
|
||||
- close(rpipe[0]);
|
||||
- close(rpipe[1]);
|
||||
- close(wpipe[0]);
|
||||
- close(wpipe[1]);
|
||||
+ for (int i = 3; i < sysconf(_SC_OPEN_MAX); i++)
|
||||
+ close(i);
|
||||
|
||||
// Exec
|
||||
execl("/bin/sh", "sh", "-c", program, (char*) NULL);
|
||||
@@ -194,8 +192,8 @@ public:
|
||||
else if (this->data[PROXY_MODE] == "manual") {
|
||||
string type, host, port;
|
||||
bool auth = this->data[PROXY_USE_AUTHENTICATION] == "true";
|
||||
- string username = url::encode(this->data[PROXY_AUTH_USER], url::ALLOWED_IN_USERINFO_ELEMENT);
|
||||
- string password = url::encode(this->data[PROXY_AUTH_PASSWORD], url::ALLOWED_IN_USERINFO_ELEMENT);
|
||||
+ string username = url::encode(this->data[PROXY_AUTH_USER], URL_ALLOWED_IN_USERINFO_ELEMENT);
|
||||
+ string password = url::encode(this->data[PROXY_AUTH_PASSWORD], URL_ALLOWED_IN_USERINFO_ELEMENT);
|
||||
bool same_proxy = this->data[PROXY_SAME_FOR_ALL] == "true";
|
||||
|
||||
// If socks is set use it (except when same_proxy is set)
|
||||
Index: libproxy/proxy.cpp
|
||||
===================================================================
|
||||
--- libproxy/proxy.cpp.orig
|
||||
+++ libproxy/proxy.cpp
|
||||
@@ -164,7 +164,7 @@ proxy_factory::proxy_factory() {
|
||||
proxy_factory::~proxy_factory() {
|
||||
lock();
|
||||
|
||||
- if (this->pac) delete this->pac;
|
||||
+ if (this->pac) delete[] this->pac;
|
||||
if (this->pacurl) delete this->pacurl;
|
||||
|
||||
unlock();
|
||||
Index: libproxy/url.hpp
|
||||
===================================================================
|
||||
--- libproxy/url.hpp.orig
|
||||
+++ libproxy/url.hpp
|
||||
@@ -27,6 +27,13 @@
|
||||
|
||||
#include "config.hpp"
|
||||
|
||||
+#define URL_GENERIC_DELIMITERS ":/?#[]@"
|
||||
+#define URL_SUBCOMPONENT_DELIMITERS "!$&'()*+,;="
|
||||
+#define URL_ALLOWED_IN_USERINFO_ELEMENT URL_SUBCOMPONENT_DELIMITERS
|
||||
+#define URL_ALLOWED_IN_USERINFO URL_ALLOWED_IN_USERINFO_ELEMENT ":"
|
||||
+#define URL_ALLOWED_IN_PATH_ELEMENT URL_SUBCOMPONENT_DELIMITERS ":@"
|
||||
+#define URL_ALLOWED_IN_PATH URL_ALLOWED_IN_PATH_ELEMENT "/"
|
||||
+
|
||||
namespace libproxy {
|
||||
|
||||
using namespace std;
|
||||
@@ -38,13 +45,6 @@ public:
|
||||
|
||||
class DLL_PUBLIC url {
|
||||
public:
|
||||
- static const string ALLOWED_IN_PATH;
|
||||
- static const string ALLOWED_IN_PATH_ELEMENT;
|
||||
- static const string ALLOWED_IN_USERINFO;
|
||||
- static const string ALLOWED_IN_USERINFO_ELEMENT;
|
||||
- static const string GENERIC_DELIMITERS;
|
||||
- static const string SUBCOMPONENT_DELIMITERS;
|
||||
-
|
||||
static bool is_valid(const string url);
|
||||
static string encode(const string &data, const string &valid_reserved = "");
|
||||
|
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 15 19:16:02 UTC 2011 - dimstar@opensuse.org
|
||||
|
||||
- Add libproxy-backports.patch: Backport critical fixes from
|
||||
upstream codestream.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 14 17:14:18 UTC 2011 - dimstar@opensuse.org
|
||||
|
||||
- Add libproxy-xul2.patch: Add compatibility to build against
|
||||
xulrunner 2.0. Patch submitted upstream, issue#155.
|
||||
- Use xulrunner 2.0 on openSUSE 11.4.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 6 16:32:28 CET 2010 - vuntz@opensuse.org
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package libproxy-plugins (Version 0.4.6)
|
||||
# spec file for package libproxy (Version 0.4.6)
|
||||
#
|
||||
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
@ -23,6 +23,9 @@
|
||||
%define have_mono 0
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version} > 1130
|
||||
%define xulrunner_ver 20
|
||||
%else
|
||||
%if 0%{?suse_version} > 1120
|
||||
%define xulrunner_ver 192
|
||||
%else
|
||||
@ -32,6 +35,7 @@
|
||||
%define xulrunner_ver 190
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
Url: http://code.google.com/p/libproxy/
|
||||
%define _name libproxy
|
||||
|
||||
@ -51,6 +55,10 @@ Source98: update-from-svn.sh
|
||||
Source99: baselibs.conf
|
||||
# PATCH-FEATURE-UPSTREAM libproxy-sysconfig-support.patch bnc#655483 dmacvicar@novell.com -- Add /etc/sysconfig support. Also tracked at http://code.google.com/p/libproxy/issues/detail?id=150
|
||||
Patch0: libproxy-sysconfig-support.patch
|
||||
# PATCH-FEATURE-UPSTREAM libproxy-xul2.patch dimstar@opensuse.org -- Add compatibility to build against xulrunner 2.0
|
||||
Patch1: libproxy-xul2.patch
|
||||
# PATCH-FIX-UPSTREAM libproxy-backports.patch dimstar@opensuse.org -- Backport from upstream source: svn revs: 769,771,776,777,778,780,781,782
|
||||
Patch2: libproxy-backports.patch
|
||||
License: GPLv2+ ; LGPLv2.1+
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: cmake
|
||||
@ -292,6 +300,8 @@ about network configuration changes.
|
||||
%setup -q -n %{_sourcename}
|
||||
mkdir build
|
||||
%patch0 -p0
|
||||
%patch1 -p0
|
||||
%patch2 -p0
|
||||
|
||||
%build
|
||||
cd build
|
||||
|
104
libproxy-xul2.patch
Normal file
104
libproxy-xul2.patch
Normal file
@ -0,0 +1,104 @@
|
||||
Index: libproxy/cmake/modules/pacrunner_mozjs.cmk
|
||||
===================================================================
|
||||
--- libproxy/cmake/modules/pacrunner_mozjs.cmk (revision 783)
|
||||
+++ libproxy/cmake/modules/pacrunner_mozjs.cmk (working copy)
|
||||
@@ -14,6 +14,10 @@
|
||||
if(MOZJS_FOUND)
|
||||
include_directories(${MOZJS_INCLUDE_DIRS})
|
||||
link_directories(${MOZJS_LIBRARY_DIRS})
|
||||
+ pkg_search_module(MOZJS2 mozilla-js>=2.0b10)
|
||||
+ if(MOZJS2_FOUND)
|
||||
+ add_definitions(-DHAVE_MOZJS_2)
|
||||
+ endif(MOZJS2_FOUND)
|
||||
else()
|
||||
set(MOZJS_FOUND 0)
|
||||
endif()
|
||||
Index: libproxy/modules/pacrunner_mozjs.cpp
|
||||
===================================================================
|
||||
--- libproxy/modules/pacrunner_mozjs.cpp (revision 783)
|
||||
+++ libproxy/modules/pacrunner_mozjs.cpp (working copy)
|
||||
@@ -42,12 +42,12 @@
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
#endif
|
||||
|
||||
-static JSBool dnsResolve(JSContext *cx, JSObject * /*obj*/, uintN /*argc*/, jsval *argv, jsval *rval) {
|
||||
+static JSBool dnsResolve_(JSContext *cx, jsval hostname, jsval *vp) {
|
||||
// Get hostname argument
|
||||
- char *tmp = JS_strdup(cx, JS_GetStringBytes(JS_ValueToString(cx, argv[0])));
|
||||
+ char *tmp = JS_EncodeString(cx, JS_ValueToString(cx, hostname));
|
||||
|
||||
// Set the default return value
|
||||
- *rval = JSVAL_NULL;
|
||||
+ JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
|
||||
// Look it up
|
||||
struct addrinfo *info = NULL;
|
||||
@@ -66,7 +66,7 @@
|
||||
NI_NUMERICHOST)) goto out;
|
||||
|
||||
// We succeeded
|
||||
- *rval = STRING_TO_JSVAL(JS_NewString(cx, tmp, strlen(tmp)));
|
||||
+ JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyN(cx, tmp, strlen(tmp))));
|
||||
tmp = NULL;
|
||||
|
||||
out:
|
||||
@@ -75,15 +75,20 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
-static JSBool myIpAddress(JSContext *cx, JSObject *obj, uintN /*argc*/, jsval * /*argv*/, jsval *rval) {
|
||||
+static JSBool dnsResolve(JSContext *cx, uintN /*argc*/, jsval *vp) {
|
||||
+ jsval *argv = JS_ARGV(cx, vp);
|
||||
+ return dnsResolve_(cx, argv[0], vp);
|
||||
+}
|
||||
+
|
||||
+static JSBool myIpAddress(JSContext *cx, uintN /*argc*/, jsval *vp) {
|
||||
char *hostname = (char *) JS_malloc(cx, 1024);
|
||||
if (!gethostname(hostname, 1023)) {
|
||||
- JSString *myhost = JS_NewString(cx, hostname, strlen(hostname));
|
||||
+ JSString *myhost = JS_NewStringCopyN(cx, hostname, strlen(hostname));
|
||||
jsval arg = STRING_TO_JSVAL(myhost);
|
||||
- return dnsResolve(cx, obj, 1, &arg, rval);
|
||||
+ return dnsResolve_(cx, 1, &arg);
|
||||
}
|
||||
JS_free(cx, hostname);
|
||||
- *rval = JSVAL_NULL;
|
||||
+ JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -111,7 +116,11 @@
|
||||
//JS_SetOptions(this->jsctx, JSOPTION_VAROBJFIX);
|
||||
//JS_SetVersion(this->jsctx, JSVERSION_LATEST);
|
||||
//JS_SetErrorReporter(cx, reportError);
|
||||
+ #ifdef HAVE_MOZJS_2
|
||||
+ if (!(this->jsglb = JS_NewCompartmentAndGlobalObject(this->jsctx, &cls, NULL))) goto error;
|
||||
+ #else
|
||||
if (!(this->jsglb = JS_NewObject(this->jsctx, &cls, NULL, NULL))) goto error;
|
||||
+ #endif
|
||||
if (!JS_InitStandardClasses(this->jsctx, this->jsglb)) goto error;
|
||||
|
||||
// Define Javascript functions
|
||||
@@ -147,15 +156,19 @@
|
||||
throw bad_alloc();
|
||||
}
|
||||
jsval args[2] = {
|
||||
- STRING_TO_JSVAL(JS_NewString(this->jsctx, tmpurl, strlen(tmpurl))),
|
||||
- STRING_TO_JSVAL(JS_NewString(this->jsctx, tmphost, strlen(tmphost)))
|
||||
+ STRING_TO_JSVAL(JS_NewStringCopyN(this->jsctx, tmpurl, strlen(tmpurl))),
|
||||
+ STRING_TO_JSVAL(JS_NewStringCopyN(this->jsctx, tmphost, strlen(tmphost)))
|
||||
};
|
||||
|
||||
// Find the proxy (call FindProxyForURL())
|
||||
jsval rval;
|
||||
JSBool result = JS_CallFunctionName(this->jsctx, this->jsglb, "FindProxyForURL", 2, args, &rval);
|
||||
if (!result) return "";
|
||||
- string answer = string(JS_GetStringBytes(JS_ValueToString(this->jsctx, rval)));
|
||||
+
|
||||
+ char * tmpanswer = JS_EncodeString(this->jsctx, JS_ValueToString(this->jsctx, rval));
|
||||
+ string answer = string(tmpanswer);
|
||||
+ JS_free(this->jsctx, tmpanswer);
|
||||
+
|
||||
if (answer == "undefined") return "";
|
||||
return answer;
|
||||
}
|
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 15 19:16:02 UTC 2011 - dimstar@opensuse.org
|
||||
|
||||
- Add libproxy-backports.patch: Backport critical fixes from
|
||||
upstream codestream.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 14 17:14:18 UTC 2011 - dimstar@opensuse.org
|
||||
|
||||
- Add libproxy-xul2.patch: Add compatibility to build against
|
||||
xulrunner 2.0. Patch submitted upstream, issue#155.
|
||||
- Use xulrunner 2.0 on openSUSE 11.4.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 6 16:32:28 CET 2010 - vuntz@opensuse.org
|
||||
|
||||
|
@ -23,6 +23,9 @@
|
||||
%define have_mono 0
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version} > 1130
|
||||
%define xulrunner_ver 20
|
||||
%else
|
||||
%if 0%{?suse_version} > 1120
|
||||
%define xulrunner_ver 192
|
||||
%else
|
||||
@ -32,6 +35,7 @@
|
||||
%define xulrunner_ver 190
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
Url: http://code.google.com/p/libproxy/
|
||||
%define _name libproxy
|
||||
|
||||
@ -51,6 +55,10 @@ Source98: update-from-svn.sh
|
||||
Source99: baselibs.conf
|
||||
# PATCH-FEATURE-UPSTREAM libproxy-sysconfig-support.patch bnc#655483 dmacvicar@novell.com -- Add /etc/sysconfig support. Also tracked at http://code.google.com/p/libproxy/issues/detail?id=150
|
||||
Patch0: libproxy-sysconfig-support.patch
|
||||
# PATCH-FEATURE-UPSTREAM libproxy-xul2.patch dimstar@opensuse.org -- Add compatibility to build against xulrunner 2.0
|
||||
Patch1: libproxy-xul2.patch
|
||||
# PATCH-FIX-UPSTREAM libproxy-backports.patch dimstar@opensuse.org -- Backport from upstream source: svn revs: 769,771,776,777,778,780,781,782
|
||||
Patch2: libproxy-backports.patch
|
||||
License: GPLv2+ ; LGPLv2.1+
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: cmake
|
||||
@ -292,6 +300,8 @@ about network configuration changes.
|
||||
%setup -q -n %{_sourcename}
|
||||
mkdir build
|
||||
%patch0 -p0
|
||||
%patch1 -p0
|
||||
%patch2 -p0
|
||||
|
||||
%build
|
||||
cd build
|
||||
|
Loading…
x
Reference in New Issue
Block a user