summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-08-04 19:26:04 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-08-04 19:28:51 +0200
commit59243e9f18a247bddd91ed704c8e3234383ed414 (patch)
tree1cbfeebfe35dc8090c19f27396c6cb638db07a5d
parentfbfa70f486522e1b752ebf3d8590375508ea2a55 (diff)
downloademacs-59243e9f18a247bddd91ed704c8e3234383ed414.tar.gz
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".
-rw-r--r--lisp/gnus/mml-sec.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el
index 740e1d2b722..69852c381d6 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)