emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 59243e9 3/4: Fix two mml-sec minor bugs revealed by new test harn


From: Lars Ingebrigtsen
Subject: master 59243e9 3/4: Fix two mml-sec minor bugs revealed by new test harness
Date: Tue, 4 Aug 2020 13:29:01 -0400 (EDT)

branch: master
commit 59243e9f18a247bddd91ed704c8e3234383ed414
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix two mml-sec minor bugs revealed by new test harness
    
    * lisp/gnus/mml-sec.el
    (mml-secure-allow-signing-with-unknown-recipient): New variable
    (bug#18393) (but this should probably be fixed in a different way).
    (mml-secure-epg-sign): Use it.
    (mml-secure-check-user-id): Protect against recipients that aren't
    email addresses, like "No recipient".
---
 lisp/gnus/mml-sec.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el
index 740e1d2..69852c3 100644
--- a/lisp/gnus/mml-sec.el
+++ b/lisp/gnus/mml-sec.el
@@ -665,8 +665,9 @@ The passphrase is read and cached."
                         (epg-user-id-string uid))))
                 (equal (downcase (car (mail-header-parse-address
                                        (epg-user-id-string uid))))
-                       (downcase (car (mail-header-parse-address
-                                       recipient))))
+                       (downcase (or (car (mail-header-parse-address
+                                           recipient))
+                                     recipient)))
                 (not (memq (epg-user-id-validity uid)
                            '(revoked expired))))
            (throw 'break t))))))
@@ -937,6 +938,10 @@ If no one is selected, symmetric encryption will be 
performed.  "
        (signal (car error) (cdr error))))
     cipher))
 
+;; Should probably be removed and the interface should be different.
+(defvar mml-secure-allow-signing-with-unknown-recipient nil
+  "Variable to bind to allow automatic recipient selection.")
+
 (defun mml-secure-epg-sign (protocol mode)
   ;; Based on code appearing inside mml2015-epg-sign.
   (let* ((context (epg-make-context protocol))
@@ -953,7 +958,8 @@ If no one is selected, symmetric encryption will be 
performed.  "
         ;; then there's no point advising the user to examine it.  If
         ;; there are any other variables worth examining, please
         ;; improve this error message by having it mention them.
-        (error "Couldn't find any signer names%s" maybe-msg)))
+       (unless mml-secure-allow-signing-with-unknown-recipient
+          (error "Couldn't find any signer names%s" maybe-msg))))
     (when (eq 'OpenPGP protocol)
       (setf (epg-context-armor context) t)
       (setf (epg-context-textmode context) t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]