Gnus development mailing list
 help / color / mirror / Atom feed
From: Andreas Seltenreich <andreas+ding@gate450.dyndns.org>
To: Greg Troxel <gdt@work.lexort.com>
Cc: ding@gnus.org
Subject: Re: bad boundary choice in forwarded multipart/signed multipart/mixed
Date: Sat, 01 May 2010 09:17:09 +0200	[thread overview]
Message-ID: <87y6g46qh6.fsf@gate450.dyndns.org> (raw)
In-Reply-To: <smumxwmcmzp.fsf@linuxpal.mit.edu> (Greg Troxel's message of "Thu, 29 Apr 2010 11:11:22 -0400")

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

Greg Troxel writes:

> The inner test message had boundary =-=-= originally.  That got remapped
> whent he message was forwarded, which I suppose is ok.

Yeah, Gnus is a bit eager with regenerating MIME (you can tame it using
message-forward-show-mml).

> But it got remaped to ===-=-= and that's the same value that was
> chosen for the outer message's multipart/signed.
[...]
> It looks like the key code is in mml.el in gnus, but I haven't
> understood it yet.

My analysis so far:

(a) mml-multipart-number is let-bound on recursive descend of
    mml-generate-mime.  So mml-compute-boundary potentially generates
    duplicate delimiters unless the collision test prevents it.

(b) The collision test code doesn't look at the content of
    message/rfc822 [#mml] handles.

(c) If it would look at them, it wouldn't note a collision generated by
    (a) since the handle still contains the untranslated
    [#multipart]-tags instead of MIME.

I think (b) needs to be fixed anyway because a collision could occur
independently of (a).  Now either fixing (a) or (c) should prevent the
generation of broken MIME.  I guess squishing the bug the (b) + (c) way
is more adequate since it's less invasive.  Will push in a jiffy.

Thanks for your elaborate report,
andreas


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 933 bytes --]

diff --git a/lisp/mml.el b/lisp/mml.el
index f262dc6..9dc0966 100644
--- a/lisp/mml.el
+++ b/lisp/mml.el
@@ -520,7 +520,10 @@ (defun mml-generate-mime-1 (cont)
 			  ;; `m-g-d-t' will be bound to "message/rfc822"
 			  ;; when encoding an article to be forwarded.
 			  (mml-generate-default-type "text/plain"))
-		      (mml-to-mime))
+		      (mml-to-mime)
+		      ;; Update handle so mml-compute-boundary can
+		      ;; detect collisions with the nested parts.
+		      (setcdr (assoc 'contents cont) (buffer-string)))
 		    (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
 		      ;; ignore 0x1b, it is part of iso-2022-jp
 		      (setq encoding (mm-body-7-or-8))))
@@ -699,7 +702,7 @@ (defun mml-compute-boundary (cont)
 (defun mml-compute-boundary-1 (cont)
   (let (filename)
     (cond
-     ((eq (car cont) 'part)
+     ((member (car cont) '(part mml))
       (with-temp-buffer
 	(cond
 	 ((cdr (assq 'buffer cont))

      reply	other threads:[~2010-05-01  7:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-29 15:11 Greg Troxel
2010-05-01  7:17 ` Andreas Seltenreich [this message]

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

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

  git send-email \
    --in-reply-to=87y6g46qh6.fsf@gate450.dyndns.org \
    --to=andreas+ding@gate450.dyndns.org \
    --cc=ding@gnus.org \
    --cc=gdt@work.lexort.com \
    /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.
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 NNTP newsgroup(s).