summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-02-06 15:11:29 +0200
committerEli Zaretskii <eliz@gnu.org>2021-02-06 15:11:29 +0200
commit1e0632e772f43ba7fd2aca180ee041bf3571d43f (patch)
treef39b67dfd851a9fc5c45f607ac1d7be8c188f910 /lisp/gnus
parentf534d3fdacb3d6114a0ebdc8df2723265339db5d (diff)
parent5903db0c2049c588f6b15717a8f9bd4c6a6f46a4 (diff)
downloademacs-1e0632e772f43ba7fd2aca180ee041bf3571d43f.tar.gz
emacs-1e0632e772f43ba7fd2aca180ee041bf3571d43f.tar.bz2
emacs-1e0632e772f43ba7fd2aca180ee041bf3571d43f.zip
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/message.el4
-rw-r--r--lisp/gnus/mml-sec.el15
2 files changed, 13 insertions, 6 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 6668784f93c..5a5dbcebc1e 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -4315,6 +4315,10 @@ It should typically alter the sending method in some way or other."
(when message-confirm-send
(or (y-or-n-p "Send message? ")
(keyboard-quit)))
+ (when (and (not (mml-secure-is-encrypted-p))
+ (mml-secure-is-encrypted-p 'anywhere)
+ (not (yes-or-no-p "This message has a <#secure tag, but is not going to be encrypted. Send anyway?")))
+ (error "Aborting sending"))
(message message-sending-message)
(let ((alist message-send-method-alist)
(success t)
diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el
index 8d01d15ca01..d41c9dd0d9a 100644
--- a/lisp/gnus/mml-sec.el
+++ b/lisp/gnus/mml-sec.el
@@ -298,14 +298,17 @@ Use METHOD if given. Else use `mml-secure-method' or
(interactive)
(mml-secure-part "smime"))
-(defun mml-secure-is-encrypted-p ()
- "Check whether secure encrypt tag is present."
+(defun mml-secure-is-encrypted-p (&optional tag-present)
+ "Whether the current buffer contains a mail message that should be encrypted.
+If TAG-PRESENT, say whether the <#secure tag is present anywhere
+in the buffer."
(save-excursion
(goto-char (point-min))
- (re-search-forward
- (concat "^" (regexp-quote mail-header-separator) "\n"
- "<#secure[^>]+encrypt")
- nil t)))
+ (message-goto-body)
+ (if tag-present
+ (re-search-forward "<#secure[^>]+encrypt" nil t)
+ (skip-chars-forward "[ \t\n")
+ (looking-at "<#secure[^>]+encrypt"))))
(defun mml-secure-bcc-is-safe ()
"Check whether usage of Bcc is safe (or absent).