From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH 5/5] index: try indexing the cleartext of inline PGP encrypted text parts
Date: Tue, 12 Dec 2017 02:15:53 -0500 [thread overview]
Message-ID: <20171212071553.6440-6-dkg@fifthhorseman.net> (raw)
In-Reply-To: <20171212071553.6440-1-dkg@fifthhorseman.net>
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
next prev parent reply other threads:[~2017-12-12 7:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 7:15 cope with inline PGP encrypted messages Daniel Kahn Gillmor
2017-12-12 7:15 ` [PATCH 1/5] crypto: prepare for decryption of " Daniel Kahn Gillmor
2018-04-30 11:24 ` David Bremner
2018-04-30 11:42 ` David Bremner
2018-05-01 17:42 ` Daniel Kahn Gillmor
2018-05-03 21:34 ` David Bremner
2017-12-12 7:15 ` [PATCH 2/5] cli/{show, reply}: try to decrypt " Daniel Kahn Gillmor
2017-12-12 7:15 ` [PATCH 3/5] index: tag text parts with inline PGP encryption as "encrypted" Daniel Kahn Gillmor
2017-12-12 7:15 ` [PATCH 4/5] index: _index_encrypted_mime_part returns success or failure Daniel Kahn Gillmor
2017-12-12 7:15 ` Daniel Kahn Gillmor [this message]
2018-05-09 21:53 ` cope with inline PGP encrypted messages Daniel Kahn Gillmor
2018-05-10 12:39 ` David Bremner
2018-05-11 17:42 ` Daniel Kahn Gillmor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171212071553.6440-6-dkg@fifthhorseman.net \
--to=dkg@fifthhorseman.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).