Re: [PATCH v3 0/6] Make Emacs search use sexp format
[notmuch-archives.git] / 68 / 3624525d0de8de69f57097627a095d3dd01311
1 Return-Path: <tbielawa@redhat.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id BC4FA431FAF\r
6         for <notmuch@notmuchmail.org>; Sat,  3 Mar 2012 15:54:57 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -5\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-5 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_HI=-5] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id qS7xfar0+lgA for <notmuch@notmuchmail.org>;\r
16         Sat,  3 Mar 2012 15:54:57 -0800 (PST)\r
17 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25])\r
18         by olra.theworths.org (Postfix) with ESMTP id ECE54431FAE\r
19         for <notmuch@notmuchmail.org>; Sat,  3 Mar 2012 15:54:56 -0800 (PST)\r
20 Received: from zmail10.collab.prod.int.phx2.redhat.com\r
21         (zmail10.collab.prod.int.phx2.redhat.com [10.5.83.12])\r
22         by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q23NstD0031277;\r
23         Sat, 3 Mar 2012 18:54:55 -0500\r
24 To: notmuch@notmuchmail.org, jani@nikula.org\r
25 From: Tim Bielawa <tbielawa@redhat.com>\r
26 Date: Sat, 03 Mar 2012 18:54:55 -0500 (EST)\r
27 X-Mailer: TouchDown\r
28 X-Mailer: Zimbra 7.1.2_GA_3268 (MobileSync - TouchDown(MSRPC)/7.1.00012/)\r
29 MIME-Version: 1.0\r
30 Subject: Re: [PATCH] Fix mml-quoting in responses where pgp-signing is enabled\r
31 Content-Type: multipart/mixed;boundary="__1330818891440TOUCHDOWN_BOUNDARY__"\r
32 Message-ID: <817359227.7576598.1330818895565.JavaMail.root@zmail10.collab.prod.int.phx2.redhat.com>\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.13\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Sat, 03 Mar 2012 23:54:57 -0000\r
46 \r
47 --__1330818891440TOUCHDOWN_BOUNDARY__\r
48 Content-Type: text/plain; charset=UTF-8\r
49 Content-Transfer-Encoding: 7bit\r
50 \r
51 Great point, I considered that too after I authored the original patch. It's a better approach I think. I'll try and give it a test run later tonight.\r
52 \r
53 \r
54 -----Original Message-----\r
55 From: Jani Nikula [jani@nikula.org]\r
56 Received: Saturday, 03 Mar 2012, 6:36pm\r
57 To: Tim Bielawa [tbielawa@redhat.com]; notmuch@notmuchmail.org\r
58 Subject: Re: [PATCH] Fix mml-quoting in responses where pgp-signing is enabled\r
59 \r
60 \r
61 On Sat,  3 Mar 2012 17:04:22 -0500, Tim Bielawa <tbielawa@redhat.com> wrote:\r
62 > The addition of mml-quote-region (notmuch-mua.el) in 2c6710e3 breaks\r
63 > automatic signing in replies. When replies are mml-quoted and signing\r
64 > is enabled by default the "<#part sign=pgpmime>" string will appear on\r
65 > line 1. This will be consumed during the application of the\r
66 > mml-quote-region function and transform into the inert string\r
67 > "<#!part sign=pgpmime>". The result is that responses will no longer\r
68 > be signed by default.\r
69\r
70 > This fix moves the point forward one line before applying the quoting\r
71 > function.\r
72\r
73 > Consideration: Clients not signing mail by default. The first line of\r
74 > their responses would be skipped when the quoting function is\r
75 > applied. This string takes this general form:\r
76\r
77 >     On Sat, 03 Mar 2012 12:55:14 -0800, notmuch-request@notmuchmail.org wrote:\r
78\r
79 > Because the string is generated by notmuch I don't believe this fix\r
80 > introduces the possibility for malicious mml commands being omitted\r
81 > from the quoting.\r
82 \r
83 Hmm, would it work to mml quote the reply *before* extracting it from\r
84 the temp buffer, like below? It would handle not mml quoting the user's\r
85 signature too. Completely untested...\r
86 \r
87 BR,\r
88 Jani.\r
89 \r
90 \r
91 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
92 index 4be7c13..13244eb 100644\r
93 --- a/emacs/notmuch-mua.el\r
94 +++ b/emacs/notmuch-mua.el\r
95 @@ -95,6 +95,9 @@ list."\r
96               (goto-char (point-min))\r
97               (setq headers (mail-header-extract)))))\r
98        (forward-line 1)\r
99 +      ;; Original message may contain (malicious) MML tags. We must\r
100 +      ;; properly quote them in the reply.\r
101 +      (mml-quote-region (point) (point-max))\r
102        (setq body (buffer-substring (point) (point-max))))\r
103      ;; If sender is non-nil, set the From: header to its value.\r
104      (when sender\r
105 @@ -116,12 +119,7 @@ list."\r
106      (push-mark))\r
107    (set-buffer-modified-p nil)\r
108  \r
109 -  (message-goto-body)\r
110 -  ;; Original message may contain (malicious) MML tags.  We must\r
111 -  ;; properly quote them in the reply.  Note that using `point-max'\r
112 -  ;; instead of `mark' here is wrong.  The buffer may include user's\r
113 -  ;; signature which should not be MML-quoted.\r
114 -  (mml-quote-region (point) (mark)))\r
115 +  (message-goto-body))\r
116  \r
117  (defun notmuch-mua-forward-message ()\r
118    (message-forward)\r
119 \r
120 --__1330818891440TOUCHDOWN_BOUNDARY__--\r