crypto: index encrypted parts when indexopts try_decrypt is set.
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sat, 21 Oct 2017 02:25:41 +0000 (22:25 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 21 Oct 2017 22:53:19 +0000 (19:53 -0300)
commit4dfcc8c9b2e1dbb965f69283dca50c7581c88050
treea71299b29a8d154d25c6e1b57688e82eafd1bb0f
parent0bb05ff693737c5b91d6a64f6209984a6c418c46
crypto: index encrypted parts when indexopts try_decrypt is set.

If we see index options that ask us to decrypt when indexing a
message, and we encounter an encrypted part, we'll try to descend into
it.

If we can decrypt, we add the property index.decryption=success.

If we can't decrypt (or recognize the encrypted type of mail), we add
the property index.decryption=failure.

Note that a single message may have both values of the
"index.decryption" property: "success" and "failure".  For example,
consider a message that includes multiple layers of encryption.  If we
manage to decrypt the outer layer ("index.decryption=success"), but
fail on the inner layer ("index.decryption=failure").

Because of the property name, this will be automatically cleared (and
possibly re-set) during re-indexing.  This means it will subsequently
correspond to the actual semantics of the stored index.
doc/man7/notmuch-properties.rst
lib/add-message.cc
lib/index.cc
lib/message.cc
lib/notmuch-private.h