Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix for mime boundary computation
@ 2003-12-11 23:17 Jeremy Maitin-Shepard
  2003-12-31  2:34 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Maitin-Shepard @ 2003-12-11 23:17 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 450 bytes --]

It appears that Gnus currently will in certain cases incorrectly select
a MIME boundary that occurs within the message, resulting in a corrupt
message.  Specifically, it appears that `mml-boundary-function' is
called directly in a number of places outside of `mml-compute-boundary'
both in mml.el and in mml2015.el.  It seems that the correct behavior
is to use `mml-compute-boundary' in these cases.

The attached patch corrects these uses.

[-- Attachment #1.2: mime-boundary.diff --]
[-- Type: text/plain, Size: 3183 bytes --]

? mime-boundary.diff
Index: mml.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mml.el,v
retrieving revision 6.85
diff -u -b -B -r6.85 mml.el
--- mml.el	3 Dec 2003 22:05:38 -0000	6.85
+++ mml.el	11 Dec 2003 23:08:29 -0000
@@ -430,8 +430,7 @@
 				       (+ (match-beginning 0) 3))))))
 		  (cond
 		   ((eq (car cont) 'mml)
-		    (let ((mml-boundary (funcall mml-boundary-function
-						 (incf mml-multipart-number)))
+		    (let ((mml-boundary (mml-compute-boundary cont)))
 			  (mml-generate-default-type "text/plain"))
 		      (mml-to-mime))
 		    (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
Index: mml2015.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mml2015.el,v
retrieving revision 6.62
diff -u -b -B -r6.62 mml2015.el
--- mml2015.el	2 May 2003 17:55:28 -0000	6.62
+++ mml2015.el	11 Dec 2003 23:08:30 -0000
@@ -277,8 +277,7 @@
 (defun mml2015-mailcrypt-sign (cont)
   (mc-sign-generic (message-options-get 'message-sender)
 		   nil nil nil nil)
-  (let ((boundary
-	 (funcall mml-boundary-function (incf mml-multipart-number)))
+  (let ((boundary (mml-compute-boundary cont))
 	hash point)
     (goto-char (point-min))
     (unless (re-search-forward "^-----BEGIN PGP SIGNED MESSAGE-----\r?$" nil t)
@@ -341,8 +340,7 @@
   (goto-char (point-min))
   (unless (looking-at "-----BEGIN PGP MESSAGE-----")
     (error "Fail to encrypt the message"))
-  (let ((boundary
-	 (funcall mml-boundary-function (incf mml-multipart-number))))
+  (let ((boundary (mml-compute-boundary cont)))
     (insert (format "Content-Type: multipart/encrypted; boundary=\"%s\";\n"
 		    boundary))
     (insert "\tprotocol=\"application/pgp-encrypted\"\n\n")
@@ -544,8 +542,7 @@
      mm-security-handle 'gnus-info "Failed")))
 
 (defun mml2015-gpg-sign (cont)
-  (let ((boundary
-	 (funcall mml-boundary-function (incf mml-multipart-number)))
+  (let ((boundary (mml-compute-boundary cont))
 	(text (current-buffer)) signature)
     (goto-char (point-max))
     (unless (bolp)
@@ -578,8 +575,7 @@
       (goto-char (point-max)))))
 
 (defun mml2015-gpg-encrypt (cont &optional sign)
-  (let ((boundary
-	 (funcall mml-boundary-function (incf mml-multipart-number)))
+  (let ((boundary (mml-compute-boundary cont))
 	(text (current-buffer))
 	cipher)
     (mm-with-unibyte-current-buffer
@@ -807,7 +803,7 @@
 
 (defun mml2015-pgg-sign (cont)
   (let ((pgg-errors-buffer mml2015-result-buffer)
-	(boundary (funcall mml-boundary-function (incf mml-multipart-number)))
+	(boundary (mml-compute-boundary cont))
 	(pgg-default-user-id (or (message-options-get 'mml-sender)
 				 pgg-default-user-id)))
     (unless (pgg-sign-region (point-min) (point-max))
@@ -829,7 +825,7 @@
 
 (defun mml2015-pgg-encrypt (cont &optional sign)
   (let ((pgg-errors-buffer mml2015-result-buffer)
-	(boundary (funcall mml-boundary-function (incf mml-multipart-number))))
+	(boundary (mml-compute-boundary cont)))
     (unless (pgg-encrypt-region (point-min) (point-max)
 				(split-string
 				 (or

[-- Attachment #1.3: Type: text/plain, Size: 30 bytes --]


-- 
Jeremy Maitin-Shepard

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

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

* Re: [PATCH] Fix for mime boundary computation
  2003-12-11 23:17 [PATCH] Fix for mime boundary computation Jeremy Maitin-Shepard
@ 2003-12-31  2:34 ` Lars Magne Ingebrigtsen
  2003-12-31  3:03   ` Jeremy Maitin-Shepard
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-12-31  2:34 UTC (permalink / raw)


Jeremy Maitin-Shepard <jbms@attbi.com> writes:

> It appears that Gnus currently will in certain cases incorrectly select
> a MIME boundary that occurs within the message, resulting in a corrupt
> message.  Specifically, it appears that `mml-boundary-function' is
> called directly in a number of places outside of `mml-compute-boundary'
> both in mml.el and in mml2015.el.  It seems that the correct behavior
> is to use `mml-compute-boundary' in these cases.
>
> The attached patch corrects these uses.

Thanks for the patch; I've applied it to Gnus v5.10.4 (i. e., CVS).

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: [PATCH] Fix for mime boundary computation
  2003-12-31  2:34 ` Lars Magne Ingebrigtsen
@ 2003-12-31  3:03   ` Jeremy Maitin-Shepard
  2003-12-31  3:12     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Maitin-Shepard @ 2003-12-31  3:03 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> [snip]

> Thanks for the patch; I've applied it to Gnus v5.10.4 (i. e., CVS).

Good.  As a noted in a message to bugs@gnus.org, the original patch I
sent both to bugs@gnus.org and in the message to which you responded
contains an extra and incorrect `)' in the addition to mml.el.

-- 
Jeremy Maitin-Shepard



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

* Re: [PATCH] Fix for mime boundary computation
  2003-12-31  3:03   ` Jeremy Maitin-Shepard
@ 2003-12-31  3:12     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-12-31  3:12 UTC (permalink / raw)


Jeremy Maitin-Shepard <jbms@attbi.com> writes:

> Good.  As a noted in a message to bugs@gnus.org, the original patch I
> sent both to bugs@gnus.org and in the message to which you responded
> contains an extra and incorrect `)' in the addition to mml.el.

Ok; removed.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

end of thread, other threads:[~2003-12-31  3:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-11 23:17 [PATCH] Fix for mime boundary computation Jeremy Maitin-Shepard
2003-12-31  2:34 ` Lars Magne Ingebrigtsen
2003-12-31  3:03   ` Jeremy Maitin-Shepard
2003-12-31  3:12     ` Lars Magne Ingebrigtsen

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