Subject: Re: bug#18513: 24.3; message-mode sends unencrypted on error

From: Daiki Ueno <[email-masked]>
Date: Mon, 29 Sep 2014 20:09:53 +0900

David Bremner <[email-masked]> writes:

> 1) Start emacs with emacs -Q
> 2) start sending a message with M-x message-mail
> 3) add "sign" tag with C-c C-m C-s
> 3) manually replace "sign with "sigencrypt", simulating failed attempt to 
>    manually change mode
> 4) add some text to the message, set a destination address and 
>    subject
> 5) send using C-c C-c
>
> The message is sent unencrypted, without any feedback to the user.  It
> seems that the correct response would be to refuse to send a message
> with malformed mml tags.

I've installed the following simple fix in the trunk.  Does it work for you?
=== modified file 'lisp/gnus/ChangeLog'
--- lisp/gnus/ChangeLog	2014-09-11 19:44:25 +0000
+++ lisp/gnus/ChangeLog	2014-09-29 11:02:32 +0000
@@ -1,3 +1,8 @@
+2014-09-29  Daiki Ueno  <[email-masked]>
+
+	* mml.el (mml-parse-1): Error out if unknown mode is specified in
+	<#secure> tag (bug#18513).
+
 2014-09-11  Paul Eggert  <[email-masked]>
 
 	* gnus-cloud.el (gnus-cloud-parse-version-1): Fix misspelling

=== modified file 'lisp/gnus/mml.el'
--- lisp/gnus/mml.el	2014-03-24 01:56:03 +0000
+++ lisp/gnus/mml.el	2014-09-29 11:00:11 +0000
@@ -257,7 +257,9 @@
 		((string= mode "encrypt")
 		 (setq tags (list "encrypt" method)))
 		((string= mode "signencrypt")
-		 (setq tags (list "sign" method "encrypt" method))))
+		 (setq tags (list "sign" method "encrypt" method)))
+		(t
+		 (error "Unknown secure mode %s" mode)))
 	  (eval `(mml-insert-tag ,secure-mode
 				 ,@tags
 				 ,(if keyfile "keyfile")