summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtupkg/client/tupkg3
-rwxr-xr-xtupkg/server/tupkgs14
2 files changed, 12 insertions, 5 deletions
diff --git a/tupkg/client/tupkg b/tupkg/client/tupkg
index c4806c9f..021e647b 100755
--- a/tupkg/client/tupkg
+++ b/tupkg/client/tupkg
@@ -87,6 +87,9 @@ class ClientSocket:
reply = self.readMsg(1)
if reply['result'] == ["PASS"]:
return 1
+ elif reply['result'] == ["SQLERR"]:
+ print "SQL server-side error"
+ return 0
else:
return 0
diff --git a/tupkg/server/tupkgs b/tupkg/server/tupkgs
index ca9ab26d..05d60241 100755
--- a/tupkg/server/tupkgs
+++ b/tupkg/server/tupkgs
@@ -119,11 +119,15 @@ class ClientSocket(threading.Thread):
m = md5.new()
m.update(authdata['password'][0])
encpw = m.hexdigest()
- q.execute("SELECT ID, Suspended, AccountTypeID FROM Users WHERE Username = '"+
- MySQLdb.escape_string(authdata['username'][0])+
- "' AND Passwd = '"+
- MySQLdb.escape_string(encpw)+
- "'")
+ try:
+ q.execute("SELECT ID, Suspended, AccountTypeID FROM Users WHERE Username = '"+
+ MySQLdb.escape_string(authdata['username'][0])+
+ "' AND Passwd = '"+
+ MySQLdb.escape_string(encpw)+
+ "'")
+ except MySQLdb.OperationalError:
+ self.sendMsg("result=SQLERR")
+ return 0
if q.rowcount == 0:
self.sendMsg("result=FAIL")
return 0