From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 2B1166DE0173 for ; Tue, 27 Sep 2016 13:35:00 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.007 X-Spam-Level: X-Spam-Status: No, score=-0.007 tagged_above=-999 required=5 tests=[AWL=-0.137, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WGsLC-t7FTF3 for ; Tue, 27 Sep 2016 13:34:58 -0700 (PDT) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 58E166DE0134 for ; Tue, 27 Sep 2016 13:34:58 -0700 (PDT) Received: by mail-wm0-f67.google.com with SMTP id l132so2852523wmf.1 for ; Tue, 27 Sep 2016 13:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=V8jT1A5C+lx+k/3IQAPncdAsAiYDbpCw2kRiRTy89Zw=; b=BjVmpzZ9+kQOT/aa9DSQaa3TE7WqbQHz4nurUxYYxuyEiTxQQ4AMhE/MAgAOFZSVVa fyklwvtVX4USKt+DEQubF6u2W8oEgZMdv7TtVjpE28oNZo7n6MCYJUQDv8ya57uRrVtF 0HCMb4DHZN2XfPOUV1M54KXZdtn0vCtJ4l0RWY2jjAmwRQMrtz+kIEDCgE+ZKSeUNPX5 hv21hwUaaZHtl8U7ofT0dNWQkzR5Fb/ZZfvKWKHCUm5uBFkRS49l7BDv1upqyVyHz2sk Ieb3L/Py40erB9tnkE1xy/qCimd+BtxtHFu94wgLlgJUy7OQmGHu/jT0r8LJi0gjCzis J8+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=V8jT1A5C+lx+k/3IQAPncdAsAiYDbpCw2kRiRTy89Zw=; b=I7AyDuz2/KfgNe/yhr5ZXtM82xa8CeFM/3Z0duuIOqt1dLWMFBo2ZgDPp9+ZlomTDc SaI+2pSFEWHFk1U8thTX3ul8X7ha9dvYKMxgpnhm3nJkwHdodKraFD8Pq+bZ73CgbMB5 kgLxI10STs2nMYTeVa+nl8dZibd83ekEMSRAT1HweW89SQaJnIqz+Kqgro6xBqC0CsTW YINzaIQTAqSdPl0JJ5ys05z/phmKDQLyU4TC6+yAEIHJvfwv0VCZCMi0uI1NcgKOw+O+ fc1RQKxyzRoZGkFfJQJpyzPsjprV6DlqNQycbFlH4R9RWCWwBX3A3ZXo4Q5zkrH4xvGC uExw== X-Gm-Message-State: AA6/9Rle71R2Yykg00e1vS06kuktFpG6MlyPx3auyYn+duYwV4cXR+BHp/WVnoTF1AqKRQ== X-Received: by 10.28.186.68 with SMTP id k65mr4877660wmf.57.1475008495086; Tue, 27 Sep 2016 13:34:55 -0700 (PDT) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id r8sm4498648wjs.22.2016.09.27.13.34.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2016 13:34:54 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH] emacs: mua: check for misplaced secure mml tags Date: Tue, 27 Sep 2016 21:34:51 +0100 Message-Id: <1475008491-28175-1-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 2.1.4 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2016 20:35:00 -0000 Emacs message-send seems to ignore a secure mml tag anywhere except at the start of the body. Since this is almost certainly not desired we check for it, and require user confirmation before sending. As the setup before message-send or message-send-and-exit is getting more complicated it is convenient to unify the two correspoinding notmuch functions. --- In id:87d1kazlof.fsf@zancas.localnet bremner pointed out there are some oddities in message mode's handling of the mml secure tag -- that is ignored if it is not at the start of the body. This definitely causes a problem with the postpone/resume patch, but could also cause a problem in normal use. Since accidentally sending a message unencrypted is rather bad we check for it. This might also mean that the current postpone/resume code (which works in many cases) might be useable until a full solution is found. Best wishes Mark emacs/notmuch-mua.el | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 55bc267..aeb60e2 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -490,15 +490,38 @@ will be addressed to all recipients of the source message." (notmuch-mua-reply query-string sender reply-all) (deactivate-mark))) +(defun notmuch-mua-misplaced-secure-tag () + "Return t if there is a misplaced secure mml tag. + +Emacs message-send will (probably) ignore a secure mml tag +anywhere except at the start of the body. Since this is almost +certainly not desired we check for it -- this function returns +non-nil if there is such a tag." + (save-excursion + (message-goto-body) + (unless (eobp) + (forward-char) + (search-forward "<#secure" nil 't)))) + +(defun notmuch-mua-send-common (arg &optional exit) + (interactive "P") + (letf (((symbol-function 'message-do-fcc) #'notmuch-maildir-message-do-fcc)) + (when (or (not (notmuch-mua-misplaced-secure-tag)) + (yes-or-no-p "\ +There is a <#secure> tag not at the start of the body. It is +likely that the message will be sent unsigned and unencrypted. +Really send? ")) + (if exit + (message-send-and-exit arg) + (message-send arg))))) + (defun notmuch-mua-send-and-exit (&optional arg) (interactive "P") - (letf (((symbol-function 'message-do-fcc) #'notmuch-maildir-message-do-fcc)) - (message-send-and-exit arg))) + (notmuch-mua-send-common arg 't)) (defun notmuch-mua-send (&optional arg) (interactive "P") - (letf (((symbol-function 'message-do-fcc) #'notmuch-maildir-message-do-fcc)) - (message-send arg))) + (notmuch-mua-send-common arg)) (defun notmuch-mua-kill-buffer () (interactive) -- 2.1.4