Merge d3a835bef6287022fcf63b097df2379ce1809aee into b4e114aac3f8b3fc95558dcc7bed163638e82a0d

This commit is contained in:
Matt Hamilton 2017-05-11 15:25:24 +00:00 committed by GitHub
commit 758e18892c
3 changed files with 7 additions and 5 deletions

View File

@ -90,7 +90,7 @@ class SyncplayClient(object):
self.setUsername(config['name']) self.setUsername(config['name'])
self.setRoom(config['room']) self.setRoom(config['room'])
if config['password']: if config['password']:
config['password'] = hashlib.md5(config['password']).hexdigest() config['password'] = hashlib.sha512(config['password']).hexdigest()
self._serverPassword = config['password'] self._serverPassword = config['password']
if not config['file']: if not config['file']:
self.__getUserlistOnLogon = True self.__getUserlistOnLogon = True

View File

@ -342,11 +342,11 @@ class SyncServerProtocol(JSONCommandProtocol):
return username, serverPassword, roomName, version return username, serverPassword, roomName, version
def _checkPassword(self, serverPassword): def _checkPassword(self, serverPassword):
if self._factory.password: if self._factory.password_sha512 or self._factory.password_md5:
if not serverPassword: if not serverPassword:
self.dropWithError(getMessage("password-required-server-error")) self.dropWithError(getMessage("password-required-server-error"))
return False 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")) self.dropWithError(getMessage("wrong-password-server-error"))
return False return False
return True return True

View File

@ -18,8 +18,10 @@ class SyncFactory(Factory):
self.isolateRooms = isolateRooms self.isolateRooms = isolateRooms
print getMessage("welcome-server-notification").format(syncplay.version) print getMessage("welcome-server-notification").format(syncplay.version)
if password: if password:
password = hashlib.md5(password).hexdigest() password_sha512 = hashlib.sha512(password).hexdigest()
self.password = password password_md5 = hashlib.md5(password).hexdigest()
self.password_sha512 = password_sha512
self.password_md5 = password_md5
if salt is None: if salt is None:
salt = RandomStringGenerator.generate_server_salt() salt = RandomStringGenerator.generate_server_salt()
print getMessage("no-salt-notification").format(salt) print getMessage("no-salt-notification").format(salt)