From b0b4d7f580cef8193d15d30d837c7502c6ab84a8 Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Thu, 5 Mar 2015 19:35:33 -0800 Subject: [PATCH] IsBanned() now rejects blank ckeys/ips/cids Also removes the admin notice. Its still logged, but this way the admins don't get spammed during world reboot. --- code/modules/admin/IsBanned.dm | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index 4abe574216a..a89aea9f725 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -1,6 +1,9 @@ //Blocks an attempt to connect before even creating our client datum thing. world/IsBanned(key,address,computer_id) + if (!key || !address || !computer_id) + log_access("Failed Login (invalid data): [key] [address]-[computer_id]") + return list("reason"="invalid login data", "desc"="Your computer provided invalid or blank information to the server on connection (byond username, IP, and Computer ID.) Provided information for reference: Username:'[key]' IP:'[address]' Computer ID:'[computer_id]' If you continue to get this error, please restart byond or contact byond support.") if(ckey(key) in admin_datums) //It has proven to be a bad idea to make admins completely immune to bans, making them have to wait for someone with daemon access //to add a daemon ban to finally stop them. Admin tempbans and admin permabans are special, high-level ban types, which are there to help @@ -76,18 +79,13 @@ world/IsBanned(key,address,computer_id) world.log << "Ban database connection failure. Key [ckeytext] not checked" diary << "Ban database connection failure. Key [ckeytext] not checked" return - - 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 [format_table_name("ban")] WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)") @@ -112,9 +110,4 @@ world/IsBanned(key,address,computer_id) var/desc = "\nReason: You, or another user of this computer or connection ([pckey]) is banned from playing here. The ban reason is:\n[reason]\nThis ban was applied by [ackey] on [bantime], [expires]" 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