summaryrefslogtreecommitdiffstats
path: root/mime-node.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2017-07-16 01:01:43 +0200
committerDavid Bremner <david@tethera.net>2017-07-15 21:39:37 -0300
commit1fdc08d0ffab9b211861de5d148d0a79eae840bc (patch)
tree45941638184e95f6fb5c512b5b69a7f8aef6a08f /mime-node.c
parentf1bcb6b7c2c568adcdfd4503522cfbccc4699665 (diff)
cli/crypto: treat failure to create a crypto context as fatal.
Silently ignoring signed/encrypted parts seems like the wrong idea, and it also complicates future gmime-3.0 compatibility changes.
Diffstat (limited to 'mime-node.c')
-rw-r--r--mime-node.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mime-node.c b/mime-node.c
index f719422e..7363e222 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -245,10 +245,12 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
GMimeContentType *content_type = g_mime_object_get_content_type (part);
const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol");
cryptoctx = notmuch_crypto_get_context (node->ctx->crypto, protocol);
+ if (!cryptoctx)
+ return NULL;
}
/* Handle PGP/MIME parts */
- if (GMIME_IS_MULTIPART_ENCRYPTED (part) && node->ctx->crypto->decrypt && cryptoctx) {
+ if (GMIME_IS_MULTIPART_ENCRYPTED (part) && node->ctx->crypto->decrypt) {
if (node->nchildren != 2) {
/* this violates RFC 3156 section 4, so we won't bother with it. */
fprintf (stderr, "Error: %d part(s) for a multipart/encrypted "
@@ -257,7 +259,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
} else {
node_decrypt_and_verify (node, part, cryptoctx);
}
- } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify && cryptoctx) {
+ } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify) {
if (node->nchildren != 2) {
/* this violates RFC 3156 section 5, so we won't bother with it. */
fprintf (stderr, "Error: %d part(s) for a multipart/signed message "