[Pkg-privacy-commits] [obfsproxy] 10/11: Add patch to work around Python issue 10212

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:02:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch tpo-quantal-backport
in repository obfsproxy.

commit 257b2767e6b281a67a4ccf179e87699814179061
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Thu Mar 27 14:42:28 2014 +0100

    Add patch to work around Python issue 10212
---
 ...ray-to-str-before-calling-struct.unpack-i.patch | 48 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 49 insertions(+)

diff --git a/debian/patches/0001-Cast-bytearray-to-str-before-calling-struct.unpack-i.patch b/debian/patches/0001-Cast-bytearray-to-str-before-calling-struct.unpack-i.patch
new file mode 100644
index 0000000..ff013af
--- /dev/null
+++ b/debian/patches/0001-Cast-bytearray-to-str-before-calling-struct.unpack-i.patch
@@ -0,0 +1,48 @@
+From d50446b22dea5bd48c27fa989fb4cedd5fcd2c3d Mon Sep 17 00:00:00 2001
+From: Yawning Angel <yawning at schwanenlied.me>
+Date: Thu, 27 Mar 2014 02:43:07 +0000
+Subject: [PATCH] Cast bytearray to str before calling struct.unpack() in
+ socks5.py.
+
+This works around <http://bugs.python.org/issue10212> which prevented
+the SOCKS5 server from working for clients running Python < 2.7.4,
+fixing <https://bugs.torproject.org/11329>.
+---
+ ChangeLog                   |    5 +++++
+ obfsproxy/network/socks5.py |   10 ++++++----
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+Index: git/obfsproxy/network/socks5.py
+===================================================================
+--- git.orig/obfsproxy/network/socks5.py	2014-03-27 14:33:34.000000000 +0100
++++ git/obfsproxy/network/socks5.py	2014-03-27 14:46:21.430531033 +0100
+@@ -499,10 +499,11 @@
+             ntohs (bool): Convert from network byte order?
+         """
+ 
++        foo = str(self[0:2])
+         if ntohs:
+-            ret = struct.unpack("!H", self[0:2])[0]
++            ret = struct.unpack("!H", foo)[0]
+         else:
+-            ret = struct.unpack("H", self[0:2])[0]
++            ret = struct.unpack("H", foo)[0]
+         del self[0:2]
+         return ret
+ 
+@@ -530,11 +531,12 @@
+             ntohl (bool): Convert from network byte order?
+         """
+ 
++        foo = str(self[0:4])
+         if ntohl:
+-            ret = struct.unpack("!I", self[0:4])[0]
++            ret = struct.unpack("!I", foo)[0]
+         else:
+-            ret = struct.unpack("I", self[0:4])[0]
+-        del self[0:2]
++            ret = struct.unpack("I", foo)[0]
++        del self[0:4]
+         return ret
+ 
+     def add(self, val):
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..dc6ca96
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Cast-bytearray-to-str-before-calling-struct.unpack-i.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git



More information about the Pkg-privacy-commits mailing list