From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/59914 Path: main.gmane.org!not-for-mail From: =?utf-8?Q?Arne_J=C3=B8rgensen?= Newsgroups: gmane.emacs.gnus.general Subject: S/MIME verification/decryption of MIME parts (patch) Date: Sat, 26 Feb 2005 00:16:29 +0100 Organization: Arne Joergensen -- http://arnested.dk/ Message-ID: <87r7j4xmb6.fsf@seamus.arnested.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1109373313 13420 80.91.229.2 (25 Feb 2005 23:15:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Feb 2005 23:15:13 +0000 (UTC) Cc: Simon Josefsson Original-X-From: ding-owner+M8455@lists.math.uh.edu Sat Feb 26 00:15:12 2005 Original-Received: from malifon.math.uh.edu ([129.7.128.13] ident=mail) by ciao.gmane.org with esmtp (Exim 4.43) id 1D4ofr-0007QK-7V for ding-account@gmane.org; Sat, 26 Feb 2005 00:15:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1D4ohr-0005zB-00; Fri, 25 Feb 2005 17:17:11 -0600 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1D4ohl-0005z6-00 for ding@lists.math.uh.edu; Fri, 25 Feb 2005 17:17:05 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by util2.math.uh.edu with esmtp (Exim 4.30) id 1D4ohi-0003z0-0s for ding@lists.math.uh.edu; Fri, 25 Feb 2005 17:17:02 -0600 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1D4ohg-00009w-00 for ; Sat, 26 Feb 2005 00:17:00 +0100 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1D4odQ-00078N-0t for ding@gnus.org; Sat, 26 Feb 2005 00:12:36 +0100 Original-Received: from 213.237.94.152 ([213.237.94.152]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Feb 2005 00:12:35 +0100 Original-Received: from arne by 213.237.94.152 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Feb 2005 00:12:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: ding@gnus.org Original-Lines: 123 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 213.237.94.152 X-Face: 5t,7/Y$&<1A_t.$vC2{pWZ{m@3_06;kcm]no{hgEL/}Uz(>XV6cl4}xO\v?-h3%>znNaZtq `~rf,GY1T%r=a.zH`hOb(-]'x)nI088Z&|e;V^h;/TShou User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:5w9VrpgRm9B9MceWqVoRQPjJjjk= X-Spam-Score: -4.9 (----) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu X-MailScanner-From: ding-owner+m8455@lists.math.uh.edu X-MailScanner-To: ding-account@gmane.org Xref: main.gmane.org gmane.emacs.gnus.general:59914 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:59914 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, I think I mentioned earlier that there is a bug when you try to S/MIEM-verify/decrypt a signed/encrypted MIME part. I traced the bug to be that when `mm-dissect-buffer' is called on the MIME parts there is no longer a "From:" field to compare against. The attached patch fixes this by passing the from field on from `mm-dissect-buffer' to `mm-dissect-multipart' and then again to `mm-dissect-buffer'. Although this might seem to be a rare case it happens quite often on mailing list when they add unsubscribe information at the end of the mail in a MIME part. Withut this patch a signed message would end up saying "sender adress forge". I always thought the mailing list screw some headers, but it turned out to be Gnus instead ;-) Have a nice weekend. Kind reagrds, -- Arne Jørgensen --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=mm-decode.patch Content-Transfer-Encoding: 8bit Index: lisp/ChangeLog =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v retrieving revision 7.645 diff -u -p -r7.645 ChangeLog --- lisp/ChangeLog 25 Feb 2005 19:57:07 -0000 7.645 +++ lisp/ChangeLog 25 Feb 2005 23:03:41 -0000 @@ -1,3 +1,12 @@ +2005-02-26 Arne J,Ax(Brgensen + + * mm-decode.el (mm-dissect-buffer): Pass the from field on to + `mm-dissect-multipart' and receive the from field as an (optional) + argument from `mm-dissect-multipart'. + (mm-dissect-multipart): Receive the from field as an argument and + pass it on when we call `mm-dissect-buffer' on MIME parts. Fixes + verification/decryption of signed/encrypted MIME parts. + 2005-02-25 Teodor Zlatanov * gnus-sum.el (gnus-summary-move-article): set Index: lisp/mm-decode.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/mm-decode.el,v retrieving revision 7.19 diff -u -p -r7.19 mm-decode.el --- lisp/mm-decode.el 13 Feb 2005 04:44:41 -0000 7.19 +++ lisp/mm-decode.el 25 Feb 2005 23:03:42 -0000 @@ -509,10 +509,10 @@ Postpone undisplaying of viewers for typ (message "Destroying external MIME viewers") (mm-destroy-parts mm-postponed-undisplay-list))) -(defun mm-dissect-buffer (&optional no-strict-mime loose-mime) +(defun mm-dissect-buffer (&optional no-strict-mime loose-mime from) "Dissect the current buffer and return a list of MIME handles." (save-excursion - (let (ct ctl type subtype cte cd description id result from) + (let (ct ctl type subtype cte cd description id result) (save-restriction (mail-narrow-to-head) (when (or no-strict-mime @@ -523,8 +523,9 @@ Postpone undisplaying of viewers for typ cte (mail-fetch-field "content-transfer-encoding") cd (mail-fetch-field "content-disposition") description (mail-fetch-field "content-description") - from (mail-fetch-field "from") id (mail-fetch-field "content-id")) + (unless from + (setq from (mail-fetch-field "from"))) ;; FIXME: In some circumstances, this code is running within ;; an unibyte macro. mail-extract-address-components ;; creates unibyte buffers. This `if', though not a perfect @@ -563,7 +564,7 @@ Postpone undisplaying of viewers for typ 'from from 'start start) (car ctl)) - (cons (car ctl) (mm-dissect-multipart ctl)))) + (cons (car ctl) (mm-dissect-multipart ctl from)))) (t (mm-possibly-verify-or-decrypt (mm-dissect-singlepart @@ -588,7 +589,7 @@ Postpone undisplaying of viewers for typ (mm-make-handle (mm-copy-to-buffer) ctl cte nil cdl description nil id))) -(defun mm-dissect-multipart (ctl) +(defun mm-dissect-multipart (ctl from) (goto-char (point-min)) (let* ((boundary (concat "\n--" (mail-content-type-get ctl 'boundary))) (close-delimiter (concat (regexp-quote boundary) "--[ \t]*$")) @@ -605,7 +606,7 @@ Postpone undisplaying of viewers for typ (save-excursion (save-restriction (narrow-to-region start (point)) - (setq parts (nconc (list (mm-dissect-buffer t)) parts))))) + (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts))))) (end-of-line 2) (or (looking-at boundary) (forward-line 1)) @@ -614,7 +615,7 @@ Postpone undisplaying of viewers for typ (save-excursion (save-restriction (narrow-to-region start end) - (setq parts (nconc (list (mm-dissect-buffer t)) parts))))) + (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts))))) (mm-possibly-verify-or-decrypt (nreverse parts) ctl))) (defun mm-copy-to-buffer () --=-=-=--