deepin-log-viewer/0001-feat-round-master-function.patch
leeffo d25dcb235c upgrade to version 5.9.13
(cherry picked from commit a9e96bc60023047c19b30735d9063fa8598d45d8)
2023-08-15 17:06:10 +08:00

52 lines
2.2 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 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