[PATCH v5 5/7] cli: modify mime_node_context to use the new crypto struct
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 26 May 2012 18:45:44 +0000 (11:45 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:27 +0000 (09:47 -0800)
ca/4145f75f5f1953337b775886a52f938f4f8b91 [new file with mode: 0644]

diff --git a/ca/4145f75f5f1953337b775886a52f938f4f8b91 b/ca/4145f75f5f1953337b775886a52f938f4f8b91
new file mode 100644 (file)
index 0000000..f5ac141
--- /dev/null
@@ -0,0 +1,138 @@
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 0F378429E25\r
+       for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:57 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id IavYEujHG-st for <notmuch@notmuchmail.org>;\r
+       Sat, 26 May 2012 11:45:55 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id AC2C2431E62\r
+       for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:55 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by fire-doxen-postvirus (Postfix) with ESMTP id 7393E2E50C18\r
+       for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:55 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [76.89.192.57])\r
+       (Authenticated sender: jrollins)\r
+       by fire-doxen-submit (Postfix) with ESMTP id 234A12E50DB0\r
+       for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:53 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id 72000B80; Sat, 26 May 2012 11:45:51 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v5 5/7] cli: modify mime_node_context to use the new crypto\r
+       struct\r
+Date: Sat, 26 May 2012 11:45:44 -0700\r
+Message-Id: <1338057946-29209-6-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1338057946-29209-5-git-send-email-jrollins@finestructure.net>\r
+References: <1338057946-29209-1-git-send-email-jrollins@finestructure.net>\r
+       <1338057946-29209-2-git-send-email-jrollins@finestructure.net>\r
+       <1338057946-29209-3-git-send-email-jrollins@finestructure.net>\r
+       <1338057946-29209-4-git-send-email-jrollins@finestructure.net>\r
+       <1338057946-29209-5-git-send-email-jrollins@finestructure.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 26 May 2012 18:45:57 -0000\r
+\r
+This simplifies some more interfaces.\r
+---\r
+ mime-node.c |   18 ++++++++----------\r
+ 1 file changed, 8 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/mime-node.c b/mime-node.c\r
+index 67f4b16..a838224 100644\r
+--- a/mime-node.c\r
++++ b/mime-node.c\r
+@@ -33,8 +33,7 @@ typedef struct mime_node_context {\r
+     GMimeMessage *mime_message;\r
+ \r
+     /* Context provided by the caller. */\r
+-    notmuch_crypto_context_t *cryptoctx;\r
+-    notmuch_bool_t decrypt;\r
++    notmuch_crypto_t *crypto;\r
+ } mime_node_context_t;\r
+ \r
+ static int\r
+@@ -109,8 +108,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,\r
+       goto DONE;\r
+     }\r
+ \r
+-    mctx->cryptoctx = crypto->gpgctx;\r
+-    mctx->decrypt = crypto->decrypt;\r
++    mctx->crypto = crypto;\r
+ \r
+     /* Create the root node */\r
+     root->part = GMIME_OBJECT (mctx->mime_message);\r
+@@ -186,7 +184,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+ \r
+     /* Handle PGP/MIME parts */\r
+     if (GMIME_IS_MULTIPART_ENCRYPTED (part)\r
+-      && node->ctx->cryptoctx && node->ctx->decrypt) {\r
++      && node->ctx->crypto->gpgctx && node->ctx->crypto->decrypt) {\r
+       if (node->nchildren != 2) {\r
+           /* this violates RFC 3156 section 4, so we won't bother with it. */\r
+           fprintf (stderr, "Error: %d part(s) for a multipart/encrypted "\r
+@@ -199,10 +197,10 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+ #ifdef GMIME_ATLEAST_26\r
+           GMimeDecryptResult *decrypt_result = NULL;\r
+           node->decrypted_child = g_mime_multipart_encrypted_decrypt\r
+-              (encrypteddata, node->ctx->cryptoctx, &decrypt_result, &err);\r
++              (encrypteddata, node->ctx->crypto->gpgctx, &decrypt_result, &err);\r
+ #else\r
+           node->decrypted_child = g_mime_multipart_encrypted_decrypt\r
+-              (encrypteddata, node->ctx->cryptoctx, &err);\r
++              (encrypteddata, node->ctx->crypto->gpgctx, &err);\r
+ #endif\r
+           if (node->decrypted_child) {\r
+               node->decrypt_success = node->verify_attempted = TRUE;\r
+@@ -220,7 +218,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+                        (err ? err->message : "no error explanation given"));\r
+           }\r
+       }\r
+-    } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->cryptoctx) {\r
++    } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->gpgctx) {\r
+       if (node->nchildren != 2) {\r
+           /* this violates RFC 3156 section 5, so we won't bother with it. */\r
+           fprintf (stderr, "Error: %d part(s) for a multipart/signed message "\r
+@@ -229,7 +227,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+       } else {\r
+ #ifdef GMIME_ATLEAST_26\r
+           node->sig_list = g_mime_multipart_signed_verify\r
+-              (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);\r
++              (GMIME_MULTIPART_SIGNED (part), node->ctx->crypto->gpgctx, &err);\r
+           node->verify_attempted = TRUE;\r
+ \r
+           if (!node->sig_list)\r
+@@ -245,7 +243,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+            * In GMime 2.6, they're both non-const, so we'll be able\r
+            * to clean up this asymmetry. */\r
+           GMimeSignatureValidity *sig_validity = g_mime_multipart_signed_verify\r
+-              (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);\r
++              (GMIME_MULTIPART_SIGNED (part), node->ctx->crypto->gpgctx, &err);\r
+           node->verify_attempted = TRUE;\r
+           node->sig_validity = sig_validity;\r
+           if (sig_validity) {\r
+-- \r
+1.7.10\r
+\r