From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83302 Path: news.gmane.org!not-for-mail From: Roy Hashimoto Newsgroups: gmane.emacs.gnus.general Subject: Re: magic numbers in mm-view.el Date: Sun, 9 Jun 2013 17:37:15 +0000 (UTC) Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1370802265 18689 80.91.229.3 (9 Jun 2013 18:24:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Jun 2013 18:24:25 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M31568@lists.math.uh.edu Sun Jun 09 20:24:25 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UlkHv-00015U-TU for ding-account@gmane.org; Sun, 09 Jun 2013 20:24:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1UlkG9-0005qu-19; Sun, 09 Jun 2013 13:22:33 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1UljbE-0005fo-A3 for ding@lists.math.uh.edu; Sun, 09 Jun 2013 12:40:16 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1UljbD-0001h1-41 for ding@lists.math.uh.edu; Sun, 09 Jun 2013 12:40:15 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1UljbB-0003jx-3h for ding@gnus.org; Sun, 09 Jun 2013 19:40:13 +0200 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Uljb1-00036n-AU for ding@gnus.org; Sun, 09 Jun 2013 19:40:03 +0200 Original-Received: from 24.143.227.254 ([24.143.227.254]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 09 Jun 2013 19:40:03 +0200 Original-Received: from roy.hashimoto by 24.143.227.254 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 09 Jun 2013 19:40:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 65 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 24.143.227.254 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36) X-Spam-Score: 2.2 (++) X-Spam-Report: SpamAssassin (3.3.1 2010-03-16) analysis follows Bayesian score: 0.0000 Ham tokens: 0.000-37229--226974h-3s--0d--100644, 0.000-21952--133835h-2s--0d--signedoffby, 0.000-21952--133834h-2s--0d--signed-off-by, 0.000-38524--235077h-37s--0d--diff, 0.000-15--86h-0s--0d--gnus Spam tokens: 0.990-7169--432h-37626s--0d--HTo:D*gnus.org, 0.989-7485--468h-39368s--0d--HX-Spam-Relays-External:quimby.gnus.org, 0.989-7485--468h-39368s--0d--H*RU:quimby.gnus.org, 0.987-7377--577h-39370s--0d--HX-Spam-Relays-Internal:quimby.gnus.org, 0.987-7377--577h-39370s--0d--H*RT:80.91.231.51 Autolearn status: no 2.1 FSL_HELO_BARE_IP_2 FSL_HELO_BARE_IP_2 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (roy.hashimoto[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 1.2 RCVD_NUMERIC_HELO Received: contains an IP address used for HELO -0.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.91.229.3 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83302 Archived-At: David S. Goldberg verizon.net> writes: > If I use the #secure tag to send an encrypted s/mime email to others > and include a copy for myself, I am unable to read my copy in Gnus. I > am able to decrypt and verify it (assuming it's signed as well) by > manually running Openssl on the message file and am also able to do so > in Thunderbird. Oddly enough, if I build a multipart structure for > the message using #multipart instead of #secure I don't have this > problem. But because the structure of the message is apparently not a > problem for OpenSSL or Thunderbird, I believe that the problem is that > the mm-pkcs7-enveloped-magic variable is not sufficient to cover all > cases. This is a followup to an ancient thread but the bug is still present in the gnus shipped with GNU Emacs 24.3. To recap, sometimes valid S/MIME encrypted messages will not be recognized with the error "Unknown or unimplemented PKCS#7 type". The cause was identified in the original message, which was that the regular expression recognizing the binary PKCS7 envelope used a '.' to match any byte but that does not include 0x0a (\n). Here's a patch that fixes that issue for both signed and encrypted messages and makes the regexp a little easier to read: Correct PKCS7 regexps to match messages with 0x0a bytes. Signed-off-by: Roy Hashimoto --- diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index ac6170a..b1cba27 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -660,14 +660,26 @@ If MODE is not set, try to find mode automatically." ;; id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } (defvar mm-pkcs7-signed-magic - "\x30\x5c\x28\x80\x5c\x7c\x81\x2e\x5c\x7c\x82\x2e\x2e\x5c\x7c\x83\x2e\x2e\ -\x2e\x5c\x29\x06\x09\x5c\x2a\x86\x48\x86\xf7\x0d\x01\x07\x02") + (concat + "0" + "\\(\\(\x80\\)" + "\\|\\(\x81\\(.\\|\n\\)\\{1\\}\\)" + "\\|\\(\x82\\(.\\|\n\\)\\{2\\}\\)" + "\\|\\(\x83\\(.\\|\n\\)\\{3\\}\\)" + "\\)" + "\x06\x09\\*\x86H\x86\xf7\x0d\x01\x07\x02")) ;; id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 } (defvar mm-pkcs7-enveloped-magic - "\x30\x5c\x28\x80\x5c\x7c\x81\x2e\x5c\x7c\x82\x2e\x2e\x5c\x7c\x83\x2e\x2e\ -\x2e\x5c\x29\x06\x09\x5c\x2a\x86\x48\x86\xf7\x0d\x01\x07\x03") + (concat + "0" + "\\(\\(\x80\\)" + "\\|\\(\x81\\(.\\|\n\\)\\{1\\}\\)" + "\\|\\(\x82\\(.\\|\n\\)\\{2\\}\\)" + "\\|\\(\x83\\(.\\|\n\\)\\{3\\}\\)" + "\\)" + "\x06\x09\\*\x86H\x86\xf7\x0d\x01\x07\x03")) (defun mm-view-pkcs7-get-type (handle) (mm-with-unibyte-buffer -- Roy