From ada4eab628aef06f1505e1c3b304a739863c5a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Fri, 30 Sep 2016 10:12:24 +0800 Subject: [PATCH] sendback an empty packet if auth success --- shadowsocks/obfsplugin/auth.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shadowsocks/obfsplugin/auth.py b/shadowsocks/obfsplugin/auth.py index bc71959..bb7c238 100644 --- a/shadowsocks/obfsplugin/auth.py +++ b/shadowsocks/obfsplugin/auth.py @@ -544,6 +544,8 @@ class auth_sha1_v2(verify_base): return (buf, False) self.recv_buf += buf out_buf = b'' + sendback = False + if not self.has_recv_header: if len(self.recv_buf) < 6: return (b'', False) @@ -580,8 +582,8 @@ class auth_sha1_v2(verify_base): return self.not_match_return(self.recv_buf) self.recv_buf = self.recv_buf[length:] self.has_recv_header = True + sendback = True - sendback = False while len(self.recv_buf) > 2: length = struct.unpack('>H', self.recv_buf[:2])[0] if length >= 8192 or length < 7: @@ -965,6 +967,8 @@ class auth_sha1_v4(verify_base): return (buf, False) self.recv_buf += buf out_buf = b'' + sendback = False + if not self.has_recv_header: if len(self.recv_buf) <= 6: return (b'', False) @@ -1004,8 +1008,8 @@ class auth_sha1_v4(verify_base): return self.not_match_return(self.recv_buf) self.recv_buf = self.recv_buf[length:] self.has_recv_header = True + sendback = True - sendback = False while len(self.recv_buf) > 4: crc = struct.pack(' 4: crc = struct.pack('