1 Return-Path: <bremner@tesseract.cs.unb.ca>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 20AF0431FD8
\r
6 for <notmuch@notmuchmail.org>; Tue, 9 Dec 2014 12:01:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id lwLR+m5I1t2K for <notmuch@notmuchmail.org>;
\r
16 Tue, 9 Dec 2014 12:01:24 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 4D0D1431FCB
\r
21 for <notmuch@notmuchmail.org>; Tue, 9 Dec 2014 12:01:24 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
24 id 1XyQyI-0003HC-5n; Tue, 09 Dec 2014 16:01:22 -0400
\r
25 Received: (nullmailer pid 23746 invoked by uid 1000); Tue, 09 Dec 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH 1/2] CLI: set up infrastructure to make path to gpg
\r
31 Date: Tue, 9 Dec 2014 21:01:10 +0100
\r
32 Message-Id: <1418155271-23704-1-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 2.1.3
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.13
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Tue, 09 Dec 2014 20:01:28 -0000
\r
48 GMIME takes a path to gpg, but we hardcode that path. In this commit
\r
49 we push hardcoding all the way up to the top level of a notmuch
\r
50 command, where we can later make it configurable.
\r
52 crypto.c | 10 +++++-----
\r
53 notmuch-client.h | 1 +
\r
54 notmuch-reply.c | 3 ++-
\r
55 notmuch-show.c | 3 ++-
\r
56 4 files changed, 10 insertions(+), 7 deletions(-)
\r
58 diff --git a/crypto.c b/crypto.c
\r
59 index 6f4a6db..026640f 100644
\r
64 /* Create a GPG context (GMime 2.6) */
\r
65 static notmuch_crypto_context_t *
\r
66 -create_gpg_context (void)
\r
67 +create_gpg_context (const char *gpgpath)
\r
69 notmuch_crypto_context_t *gpgctx;
\r
71 /* TODO: GMimePasswordRequestFunc */
\r
72 - gpgctx = g_mime_gpg_context_new (NULL, "gpg");
\r
73 + gpgctx = g_mime_gpg_context_new (NULL, gpgpath ? gpgpath : "gpg");
\r
77 @@ -43,13 +43,13 @@ create_gpg_context (void)
\r
79 /* Create a GPG context (GMime 2.4) */
\r
80 static notmuch_crypto_context_t *
\r
81 -create_gpg_context (void)
\r
82 +create_gpg_context (const char* gpgpath)
\r
84 GMimeSession *session;
\r
85 notmuch_crypto_context_t *gpgctx;
\r
87 session = g_object_new (g_mime_session_get_type (), NULL);
\r
88 - gpgctx = g_mime_gpg_context_new (session, "gpg");
\r
89 + gpgctx = g_mime_gpg_context_new (session, gpgpath ? gpgpath : "gpg");
\r
90 g_object_unref (session);
\r
93 @@ -83,7 +83,7 @@ notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol)
\r
94 if (strcasecmp (protocol, "application/pgp-signature") == 0 ||
\r
95 strcasecmp (protocol, "application/pgp-encrypted") == 0) {
\r
96 if (! crypto->gpgctx) {
\r
97 - crypto->gpgctx = create_gpg_context ();
\r
98 + crypto->gpgctx = create_gpg_context (crypto->gpgpath);
\r
99 if (! crypto->gpgctx)
\r
100 fprintf (stderr, "Failed to construct gpg context.\n");
\r
102 diff --git a/notmuch-client.h b/notmuch-client.h
\r
103 index 5e0d475..c25c4ea 100644
\r
104 --- a/notmuch-client.h
\r
105 +++ b/notmuch-client.h
\r
106 @@ -80,6 +80,7 @@ typedef struct notmuch_crypto {
\r
107 notmuch_crypto_context_t* gpgctx;
\r
108 notmuch_bool_t verify;
\r
109 notmuch_bool_t decrypt;
\r
110 + const char *gpgpath;
\r
111 } notmuch_crypto_t;
\r
113 typedef struct notmuch_show_params {
\r
114 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
115 index 7c1c809..e18370f 100644
\r
116 --- a/notmuch-reply.c
\r
117 +++ b/notmuch-reply.c
\r
118 @@ -769,7 +769,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
\r
123 + .decrypt = FALSE,
\r
127 int format = FORMAT_DEFAULT;
\r
128 diff --git a/notmuch-show.c b/notmuch-show.c
\r
129 index d416fbd..d292f29 100644
\r
130 --- a/notmuch-show.c
\r
131 +++ b/notmuch-show.c
\r
132 @@ -1082,7 +1082,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
\r
133 .output_body = TRUE,
\r
137 + .decrypt = FALSE,
\r
140 .include_html = FALSE
\r