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 arlo.cworth.org (Postfix) with ESMTP id 2B3C76DE0B26
\r
6 for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 08:34:24 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.129 tagged_above=-999 required=5 tests=[AWL=0.119,
\r
12 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 0VTWOAOrvhpZ for <notmuch@notmuchmail.org>;
\r
16 Sun, 16 Aug 2015 08:34:21 -0700 (PDT)
\r
17 Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])
\r
18 by arlo.cworth.org (Postfix) with ESMTPS id 5459C6DE01D3
\r
19 for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 08:34:20 -0700 (PDT)
\r
20 Received: from remotemail by gitolite.debian.net with local (Exim 4.80)
\r
21 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
22 id 1ZQzwI-0003E5-1s; Sun, 16 Aug 2015 15:33:38 +0000
\r
23 Received: (nullmailer pid 11162 invoked by uid 1000); Sun, 16 Aug 2015
\r
25 From: David Bremner <david@tethera.net>
\r
26 To: notmuch@notmuchmail.org
\r
27 Subject: [PATCH] cli/lib: remove support for GMime 2.4
\r
28 Date: Sun, 16 Aug 2015 17:33:21 +0200
\r
29 Message-Id: <1439739201-11068-1-git-send-email-david@tethera.net>
\r
30 X-Mailer: git-send-email 2.5.0
\r
31 X-BeenThere: notmuch@notmuchmail.org
\r
32 X-Mailman-Version: 2.1.18
\r
34 List-Id: "Use and development of the notmuch mail system."
\r
35 <notmuch.notmuchmail.org>
\r
36 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
37 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
39 List-Post: <mailto:notmuch@notmuchmail.org>
\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
41 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
43 X-List-Received-Date: Sun, 16 Aug 2015 15:34:24 -0000
\r
45 It's becoming a maintenance burden to do anything things with the
\r
46 crypto glue code twice, once for 2.4 and once for 2.6. I don't have
\r
47 any 2.4 version available to test on my development machine anymore,
\r
48 so the 2.4 specific code paths are likely not very well tested.
\r
51 I started to rebase the SMIME signature verification patches and got
\r
52 aggravated at solving the same conflicts twice in every file.
\r
54 2.6.7 is from 2012, so that's a bit newer than some of our
\r
55 requirements, but I think not so bad. YMMV.
\r
58 configure | 49 ++++++++++-----------------------
\r
59 crypto.c | 25 -----------------
\r
60 mime-node.c | 83 -------------------------------------------------------
\r
61 notmuch-show.c | 87 ----------------------------------------------------------
\r
62 5 files changed, 17 insertions(+), 233 deletions(-)
\r
64 diff --git a/INSTALL b/INSTALL
\r
65 index eaccd93..b1b9cd5 100644
\r
68 @@ -20,7 +20,7 @@ configure stage.
\r
72 -Notmuch depends on four libraries: Xapian, GMime 2.4 or 2.6,
\r
73 +Notmuch depends on four libraries: Xapian, GMime 2.6,
\r
74 Talloc, and zlib which are each described below:
\r
77 @@ -39,8 +39,8 @@ Talloc, and zlib which are each described below:
\r
78 reading mail while notmuch would wait for Xapian when removing
\r
79 the "inbox" and "unread" tags from messages in a thread.
\r
85 GMime provides decoding of MIME email messages for Notmuch.
\r
87 Without GMime, Notmuch would not be able to extract and index
\r
88 diff --git a/configure b/configure
\r
89 index d289880..440d678 100755
\r
92 @@ -71,16 +71,6 @@ WITH_BASH=1
\r
96 -# Compatible GMime versions (with constraints).
\r
97 -# If using GMime 2.6, we need to have a version >= 2.6.5 to avoid a
\r
98 -# crypto bug. We need 2.6.7 for permissive "From " header handling.
\r
99 -GMIME_24_VERSION_CTR=''
\r
100 -GMIME_24_VERSION="gmime-2.4 $GMIME_24_VERSION_CTR"
\r
101 -GMIME_26_VERSION_CTR='>= 2.6.7'
\r
102 -GMIME_26_VERSION="gmime-2.6 $GMIME_26_VERSION_CTR"
\r
104 -WITH_GMIME_VERSIONS="$GMIME_26_VERSION;$GMIME_24_VERSION"
\r
109 @@ -140,10 +130,6 @@ Fine tuning of some installation directories is available:
\r
110 --bashcompletiondir=DIR Bash completions files [SYSCONFDIR/bash_completion.d]
\r
111 --zshcompletiondir=DIR Zsh completions files [PREFIX/share/zsh/functions/Completion/Unix]
\r
113 -Some specific library versions can be specified (auto-detected otherwise):
\r
115 - --with-gmime-version=VERS Specify GMIME version (2.4 or 2.6)
\r
117 Some features can be disabled (--with-feature=no is equivalent to
\r
118 --without-feature) :
\r
120 @@ -231,12 +217,6 @@ for option; do
\r
122 elif [ "${option}" = '--without-zsh-completion' ] ; then
\r
124 - elif [ "${option%%=*}" = '--with-gmime-version' ] ; then
\r
125 - if [ "${option#*=}" = '2.4' ]; then
\r
126 - WITH_GMIME_VERSIONS=$GMIME_24_VERSION
\r
127 - elif [ "${option#*=}" = '2.6' ]; then
\r
128 - WITH_GMIME_VERSIONS=$GMIME_26_VERSION
\r
130 elif [ "${option%%=*}" = '--build' ] ; then
\r
132 elif [ "${option%%=*}" = '--host' ] ; then
\r
133 @@ -391,20 +371,19 @@ if [ ${have_xapian} = "1" ]; then
\r
138 +# we need to have a version >= 2.6.5 to avoid a crypto bug. We need
\r
139 +# 2.6.7 for permissive "From " header handling.
\r
140 +GMIME_MINVER=2.6.7
\r
142 printf "Checking for GMime development files... "
\r
145 -for gmimepc in $WITH_GMIME_VERSIONS; do
\r
146 - if pkg-config --exists $gmimepc; then
\r
147 - printf "Yes ($gmimepc).\n"
\r
149 - gmime_cflags=$(pkg-config --cflags $gmimepc)
\r
150 - gmime_ldflags=$(pkg-config --libs $gmimepc)
\r
155 -if [ "$have_gmime" = "0" ]; then
\r
156 +if pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then
\r
159 + gmime_cflags=$(pkg-config --cflags gmime-2.6)
\r
160 + gmime_ldflags=$(pkg-config --libs gmime-2.6)
\r
164 errors=$((errors + 1))
\r
166 @@ -640,7 +619,7 @@ EOF
\r
169 if [ $have_gmime -eq 0 ]; then
\r
170 - echo " Either GMime 2.4 library" $GMIME_24_VERSION_CTR "or GMime 2.6 library" $GMIME_26_VERSION_CTR
\r
171 + echo " GMime 2.6 library >= $GMIME_MINVER"
\r
172 echo " (including development files such as headers)"
\r
173 echo " http://spruce.sourceforge.net/gmime/"
\r
175 @@ -1026,7 +1005,7 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
\r
176 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
\r
177 XAPIAN_LDFLAGS = ${xapian_ldflags}
\r
179 -# Flags needed to compile and link against GMime-2.4
\r
180 +# Flags needed to compile and link against GMime
\r
181 GMIME_CFLAGS = ${gmime_cflags}
\r
182 GMIME_LDFLAGS = ${gmime_ldflags}
\r
184 diff --git a/crypto.c b/crypto.c
\r
185 index 026640f..a6eb27d 100644
\r
190 #include "notmuch-client.h"
\r
192 -#ifdef GMIME_ATLEAST_26
\r
194 /* Create a GPG context (GMime 2.6) */
\r
195 static notmuch_crypto_context_t *
\r
196 create_gpg_context (const char *gpgpath)
\r
197 @@ -39,29 +37,6 @@ create_gpg_context (const char *gpgpath)
\r
201 -#else /* GMIME_ATLEAST_26 */
\r
203 -/* Create a GPG context (GMime 2.4) */
\r
204 -static notmuch_crypto_context_t *
\r
205 -create_gpg_context (const char* gpgpath)
\r
207 - GMimeSession *session;
\r
208 - notmuch_crypto_context_t *gpgctx;
\r
210 - session = g_object_new (g_mime_session_get_type (), NULL);
\r
211 - gpgctx = g_mime_gpg_context_new (session, gpgpath ? gpgpath : "gpg");
\r
212 - g_object_unref (session);
\r
217 - g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, FALSE);
\r
222 -#endif /* GMIME_ATLEAST_26 */
\r
224 /* for the specified protocol return the context pointer (initializing
\r
226 notmuch_crypto_context_t *
\r
227 diff --git a/mime-node.c b/mime-node.c
\r
228 index fd9e4a4..e96e663 100644
\r
231 @@ -129,8 +129,6 @@ DONE:
\r
235 -#ifdef GMIME_ATLEAST_26
\r
237 /* Signature list destructor (GMime 2.6) */
\r
239 _signature_list_free (GMimeSignatureList **proxy)
\r
240 @@ -205,87 +203,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
\r
241 g_error_free (err);
\r
244 -#else /* GMIME_ATLEAST_26 */
\r
246 -/* Signature validity destructor (GMime 2.4) */
\r
248 -_signature_validity_free (GMimeSignatureValidity **proxy)
\r
250 - g_mime_signature_validity_free (*proxy);
\r
254 -/* Set up signature validity destructor (GMime 2.4) */
\r
256 -set_signature_validity_destructor (mime_node_t *node,
\r
257 - GMimeSignatureValidity *sig_validity)
\r
259 - GMimeSignatureValidity **proxy = talloc (node, GMimeSignatureValidity *);
\r
261 - *proxy = sig_validity;
\r
262 - talloc_set_destructor (proxy, _signature_validity_free);
\r
266 -/* Verify a signed mime node (GMime 2.4) */
\r
268 -node_verify (mime_node_t *node, GMimeObject *part,
\r
269 - notmuch_crypto_context_t *cryptoctx)
\r
271 - GError *err = NULL;
\r
272 - GMimeSignatureValidity *sig_validity;
\r
274 - node->verify_attempted = TRUE;
\r
275 - sig_validity = g_mime_multipart_signed_verify
\r
276 - (GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
\r
277 - node->sig_validity = sig_validity;
\r
278 - if (sig_validity) {
\r
279 - set_signature_validity_destructor (node, sig_validity);
\r
281 - fprintf (stderr, "Failed to verify signed part: %s\n",
\r
282 - err ? err->message : "no error explanation given");
\r
286 - g_error_free (err);
\r
289 -/* Decrypt and optionally verify an encrypted mime node (GMime 2.4) */
\r
291 -node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
\r
292 - notmuch_crypto_context_t *cryptoctx)
\r
294 - GError *err = NULL;
\r
295 - GMimeMultipartEncrypted *encrypteddata = GMIME_MULTIPART_ENCRYPTED (part);
\r
297 - node->decrypt_attempted = TRUE;
\r
298 - node->decrypted_child = g_mime_multipart_encrypted_decrypt
\r
299 - (encrypteddata, cryptoctx, &err);
\r
300 - if (! node->decrypted_child) {
\r
301 - fprintf (stderr, "Failed to decrypt part: %s\n",
\r
302 - err ? err->message : "no error explanation given");
\r
306 - node->decrypt_success = TRUE;
\r
307 - node->verify_attempted = TRUE;
\r
309 - /* The GMimeSignatureValidity returned here is a const, unlike the
\r
310 - * one returned by g_mime_multipart_signed_verify() in
\r
311 - * node_verify() above, so the destructor is not needed.
\r
313 - node->sig_validity = g_mime_multipart_encrypted_get_signature_validity (encrypteddata);
\r
314 - if (! node->sig_validity)
\r
315 - fprintf (stderr, "Failed to verify encrypted signed part: %s\n",
\r
316 - err ? err->message : "no error explanation given");
\r
320 - g_error_free (err);
\r
323 -#endif /* GMIME_ATLEAST_26 */
\r
325 static mime_node_t *
\r
326 _mime_node_create (mime_node_t *parent, GMimeObject *part)
\r
328 diff --git a/notmuch-show.c b/notmuch-show.c
\r
329 index b80933a..21015fd 100644
\r
330 --- a/notmuch-show.c
\r
331 +++ b/notmuch-show.c
\r
332 @@ -334,8 +334,6 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
\r
333 g_object_unref(stream_filter);
\r
336 -#ifdef GMIME_ATLEAST_26
\r
338 /* Get signature status string (GMime 2.6) */
\r
340 signature_status_to_string (GMimeSignatureStatus x)
\r
341 @@ -427,91 +425,6 @@ format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)
\r
345 -#else /* GMIME_ATLEAST_26 */
\r
347 -/* Get signature status string (GMime 2.4) */
\r
348 -static const char*
\r
349 -signer_status_to_string (GMimeSignerStatus x)
\r
352 - case GMIME_SIGNER_STATUS_NONE:
\r
354 - case GMIME_SIGNER_STATUS_GOOD:
\r
356 - case GMIME_SIGNER_STATUS_BAD:
\r
358 - case GMIME_SIGNER_STATUS_ERROR:
\r
361 - return "unknown";
\r
364 -/* Signature status sprinter (GMime 2.4) */
\r
366 -format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)
\r
368 - const GMimeSignatureValidity* validity = node->sig_validity;
\r
370 - sp->begin_list (sp);
\r
377 - const GMimeSigner *signer = g_mime_signature_validity_get_signers (validity);
\r
379 - sp->begin_map (sp);
\r
382 - sp->map_key (sp, "status");
\r
383 - sp->string (sp, signer_status_to_string (signer->status));
\r
385 - if (signer->status == GMIME_SIGNER_STATUS_GOOD)
\r
387 - if (signer->fingerprint) {
\r
388 - sp->map_key (sp, "fingerprint");
\r
389 - sp->string (sp, signer->fingerprint);
\r
391 - /* these dates are seconds since the epoch; should we
\r
392 - * provide a more human-readable format string? */
\r
393 - if (signer->created) {
\r
394 - sp->map_key (sp, "created");
\r
395 - sp->integer (sp, signer->created);
\r
397 - if (signer->expires) {
\r
398 - sp->map_key (sp, "expires");
\r
399 - sp->integer (sp, signer->expires);
\r
401 - /* output user id only if validity is FULL or ULTIMATE. */
\r
402 - /* note that gmime is using the term "trust" here, which
\r
403 - * is WRONG. It's actually user id "validity". */
\r
404 - if ((signer->name) && (signer->trust)) {
\r
405 - if ((signer->trust == GMIME_SIGNER_TRUST_FULLY) || (signer->trust == GMIME_SIGNER_TRUST_ULTIMATE)) {
\r
406 - sp->map_key (sp, "userid");
\r
407 - sp->string (sp, signer->name);
\r
411 - if (signer->keyid) {
\r
412 - sp->map_key (sp, "keyid");
\r
413 - sp->string (sp, signer->keyid);
\r
416 - if (signer->errors != GMIME_SIGNER_ERROR_NONE) {
\r
417 - sp->map_key (sp, "errors");
\r
418 - sp->integer (sp, signer->errors);
\r
422 - signer = signer->next;
\r
428 -#endif /* GMIME_ATLEAST_26 */
\r
430 static notmuch_status_t
\r
431 format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
432 int indent, const notmuch_show_params_t *params)
\r