1 Star 0 Fork 1

brucezhang/plasma-workspace

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0dcf34458d99b07a3d9054ae0c86c656e0dfa7aa.patch 2.34 KB
一键复制 编辑 原始数据 按行查看 历史
fanjunkong 提交于 2024-09-25 11:08 +08:00 . update
From 0dcf34458d99b07a3d9054ae0c86c656e0dfa7aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Trnka?= <tomastrnka@gmx.com>
Date: Tue, 4 Jun 2024 09:36:34 +0200
Subject: [PATCH] Fix writing ICEAuthority file
Commit 9398f6cf8933055b31506ba155aef2fc2b3561d7 "Remove iceauth
dependency" introduced two bugs:
1) "fp" is never closed, so the generated auth data stays buffered in
memory for some indeterminate time and the file stays empty on disk.
This completely breaks authentication and thus also session restore.
2) Checking the return value of IceWriteAuthFileEntry() is inverted (the
function returns non-zero on success), so warnings are printed iff
everything goes well.
BUG: 487912
---
ksmserver/server.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp
index c5e0c7b372..4b0a8763c1 100644
--- a/ksmserver/server.cpp
+++ b/ksmserver/server.cpp
@@ -362,7 +362,7 @@ Status SetAuthentication(int count, IceListenObj *listenObjs, IceAuthDataEntry *
file_entry->auth_name = strdup("MIT-MAGIC-COOKIE-1");
file_entry->auth_data = strdup((*authDataEntries)[i].auth_data);
file_entry->auth_data_length = MAGIC_COOKIE_LEN;
- if (IceWriteAuthFileEntry(fp, file_entry) != 0) {
+ if (IceWriteAuthFileEntry(fp, file_entry) == 0) {
qWarning("Failed to write ice auth file entry");
}
IceFreeAuthFileEntry(file_entry);
@@ -386,7 +386,7 @@ Status SetAuthentication(int count, IceListenObj *listenObjs, IceAuthDataEntry *
file_entry->auth_name = strdup("MIT-MAGIC-COOKIE-1");
file_entry->auth_data = strdup((*authDataEntries)[i + 1].auth_data);
file_entry->auth_data_length = MAGIC_COOKIE_LEN;
- if (IceWriteAuthFileEntry(fp, file_entry) != 0) {
+ if (IceWriteAuthFileEntry(fp, file_entry) == 0) {
qWarning("Failed to write xsmp ice auth file entry");
}
IceFreeAuthFileEntry(file_entry);
@@ -395,6 +395,11 @@ Status SetAuthentication(int count, IceListenObj *listenObjs, IceAuthDataEntry *
IceSetPaAuthData(2, &(*authDataEntries)[i]);
}
+ if (fclose(fp) != 0) {
+ qWarning() << "Could not close ICEAuthority file";
+ return 0;
+ }
+
return (1);
}
--
GitLab
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bbrucezhang/plasma-workspace.git
git@gitee.com:bbrucezhang/plasma-workspace.git
bbrucezhang
plasma-workspace
plasma-workspace
master

搜索帮助