unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Please install this for me (2)
@ 2019-02-24  4:45 Richard Stallman
  2019-02-24 18:46 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2019-02-24  4:45 UTC (permalink / raw)
  To: emacs-devel

[[[ 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)





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-24 18:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-24  4:45 Please install this for me (2) Richard Stallman
2019-02-24 18:46 ` Paul Eggert

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).