From 4ac30972ee310b99947a684f5dd58600f33592c4 Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Sat, 22 Dec 2012 17:24:06 +0000 Subject: [PATCH] Added a fix in IsBanned() that alters the SQL statement based on whether an ip and computer id was passed into the IsBanned() proc. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5374 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/admin/IsBanned.dm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index 91597bcfefd..20a3e8b07f4 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -38,7 +38,20 @@ world/IsBanned(key,address,computer_id) diary << "Ban database connection failure. Key [ckeytext] not checked" return - var/DBQuery/query = dbcon.NewQuery("SELECT ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM erro_Ban WHERE (ckey = '[ckeytext]' OR ip = '[address]' OR computerid = '[computer_id]') AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)") + var/failedcid = 1 + var/failedip = 1 + + var/ipquery = "" + var/cidquery = "" + if(address) + failedip = 0 + ipquery = " OR ip = '[address]' " + + if(computer_id) + failedcid = 0 + cidquery = " OR computerid = '[computer_id]' " + + var/DBQuery/query = dbcon.NewQuery("SELECT ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM erro_Ban WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)") query.Execute() @@ -61,4 +74,8 @@ world/IsBanned(key,address,computer_id) return list("reason"="[bantype]", "desc"="[desc]") + if (failedcid) + message_admins("[key] has logged in with a blank computer id in the ban check.") + if (failedip) + message_admins("[key] has logged in with a blank ip in the ban check.") return ..() //default pager ban stuff \ No newline at end of file