summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-26 10:22:24 +0800
committerTeddy <[email protected]>2013-08-26 10:22:24 +0800
commit595d0a7826e2fdb9ee859f9cde90cfef844b0342 (patch)
tree91c1a2c035a5cd92b4fbec42fc3a100d8015e74c /server
parent9b9993e33932058cc78d1882a301eefd22380b45 (diff)
fixed a bug in server
Diffstat (limited to 'server')
-rw-r--r--server/piztor/prob.py3
-rw-r--r--server/piztor/server.py4
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,