aops-ceres/0005-match-correctly-applied-hotpatchs.patch
gongzt 0015d11f31 获取存在多个热补丁对CVE有效时,匹配正确应用的热补丁
(cherry picked from commit 0c2c73e7ae87a4e45b238793f5d950544d123395)
2023-06-30 19:26:06 +08:00

40 lines
1.5 KiB
Diff

From 6875f8f6dbe2f7b08cf6a447057bfd4514b83537 Mon Sep 17 00:00:00 2001
From: gongzhengtang <gong_zhengtang@163.com>
Date: Fri, 30 Jun 2023 11:09:24 +0000
Subject: [PATCH] Match the correctly applied hot patches
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: gongzhengtang <gong_zhengtang@163.com>
---
ceres/manages/vulnerability_manage.py | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/ceres/manages/vulnerability_manage.py b/ceres/manages/vulnerability_manage.py
index 8547abe..cfecb60 100644
--- a/ceres/manages/vulnerability_manage.py
+++ b/ceres/manages/vulnerability_manage.py
@@ -429,14 +429,11 @@ class VulnerabilityManage:
if status_code == FAIL or not re.search("base-pkg/hotpatch", hotpatch_list_output):
return None
- for hotpatch_info in [line for line in hotpatch_list_output.split(os.linesep) if line]:
- if not hotpatch_info.startswith("CVE"):
- continue
- _, hot_pkg, _, = [info.strip() for info in hotpatch_info.split()]
- if hot_pkg == "base-pkg/hotpatch":
- continue
- return hot_pkg
- return ""
+ for hotpatch_info in [line for line in hotpatch_list_output.split(os.linesep) if line.startswith("CVE")]:
+ _, hot_pkg, status = hotpatch_info.strip().split()
+ if status == "ACTIVED":
+ return hot_pkg
+ return None
def _syscare_operate(self, operate, patch_name=None):
"""
--
Gitee