]> git.cworth.org Git - notmuch/commitdiff
crypto: Avoid pretending to verify signatures on unsigned encrypted mail
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sat, 20 Apr 2019 17:02:57 +0000 (13:02 -0400)
committerDavid Bremner <david@tethera.net>
Fri, 26 Apr 2019 11:03:15 +0000 (08:03 -0300)
Unsigned encrypted mail shows up with a weird empty signature list.
If we successfully decrypted and there was no signature in it, we
should just not show a sigstatus at all.

The documentation for g_mime_decrypt_result_get_signatures says:

    a GMimeSignatureList or NULL if the stream was not signed.

mime-node.c
test/T350-crypto.sh

index 2a24e537c6a25fa4b79785f33062826666b63b88..1bfb479ba1705c46d808d0fbd7344f3c0fceb292 100644 (file)
@@ -218,12 +218,12 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
     }
 
     node->decrypt_success = true;
-    node->verify_attempted = true;
 
     if (decrypt_result) {
        /* This may be NULL if the part is not signed. */
        node->sig_list = g_mime_decrypt_result_get_signatures (decrypt_result);
        if (node->sig_list) {
+           node->verify_attempted = true;
            g_object_ref (node->sig_list);
            set_signature_list_destructor (node);
        }
index 7b10f434f6d5877b4d4461be7ce7fb0a84ea6934..2f793e96720fcda9727a8ad6444b52fd920cc182 100755 (executable)
@@ -269,7 +269,6 @@ expected='[[[{"id": "XXXXX",
  "Date": "Sat, 01 Jan 2000 12:00:00 +0000"},
  "body": [{"id": 1,
  "encstatus": [{"status": "good"}],
- "sigstatus": [],
  "content-type": "multipart/encrypted",
  "content": [{"id": 2,
  "content-type": "application/pgp-encrypted",