Gnus development mailing list
 help / color / mirror / Atom feed
* S/MIME verification/decryption of MIME parts (patch)
@ 2005-02-25 23:16 Arne Jørgensen
  2005-02-25 23:24 ` Simon Josefsson
  0 siblings, 1 reply; 5+ messages in thread
From: Arne Jørgensen @ 2005-02-25 23:16 UTC (permalink / raw)
  Cc: Simon Josefsson

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

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 <http://arnested.dk/>


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

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  <arne@arnested.dk>
+
+	* 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  <tzz@lifelogs.com>
 
 	* 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 ()

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

* Re: S/MIME verification/decryption of MIME parts (patch)
  2005-02-25 23:16 S/MIME verification/decryption of MIME parts (patch) Arne Jørgensen
@ 2005-02-25 23:24 ` Simon Josefsson
  2005-02-27 17:11   ` Arne Jørgensen
  2005-02-27 17:16   ` Arne Jørgensen
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Josefsson @ 2005-02-25 23:24 UTC (permalink / raw)
  Cc: ding

Arne Jørgensen <arne@arnested.dk> writes:

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

Applied, thanks!

> Have a nice weekend.

Likewise.



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

* Re: S/MIME verification/decryption of MIME parts (patch)
  2005-02-25 23:24 ` Simon Josefsson
@ 2005-02-27 17:11   ` Arne Jørgensen
  2005-02-27 17:16   ` Arne Jørgensen
  1 sibling, 0 replies; 5+ messages in thread
From: Arne Jørgensen @ 2005-02-27 17:11 UTC (permalink / raw)


Simon Josefsson <jas@extundo.com> writes:

> Arne Jørgensen <arne@arnested.dk> writes:
>
>> 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'.
>
> Applied, thanks!

Super! Maybe for the v5-10 branch too?

(btw, what is the policy regarding which changes go into the v5-10
branch and which don't? This change I think should because it's more
of a bugfix and it will get sync'ed with emacs cvs)

>> Have a nice weekend.
>
> Likewise.

Thanks. It's been so.

Kind regards,
-- 
Arne Jørgensen <http://arnested.dk/>





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

* Re: S/MIME verification/decryption of MIME parts (patch)
  2005-02-25 23:24 ` Simon Josefsson
  2005-02-27 17:11   ` Arne Jørgensen
@ 2005-02-27 17:16   ` Arne Jørgensen
  2005-02-27 18:05     ` Simon Josefsson
  1 sibling, 1 reply; 5+ messages in thread
From: Arne Jørgensen @ 2005-02-27 17:16 UTC (permalink / raw)


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

[ this time with the patch ]

Simon Josefsson <jas@extundo.com> writes:

> Arne Jørgensen <arne@arnested.dk> writes:
>
>> 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'.
>
> Applied, thanks!

Super! Maybe for the v5-10 branch too?

(btw, what is the policy regarding which changes go into the v5-10
branch and which don't? This change I think should because it's more
of a bugfix and it will get sync'ed with emacs cvs)

>> Have a nice weekend.
>
> Likewise.

Thanks. It's been so.

Kind regards,
-- 
Arne Jørgensen <http://arnested.dk/>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch for v5-10 branch --]
[-- Type: text/x-patch, Size: 3745 bytes --]

Index: lisp/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v
retrieving revision 6.2771.2.122
diff -u -p -r6.2771.2.122 ChangeLog
--- lisp/ChangeLog	26 Feb 2005 07:09:32 -0000	6.2771.2.122
+++ lisp/ChangeLog	27 Feb 2005 17:08:28 -0000
@@ -1,3 +1,12 @@
+2005-02-27  Arne J^[,Ax^[(Brgensen  <arne@arnested.dk>
+
+	* 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-26  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* gnus-sum.el (gnus-summary-exit): Move point after displaying the
Index: lisp/mm-decode.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mm-decode.el,v
retrieving revision 6.104.2.11
diff -u -p -r6.104.2.11 mm-decode.el
--- lisp/mm-decode.el	13 Feb 2005 04:46:01 -0000	6.104.2.11
+++ lisp/mm-decode.el	27 Feb 2005 17:08:30 -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
@@ -567,7 +568,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
@@ -594,7 +595,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]*$"))
@@ -611,7 +612,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))
@@ -620,7 +621,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 ()

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

* Re: S/MIME verification/decryption of MIME parts (patch)
  2005-02-27 17:16   ` Arne Jørgensen
@ 2005-02-27 18:05     ` Simon Josefsson
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Josefsson @ 2005-02-27 18:05 UTC (permalink / raw)
  Cc: ding

Arne Jørgensen <arne@arnested.dk> writes:

> Super! Maybe for the v5-10 branch too?

Applied.

> (btw, what is the policy regarding which changes go into the v5-10
> branch and which don't? This change I think should because it's more
> of a bugfix and it will get sync'ed with emacs cvs)

I believe bugfixes should go into 5.10 and consequently emacs cvs.

Thanks!



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

end of thread, other threads:[~2005-02-27 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-25 23:16 S/MIME verification/decryption of MIME parts (patch) Arne Jørgensen
2005-02-25 23:24 ` Simon Josefsson
2005-02-27 17:11   ` Arne Jørgensen
2005-02-27 17:16   ` Arne Jørgensen
2005-02-27 18:05     ` Simon Josefsson

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