From 05c40a6e55c38a6426bc293b9def22677e42a52a 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 ffc6b13665..7b97fab118 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -2167,7 +2167,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;