9 Star 6 Fork 16

src-openEuler/deepin-log-viewer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-feat-round-master-function.patch 2.22 KB
一键复制 编辑 原始数据 按行查看 历史
Venland 提交于 2023-07-26 11:16 . upgrade to version 5.9.13
From 9e6687c11f63ae25a3f4520dc22d44cdf94f776a Mon Sep 17 00:00:00 2001
From: leeffo <leeffo@yeah.net>
Date: Wed, 1 Mar 2023 13:33:26 +0800
Subject: [PATCH] feat: round master function
---
application/loglistview.cpp | 2 +-
logViewerService/logviewerservice.cpp | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/application/loglistview.cpp b/application/loglistview.cpp
index 7631e03..bbcb19b 100644
--- a/application/loglistview.cpp
+++ b/application/loglistview.cpp
@@ -146,7 +146,7 @@ void LogListView::initUI()
const QVariant VListViewItemMargin = QVariant::fromValue(ListViweItemMargin);
Dtk::Core::DSysInfo::UosEdition edition = Dtk::Core::DSysInfo::uosEditionType();
//等于服务器行业版或欧拉版(centos)
- bool isCentos = Dtk::Core::DSysInfo::UosEuler == edition || Dtk::Core::DSysInfo::UosEnterpriseC == edition;
+ bool isCentos = Dtk::Core::DSysInfo::UosEuler == edition || Dtk::Core::DSysInfo::UosEnterpriseC == edition || Dtk::Core::DSysInfo::UosMilitaryS == edition;
m_pModel = new QStandardItemModel(this);
QStandardItem *item = nullptr;
QString systemName = DBusManager::getSystemInfo();
diff --git a/logViewerService/logviewerservice.cpp b/logViewerService/logviewerservice.cpp
index 63cb9db..c1ecd75 100644
--- a/logViewerService/logviewerservice.cpp
+++ b/logViewerService/logviewerservice.cpp
@@ -40,10 +40,19 @@ LogViewerService::~LogViewerService()
*/
QString LogViewerService::readLog(const QString &filePath)
{
+ if (!isValidInvoker()) {
+ return " ";
+ }
+
//增加服务黑名单,只允许通过提权接口读取/var/log下,家目录下和临时目录下的文件
- if ((!filePath.startsWith("/var/log/") && !filePath.startsWith("/tmp") && !filePath.startsWith("/home")) || filePath.contains("..") || !isValidInvoker()) {
+ if ((!filePath.startsWith("/var/log/") &&
+ !filePath.startsWith("/tmp") &&
+ !filePath.startsWith("/home") &&
+ !filePath.startsWith("/root")) ||
+ filePath.contains("..")) {
return " ";
}
+
m_process.start("cat", QStringList() << filePath);
m_process.waitForFinished(-1);
QByteArray byte = m_process.readAllStandardOutput();
--
2.20.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/deepin-log-viewer.git
git@gitee.com:src-openeuler/deepin-log-viewer.git
src-openeuler
deepin-log-viewer
deepin-log-viewer
master

搜索帮助