From 05221acd2810d03d0bd50e9a02ea15ade83578fd Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 4 Jan 2020 17:23:44 -0800 Subject: [PATCH] ports TG PRs 32384 and 48583 1) ports https://github.com/tgstation/tgstation/pull/32384 - fixes our world/IsBanned not being updated to account for a BYOND change where the world/IsBanned proc now includes a 4th param, 'type' 2) ports https://github.com/tgstation/tgstation/pull/48583 - changes by MSO which prevent BYOND from degrading server performance during world topic calls 3) future-proofs calls to world/IsBanned by using explicitly named params to avoid this sort of thing happening again if it changes in future --- code/modules/admin/IsBanned.dm | 11 ++++++++++- goon/code/datums/browserOutput.dm | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index 045819c365b..d776b4a2095 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -1,5 +1,5 @@ //Blocks an attempt to connect before even creating our client datum thing. -world/IsBanned(key, address, computer_id, check_ipintel = TRUE) +world/IsBanned(key, address, computer_id, type, check_ipintel = TRUE) if(!config.ban_legacy_system) if(address) @@ -11,11 +11,20 @@ world/IsBanned(key, address, computer_id, check_ipintel = TRUE) log_adminwarn("Failed Login (invalid data): [key] [address]-[computer_id]") return list("reason"="invalid login data", "desc"="Error: Could not check ban status, please try again. Error message: 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(type == "world") + return ..() //shunt world topic banchecks to purely to byond's internal ban system + if(text2num(computer_id) == 2147483647) //this cid causes stickybans to go haywire log_adminwarn("Failed Login (invalid cid): [key] [address]-[computer_id]") return list("reason"="invalid login data", "desc"="Error: Could not check ban status, Please try again. Error message: Your computer provided an invalid Computer ID.") + var/admin = 0 var/ckey = ckey(key) + + var/client/C = GLOB.directory[ckey] + if (C && ckey == C.ckey && computer_id == C.computer_id && address == C.address) + return //don't recheck connected clients. + if((ckey in admin_datums) || (ckey in GLOB.deadmins)) var/datum/admins/A = admin_datums[ckey] if(A && (A.rights & R_ADMIN)) diff --git a/goon/code/datums/browserOutput.dm b/goon/code/datums/browserOutput.dm index cbeb7ae3ab0..4abb3ac20b8 100644 --- a/goon/code/datums/browserOutput.dm +++ b/goon/code/datums/browserOutput.dm @@ -149,7 +149,7 @@ var/list/chatResources = list( var/list/row = connectionHistory[i] if(!row || row.len < 3 || !(row["ckey"] && row["compid"] && row["ip"])) return - if(world.IsBanned(row["ckey"], row["ip"], row["compid"], FALSE)) + if(world.IsBanned(key=row["ckey"], address=row["ip"], computer_id=row["compid"], type=null, check_ipintel=FALSE)) found = row break //Add autoban using the DB_ban_record function