[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/05: cve: Make CPE patch level part of the version string.
From: |
Ludovic Courtès |
Subject: |
01/05: cve: Make CPE patch level part of the version string. |
Date: |
Fri, 11 Mar 2016 15:34:19 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit cf557afa2e679f73b93796460dee23d5c5c314c5
Author: Ludovic Courtès <address@hidden>
Date: Fri Mar 11 10:21:58 2016 +0100
cve: Make CPE patch level part of the version string.
* guix/cve.scm (%cpe-package-rx): Adjust to account for :PATCH-LEVEL.
(cpe->package-name): Likewise.
---
guix/cve.scm | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/guix/cve.scm b/guix/cve.scm
index a7b0bde..663097b 100644
--- a/guix/cve.scm
+++ b/guix/cve.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015, 2016 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -70,8 +70,9 @@
(close-port port)))))
(define %cpe-package-rx
- ;; For applications: "cpe:/a:VENDOR:PACKAGE:VERSION".
- (make-regexp "^cpe:/a:([^:]+):([^:]+):([^:]+)"))
+ ;; For applications: "cpe:/a:VENDOR:PACKAGE:VERSION", or sometimes
+ ;; "cpe/a:VENDOR:PACKAGE:VERSION:PATCH-LEVEL".
+ (make-regexp "^cpe:/a:([^:]+):([^:]+):([^:]+)((:.+)?)"))
(define (cpe->package-name cpe)
"Converts the Common Platform Enumeration (CPE) string CPE to a package
@@ -80,7 +81,13 @@ CPE string."
(and=> (regexp-exec %cpe-package-rx (string-trim-both cpe))
(lambda (matches)
(cons (match:substring matches 2)
- (match:substring matches 3)))))
+ (string-append (match:substring matches 3)
+ (match (match:substring matches 4)
+ ("" "")
+ (patch-level
+ ;; Drop the colon from things like
+ ;; "cpe:/a:openbsd:openssh:6.8:p1".
+ (string-drop patch-level 1))))))))
(define %parse-vulnerability-feed
;; Parse the XML vulnerability feed from