mirror of
https://github.com/barronwaffles/dwc_network_server_emulator.git
synced 2026-10-01 22:36:50 -05:00
Make getprofile use the id instead of session key
Fixed some broken code that stopped the game from logging in.
This commit is contained in:
@@ -36,9 +36,9 @@ class GamespyDatabase(object):
|
||||
|
||||
r = self.get_dict(c.fetchone())
|
||||
|
||||
profileid = 476639431 #100000000
|
||||
profileid = 476639431 #100000000 # TODO: Fix profile id generation
|
||||
if r != None and r['max(profileid)'] != None:
|
||||
profileid = int(r[0]) + 1
|
||||
profileid = int(r['max(profileid)']) + 1
|
||||
|
||||
c.close()
|
||||
|
||||
@@ -70,6 +70,17 @@ class GamespyDatabase(object):
|
||||
c.close()
|
||||
return valid_profile
|
||||
|
||||
def get_profile_from_profileid(self, profileid):
|
||||
profile = {}
|
||||
if profileid != None:
|
||||
c = self.conn.cursor()
|
||||
c.execute("SELECT * FROM users WHERE profileid = ?", [profileid])
|
||||
|
||||
profile = self.get_dict(c.fetchone())
|
||||
|
||||
c.close()
|
||||
return profile
|
||||
|
||||
def perform_login(self, userid, password):
|
||||
c = self.conn.cursor()
|
||||
c.execute("SELECT * FROM users WHERE userid = ?", [userid])
|
||||
@@ -134,7 +145,8 @@ class GamespyDatabase(object):
|
||||
# FIXME: Possible security issue due to embedding an unsanitized string directly into the statement.
|
||||
c = self.conn.cursor()
|
||||
for field in fields:
|
||||
c.execute("UPDATE users SET %s = ? WHERE profileid = ?" % (field), [fields[field], profileid])
|
||||
print "UPDATE users SET %s = %s WHERE profileid = %s" % (field[0], field[1], profileid)
|
||||
c.execute("UPDATE users SET %s = ? WHERE profileid = ?" % (field[0]), [field[1], profileid])
|
||||
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
@@ -90,13 +90,14 @@ while 1:
|
||||
msg = gs_query.create_gamespy_message(msg_d)
|
||||
|
||||
elif data_parsed['__cmd__'] == "getprofile":
|
||||
profile = db.get_profile_from_session_key(data_parsed['sesskey'])
|
||||
#profile = db.get_profile_from_session_key(data_parsed['sesskey'])
|
||||
profile = db.get_profile_from_profileid(data_parsed['profileid'])
|
||||
|
||||
msg_d = []
|
||||
msg_d.append(('__cmd__', "pi"))
|
||||
msg_d.append(('__cmd_val__', ""))
|
||||
msg_d.append(('profileid', profile['profileid']))
|
||||
msg_d.append(('nick', profile['nick']))
|
||||
msg_d.append(('nick', profile['uniquenick']))
|
||||
msg_d.append(('userid', profile['userid']))
|
||||
msg_d.append(('email', profile['email']))
|
||||
msg_d.append(('sig', utils.generate_random_hex_str(32)))
|
||||
|
||||
@@ -177,8 +177,7 @@ while 1:
|
||||
|
||||
elif recv_data[0] == '\x09': # Available
|
||||
# Availability check only sent to *.available.gs.nintendowifi.net
|
||||
utils.print_log("Received availability request for '%s' from %s:%s... %s" % (
|
||||
get_game_id(recv_data), addr[0], addr[1], [elem.encode("hex") for elem in recv_data]))
|
||||
utils.print_log("Received availability request for '%s' from %s:%s..." % (get_game_id(recv_data), addr[0], addr[1]))
|
||||
|
||||
s.sendto(bytearray([0xfe, 0xfd, recv_data[0], recv_data[1], recv_data[2], recv_data[3], recv_data[4]]), addr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user