From efea3e08cc85371baeecd38575102b2585dd456e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Tue, 16 Aug 2016 19:11:50 +0800 Subject: [PATCH] fix error return --- shadowsocks/obfsplugin/auth.py | 9 ++------- shadowsocks/obfsplugin/verify.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/shadowsocks/obfsplugin/auth.py b/shadowsocks/obfsplugin/auth.py index 8b673f3..c132114 100644 --- a/shadowsocks/obfsplugin/auth.py +++ b/shadowsocks/obfsplugin/auth.py @@ -313,8 +313,7 @@ class auth_sha1(verify_base): pos = common.ord(self.recv_buf[6]) + 6 out_buf = self.recv_buf[pos:length - 10] if len(out_buf) < 12: - self.recv_buf = b'' - logging.info('auth_sha1: too short') + logging.info('auth_sha1: too short, data %s' % (binascii.hexlify(self.recv_buf),)) return self.not_match_return(self.recv_buf) utc_time = struct.unpack(' self.max_time_dif \ or common.int32(utc_time - self.server_info.data.startup_time) < -self.max_time_dif / 2: - self.recv_buf = b'' logging.info('auth_sha1: wrong timestamp, time_dif %d, data %s' % (time_dif, binascii.hexlify(out_buf),)) return self.not_match_return(self.recv_buf) elif self.server_info.data.insert(client_id, connection_id): @@ -331,7 +329,6 @@ class auth_sha1(verify_base): self.client_id = client_id self.connection_id = connection_id else: - self.recv_buf = b'' logging.info('auth_sha1: auth fail, data %s' % (binascii.hexlify(out_buf),)) return self.not_match_return(self.recv_buf) self.recv_buf = self.recv_buf[length:] @@ -551,8 +548,7 @@ class auth_sha1_v2(verify_base): pos = struct.unpack('>H', self.recv_buf[7:9])[0] + 6 out_buf = self.recv_buf[pos:length - 10] if len(out_buf) < 12: - self.recv_buf = b'' - logging.info('auth_sha1_v2: too short, data %s' % (binascii.hexlify(out_buf),)) + logging.info('auth_sha1_v2: too short, data %s' % (binascii.hexlify(self.recv_buf),)) return self.not_match_return(self.recv_buf) client_id = struct.unpack(' len(self.recv_buf):