diff options
-rw-r--r-- | server/piztor/prob.py | 3 | ||||
-rw-r--r-- | server/piztor/server.py | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/server/piztor/prob.py b/server/piztor/prob.py index f18e42d..0ed328f 100644 --- a/server/piztor/prob.py +++ b/server/piztor/prob.py @@ -9,11 +9,12 @@ host = "localhost" port = 9990 def gen_auth(username, password): - length = 4 + 1 + len(username) + 1 + len(password) + length = 4 + 1 + len(username) + 1 + len(password) + 1 data = pack("!LB", length, 0x00) data += username data += "\0" data += password + data += "\0" return data def gen_update_location(token, username, lat, lng): diff --git a/server/piztor/server.py b/server/piztor/server.py index 511d51b..725fc5b 100644 --- a/server/piztor/server.py +++ b/server/piztor/server.py @@ -111,7 +111,7 @@ class UserAuthHandler(RequestHandler): raise BadReqError("Authentication: Malformed request body") username = tr_data[0:pos] - password = tr_data[pos + 1:] + password = tr_data[pos + 1:-1] logger.info("Trying to login with " \ "(username = {0}, password = {1})" \ .format(username, password)) @@ -136,7 +136,7 @@ class UserAuthHandler(RequestHandler): if uauth is None: raise DBCorruptedError() if not uauth.check_password(password): - logger.info("Incorrect password: {0}".format(username)) + logger.info("Incorrect password: {0}".format(password)) return struct.pack("!LBBL32s", UserAuthHandler \ ._user_auth_response_size, _OptCode.user_auth, |