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
This commit is contained in:
Kyep
2020-01-04 17:23:44 -08:00
parent a326db3879
commit 05221acd28
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -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))