unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: emacs-devel@gnu.org
Subject: Please install this for me (2)
Date: Sat, 23 Feb 2019 23:45:02 -0500	[thread overview]
Message-ID: <E1gxlew-0005hT-5u@fencepost.gnu.org> (raw)

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Would someone please install this bug fix?

2019-02-23  Richard Stallman  <rms@gnu.org>

	* lisp/mail/rmail.el (rmail-epa-decrypt): 
	Don't decrypt an armor that was copied into
        the message from a message it is a reply to.
	(rmail-epa-decrypt-1): Catch and ignore errors
	in epa-decrypt-region.
	Make armor-start and armor-end markers.

diff -u /home/rms/emacs-git/build-oct-4/lisp/mail/rmail.el.\~1\~ /home/rms/emacs-git/build-oct-4/lisp/mail/rmail.el
--- /home/rms/emacs-git/build-oct-4/lisp/mail/rmail.el.~1~	2018-11-17 18:00:19.352983946 -0500
+++ /home/rms/emacs-git/build-oct-4/lisp/mail/rmail.el	2018-11-17 18:05:37.168476414 -0500
@@ -4548,6 +4548,9 @@
 
     (unless armor-end
       (error "Encryption armor beginning has no matching end"))
+    (setq armor-start (move-marker (make-marker) armor-start))
+    (setq armor-end (move-marker (make-marker) armor-end))
+
     (goto-char armor-start)
 
     ;; Because epa--find-coding-system-for-mime-charset not autoloaded.
@@ -4580,16 +4583,17 @@
         (mail-unquote-printable-region armor-start
                                        (- (point-max) after-end))))
 
-    ;; Decrypt it, maybe in place, maybe making new buffer.
-    (epa-decrypt-region
-     armor-start (- (point-max) after-end)
-     ;; Call back this function to prepare the output.
-     (lambda ()
-       (let ((inhibit-read-only t))
-         (delete-region armor-start (- (point-max) after-end))
-         (goto-char armor-start)
-         (current-buffer))))
-
+    (condition-case nil
+        (epa-decrypt-region
+         armor-start (- (point-max) after-end)
+         ;; Call back this function to prepare the output.
+         (lambda ()
+           (let ((inhibit-read-only t))
+             (delete-region armor-start (- (point-max) after-end))
+             (goto-char armor-start)
+             (current-buffer))))
+      (error nil))
+ 
     (list armor-start (- (point-max) after-end) mime
           armor-end-regexp
           (buffer-substring armor-start (- (point-max) after-end)))))
@@ -4624,9 +4628,14 @@
       (goto-char (point-min))
       (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
 	(let ((coding-system-for-read coding-system-for-read)
-	      (case-fold-search t))
-
-          (push (rmail-epa-decrypt-1 mime) decrypts)))
+	      (case-fold-search t)
+              (armor-start (match-beginning 0)))
+          ;; Don't decrypt an armor that was copied into
+          ;; the message from a message it is a reply to.
+          (or (equal (buffer-substring (line-beginning-position)
+                                       armor-start)
+                     "> ")
+              (push (rmail-epa-decrypt-1 mime) decrypts))))
 
       (when (and decrypts (eq major-mode 'rmail-mode))
         (rmail-add-label "decrypt"))

Diff finished.  Sat Feb 23 20:23:43 2019

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





             reply	other threads:[~2019-02-24  4:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24  4:45 Richard Stallman [this message]
2019-02-24 18:46 ` Please install this for me (2) Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1gxlew-0005hT-5u@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).