!34 修复通过xdmcp远程登录后切换用户错误问题

From: @tangjie02 
Reviewed-by: @liubuguiii 
Signed-off-by: @liubuguiii
This commit is contained in:
openeuler-ci-bot 2022-07-19 12:06:16 +00:00 committed by Gitee
commit 02640214ea
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,66 @@
From 40e7e134d87727cb651e9d290a852bd9ef95b826 Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Mon, 18 Jul 2022 16:20:26 +0800
Subject: [PATCH] fix(menu): Fix the switch user error by xdmcp logging.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复通过xdmcp远程登录后切换用户错误问题
Closes #57865
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
src/common/kiran-power.cpp | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/common/kiran-power.cpp b/src/common/kiran-power.cpp
index c7f1011..9ef8a2c 100644
--- a/src/common/kiran-power.cpp
+++ b/src/common/kiran-power.cpp
@@ -68,11 +68,18 @@ KiranPower::KiranPower()
SESSION_MANAGER_PATH,
SESSION_MANAGER_INTERFACE);
- // TODO: 这里直接选用seat0是有问题的需要获取会话所在seat
- this->seat_manager_proxy_ = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SYSTEM,
- DISPLAY_MANAGER_DBUS,
- DISPLAY_MANAGER_SEAT_PATH,
- DISPLAY_MANAGER_INTERFACE);
+ auto xdg_seat_object_path = Glib::getenv("XDG_SEAT_PATH");
+ if (!xdg_seat_object_path.empty())
+ {
+ this->seat_manager_proxy_ = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SYSTEM,
+ DISPLAY_MANAGER_DBUS,
+ xdg_seat_object_path,
+ DISPLAY_MANAGER_INTERFACE);
+ }
+ else
+ {
+ KLOG_WARNING("Failed to get environment variable XDG_SEAT_PATH.");
+ }
}
catch (const Gio::DBus::Error &e)
{
@@ -359,6 +366,17 @@ bool KiranPower::can_logout()
bool KiranPower::can_switch_user()
{
RETURN_VAL_IF_TRUE(this->settings_->get_boolean(STARTMENU_LOCKDOWN_KEY_DISABLE_USER_SWITCHING), false);
+
+ try
+ {
+ Glib::VariantBase variant_value;
+ this->seat_manager_proxy_->get_cached_property(variant_value, "CanSwitch");
+ return Glib::VariantBase::cast_dynamic<Glib::Variant<bool>>(variant_value).get();
+ }
+ catch (const Glib::Error &e)
+ {
+ KLOG_WARNING("%s", e.what().c_str());
+ }
return true;
}
--
2.33.0

View File

@ -1,11 +1,13 @@
Name: kiran-menu
Version: 2.3.0
Release: 2
Release: 3
Summary: Applets for mate panel from Kiran Desktop
License: Mulan PSL v2
Source0: %{name}-%{version}.tar.gz
Patch1000: 0001-fix-menu-Fix-the-switch-user-error-by-xdmcp-logging.patch
BuildRequires: cmake > 3.0
BuildRequires: gcc-c++
@ -84,6 +86,9 @@ gtk-update-icon-cache -f /usr/share/icons/hicolor/
%changelog
* Tue Jul 19 2022 tangjie02 <tangjie02@kylinsec.com.cn> - 2.3.0-3
- KYOS-B: Fix the switch user error by xdmcp logging.(#57865)
* Tue Jul 19 2022 yuanxing <yaunxing@kylinsec.com.cn> - 2.3.0-2
- KYOS-F: Do not output the alarm information to the screen