Do not replace multipart/signed part with content part when doing verification.

Some folks have complained about the part renumbering that occurs when
the entire multipart/signed part is replaced with the part contents
after verification.  This is primarily because it incurs an additional
computational cost to retrieve individual parts, since verification
has to be performed again to ensure that part numbering is consistent.
This patch simply leaves the full multipart/signed part as is.

The emacs crypto test is also updated to reflect this change.
This commit is contained in:
Jameson Graef Rollins 2011-05-27 03:27:36 -07:00 committed by Carl Worth
parent 1d6b49561f
commit 5404519749
2 changed files with 20 additions and 6 deletions

View file

@ -105,8 +105,6 @@ show_message_part (GMimeObject *part,
} }
if ((selected || state->in_zone) && format->part_sigstatus) if ((selected || state->in_zone) && format->part_sigstatus)
format->part_sigstatus (sigvalidity); format->part_sigstatus (sigvalidity);
/* extract only data part, and ignore signature part */
part = g_mime_multipart_get_part (multipart, 0);
if (sigvalidity) if (sigvalidity)
g_mime_signature_validity_free (sigvalidity); g_mime_signature_validity_free (sigvalidity);
} }

View file

@ -57,8 +57,12 @@ expected='[[[{"id": "XXXXX",
"sigstatus": [{"status": "good", "sigstatus": [{"status": "good",
"fingerprint": "'$FINGERPRINT'", "fingerprint": "'$FINGERPRINT'",
"created": 946728000}], "created": 946728000}],
"content-type": "multipart/signed",
"content": [{"id": 2,
"content-type": "text/plain", "content-type": "text/plain",
"content": "This is a test signed message.\n"}]}, "content": "This is a test signed message.\n"},
{"id": 3,
"content-type": "application/pgp-signature"}]}]},
[]]]]' []]]]'
test_expect_equal \ test_expect_equal \
"$output" \ "$output" \
@ -88,8 +92,12 @@ expected='[[[{"id": "XXXXX",
"fingerprint": "'$FINGERPRINT'", "fingerprint": "'$FINGERPRINT'",
"created": 946728000, "created": 946728000,
"userid": " Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)"}], "userid": " Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)"}],
"content-type": "multipart/signed",
"content": [{"id": 2,
"content-type": "text/plain", "content-type": "text/plain",
"content": "This is a test signed message.\n"}]}, "content": "This is a test signed message.\n"},
{"id": 3,
"content-type": "application/pgp-signature"}]}]},
[]]]]' []]]]'
test_expect_equal \ test_expect_equal \
"$output" \ "$output" \
@ -117,8 +125,12 @@ expected='[[[{"id": "XXXXX",
"sigstatus": [{"status": "error", "sigstatus": [{"status": "error",
"keyid": "'$(echo $FINGERPRINT | cut -c 25-)'", "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'",
"errors": 2}], "errors": 2}],
"content-type": "multipart/signed",
"content": [{"id": 2,
"content-type": "text/plain", "content-type": "text/plain",
"content": "This is a test signed message.\n"}]}, "content": "This is a test signed message.\n"},
{"id": 3,
"content-type": "application/pgp-signature"}]}]},
[]]]]' []]]]'
test_expect_equal \ test_expect_equal \
"$output" \ "$output" \
@ -320,8 +332,12 @@ expected='[[[{"id": "XXXXX",
"sigstatus": [{"status": "error", "sigstatus": [{"status": "error",
"keyid": "6D92612D94E46381", "keyid": "6D92612D94E46381",
"errors": 8}], "errors": 8}],
"content-type": "multipart/signed",
"content": [{"id": 2,
"content-type": "text/plain", "content-type": "text/plain",
"content": "This is a test signed message.\n"}]}, "content": "This is a test signed message.\n"},
{"id": 3,
"content-type": "application/pgp-signature"}]}]},
[]]]]' []]]]'
test_expect_equal \ test_expect_equal \
"$output" \ "$output" \