From 060c7b9dec40ff935e86f54822b8ae51f4a7d0c5 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Sun, 9 Jul 2017 19:49:00 -0500 Subject: [PATCH] Fixes race condition with admin proc calls and load admins --- code/modules/admin/admin_ranks.dm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/admin_ranks.dm b/code/modules/admin/admin_ranks.dm index 3d3bc8d929..a9e75c6028 100644 --- a/code/modules/admin/admin_ranks.dm +++ b/code/modules/admin/admin_ranks.dm @@ -97,6 +97,7 @@ GLOBAL_PROTECT(admin_ranks) if(!adds.Remove(path)) subs += path //- + // Checks for (keyword-formatted) rights on this admin /datum/admins/proc/check_keyword(word) var/flag = admin_keyword_to_flag(word) @@ -111,6 +112,9 @@ GLOBAL_PROTECT(admin_ranks) //load our rank - > rights associations /proc/load_admin_ranks() + if(IsAdminAdvancedProcCall()) + to_chat(usr, "Admin Reload blocked: Advanced ProcCall detected.") + return GLOB.admin_ranks.Cut() if(config.admin_legacy_system) @@ -168,6 +172,9 @@ GLOBAL_PROTECT(admin_ranks) /proc/load_admins(target = null) + if(IsAdminAdvancedProcCall()) + to_chat(usr, "Admin Reload blocked: Advanced ProcCall detected.") + return //clear the datums references if(!target) GLOB.admin_datums.Cut() @@ -270,6 +277,9 @@ GLOBAL_PROTECT(admin_ranks) message_admins("[key_name_admin(usr)] attempted to edit the admin permissions without sufficient rights.") log_admin("[key_name(usr)] attempted to edit the admin permissions without sufficient rights.") return + if(IsAdminAdvancedProcCall()) + to_chat(usr, "Admin Edit blocked: Advanced ProcCall detected.") + return var/adm_ckey var/task = href_list["editrights"] @@ -371,7 +381,6 @@ GLOBAL_PROTECT(admin_ranks) if(!findtext(D.rank.name, "([adm_ckey])")) //not a modified subrank, need to duplicate the admin_rank datum to prevent modifying others too D.rank = new("[D.rank.name]([adm_ckey])", D.rank.rights, D.rank.adds, D.rank.subs) //duplicate our previous admin_rank but with a new name //we don't add this clone to the admin_ranks list, as it is unique to that ckey - D.rank.process_keyword(keyword) var/client/C = GLOB.directory[adm_ckey] //find the client with the specified ckey (if they are logged in)