From e8a9b867dd5106afde9cf41dd6dc374c2b5b503d Mon Sep 17 00:00:00 2001 From: Muxy Du Goulp Date: Sat, 15 Nov 2025 21:01:52 +0100 Subject: [PATCH] Fix #14777: authorized_key: Correctly target key type for add/remove The logic in ConNetworkAuthorizedKey for the `authorized_key` command was inverted. The check `if (StrEqualsIgnoreCase(type, name)) continue;` caused the action (add/remove) to be incorrectly executed on the first key type encountered that *did not* match the requested type, rather than the intended one. This resulted in keys specified for 'admin' being added to 'rcon', for example. This commit inverts the condition to ensure the action is performed only when the requested type matches the iterated key name. --- src/console_cmds.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 6e5d53a543..b816e358de 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -2170,7 +2170,7 @@ static bool ConNetworkAuthorizedKey(std::span argv) } for (auto [name, authorized_keys] : _console_cmd_authorized_keys) { - if (StrEqualsIgnoreCase(type, name)) continue; + if (!StrEqualsIgnoreCase(type, name)) continue; PerformNetworkAuthorizedKeyAction(name, authorized_keys, action, authorized_key); return true;