From 823f64a7a51c9dcee06f338f29c308f552c21a8a Mon Sep 17 00:00:00 2001 From: Stefan Hacker Date: Thu, 19 Feb 2015 19:07:49 +0100 Subject: Fix single argument queries with mysqldb in Authenticators. Seems like the call style we used for these was non-standart or deprecated. --- Authenticators/SMF/1.x/smfauth.py | 10 +++++----- Authenticators/SMF/2.0/smfauth.py | 12 ++++++------ Authenticators/phpBB3/phpBB3auth.py | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Authenticators/SMF/1.x/smfauth.py b/Authenticators/SMF/1.x/smfauth.py index 5e387ac..bcadbfa 100644 --- a/Authenticators/SMF/1.x/smfauth.py +++ b/Authenticators/SMF/1.x/smfauth.py @@ -551,7 +551,7 @@ def do_main_program(): try: sql = 'SELECT ID_MEMBER FROM %smembers WHERE LOWER(memberName) = LOWER(%%s)' % cfg.database.prefix - cur = threadDB.execute(sql, name) + cur = threadDB.execute(sql, [name]) except threadDbException: return FALL_THROUGH @@ -580,7 +580,7 @@ def do_main_program(): # Fetch the user from the database try: sql = 'SELECT memberName FROM %smembers WHERE ID_MEMBER = %%s' % cfg.database.prefix - cur = threadDB.execute(sql, bbid) + cur = threadDB.execute(sql, [bbid]) except threadDbException: return FALL_THROUGH @@ -615,7 +615,7 @@ def do_main_program(): bbid = id - cfg.user.id_offset try: sql = 'SELECT realName, avatar FROM %smembers WHERE ID_MEMBER = %%s' % cfg.database.prefix - cur = threadDB.execute(sql, bbid) + cur = threadDB.execute(sql, [bbid]) except threadDbException: return FALL_THROUGH @@ -630,7 +630,7 @@ def do_main_program(): # Either the user has none or it is in the attachments, check there try: sql = 'SELECT ID_ATTACH, file_hash FROM %sattachments WHERE ID_MEMBER = %%s' % cfg.database.prefix - cur = threadDB.execute(sql, bbid) + cur = threadDB.execute(sql, [bbid]) except threadDbException: return FALL_THROUGH @@ -705,7 +705,7 @@ def do_main_program(): try: sql = 'SELECT ID_MEMBER, memberName FROM %smembers WHERE is_activated = 1 AND memberName LIKE %%s' % cfg.database.prefix - cur = threadDB.execute(sql, filter) + cur = threadDB.execute(sql, [filter]) except threadDbException: return {} diff --git a/Authenticators/SMF/2.0/smfauth.py b/Authenticators/SMF/2.0/smfauth.py index f6efebf..1529ace 100755 --- a/Authenticators/SMF/2.0/smfauth.py +++ b/Authenticators/SMF/2.0/smfauth.py @@ -489,7 +489,7 @@ def do_main_program(): try: sql = 'SELECT id_member, passwd, id_group, member_name, real_name, additional_groups, is_activated FROM %smembers WHERE LOWER(member_name) = LOWER(%%s)' % cfg.database.prefix - cur = threadDB.execute(sql, name) + cur = threadDB.execute(sql, [name]) except threadDbException: return (FALL_THROUGH, None, None) @@ -551,7 +551,7 @@ def do_main_program(): try: sql = 'SELECT id_member FROM %smembers WHERE LOWER(member_name) = LOWER(%%s)' % cfg.database.prefix - cur = threadDB.execute(sql, name) + cur = threadDB.execute(sql, [name]) except threadDbException: return FALL_THROUGH @@ -580,7 +580,7 @@ def do_main_program(): # Fetch the user from the database try: sql = 'SELECT member_name FROM %smembers WHERE id_member = %%s' % cfg.database.prefix - cur = threadDB.execute(sql, bbid) + cur = threadDB.execute(sql, [bbid]) except threadDbException: return FALL_THROUGH @@ -615,7 +615,7 @@ def do_main_program(): bbid = id - cfg.user.id_offset try: sql = 'SELECT avatar FROM %smembers WHERE id_member = %%s' % cfg.database.prefix - cur = threadDB.execute(sql, bbid) + cur = threadDB.execute(sql, [bbid]) except threadDbException: return FALL_THROUGH res = cur.fetchone() @@ -630,7 +630,7 @@ def do_main_program(): try: sql = '''SELECT id_attach, file_hash, filename, attachment_type FROM %sattachments WHERE approved = true AND (attachment_type = 0 OR attachment_type = 1) AND id_member = %%s''' % cfg.database.prefix - cur = threadDB.execute(sql, bbid) + cur = threadDB.execute(sql, [bbid]) except threadDbException: return FALL_THROUGH @@ -708,7 +708,7 @@ def do_main_program(): try: sql = 'SELECT id_member, member_name FROM %smembers WHERE is_activated = 1 AND member_name LIKE %%s' % cfg.database.prefix - cur = threadDB.execute(sql, filter) + cur = threadDB.execute(sql, [filter]) except threadDbException: return {} diff --git a/Authenticators/phpBB3/phpBB3auth.py b/Authenticators/phpBB3/phpBB3auth.py index 602c84e..ac3077d 100755 --- a/Authenticators/phpBB3/phpBB3auth.py +++ b/Authenticators/phpBB3/phpBB3auth.py @@ -463,7 +463,7 @@ def do_main_program(): try: sql = 'SELECT user_id, user_password, user_type, username FROM %susers WHERE (user_type = 0 OR user_type = 3) AND LOWER(username) = LOWER(%%s)' % cfg.database.prefix - cur = threadDB.execute(sql, name) + cur = threadDB.execute(sql, [name]) except threadDbException: return (FALL_THROUGH, None, None) @@ -478,7 +478,7 @@ def do_main_program(): # Authenticated, fetch group memberships try: sql = 'SELECT group_name FROM %suser_group JOIN %sgroups USING (group_id) WHERE user_id = %%s' % (cfg.database.prefix, cfg.database.prefix) - cur = threadDB.execute(sql, uid) + cur = threadDB.execute(sql, [uid]) except threadDbException: return (FALL_THROUGH, None, None) @@ -519,7 +519,7 @@ def do_main_program(): try: sql = 'SELECT user_id FROM %susers WHERE (user_type = 0 OR user_type = 3) AND LOWER(username) = LOWER(%%s)' % cfg.database.prefix - cur = threadDB.execute(sql, name) + cur = threadDB.execute(sql, [name]) except threadDbException: return FALL_THROUGH @@ -548,7 +548,7 @@ def do_main_program(): # Fetch the user from the database try: sql = 'SELECT username FROM %susers WHERE (user_type = 0 OR user_type = 3) AND user_id = %%s' % cfg.database.prefix - cur = threadDB.execute(sql, bbid) + cur = threadDB.execute(sql, [bbid]) except threadDbException: return FALL_THROUGH @@ -583,7 +583,7 @@ def do_main_program(): bbid = id - cfg.user.id_offset try: sql = 'SELECT username, user_avatar, user_avatar_type FROM %susers WHERE (user_type = 0 OR user_type = 3) AND user_id = %%s' % cfg.database.prefix - cur = threadDB.execute(sql, bbid) + cur = threadDB.execute(sql, [bbid]) except threadDbException: return FALL_THROUGH @@ -654,7 +654,7 @@ def do_main_program(): try: sql = 'SELECT user_id, username FROM %susers WHERE (user_type = 0 OR user_type = 3) AND username LIKE %%s' % cfg.database.prefix - cur = threadDB.execute(sql, filter) + cur = threadDB.execute(sql, [filter]) except threadDbException: return {} -- cgit v1.2.3