]> git.notmuchmail.org Git - notmuch/commitdiff
cli/reply: pull proposed subject line from the message, not the index
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sun, 26 May 2019 22:16:10 +0000 (18:16 -0400)
committerDavid Bremner <david@tethera.net>
Wed, 29 May 2019 11:17:33 +0000 (08:17 -0300)
Protected subject lines were being emitted in reply when the cleartext
of documents was indexed.  create_reply_message() was pulling the
subject line from the index, rather than pulling it from the
GMimeMessage object that it already has on hand.

This one-line fix to notmuch-reply.c solves that problem, and doesn't
cause any additional tests to fail.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
notmuch-reply.c
test/T356-protected-headers.sh
test/T358-emacs-protected-headers.sh

index 2689b2470c278b44662ac5fcaf7ad463165b1223..46bab4344f7464f57f603040c13608e1a14459a9 100644 (file)
@@ -591,7 +591,7 @@ create_reply_message(void *ctx,
                                 from_addr);
     g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr, NULL);
 
                                 from_addr);
     g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr, NULL);
 
-    subject = notmuch_message_get_header (message, "subject");
+    subject = g_mime_message_get_subject (mime_message);
     if (subject) {
        if (strncasecmp (subject, "Re:", 3))
            subject = talloc_asprintf (ctx, "Re: %s", subject);
     if (subject) {
        if (strncasecmp (subject, "Re:", 3))
            subject = talloc_asprintf (ctx, "Re: %s", subject);
index 746c47607767196c0a80b82563b41d974d56b62e..4af018f30dc89620801dc88cff28172e7ae69937 100755 (executable)
@@ -100,7 +100,6 @@ test_json_nodes <<<"$output" \
                 'subject:[0]["subject"]="This is a protected header"'
 
 test_begin_subtest "indexed protected subject is not visible in reply header"
                 'subject:[0]["subject"]="This is a protected header"'
 
 test_begin_subtest "indexed protected subject is not visible in reply header"
-test_subtest_known_broken
 output=$(notmuch reply --format=json 'id:protected-header@crypto.notmuchmail.org')
 test_json_nodes <<<"$output" \
                 'subject:["original"]["headers"]["Subject"]="This is a protected header"' \
 output=$(notmuch reply --format=json 'id:protected-header@crypto.notmuchmail.org')
 test_json_nodes <<<"$output" \
                 'subject:["original"]["headers"]["Subject"]="This is a protected header"' \
index 765511d4f50c761f2376eeeb7eaa926d7f39df3b..c195d5c2abb6dc0b16d94373d6f30f95448ce52e 100755 (executable)
@@ -92,7 +92,6 @@ test_expect_equal_file EXPECTED OUTPUT
 
 # notmuch-emacs still leaks the subject line:
 test_begin_subtest "don't leak protected subject during reply, even if indexed"
 
 # notmuch-emacs still leaks the subject line:
 test_begin_subtest "don't leak protected subject during reply, even if indexed"
-test_subtest_known_broken
 test_emacs "(let ((message-hidden-headers '()))
            (notmuch-show \"id:protected-header@crypto.notmuchmail.org\")
            (notmuch-show-reply)
 test_emacs "(let ((message-hidden-headers '()))
            (notmuch-show \"id:protected-header@crypto.notmuchmail.org\")
            (notmuch-show-reply)