mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-27 21:27:58 +01:00
23bcd00363
When showing or replying to a message that has been mangled in transit by an MTA in the "Mixed up" way, notmuch should instead use the repaired form of the message. Tracking the repaired GMimeObject for the lifetime of the mime_node so that it is cleaned up properly is probably the trickiest part of this patch, but the choices here are based on the idea that the mime_node_context is the memory manager for the whole mime_node tree in the first place, so new GMimeObject tree created on-the-fly during message parsing should be disposed of in the same place. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
32 lines
1.3 KiB
Bash
Executable file
32 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
test_description='PGP/MIME message mangling'
|
|
. $(dirname "$0")/test-lib.sh || exit 1
|
|
|
|
add_gnupg_home
|
|
add_email_corpus mangling
|
|
|
|
bodytext='["body"][0]["content"][1]["content"]="The password is \"abcd1234!\", please do not tell anyone.\n"'
|
|
|
|
test_begin_subtest "show 'Mixed-Up' mangled PGP/MIME message correctly"
|
|
output=$(notmuch show --format=json --decrypt=true id:mixed-up@mangling.notmuchmail.org)
|
|
test_json_nodes <<<"$output" \
|
|
'body:[0][0][0]'"$bodytext"
|
|
|
|
test_begin_subtest "reply to 'Mixed-Up' mangled PGP/MIME message correctly"
|
|
output=$(notmuch reply --format=json --decrypt=true id:mixed-up@mangling.notmuchmail.org)
|
|
test_json_nodes <<<"$output" \
|
|
'body:["original"]'"$bodytext"
|
|
|
|
test_begin_subtest "repaired 'Mixed-up' messages can be found with index.repaired=mixedup"
|
|
output=$(notmuch search --output=messages property:index.repaired=mixedup)
|
|
test_expect_equal "$output" id:mixed-up@mangling.notmuchmail.org
|
|
|
|
test_begin_subtest "index cleartext of 'Mixed-Up' mangled PGP/MIME message"
|
|
test_expect_success 'notmuch reindex --decrypt=true id:mixed-up@mangling.notmuchmail.org'
|
|
|
|
test_begin_subtest "search cleartext of 'Mixed-Up' mangled PGP/MIME message"
|
|
output=$(notmuch search --output=messages body:password)
|
|
test_expect_equal "$output" id:mixed-up@mangling.notmuchmail.org
|
|
|
|
test_done
|