1 |
On 01/12/2017 03:10 PM, Brian Dolbec wrote: |
2 |
> On Thu, 12 Jan 2017 09:36:36 -0800 |
3 |
> Zac Medico <zmedico@g.o> wrote: |
4 |
> |
5 |
>> Use the idna codec to decode the destination address that is read |
6 |
>> from the client. This fixes a "TypeError: must be str, not bytes" |
7 |
>> exception raised from getaddrinfo with Python 3.4.5. |
8 |
>> |
9 |
>> X-Gentoo-Bug: 604474 |
10 |
>> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604474 |
11 |
>> --- |
12 |
>> bin/socks5-server.py | 5 +++++ |
13 |
>> 1 file changed, 5 insertions(+) |
14 |
>> |
15 |
>> diff --git a/bin/socks5-server.py b/bin/socks5-server.py |
16 |
>> index cfe3ece..d46cf53 100644 |
17 |
>> --- a/bin/socks5-server.py |
18 |
>> +++ b/bin/socks5-server.py |
19 |
>> @@ -83,6 +83,11 @@ class Socks5Server(object): |
20 |
>> data = yield from |
21 |
>> reader.readexactly(1) addr_len, = struct.unpack('!B', data) |
22 |
>> addr = yield from |
23 |
>> reader.readexactly(addr_len) |
24 |
>> + try: |
25 |
>> + addr = addr.decode('idna') |
26 |
>> + except UnicodeDecodeError: |
27 |
>> + rpl = 0x04 # host |
28 |
>> unreachable + |
29 |
>> elif atyp == 0x04: # IPv6 |
30 |
>> data = yield from |
31 |
>> reader.readexactly(16) addr = socket.inet_ntop(socket.AF_INET6, data) |
32 |
> |
33 |
> |
34 |
> looks good |
35 |
> |
36 |
|
37 |
Thanks, pushed: |
38 |
|
39 |
https://gitweb.gentoo.org/proj/portage.git/commit/?id=0d32c30b1db848e9eac6fe2e216e6373846467a2 |
40 |
-- |
41 |
Thanks, |
42 |
Zac |