From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 515F86DE0C7A for ; Mon, 11 Dec 2017 23:18:24 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.027 X-Spam-Level: X-Spam-Status: No, score=-0.027 tagged_above=-999 required=5 tests=[AWL=-0.027] 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 deAPEMjU7wnq for ; Mon, 11 Dec 2017 23:18:22 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id 980736DE0243 for ; Mon, 11 Dec 2017 23:18:17 -0800 (PST) Received: from fifthhorseman.net (unknown [38.109.115.130]) by che.mayfirst.org (Postfix) with ESMTPSA id 88158F9A0 for ; Tue, 12 Dec 2017 02:18:16 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id 5FB9121008; Tue, 12 Dec 2017 02:18:13 -0500 (EST) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH 5/5] index: try indexing the cleartext of inline PGP encrypted text parts Date: Tue, 12 Dec 2017 02:15:53 -0500 Message-Id: <20171212071553.6440-6-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171212071553.6440-1-dkg@fifthhorseman.net> References: <20171212071553.6440-1-dkg@fifthhorseman.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Tue, 12 Dec 2017 07:18:24 -0000 Assuming that we're using GMime 3.0 or later, and the user has asked for decryption of some sort, we should go ahead and index the cleartext. --- lib/index.cc | 7 +++++++ test/T359-inline-pgp-decryption.sh | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/lib/index.cc b/lib/index.cc index 29ede685..49f7cfbf 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -473,6 +473,13 @@ _index_mime_part (notmuch_message_t *message, #if (GMIME_MAJOR_VERSION >= 3) if (GMIME_IS_TEXT_PART (part) && g_mime_part_get_openpgp_data (GMIME_PART (part)) == GMIME_OPENPGP_DATA_ENCRYPTED) { _notmuch_message_add_term (message, "tag", "encrypted"); + if (_index_encrypted_mime_part(message, indexopts, + content_type, + part)) + return; + /* if decryption on inline PGP encrypted message fails, we + * should still fall through and try indexing the MIME part + * anyway (this is what we did before inline PGP decryption) */ } #endif diff --git a/test/T359-inline-pgp-decryption.sh b/test/T359-inline-pgp-decryption.sh index 314ca786..66b85d5b 100755 --- a/test/T359-inline-pgp-decryption.sh +++ b/test/T359-inline-pgp-decryption.sh @@ -94,4 +94,11 @@ output=$(notmuch search 'sekrit') expected='' test_expect_equal "$output" "$expected" +test_begin_subtest "reindexing cleartext of inline PGP encrypted message should succeed" +test_subtest_broken_gmime_2 +notmuch reindex --decrypt=true id:inline-pgp-encrypted@testsuite.notmuchmail.org +output=$(notmuch search 'sekrit') +expected='thread:0000000000000001 2000-01-01 [1/1] test_suite@notmuchmail.org; inline PGP encrypted message (encrypted inbox unread)' +test_expect_equal "$output" "$expected" + test_done -- 2.15.1