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.
This commit is contained in:
parent
d381962f35
commit
cf557afa2e
15
guix/cve.scm
15
guix/cve.scm
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -70,8 +70,9 @@
|
||||||
(close-port port)))))
|
(close-port port)))))
|
||||||
|
|
||||||
(define %cpe-package-rx
|
(define %cpe-package-rx
|
||||||
;; For applications: "cpe:/a:VENDOR:PACKAGE:VERSION".
|
;; For applications: "cpe:/a:VENDOR:PACKAGE:VERSION", or sometimes
|
||||||
(make-regexp "^cpe:/a:([^:]+):([^:]+):([^:]+)"))
|
;; "cpe/a:VENDOR:PACKAGE:VERSION:PATCH-LEVEL".
|
||||||
|
(make-regexp "^cpe:/a:([^:]+):([^:]+):([^:]+)((:.+)?)"))
|
||||||
|
|
||||||
(define (cpe->package-name cpe)
|
(define (cpe->package-name cpe)
|
||||||
"Converts the Common Platform Enumeration (CPE) string CPE to a package
|
"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))
|
(and=> (regexp-exec %cpe-package-rx (string-trim-both cpe))
|
||||||
(lambda (matches)
|
(lambda (matches)
|
||||||
(cons (match:substring matches 2)
|
(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
|
(define %parse-vulnerability-feed
|
||||||
;; Parse the XML vulnerability feed from
|
;; Parse the XML vulnerability feed from
|
||||||
|
|
Loading…
Reference in New Issue