kiran-session-manager/1002-fix-env-Some-environments-are-filtered-because-the-i-3d2ec38f.patch
kylinsecos_admin b6d803a18a update to 2.2.1
Signed-off-by: kylinsecos_admin <gitee@kylinos.com.cn>
2022-01-22 10:55:54 +08:00

57 lines
2.0 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 3d2ec38f9c4d3bd19d707ef60fefc6243d650235 Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Mon, 17 Jan 2022 17:24:46 +0800
Subject: [PATCH] fix(env): Some environments are filtered because the if
statement is wrong.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 由于if语句写错导致部分环境变量被过滤
Closes #48435
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
src/main.cpp | 8 ++++++--
src/utils.cpp | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
index 005ae0e..eec074c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -69,10 +69,14 @@ void init_env()
for (auto key : Glib::listenv())
{
auto value = Glib::getenv(key);
- if (key_regex->match(value) && value_regex->match(value))
+ if (key_regex->match(key) && value_regex->match(value))
{
envs.emplace(key, value);
- KLOG_DEBUG("key: %s, value: %s.", key.c_str(), value.c_str());
+ KLOG_DEBUG("Add environment: %s=%s.", key.c_str(), value.c_str());
+ }
+ else
+ {
+ KLOG_WARNING("Filter environment: %s=%s.", key.c_str(), value.c_str());
}
}
Utils::setenvs(envs);
diff --git a/src/utils.cpp b/src/utils.cpp
index b2cfb29..e70cc98 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -125,7 +125,7 @@ void Utils::setenvs(const std::map<Glib::ustring, Glib::ustring> &envs)
list_env.push_back(env);
}
- KLOG_DEBUG("envs: %s.", StrUtils::join(list_env, ";").c_str());
+ KLOG_DEBUG("Set environments: %s.", StrUtils::join(list_env, ";").c_str());
auto systemd_proxy = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SESSION,
SYSTEMD_DBUS_NAME,
SYSTEMD_DBUS_OBJECT_PATH,
--
2.27.0