From b6211d94f8258413bd7dec5ebf2196b8fe657c78 Mon Sep 17 00:00:00 2001 From: Bartosz Wieczorek Date: Fri, 18 Jul 2025 12:27:07 +0200 Subject: [PATCH] Fix handling proxy configuration --- PAM/ssh/include/rublon/configuration.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/PAM/ssh/include/rublon/configuration.hpp b/PAM/ssh/include/rublon/configuration.hpp index 0c304f3..a6aee8b 100644 --- a/PAM/ssh/include/rublon/configuration.hpp +++ b/PAM/ssh/include/rublon/configuration.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -86,6 +87,7 @@ class ConfigurationReader { if(it == keyValues.end()) { return std::nullopt; } + return string{it->second.data(), it->second.size(), memoryResource}; }; @@ -198,6 +200,12 @@ class ConfigurationReader { return true; }; + auto toLowerCaseOpt = [](auto str) { + if(str) + std::transform(str->cbegin(), str->cend(), str->begin(), [](auto c) { return std::tolower(c); }); + return str; + }; + /// NOTE: // getStringOpt can return a valid empty string, for example configuration entry like // option= @@ -238,8 +246,8 @@ class ConfigurationReader { // reading proxy configuration config.proxyEnabled = getBool("proxyEnabled").value_or(false); - config.proxyType = getStringOpt("proxyType"); - config.proxyHost = getStringOpt("proxyHost"); + config.proxyType = toLowerCaseOpt(getStringOpt("proxyType")); + config.proxyHost = toLowerCaseOpt(getStringOpt("proxyHost")); // Apply fallback if no config is set if(config.proxyEnabled && (!config.proxyType || config.proxyType->empty()) && (!config.proxyHost || config.proxyHost->empty())) {