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