mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-03 16:14:11 +01:00
cli/show: emit new whole-message crypto status output
This allows MUAs that don't want to think about per-mime-part cryptographic status to have a simple high-level overview of the message's cryptographic state. Sensibly structured encrypted and/or signed messages will work fine with this. The only requirement for the simplest encryption + signing is that the message have all of its encryption and signing protection (the "cryptographic envelope") in a contiguous set of MIME layers at the very outside of the message itself. This is because messages with some subparts signed or encrypted, but with other subparts with no cryptographic protection is very difficult to reason about, and even harder for the user to make sense of or work with. For further characterization of the Cryptographic Envelope and some of the usability tradeoffs, see here: https://dkg.fifthhorseman.net/blog/e-mail-cryptography.html#cryptographic-envelope
This commit is contained in:
parent
d187a6993e
commit
4cb789aa09
13 changed files with 96 additions and 17 deletions
|
@ -33,6 +33,8 @@ v3
|
|||
v4
|
||||
- replace signature error integer bitmask with a set of flags for
|
||||
individual errors.
|
||||
- (notmuch 0.29) added message.crypto to identify overall message
|
||||
cryptographic state
|
||||
|
||||
Common non-terminals
|
||||
--------------------
|
||||
|
@ -73,9 +75,25 @@ message = {
|
|||
tags: [string*],
|
||||
|
||||
headers: headers,
|
||||
crypto: crypto,
|
||||
body?: [part] # omitted if --body=false
|
||||
}
|
||||
|
||||
# when showing the message, was any or all of it decrypted?
|
||||
msgdecstatus: "full"|"partial"
|
||||
|
||||
# The overall cryptographic state of the message as a whole:
|
||||
crypto = {
|
||||
signed?: {
|
||||
status: sigstatus,
|
||||
# was the set of signatures described under encrypted cover?
|
||||
encrypted: bool,
|
||||
},
|
||||
decrypted?: {
|
||||
status: msgdecstatus,
|
||||
}
|
||||
}
|
||||
|
||||
# A MIME part (format_part_sprinter)
|
||||
part = {
|
||||
id: int|string, # part id (currently DFS part number)
|
||||
|
|
|
@ -628,6 +628,35 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
|
|||
format_part_sprinter (ctx, sp, mime_node_child (node, 0), true, include_html);
|
||||
sp->end (sp);
|
||||
}
|
||||
|
||||
if (notmuch_format_version >= 4) {
|
||||
const _notmuch_message_crypto_t *msg_crypto = mime_node_get_message_crypto_status (node);
|
||||
sp->map_key (sp, "crypto");
|
||||
sp->begin_map (sp);
|
||||
if (msg_crypto->sig_list ||
|
||||
msg_crypto->decryption_status != NOTMUCH_MESSAGE_DECRYPTED_NONE) {
|
||||
if (msg_crypto->sig_list) {
|
||||
sp->map_key (sp, "signed");
|
||||
sp->begin_map (sp);
|
||||
sp->map_key (sp, "status");
|
||||
format_part_sigstatus_sprinter (sp, msg_crypto->sig_list);
|
||||
if (msg_crypto->signature_encrypted) {
|
||||
sp->map_key (sp, "encrypted");
|
||||
sp->boolean (sp, msg_crypto->signature_encrypted);
|
||||
}
|
||||
sp->end (sp);
|
||||
}
|
||||
if (msg_crypto->decryption_status != NOTMUCH_MESSAGE_DECRYPTED_NONE) {
|
||||
sp->map_key (sp, "decrypted");
|
||||
sp->begin_map (sp);
|
||||
sp->map_key (sp, "status");
|
||||
sp->string (sp, msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL ? "full" : "partial");
|
||||
sp->end (sp);
|
||||
}
|
||||
}
|
||||
sp->end (sp);
|
||||
}
|
||||
|
||||
sp->end (sp);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ test_begin_subtest "Insert message adds default tags"
|
|||
output=$(notmuch show --format=json "subject:insert-subject")
|
||||
expected='[[[{
|
||||
"id": "'"${gen_msg_id}"'",
|
||||
"crypto": {},
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
"filename": ["'"${cur_msg_filename}"'"],
|
||||
|
|
|
@ -5,16 +5,16 @@ test_description="--format=json output"
|
|||
test_begin_subtest "Show message: json"
|
||||
add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"json-show-message\""
|
||||
output=$(notmuch show --format=json "json-show-message")
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
|
||||
|
||||
# This should be the same output as above.
|
||||
test_begin_subtest "Show message: json --body=true"
|
||||
output=$(notmuch show --format=json --body=true "json-show-message")
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
|
||||
|
||||
test_begin_subtest "Show message: json --body=false"
|
||||
output=$(notmuch show --format=json --body=false "json-show-message")
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Reply-To\": \"test_suite+replyto@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"
|
||||
|
||||
test_begin_subtest "Search message: json"
|
||||
add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\""
|
||||
|
@ -33,7 +33,7 @@ test_expect_equal_json "$output" "[{\"thread\": \"XXX\",
|
|||
test_begin_subtest "Show message: json, utf-8"
|
||||
add_message "[subject]=\"json-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""
|
||||
output=$(notmuch show --format=json "jsön-show-méssage")
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"
|
||||
|
||||
test_begin_subtest "Show message: json, inline attachment filename"
|
||||
subject='json-show-inline-attachment-filename'
|
||||
|
@ -48,7 +48,7 @@ output=$(notmuch show --format=json "id:$id")
|
|||
filename=$(notmuch search --output=files "id:$id")
|
||||
# Get length of README after base64-encoding, minus additional newline.
|
||||
attachment_length=$(( $(base64 $NOTMUCH_SRCDIR/test/README | wc -c) - 1 ))
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": [\"$filename\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"content-disposition\": \"inline\", \"filename\": \"README\"}]}]}, []]]]"
|
||||
test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"$filename\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"content-disposition\": \"inline\", \"filename\": \"README\"}]}]}, []]]]"
|
||||
|
||||
test_begin_subtest "Search message: json, utf-8"
|
||||
add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
|
||||
|
@ -91,6 +91,7 @@ cat <<EOF > EXPECTED
|
|||
"To": "Notmuch Test Suite <test_suite@notmuchmail.org>"
|
||||
},
|
||||
"id": "message-id@example.com",
|
||||
"crypto": {},
|
||||
"match": true,
|
||||
"tags": [
|
||||
"inbox",
|
||||
|
|
|
@ -5,16 +5,16 @@ test_description="--format=sexp output"
|
|||
test_begin_subtest "Show message: sexp"
|
||||
add_message "[subject]=\"sexp-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"sexp-show-message\""
|
||||
output=$(notmuch show --format=sexp "sexp-show-message")
|
||||
test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
|
||||
test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\")) :crypto ()) ())))"
|
||||
|
||||
# This should be the same output as above.
|
||||
test_begin_subtest "Show message: sexp --body=true"
|
||||
output=$(notmuch show --format=sexp --body=true "sexp-show-message")
|
||||
test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
|
||||
test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\")) :crypto ()) ())))"
|
||||
|
||||
test_begin_subtest "Show message: sexp --body=false"
|
||||
output=$(notmuch show --format=sexp --body=false "sexp-show-message")
|
||||
test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\")) ())))"
|
||||
test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :crypto ()) ())))"
|
||||
|
||||
test_begin_subtest "Search message: sexp"
|
||||
add_message "[subject]=\"sexp-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"sexp-search-message\""
|
||||
|
@ -24,7 +24,7 @@ test_expect_equal "$output" "((:thread \"0000000000000002\" :timestamp 946728000
|
|||
test_begin_subtest "Show message: sexp, utf-8"
|
||||
add_message "[subject]=\"sexp-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""
|
||||
output=$(notmuch show --format=sexp "jsön-show-méssage")
|
||||
test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"jsön-show-méssage\n\"))) ())))"
|
||||
test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"jsön-show-méssage\n\")) :crypto ()) ())))"
|
||||
|
||||
test_begin_subtest "Search message: sexp, utf-8"
|
||||
add_message "[subject]=\"sexp-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
|
||||
|
@ -44,6 +44,6 @@ output=$(notmuch show --format=sexp "id:$id")
|
|||
filename=$(notmuch search --output=files "id:$id")
|
||||
# Get length of README after base64-encoding, minus additional newline.
|
||||
attachment_length=$(( $(base64 $NOTMUCH_SRCDIR/test/README | wc -c) - 1 ))
|
||||
test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename (\"$filename\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"test_suite@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/mixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a test message with inline attachment with a filename\") (:id 3 :content-type \"application/octet-stream\" :content-disposition \"inline\" :filename \"README\" :content-transfer-encoding \"base64\" :content-length $attachment_length))))) ())))"
|
||||
test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename (\"$filename\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"test_suite@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/mixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a test message with inline attachment with a filename\") (:id 3 :content-type \"application/octet-stream\" :content-disposition \"inline\" :filename \"README\" :content-transfer-encoding \"base64\" :content-length $attachment_length)))) :crypto ()) ())))"
|
||||
|
||||
test_done
|
||||
|
|
|
@ -378,7 +378,7 @@ test_expect_success "notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom
|
|||
test_begin_subtest "--format=json --part=0, full message"
|
||||
notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
|
||||
cat <<EOF >EXPECTED
|
||||
{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "excluded": false, "filename": ["${MAIL_DIR}/multipart"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
|
||||
{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "crypto": {}, "match": true, "excluded": false, "filename": ["${MAIL_DIR}/multipart"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
|
||||
{"id": 1, "content-type": "multipart/signed", "content": [
|
||||
{"id": 2, "content-type": "multipart/mixed", "content": [
|
||||
{"id": 3, "content-type": "message/rfc822", "content-disposition": "inline", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
|
||||
|
@ -637,6 +637,7 @@ notmuch_json_show_sanitize <<EOF >EXPECTED
|
|||
"In-reply-to": "<87liy5ap00.fsf@yoom.home.cworth.org>",
|
||||
"References": "<87liy5ap00.fsf@yoom.home.cworth.org>"},
|
||||
"original": {"id": "XXXXX",
|
||||
"crypto": {},
|
||||
"match": false,
|
||||
"excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
|
@ -728,6 +729,7 @@ cat_expected_head ()
|
|||
{
|
||||
cat <<EOF
|
||||
[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",
|
||||
"crypto": {},
|
||||
"timestamp": 946684800,
|
||||
"filename": ["${MAIL_DIR}/include-html"],
|
||||
"tags": ["inbox", "unread"],
|
||||
|
|
|
@ -278,6 +278,7 @@ test_expect_equal_json "$output" '
|
|||
"id": 1
|
||||
}
|
||||
],
|
||||
"crypto": {},
|
||||
"date_relative": "2010-01-05",
|
||||
"excluded": false,
|
||||
"filename": ["'${MAIL_DIR}'/msg-014"],
|
||||
|
|
|
@ -45,6 +45,7 @@ test_expect_equal "$output" "adding-replied-tag:2,RS"
|
|||
test_begin_subtest "notmuch show works with renamed file (without notmuch new)"
|
||||
output=$(notmuch show --format=json id:${gen_msg_id} | notmuch_json_show_sanitize)
|
||||
test_expect_equal_json "$output" '[[[{"id": "XXXXX",
|
||||
"crypto": {},
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
|
|
|
@ -25,7 +25,7 @@ test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; t
|
|||
test_begin_subtest "signature verification"
|
||||
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
|
||||
| notmuch_json_show_sanitize \
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|g')
|
||||
expected='[[[{"id": "XXXXX",
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
|
@ -33,6 +33,7 @@ expected='[[[{"id": "XXXXX",
|
|||
"timestamp": 946728000,
|
||||
"date_relative": "2000-01-01",
|
||||
"tags": ["inbox","signed"],
|
||||
"crypto": {"signed": {"status": [{ "status": "good", "created": 946728000, "fingerprint": "'$FINGERPRINT'", "userid": "'"$SELF_USERID"'"}]}},
|
||||
"headers": {"Subject": "test signed message 001",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
"To": "test_suite@notmuchmail.org",
|
||||
|
@ -74,6 +75,7 @@ expected='[[[{"id": "XXXXX",
|
|||
"timestamp": 946728000,
|
||||
"date_relative": "2000-01-01",
|
||||
"tags": ["inbox","signed"],
|
||||
"crypto": {"signed": {"status": [{ "status": "bad", "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'"}]}},
|
||||
"headers": {"Subject": "bad signed message 001",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
"To": "test_suite@notmuchmail.org",
|
||||
|
@ -112,6 +114,7 @@ output=$(notmuch show --format=json --verify subject:"bad signed message 002" \
|
|||
| notmuch_json_show_sanitize \
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
|
||||
expected='[[[{"id": "XXXXX",
|
||||
"crypto": {},
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
|
@ -143,7 +146,7 @@ gpg --quiet --batch --no-tty --export-ownertrust > "$GNUPGHOME/ownertrust.bak"
|
|||
echo "${FINGERPRINT}:3:" | gpg --quiet --batch --no-tty --import-ownertrust
|
||||
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
|
||||
| notmuch_json_show_sanitize \
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|g')
|
||||
expected='[[[{"id": "XXXXX",
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
|
@ -151,6 +154,7 @@ expected='[[[{"id": "XXXXX",
|
|||
"timestamp": 946728000,
|
||||
"date_relative": "2000-01-01",
|
||||
"tags": ["inbox","signed"],
|
||||
"crypto": {"signed": {"status": [{ "status": "good", "created": 946728000, "fingerprint": "'$FINGERPRINT'"}]}},
|
||||
"headers": {"Subject": "test signed message 001",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
"To": "test_suite@notmuchmail.org",
|
||||
|
@ -177,7 +181,7 @@ test_begin_subtest "signature verification with signer key unavailable"
|
|||
mv "${GNUPGHOME}"{,.bak}
|
||||
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
|
||||
| notmuch_json_show_sanitize \
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|g')
|
||||
expected='[[[{"id": "XXXXX",
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
|
@ -185,6 +189,7 @@ expected='[[[{"id": "XXXXX",
|
|||
"timestamp": 946728000,
|
||||
"date_relative": "2000-01-01",
|
||||
"tags": ["inbox","signed"],
|
||||
"crypto": {"signed": {"status": [{"errors": {"key-missing": true}, "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'", "status": "error"}]}},
|
||||
"headers": {"Subject": "test signed message 001",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
"To": "test_suite@notmuchmail.org",
|
||||
|
@ -264,6 +269,7 @@ expected='[[[{"id": "XXXXX",
|
|||
"timestamp": 946728000,
|
||||
"date_relative": "2000-01-01",
|
||||
"tags": ["encrypted","inbox"],
|
||||
"crypto": {"decrypted": {"status": "full"}},
|
||||
"headers": {"Subject": "test encrypted message 001",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
"To": "test_suite@notmuchmail.org",
|
||||
|
@ -315,6 +321,7 @@ output=$(notmuch show --format=json --decrypt=true subject:"test encrypted messa
|
|||
| notmuch_json_show_sanitize \
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
|
||||
expected='[[[{"id": "XXXXX",
|
||||
"crypto": {},
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
|
@ -350,7 +357,7 @@ test_expect_success \
|
|||
test_begin_subtest "decryption + signature verification"
|
||||
output=$(notmuch show --format=json --decrypt=true subject:"test encrypted message 002" \
|
||||
| notmuch_json_show_sanitize \
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
|
||||
| sed -e 's|"created": [1234567890]*|"created": 946728000|g')
|
||||
expected='[[[{"id": "XXXXX",
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
|
@ -358,6 +365,9 @@ expected='[[[{"id": "XXXXX",
|
|||
"timestamp": 946728000,
|
||||
"date_relative": "2000-01-01",
|
||||
"tags": ["encrypted","inbox"],
|
||||
"crypto": {"signed": {"status": [{ "status": "good", "created": 946728000, "fingerprint": "'$FINGERPRINT'", "userid": "'"$SELF_USERID"'"}],
|
||||
"encrypted": true },
|
||||
"decrypted": {"status": "full"}},
|
||||
"headers": {"Subject": "test encrypted message 002",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
"To": "test_suite@notmuchmail.org",
|
||||
|
@ -433,6 +443,7 @@ expected='[[[{"id": "XXXXX",
|
|||
"timestamp": 946728000,
|
||||
"date_relative": "2000-01-01",
|
||||
"tags": ["inbox","signed"],
|
||||
"crypto": {"signed": {"status": [{"errors": {"key-revoked": true}, "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'", "status": "error"}]}},
|
||||
"headers": {"Subject": "test signed message 001",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
"To": "test_suite@notmuchmail.org",
|
||||
|
|
|
@ -50,8 +50,8 @@ test_expect_equal_file EXPECTED OUTPUT
|
|||
test_begin_subtest "signature verification (notmuch CLI)"
|
||||
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
|
||||
| notmuch_json_show_sanitize \
|
||||
| sed -e 's|"created": [-1234567890]*|"created": 946728000|' \
|
||||
-e 's|"expires": [-1234567890]*|"expires": 424242424|' )
|
||||
| sed -e 's|"created": [-1234567890]*|"created": 946728000|g' \
|
||||
-e 's|"expires": [-1234567890]*|"expires": 424242424|g' )
|
||||
expected='[[[{"id": "XXXXX",
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
|
@ -59,6 +59,7 @@ expected='[[[{"id": "XXXXX",
|
|||
"timestamp": 946728000,
|
||||
"date_relative": "2000-01-01",
|
||||
"tags": ["inbox","signed"],
|
||||
"crypto": {"signed": {"status": [{"fingerprint": "'$FINGERPRINT'", "status": "good","userid": "CN=Notmuch Test Suite","expires": 424242424, "created": 946728000}]}},
|
||||
"headers": {"Subject": "test signed message 001",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
"To": "test_suite@notmuchmail.org",
|
||||
|
|
|
@ -107,6 +107,7 @@ expected=$(notmuch_json_show_sanitize <<EOF
|
|||
"id": 1
|
||||
}
|
||||
],
|
||||
"crypto": {},
|
||||
"date_relative": "2001-01-05",
|
||||
"excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
|
@ -137,6 +138,7 @@ expected=$(notmuch_json_show_sanitize <<EOF
|
|||
"id": 1
|
||||
}
|
||||
],
|
||||
"crypto": {},
|
||||
"date_relative": "1970-01-01",
|
||||
"excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
|
|
|
@ -19,6 +19,7 @@ add_message '[in-reply-to]="mumble"' \
|
|||
'[subject]="Re: one"'
|
||||
output=$(notmuch show --format=json 'subject:one' | notmuch_json_show_sanitize)
|
||||
expected='[[[{"id": "foo@one.com",
|
||||
"crypto": {},
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
|
@ -33,6 +34,7 @@ expected='[[[{"id": "foo@one.com",
|
|||
"content-type": "text/plain",
|
||||
"content": "This is just a test message (#1)\n"}]},
|
||||
[[{"id": "msg-002@notmuch-test-suite",
|
||||
"crypto": {},
|
||||
"match": true, "excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
"timestamp": 978709437, "date_relative": "2001-01-05",
|
||||
|
@ -53,6 +55,7 @@ add_message '[in-reply-to]="Your message of December 31 1999 <bar@baz.com>"' \
|
|||
'[subject]="Re: two"'
|
||||
output=$(notmuch show --format=json 'subject:two' | notmuch_json_show_sanitize)
|
||||
expected='[[[{"id": "foo@two.com",
|
||||
"crypto": {},
|
||||
"match": true, "excluded": false,
|
||||
"filename": ["YYYYY"],
|
||||
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
|
||||
|
@ -63,6 +66,7 @@ expected='[[[{"id": "foo@two.com",
|
|||
"body": [{"id": 1, "content-type": "text/plain",
|
||||
"content": "This is just a test message (#3)\n"}]},
|
||||
[[{"id": "msg-004@notmuch-test-suite", "match": true, "excluded": false,
|
||||
"crypto": {},
|
||||
"filename": ["YYYYY"],
|
||||
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
|
||||
"headers": {"Subject": "Re: two",
|
||||
|
@ -82,6 +86,7 @@ add_message '[in-reply-to]="<foo@three.com>"' \
|
|||
'[subject]="Re: three"'
|
||||
output=$(notmuch show --format=json 'subject:three' | notmuch_json_show_sanitize)
|
||||
expected='[[[{"id": "foo@three.com", "match": true, "excluded": false,
|
||||
"crypto": {},
|
||||
"filename": ["YYYYY"],
|
||||
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
|
||||
"headers": {"Subject": "three",
|
||||
|
@ -90,6 +95,7 @@ expected='[[[{"id": "foo@three.com", "match": true, "excluded": false,
|
|||
"Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
|
||||
"content-type": "text/plain", "content": "This is just a test message (#5)\n"}]},
|
||||
[[{"id": "msg-006@notmuch-test-suite", "match": true, "excluded": false,
|
||||
"crypto": {},
|
||||
"filename": ["YYYYY"],
|
||||
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
|
||||
"headers": {"Subject": "Re: three",
|
||||
|
@ -111,6 +117,7 @@ add_message '[in-reply-to]="<baz@four.com> (RFC822 4lyfe)"' \
|
|||
'[subject]="neither"'
|
||||
output=$(notmuch show --format=json 'subject:four' | notmuch_json_show_sanitize)
|
||||
expected='[[[{"id": "foo@four.com", "match": true, "excluded": false,
|
||||
"crypto": {},
|
||||
"filename": ["YYYYY"],
|
||||
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
|
||||
"headers": {"Subject": "four",
|
||||
|
@ -119,6 +126,7 @@ expected='[[[{"id": "foo@four.com", "match": true, "excluded": false,
|
|||
"Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
|
||||
"content-type": "text/plain", "content": "This is just a test message (#7)\n"}]},
|
||||
[[{"id": "msg-009@notmuch-test-suite", "match": false, "excluded": false,
|
||||
"crypto": {},
|
||||
"filename": ["YYYYY"],
|
||||
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
|
||||
"headers": {"Subject": "neither",
|
||||
|
@ -127,6 +135,7 @@ expected='[[[{"id": "foo@four.com", "match": true, "excluded": false,
|
|||
"Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
|
||||
"content-type": "text/plain", "content": "This is just a test message (#9)\n"}]},
|
||||
[]]]]], [[{"id": "bar@four.com", "match": true, "excluded": false,
|
||||
"crypto": {},
|
||||
"filename": ["YYYYY"],
|
||||
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
|
||||
"headers": {"Subject": "not-four",
|
||||
|
@ -145,6 +154,7 @@ add_message '[id]="bar@five.com"' \
|
|||
'[subject]="not-five"'
|
||||
output=$(notmuch show --format=json 'subject:five' | notmuch_json_show_sanitize)
|
||||
expected='[[[{"id": "XXXXX", "match": true, "excluded": false,
|
||||
"crypto": {},
|
||||
"filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05",
|
||||
"tags": ["inbox", "unread"], "headers": {"Subject": "five",
|
||||
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
|
||||
|
@ -153,6 +163,7 @@ expected='[[[{"id": "XXXXX", "match": true, "excluded": false,
|
|||
"content-type": "text/plain",
|
||||
"content": "This is just a test message (#10)\n"}]},
|
||||
[[{"id": "XXXXX", "match": true, "excluded": false,
|
||||
"crypto": {},
|
||||
"filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05",
|
||||
"tags": ["inbox", "unread"],
|
||||
"headers": {"Subject": "not-five",
|
||||
|
|
|
@ -92,6 +92,7 @@ output=$(notmuch show --body=false --format=json id:duplicate |
|
|||
notmuch_json_show_sanitize | sed 's/message [0-9]/A_SUBJECT/')
|
||||
expected='[[[{
|
||||
"id": "XXXXX",
|
||||
"crypto": {},
|
||||
"match": true,
|
||||
"excluded": false,
|
||||
"filename": [
|
||||
|
|
Loading…
Reference in a new issue