From 4b810cc5943359a428619fcd8f7e321fc9aae68d Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Wed, 22 Dec 2021 17:13:19 +0000 Subject: [PATCH] Fixes some busted logging (#17269) --- code/modules/admin/IsBanned.dm | 22 ++++++++++++++-------- goon/code/datums/browserOutput.dm | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index 60f870d9e8d..4bc89c0280e 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -1,10 +1,11 @@ //Blocks an attempt to connect before even creating our client datum thing. -/world/IsBanned(key, address, computer_id, type, check_ipintel = TRUE, check_2fa = TRUE) +/world/IsBanned(key, address, computer_id, type, check_ipintel = TRUE, check_2fa = TRUE, check_guest = TRUE, log_info = TRUE) if(!key || !address || !computer_id) log_adminwarn("Failed Login (invalid data): [key] [address]-[computer_id]") // The nested ternaries are needed here - INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, (ckey(key) || ""), (address || ""), (computer_id || ""), CONNECTION_TYPE_DROPPED_INVALID) + if(log_info) + INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, (ckey(key) || ""), (address || ""), (computer_id || ""), CONNECTION_TYPE_DROPPED_INVALID) 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") @@ -12,7 +13,8 @@ if(text2num(computer_id) == 2147483647) //this cid causes stickybans to go haywire log_adminwarn("Failed Login (invalid cid): [key] [address]-[computer_id]") - INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_INVALID) + if(log_info) + INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_INVALID) 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 @@ -34,10 +36,11 @@ return list("reason"="duplicate login", "desc"="\nReason: You are already logged in on server '[other_server_login]'. Please contact the server host if you believe this is an error.") //Guest Checking - if(GLOB.configuration.general.guest_ban && IsGuestKey(key)) + if(GLOB.configuration.general.guest_ban && check_guest && IsGuestKey(key)) log_adminwarn("Failed Login: [key] [computer_id] [address] - Guests not allowed") // message_admins("Failed Login: [key] - Guests not allowed") - INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED) + if(log_info) + INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED) return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a BYOND account.") //check if the IP address is a known proxy/vpn, and the user is not whitelisted @@ -46,7 +49,8 @@ var/mistakemessage = "" if(GLOB.configuration.url.banappeals_url) mistakemessage = "\nIf you have to use one, request whitelisting at: [GLOB.configuration.url.banappeals_url]" - INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_IPINTEL) + if(log_info) + INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_IPINTEL) return list("reason"="using proxy or vpn", "desc"="\nReason: Proxies/VPNs are not allowed here. [mistakemessage]") @@ -178,7 +182,8 @@ . = list("reason"="[bantype]", "desc"="[desc]") log_adminwarn("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]") - INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED) + if(log_info) + INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED) qdel(query) return . qdel(query) @@ -195,5 +200,6 @@ return null else log_adminwarn("Failed Login: [key] [computer_id] [address] - Banned [.["message"]]") - INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED) + if(log_info) + INVOKE_ASYNC(GLOBAL_PROC, .proc/log_connection, ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED) return . diff --git a/goon/code/datums/browserOutput.dm b/goon/code/datums/browserOutput.dm index 4b4a0d054c2..0fbb6fc405a 100644 --- a/goon/code/datums/browserOutput.dm +++ b/goon/code/datums/browserOutput.dm @@ -188,7 +188,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(key=row["ckey"], address=row["ip"], computer_id=row["compid"], type=null, check_ipintel=FALSE, check_2fa=FALSE)) + if(world.IsBanned(key=row["ckey"], address=row["ip"], computer_id=row["compid"], type=null, check_ipintel=FALSE, check_2fa=FALSE, check_guest=FALSE, log_info=FALSE)) found = row break CHECK_TICK