代码拉取完成,页面将自动刷新
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。