From 096a9cf56308193065a609f2ae426a3c487e8f4b Mon Sep 17 00:00:00 2001 From: errorage Date: Thu, 4 Apr 2013 00:40:30 +0200 Subject: [PATCH 1/3] - Added an extra variable to determine the behavior of bans when they are applied. The variable is kickbannedckey. It is used to determine whether the bans, which are handled by db_ban kick the mob or not, if he is connected, that is. Some ban types, such as permaban and tempban, do not use this, as it is handled by legacy ban code. --- code/modules/admin/DB ban/functions.dm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm index 8244fa353b3..3b2faf98319 100644 --- a/code/modules/admin/DB ban/functions.dm +++ b/code/modules/admin/DB ban/functions.dm @@ -14,6 +14,9 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = var/maxadminbancheck //Used to limit the number of active bans of a certein type that each admin can give. Used to protect against abuse or mutiny. var/announceinirc //When set, it announces the ban in irc. Intended to be a way to raise an alarm, so to speak. var/blockselfban //Used to prevent the banning of yourself. + var/kickbannedckey //Defines whether this proc should kick the banned person, if they are connected (if banned_mob is defined). + //some ban types kick players after this proc passes (tempban, permaban), but some are specific to db_ban, so + //they should kick within this proc. switch(bantype) if(BANTYPE_PERMA) bantype_str = "PERMABAN" @@ -42,12 +45,14 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = maxadminbancheck = 1 announceinirc = 1 blockselfban = 1 + kickbannedckey = 1 if(BANTYPE_ADMIN_TEMP) bantype_str = "ADMIN_TEMPBAN" bantype_pass = 1 maxadminbancheck = 1 announceinirc = 1 blockselfban = 1 + kickbannedckey = 1 if( !bantype_pass ) return if( !istext(reason) ) return if( !isnum(duration) ) return @@ -86,10 +91,12 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = a_computerid = src.owner:computer_id a_ip = src.owner:address + /* TODO UNCEOMMENT if(blockselfban) if(a_ckey == ckey) usr << "\red You cannot apply this ban type on yourself." return + */ var/who for(var/client/C in clients) @@ -125,6 +132,10 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = if(announceinirc) send2irc("BAN ALERT","[a_ckey] applied a [bantype_str] on [ckey]") + if(kickbannedckey) + if(banned_mob && banned_mob.client && banned_mob.client.ckey == banckey) + del(banned_mob.client) + datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "") @@ -339,7 +350,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) output += "" output += "" output += "" - output += "" + output += "" output += "" output += "" output += "" @@ -463,6 +474,4 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) output += "" - usr << browse(output,"window=lookupbans;size=900x500") - -#undef MAX_ADMIN_BANS_PER_ADMIN \ No newline at end of file + usr << browse(output,"window=lookupbans;size=900x500") \ No newline at end of file From 5f9bddd9982617638c48ca69b9f91773c44f3ee0 Mon Sep 17 00:00:00 2001 From: errorage Date: Thu, 4 Apr 2013 00:54:49 +0200 Subject: [PATCH 2/3] Removed a comment I should have removed before the previous commit. --- code/modules/admin/DB ban/functions.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm index 3b2faf98319..e154b5b8f09 100644 --- a/code/modules/admin/DB ban/functions.dm +++ b/code/modules/admin/DB ban/functions.dm @@ -91,12 +91,10 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = a_computerid = src.owner:computer_id a_ip = src.owner:address - /* TODO UNCEOMMENT if(blockselfban) if(a_ckey == ckey) usr << "\red You cannot apply this ban type on yourself." return - */ var/who for(var/client/C in clients) From 2f132126e90553a9b17a6bbab797f8bd11abc84a Mon Sep 17 00:00:00 2001 From: errorage Date: Thu, 4 Apr 2013 20:33:23 +0200 Subject: [PATCH 3/3] - Makes it impossible for admins to varedit the ckey or key value of client objects. This is to prevent admin log spoofing. --- code/modules/admin/verbs/modifyvariables.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 49ded54e4c5..2b5d1259083 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -275,6 +275,10 @@ var/list/forbidden_varedit_object_types = list( usr << "\red It is forbidden to edit this object's variables." return + if(istype(O, /client) && (param_var_name == "ckey" || param_var_name == "key")) + usr << "\red You cannot edit ckeys on client objects." + return + var/class var/variable var/var_value