From 11e00b9c1ce9ee8e490c7f38ae49b8dcb753221c Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 15 Apr 2025 15:03:11 +0100 Subject: [PATCH] config: fix case-sensitive actions --- src/config/Config.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/config/Config.cpp b/src/config/Config.cpp index 2ec855d..310cef2 100644 --- a/src/config/Config.cpp +++ b/src/config/Config.cpp @@ -12,11 +12,14 @@ static CConfig::eConfigIPAction strToAction(const std::string& s) { if (s.empty()) return CConfig::IP_ACTION_NONE; - if (s == "ALLOW" || s == "allow" || s == "Allow") + std::string LC = s; + std::transform(LC.begin(), LC.end(), LC.begin(), ::tolower); + + if (LC == "allow") return CConfig::IP_ACTION_ALLOW; - if (s == "Deny" || s == "deny" || s == "Deny") + if (LC == "deny") return CConfig::IP_ACTION_DENY; - if (s == "CHALLENGE" || s == "challenge" || s == "Challenge") + if (LC == "challenge") return CConfig::IP_ACTION_CHALLENGE; Debug::log(ERR, "Invalid action: {}, assuming NONE", s);