From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id D67826DE2DFF for ; Sat, 15 Jul 2017 11:57:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N44YjGCsIlDk for ; Sat, 15 Jul 2017 11:57:55 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 9FBA56DE25BA for ; Sat, 15 Jul 2017 11:57:54 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1dWSD2-0005wi-14; Sat, 15 Jul 2017 14:54:32 -0400 Received: (nullmailer pid 17683 invoked by uid 1000); Sat, 15 Jul 2017 18:57:48 -0000 From: David Bremner To: Daniel Kahn Gillmor , Notmuch Mail Subject: [PATCH 1/4] cli/crypto: treat failure to create a crypto context as fatal. Date: Sat, 15 Jul 2017 15:57:41 -0300 Message-Id: <20170715185744.17640-1-david@tethera.net> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170714131202.24966-3-dkg@fifthhorseman.net> References: <20170714131202.24966-3-dkg@fifthhorseman.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 18:57:55 -0000 Silently ignoring signed/encrypted parts seems like the wrong idea, and it also complicates future gmime-3.0 compatibility changes. --- mime-node.c | 6 ++++-- 1 file 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 " -- 2.13.2