From 344465fd3b73502ea266e1009e99be93600d812f Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 17 Oct 2011 04:29:19 +0000 Subject: [PATCH] Merge changes made in Gnus trunk. mml2015.el (mml2015-epg-find-usable-key): Skip the whole key if the primary key is marked as disabled. mml1991.el (mml1991-epg-find-usable-key): Ditto. Thanks to Christian von Roques . --- lisp/gnus/ChangeLog | 7 +++++++ lisp/gnus/mml1991.el | 17 ++++++++++------- lisp/gnus/mml2015.el | 17 ++++++++++------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 2fd624e819b..cc2568a3647 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,10 @@ +2011-10-17 Daiki Ueno + + * mml2015.el (mml2015-epg-find-usable-key): Skip the whole key if the + primary key is marked as disabled. + * mml1991.el (mml1991-epg-find-usable-key): Ditto. + Thanks to Christian von Roques . + 2011-10-11 Andreas Schwab * html2text.el (html2text-clean-anchor): Check for quotes around diff --git a/lisp/gnus/mml1991.el b/lisp/gnus/mml1991.el index ad9f95796fe..1777a660319 100644 --- a/lisp/gnus/mml1991.el +++ b/lisp/gnus/mml1991.el @@ -282,13 +282,16 @@ Whether the passphrase is cached at all is controlled by (catch 'found (while keys (let ((pointer (epg-key-sub-key-list (car keys)))) - (while pointer - (if (and (memq usage (epg-sub-key-capability (car pointer))) - (not (memq 'disabled (epg-sub-key-capability (car pointer)))) - (not (memq (epg-sub-key-validity (car pointer)) - '(revoked expired)))) - (throw 'found (car keys))) - (setq pointer (cdr pointer)))) + ;; The primary key will be marked as disabled, when the entire + ;; key is disabled (see 12 Field, Format of colon listings, in + ;; gnupg/doc/DETAILS) + (unless (memq 'disabled (epg-sub-key-capability (car pointer))) + (while pointer + (if (and (memq usage (epg-sub-key-capability (car pointer))) + (not (memq (epg-sub-key-validity (car pointer)) + '(revoked expired)))) + (throw 'found (car keys))) + (setq pointer (cdr pointer))))) (setq keys (cdr keys))))) ;; XXX: since gpg --list-secret-keys does not return validity of each diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el index b9310beed58..028955a8c33 100644 --- a/lisp/gnus/mml2015.el +++ b/lisp/gnus/mml2015.el @@ -788,13 +788,16 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (catch 'found (while keys (let ((pointer (epg-key-sub-key-list (car keys)))) - (while pointer - (if (and (memq usage (epg-sub-key-capability (car pointer))) - (not (memq 'disabled (epg-sub-key-capability (car pointer)))) - (not (memq (epg-sub-key-validity (car pointer)) - '(revoked expired)))) - (throw 'found (car keys))) - (setq pointer (cdr pointer)))) + ;; The primary key will be marked as disabled, when the entire + ;; key is disabled (see 12 Field, Format of colon listings, in + ;; gnupg/doc/DETAILS) + (unless (memq 'disabled (epg-sub-key-capability (car pointer))) + (while pointer + (if (and (memq usage (epg-sub-key-capability (car pointer))) + (not (memq (epg-sub-key-validity (car pointer)) + '(revoked expired)))) + (throw 'found (car keys))) + (setq pointer (cdr pointer))))) (setq keys (cdr keys))))) ;; XXX: since gpg --list-secret-keys does not return validity of each -- 2.39.2