[PATCH v4 08/16] reorganize indexing of multipart/signed and multipart/encrypted
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Fri, 8 Jul 2016 09:27:19 +0000 (11:27 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:11 +0000 (16:22 -0700)
3a/036f16e7e6f0fc8fcfd80ce93893bff5634475 [new file with mode: 0644]

diff --git a/3a/036f16e7e6f0fc8fcfd80ce93893bff5634475 b/3a/036f16e7e6f0fc8fcfd80ce93893bff5634475
new file mode 100644 (file)
index 0000000..3674c33
--- /dev/null
@@ -0,0 +1,107 @@
+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 05CF96DE09D9\r
+ for <notmuch@notmuchmail.org>; Fri,  8 Jul 2016 03:14:00 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.049\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.049 tagged_above=-999 required=5 tests=[AWL=0.049]\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 PLsih2GgQyOT for <notmuch@notmuchmail.org>;\r
+ Fri,  8 Jul 2016 03:13:49 -0700 (PDT)\r
+Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 603446DE0361\r
+ for <notmuch@notmuchmail.org>; Fri,  8 Jul 2016 03:13:12 -0700 (PDT)\r
+Received: from fifthhorseman.net (unknown [88.128.80.54])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id C4D12F99B\r
+ for <notmuch@notmuchmail.org>; Fri,  8 Jul 2016 06:13:11 -0400 (EDT)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id AAB5721248; Fri,  8 Jul 2016 11:27:34 +0200 (CEST)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v4 08/16] reorganize indexing of multipart/signed and\r
+ multipart/encrypted\r
+Date: Fri,  8 Jul 2016 11:27:19 +0200\r
+Message-Id: <1467970047-8013-9-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 2.8.1\r
+In-Reply-To: <1467970047-8013-1-git-send-email-dkg@fifthhorseman.net>\r
+References: <1467970047-8013-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: Fri, 08 Jul 2016 10:14:00 -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 8c14554..1c030a6 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.8.1\r
+\r