[PATCH v3 08/16] reorganize indexing of multipart/signed and multipart/encrypted
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sun, 31 Jan 2016 20:39:53 +0000 (15:39 +1900)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:20:57 +0000 (16:20 -0700)
2a/69d8389e7562e5211cf029a1d10ca93b3553b1 [new file with mode: 0644]

diff --git a/2a/69d8389e7562e5211cf029a1d10ca93b3553b1 b/2a/69d8389e7562e5211cf029a1d10ca93b3553b1
new file mode 100644 (file)
index 0000000..28d1ee8
--- /dev/null
@@ -0,0 +1,108 @@
+Return-Path: <dkg@fifthhorseman.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 693986DE0C5F\r
+ for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 12:40:15 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 3ynY149BZW-l for <notmuch@notmuchmail.org>;\r
+ Sun, 31 Jan 2016 12:40:13 -0800 (PST)\r
+Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 7F7736DE1AB6\r
+ for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 12:40:09 -0800 (PST)\r
+Received: from fifthhorseman.net (ip-64-134-185-108.public.wayport.net\r
+ [64.134.185.108])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id 5E5F9F99C\r
+ for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 15:40:06 -0500 (EST)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id 4A54720FA6; Sun, 31 Jan 2016 15:40:06 -0500 (EST)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v3 08/16] reorganize indexing of multipart/signed and\r
+ multipart/encrypted\r
+Date: Sun, 31 Jan 2016 15:39:53 -0500\r
+Message-Id: <1454272801-23623-9-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 2.7.0.rc3\r
+In-Reply-To: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net>\r
+References: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 31 Jan 2016 20:40:15 -0000\r
+\r
+This prepares the codebase for a cleaner changeset for dealing with\r
+indexing some encrypted messages in the clear.\r
+---\r
+ lib/index.cc | 39 +++++++++++++++++++--------------------\r
+ 1 file changed, 19 insertions(+), 20 deletions(-)\r
+\r
+diff --git a/lib/index.cc b/lib/index.cc\r
+index f166aef..ab0fd78 100644\r
+--- a/lib/index.cc\r
++++ b/lib/index.cc\r
+@@ -333,27 +333,26 @@ _index_mime_part (notmuch_message_t *message,\r
+       GMimeMultipart *multipart = GMIME_MULTIPART (part);\r
+       int i;\r
\r
+-      if (GMIME_IS_MULTIPART_SIGNED (multipart))\r
+-        _notmuch_message_add_term (message, "tag", "signed");\r
+-\r
+-      if (GMIME_IS_MULTIPART_ENCRYPTED (multipart))\r
+-        _notmuch_message_add_term (message, "tag", "encrypted");\r
+-\r
+-      for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {\r
+-          if (GMIME_IS_MULTIPART_SIGNED (multipart)) {\r
+-              /* Don't index the signature. */\r
+-              if (i == 1)\r
+-                  continue;\r
+-              if (i > 1)\r
+-                  _notmuch_database_log (_notmuch_message_database (message),\r
+-                                        "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n");\r
+-          }\r
+-          if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) {\r
+-              /* Don't index encrypted parts. */\r
+-              continue;\r
+-          }\r
++      if (GMIME_IS_MULTIPART_SIGNED (multipart)) {\r
++          _notmuch_message_add_term (message, "tag", "signed");\r
++          /* FIXME: should we try to validate the signature? */\r
++          \r
++          /* FIXME: is it always just the first part that is signed in\r
++           all multipart/signed messages?*/\r
+           _index_mime_part (message,\r
+-                            g_mime_multipart_get_part (multipart, i));\r
++                            g_mime_multipart_get_part (multipart, 0));\r
++          \r
++          if (g_mime_multipart_get_count (multipart) > 2)\r
++              _notmuch_database_log (_notmuch_message_database (message),\r
++                                     "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n");\r
++      } else if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) {\r
++          /* Don't index encrypted parts */\r
++          _notmuch_message_add_term (message, "tag", "encrypted");\r
++      } else {\r
++          for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {\r
++              _index_mime_part (message,\r
++                                g_mime_multipart_get_part (multipart, i));\r
++          }\r
+       }\r
+       return;\r
+     }\r
+-- \r
+2.7.0.rc3\r
+\r