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 E33B16DE263F for ; Sat, 15 Jul 2017 16:01:53 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.000] 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 Soda3yNfgK_A for ; Sat, 15 Jul 2017 16:01:53 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTP id 313586DE2617 for ; Sat, 15 Jul 2017 16:01:52 -0700 (PDT) Received: from fifthhorseman.net (38.200.broadband6.iol.cz [88.101.200.38]) by che.mayfirst.org (Postfix) with ESMTPSA id ECA97F999; Sat, 15 Jul 2017 19:01:50 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id F084B20C40; Sun, 16 Jul 2017 01:01:46 +0200 (CEST) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH v2 1/4] cli/crypto: treat failure to create a crypto context as fatal. Date: Sun, 16 Jul 2017 01:01:43 +0200 Message-Id: <20170715230146.12695-1-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.13.2 In-Reply-To: <87mv85qpyw.fsf@fifthhorseman.net> References: <87mv85qpyw.fsf@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 23:01:54 -0000 From: David Bremner 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