From 153a3a3298dfdf2b80551f571b11237d8f10b22e Mon Sep 17 00:00:00 2001 From: Jia Chao Date: Wed, 24 Jul 2024 15:00:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=BA=9B=20get=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E7=B1=BB=E4=BC=BC=20cvrf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jia Chao --- src/lib.rs | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index a70ca7d..22c7830 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,6 +54,47 @@ impl CSAF { return "" } + /// 详细的公告描述信息 + pub fn affected_component(&self) -> &str { + for note in &self.document.notes { + if note.title == "Affected Component" { + return ¬e.text + } + } + + return "" + } + + /// 受影响的产品列表 + pub fn affected_products(&self) -> Vec<&Product> { + let mut products = vec![]; + for product_branch in &self.product_tree.branches { + for branch in &product_branch.branches { + if &branch.name == "openEuler" { + products.push(&branch.branches[0].product); + break; + } + } + } + + products + } + + /// 已修复的 src 产品列表 + pub fn fixed_srcs(&self) -> Vec<&Product> { + let mut srcs = vec![]; + for product_branch in &self.product_tree.branches { + for branch in &product_branch.branches { + if &branch.name == "src" { + srcs.push(&branch.branches[0].product); + break; + } + } + } + + srcs + } + /// 安全公告所涉及的所有 CVE 的列表 pub fn cves(&self) -> Vec { let mut cves = vec![];