[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 4318d70: Reject gpg 2.0 for epg configs by default
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master 4318d70: Reject gpg 2.0 for epg configs by default (Bug#23561) |
Date: |
Sun, 15 Jul 2018 21:54:02 -0400 (EDT) |
branch: master
commit 4318d70677dedea12a3dcfb689bce71e409212f0
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Reject gpg 2.0 for epg configs by default (Bug#23561)
Previously, gpg2 2.0 would be rejected, but the same version installed
as "gpg" would be accepted.
* lisp/epg-config.el (epg-gpg2-minimum-version): New constant.
(epg-config--program-alist) <OpenPGP>: Require a version in 1.4.3..2.0
or 2.1.6+., not just anything above 1.4.3.
(epg-check-configuration): Accept a list of required version
intervals, in addtion to just a single minimum.
---
lisp/epg-config.el | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index 8543498..39d264c 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -98,11 +98,14 @@ Note that the buffer name starts with a space."
:type 'boolean)
(defconst epg-gpg-minimum-version "1.4.3")
+(defconst epg-gpg2-minimum-version "2.1.6")
(defconst epg-config--program-alist
`((OpenPGP
epg-gpg-program
- ("gpg2" . "2.1.6") ("gpg" . ,epg-gpg-minimum-version))
+ ("gpg2" . ,epg-gpg2-minimum-version)
+ ("gpg" . ((,epg-gpg-minimum-version . "2.0")
+ ,epg-gpg2-minimum-version)))
(CMS
epg-gpgsm-program
("gpgsm" . "2.0.4")))
@@ -231,14 +234,26 @@ version requirement is met."
(epg-config--make-gpg-configuration epg-gpg-program))
;;;###autoload
-(defun epg-check-configuration (config &optional minimum-version)
- "Verify that a sufficient version of GnuPG is installed."
+(defun epg-check-configuration (config &optional req-versions)
+ "Verify that a sufficient version of GnuPG is installed.
+CONFIG should be a `epg-configuration' object (a plist).
+REQ-VERSIONS should be a list with elements of the form (MIN
+. MAX) where MIN and MAX are version strings indicating a
+semi-open range of acceptable versions. REQ-VERSIONS may also be
+a single minimum version string."
(let ((version (alist-get 'version config)))
(unless (stringp version)
(error "Undetermined version: %S" version))
- (unless (version<= (or minimum-version
- epg-gpg-minimum-version)
- version)
+ (catch 'version-ok
+ (pcase-dolist ((or `(,min . ,max)
+ (and min (let max nil)))
+ (if (listp req-versions) req-versions
+ (list req-versions)))
+ (when (and (version<= (or min epg-gpg-minimum-version)
+ version)
+ (or (null max)
+ (version< version max)))
+ (throw 'version-ok t)))
(error "Unsupported version: %s" version))))
;;;###autoload
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 4318d70: Reject gpg 2.0 for epg configs by default (Bug#23561),
Noam Postavsky <=