lib: index the content-type of the parts of encrypted messages
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sat, 16 Sep 2017 14:59:05 +0000 (17:59 +0300)
committerDavid Bremner <david@tethera.net>
Sun, 17 Sep 2017 23:01:19 +0000 (20:01 -0300)
This is a logical followup to "lib: index the content type of
signature parts", which will make it easier to record the message
structure of all messages.

lib/index.cc
test/T350-crypto.sh

index 0beaae62f048c37001e699351df030705e2341d9..ceb444df60bfdd7ad8bb36487599321a70dd6a9e 100644 (file)
@@ -409,7 +409,14 @@ _index_mime_part (notmuch_message_t *message,
                }
            }
            if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) {
-               /* Don't index encrypted parts. */
+               /* Don't index encrypted parts, but index their content type. */
+               _index_content_type (message,
+                                    g_mime_multipart_get_part (multipart, i));
+               if ((i != GMIME_MULTIPART_ENCRYPTED_VERSION) &&
+                   (i != GMIME_MULTIPART_ENCRYPTED_CONTENT)) {
+                   _notmuch_database_log (_notmuch_message_database (message),
+                                          "Warning: Unexpected extra parts of multipart/encrypted.\n");
+               }
                continue;
            }
            _index_mime_part (message,
index b8f86256000650da1c24b07fcd33f5259cbed2b4..53bf4113d62222d2c5e4cea9a3a5920a68084ab8 100755 (executable)
@@ -236,7 +236,6 @@ test_expect_success \
     "(mml-attach-file \"TESTATTACHMENT\") (mml-secure-message-encrypt)"'
 
 test_begin_subtest "encrypted part content-type indexing"
-test_subtest_known_broken
 output=$(notmuch search mimetype:multipart/encrypted and mimetype:application/pgp-encrypted and mimetype:application/octet-stream | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; test encrypted message 001 (encrypted inbox)"