From d3a835bef6287022fcf63b097df2379ce1809aee Mon Sep 17 00:00:00 2001 From: Matt Hamilton Date: Mon, 22 Aug 2016 15:05:34 -0700 Subject: [PATCH] check password against MD5 for compatibility --- syncplay/protocols.py | 4 ++-- syncplay/server.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/syncplay/protocols.py b/syncplay/protocols.py index 2eeafe8..48f5b90 100644 --- a/syncplay/protocols.py +++ b/syncplay/protocols.py @@ -325,11 +325,11 @@ class SyncServerProtocol(JSONCommandProtocol): return username, serverPassword, roomName, version def _checkPassword(self, serverPassword): - if self._factory.password: + if self._factory.password_sha512 or self._factory.password_md5: if not serverPassword: self.dropWithError(getMessage("password-required-server-error")) return False - if serverPassword != self._factory.password: + if serverPassword != self._factory.password_md5 and serverPassword != self._factory.password_sha512: self.dropWithError(getMessage("wrong-password-server-error")) return False return True diff --git a/syncplay/server.py b/syncplay/server.py index b7a0c85..df5aaa3 100644 --- a/syncplay/server.py +++ b/syncplay/server.py @@ -17,8 +17,10 @@ class SyncFactory(Factory): def __init__(self, password='', motdFilePath=None, isolateRooms=False, salt=None, disableReady=False): print getMessage("welcome-server-notification").format(syncplay.version) if password: - password = hashlib.sha512(password).hexdigest() - self.password = password + password_sha512 = hashlib.sha512(password).hexdigest() + password_md5 = hashlib.md5(password).hexdigest() + self.password_sha512 = password_sha512 + self.password_md5 = password_md5 if salt is None: salt = RandomStringGenerator.generate_server_salt() print getMessage("no-salt-notification").format(salt)