From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/55205 Path: main.gmane.org!not-for-mail From: Jeremy Maitin-Shepard Newsgroups: gmane.emacs.gnus.general Subject: [PATCH] Fix for mime boundary computation Date: Thu, 11 Dec 2003 18:17:37 -0500 Sender: ding-owner@lists.math.uh.edu Message-ID: <87n09zgd0u.fsf@jbms.ath.cx> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: sea.gmane.org 1071184654 18209 80.91.224.253 (11 Dec 2003 23:17:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 11 Dec 2003 23:17:34 +0000 (UTC) Original-X-From: ding-owner+M3745@lists.math.uh.edu Fri Dec 12 00:17:32 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AUa3o-0006kS-00 for ; Fri, 12 Dec 2003 00:17:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1AUa2B-0001B6-00; Thu, 11 Dec 2003 17:15:51 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1AUa23-0001B0-00 for ding@lists.math.uh.edu; Thu, 11 Dec 2003 17:15:43 -0600 Original-Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.198.35]) by justine.libertine.org (Postfix) with ESMTP id 80EB73A0046 for ; Thu, 11 Dec 2003 17:15:42 -0600 (CST) Original-Received: from jay.local.invalid (h00105aa5eefe.ne.client2.attbi.com[24.91.123.131]) by comcast.net (rwcrmhc11) with ESMTP id <2003121123154101300bn6o1e>; Thu, 11 Dec 2003 23:15:41 +0000 Original-Received: by jay.local.invalid (Postfix, from userid 1000) id 6A510219F3B; Thu, 11 Dec 2003 18:17:43 -0500 (EST) Original-To: ding@gnus.org User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:55205 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:55205 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=mime-boundary.diff Content-Transfer-Encoding: quoted-printable ? mime-boundary.diff Index: mml.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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?$" n= il 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=3D\"%s\";= \n" boundary)) (insert "\tprotocol=3D\"application/pgp-encrypted\"\n\n") @@ -544,8 +542,7 @@ mm-security-handle 'gnus-info "Failed"))) =20 (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))))) =20 (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 @@ =20 (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 @@ =20 (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 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable --=20 Jeremy Maitin-Shepard --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQA/2PsXASWI4gwIY4kRAlKbAJ4oGyAgydhCqShhtWmughnB+gVAFgCgpB2Z 6RYvSszKAnzzFJ+GBXZlOv4= =mm+T -----END PGP SIGNATURE----- --==-=-=--