Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2BD89429E21 for ; Fri, 25 Nov 2011 12:37:23 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.1 X-Spam-Level: X-Spam-Status: No, score=0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KVfTYtGBTkMO for ; Fri, 25 Nov 2011 12:37:21 -0800 (PST) Received: from silentio.fernseed.info (silentio.fernseed.info [217.169.4.202]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 513DC431FB6 for ; Fri, 25 Nov 2011 12:37:21 -0800 (PST) Received: from localhost (bookbinder.fernseed.info [IPv6:2001:8b0:ff94:1:224:2cff:fe37:838b]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: darren) by silentio.fernseed.info (Postfix) with ESMTPSA id 6812D98; Fri, 25 Nov 2011 20:37:16 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fernseed.info; s=default; t=1322253439; bh=pcrolySvIqSt9MzCMA2dFeSReAhfFU6EZVw9iT2Nnok=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Q+mcg76t/xsma4maJeg41VyTt1BWQ/aNVIojvAvGC6JWexrMbuHFwKrj8WyUE7Fn2 WJnifWRmEG89uE/HJmnoUnlUHOuxix8ZLQ/p0MT5maw/Hpvv8fa9/ZvuNpeoxdtiJv NLt18hGfIR0gIaC+Ub8Ap3XFk/dSUFbV+S0lh5+g= From: Darren McGuicken To: David Bremner , Jameson Graef Rollins , Dirk Hohndel , Daniel Kahn Gillmor Subject: Re: compile error of current git on F15 In-Reply-To: <87ehwwvy94.fsf@rocinante.cs.unb.ca> References: <8762osjagp.fsf@servo.factory.finestructure.net> <4DE51768.3070409@fifthhorseman.net> <87oc2hlcej.fsf@servo.factory.finestructure.net> <87y5v5i49b.fsf@bookbinder.fernseed.info> <87ehwwvy94.fsf@rocinante.cs.unb.ca> User-Agent: Notmuch/0.10 (http://notmuchmail.org) Emacs/23.3.1 (i386-redhat-linux-gnu) Date: Fri, 25 Nov 2011 20:37:14 +0000 Message-ID: <8762i8hrb9.fsf@bookbinder.fernseed.info> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: notmuch , Jeffrey Stedfast X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Fri, 25 Nov 2011 20:37:23 -0000 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, 25 Nov 2011 13:43:35 -0500, David Bremner wrote: > Just confirm, all the crypto tests pass with this patch? In that case, > can we have the patch (preferably as generated by git-send-email)? Or > did I miss it somewhere in this thread? I don't believe the patch ever made it to the list, I can't find it in my own archive. From the changelog here: http://koji.fedoraproject.org/koji/buildinfo?buildID=3D269819 it looks like Karel Kl=C3=AD=C4=8D of Red Hat created it back in July, I = assume that's when Fedora moved to the later GMime version. The patch itself looks like it's a straight re-mapping of the 2.4 GMimeSignatureValidity to the 2.5+ equivalent along with some deprecation of GMimeSession, so just applying the patch will break compilation for anyone < 2.5. Also, three of the crypto tests relating to signature validation /do/ fail, although it looks like that may simply be down to changes in the output format and so just need updated test cases. I've attached the patch as-is to this mail for reference purposes, but based on the above it'll need a bit of tweaking before it's useful to the wider group. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=notmuch-0.6.1-gmime.patch Content-Transfer-Encoding: quoted-printable Content-Description: Fedora GMime Patch diff -up notmuch-0.6.1/notmuch-client.h.gmime notmuch-0.6.1/notmuch-client.h =2D-- notmuch-0.6.1/notmuch-client.h.gmime 2011-07-17 16:20:51.000000000 +0= 200 +++ notmuch-0.6.1/notmuch-client.h 2011-07-28 17:24:16.904949635 +0200 @@ -68,7 +68,7 @@ typedef struct notmuch_show_format { void (*part_start) (GMimeObject *part, int *part_count); void (*part_encstatus) (int status); =2D void (*part_sigstatus) (const GMimeSignatureValidity* validity); + void (*part_sigstatus) (GMimeSignatureList *siglist); void (*part_content) (GMimeObject *part); void (*part_end) (GMimeObject *part); const char *part_sep; @@ -82,7 +82,7 @@ typedef struct notmuch_show_params { int entire_thread; int raw; int part; =2D GMimeCipherContext* cryptoctx; + GMimeCryptoContext* cryptoctx; int decrypt; } notmuch_show_params_t; =20 diff -up notmuch-0.6.1/notmuch-reply.c.gmime notmuch-0.6.1/notmuch-reply.c =2D-- notmuch-0.6.1/notmuch-reply.c.gmime 2011-07-17 16:20:51.000000000 +02= 00 +++ notmuch-0.6.1/notmuch-reply.c 2011-07-28 17:24:16.904949635 +0200 @@ -610,13 +610,10 @@ notmuch_reply_command (void *ctx, int ar } } else if ((STRNCMP_LITERAL (argv[i], "--decrypt") =3D=3D 0)) { if (params.cryptoctx =3D=3D NULL) { =2D GMimeSession* session =3D g_object_new(g_mime_session_get_type(), NULL= ); =2D if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(session, = "gpg"))) + if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(NULL, "gpg"= ))) fprintf (stderr, "Failed to construct gpg context.\n"); else g_mime_gpg_context_set_always_trust((GMimeGpgContext*)params.cryptoc= tx, FALSE); =2D g_object_unref (session); =2D session =3D NULL; } } else { fprintf (stderr, "Unrecognized option: %s\n", argv[i]); diff -up notmuch-0.6.1/notmuch-show.c.gmime notmuch-0.6.1/notmuch-show.c =2D-- notmuch-0.6.1/notmuch-show.c.gmime 2011-07-17 16:20:51.000000000 +0200 +++ notmuch-0.6.1/notmuch-show.c 2011-07-28 17:24:16.905949620 +0200 @@ -70,7 +70,7 @@ static void format_part_encstatus_json (int status); =20 static void =2Dformat_part_sigstatus_json (const GMimeSignatureValidity* validity); +format_part_sigstatus_json (GMimeSignatureList *siglist); =20 static void format_part_content_json (GMimeObject *part); @@ -420,16 +420,14 @@ show_text_part_content (GMimeObject *par } =20 static const char* =2Dsigner_status_to_string (GMimeSignerStatus x) +signature_status_to_string (GMimeSignatureStatus x) { switch (x) { =2D case GMIME_SIGNER_STATUS_NONE: =2D return "none"; =2D case GMIME_SIGNER_STATUS_GOOD: + case GMIME_SIGNATURE_STATUS_GOOD: return "good"; =2D case GMIME_SIGNER_STATUS_BAD: + case GMIME_SIGNATURE_STATUS_BAD: return "bad"; =2D case GMIME_SIGNER_STATUS_ERROR: + case GMIME_SIGNATURE_STATUS_ERROR: return "error"; } return "unknown"; @@ -524,59 +522,65 @@ format_part_encstatus_json (int status) } =20 static void =2Dformat_part_sigstatus_json (const GMimeSignatureValidity* validity) +format_part_sigstatus_json (GMimeSignatureList *siglist) { printf (", \"sigstatus\": ["); =20 =2D if (!validity) { + if (!siglist) { printf ("]"); return; } =20 =2D const GMimeSigner *signer =3D g_mime_signature_validity_get_signers = (validity); =2D int first =3D 1; void *ctx_quote =3D talloc_new (NULL); + int i; + for (i =3D 0; i < g_mime_signature_list_length (siglist); ++i) { + GMimeSignature *signature =3D g_mime_signature_list_get_signature (siglis= t, i); =20 =2D while (signer) { =2D if (first) =2D first =3D 0; =2D else + if (i > 0) printf (", "); =2D printf ("{"); =20 /* status */ + GMimeSignatureStatus status =3D g_mime_signature_get_status (signature); printf ("\"status\": %s", json_quote_str (ctx_quote, =2D signer_status_to_string (signer->status))); + signature_status_to_string (status))); =20 =2D if (signer->status =3D=3D GMIME_SIGNER_STATUS_GOOD) + GMimeCertificate *certificate =3D g_mime_signature_get_certificate (signa= ture); + if (status =3D=3D GMIME_SIGNATURE_STATUS_GOOD) { =2D if (signer->fingerprint) =2D printf (", \"fingerprint\": %s", json_quote_str (ctx_quote, signer->fi= ngerprint)); + if (certificate) + printf (", \"fingerprint\": %s", json_quote_str (ctx_quote, g_mime_certi= ficate_get_fingerprint (certificate))); /* these dates are seconds since the epoch; should we * provide a more human-readable format string? */ =2D if (signer->created) =2D printf (", \"created\": %d", (int) signer->created); =2D if (signer->expires) =2D printf (", \"expires\": %d", (int) signer->expires); + time_t created =3D g_mime_signature_get_created (signature); + if (created !=3D -1) + printf (", \"created\": %d", (int) created); + time_t expires =3D g_mime_signature_get_expires (signature); + if (expires !=3D -1) + printf (", \"expires\": %d", (int) expires); /* output user id only if validity is FULL or ULTIMATE. */ /* note that gmime is using the term "trust" here, which * is WRONG. It's actually user id "validity". */ =2D if ((signer->name) && (signer->trust)) { =2D if ((signer->trust =3D=3D GMIME_SIGNER_TRUST_FULLY) || (signer->trust = =3D=3D GMIME_SIGNER_TRUST_ULTIMATE)) =2D printf (", \"userid\": %s", json_quote_str (ctx_quote, signer->nam= e)); + if (certificate) + { + const char *name =3D g_mime_certificate_get_issuer_name (certificate); + GMimeCertificateTrust trust =3D g_mime_certificate_get_trust (certificat= e); + if (name && (trust =3D=3D GMIME_CERTIFICATE_TRUST_FULLY || trust =3D=3D = GMIME_CERTIFICATE_TRUST_ULTIMATE)) + printf (", \"userid\": %s", json_quote_str (ctx_quote, name)); } =2D } else { =2D if (signer->keyid) =2D printf (", \"keyid\": %s", json_quote_str (ctx_quote, sig= ner->keyid)); =2D } =2D if (signer->errors !=3D GMIME_SIGNER_ERROR_NONE) { =2D printf (", \"errors\": %x", signer->errors); =2D } + } else if (certificate) { + const char *key_id =3D g_mime_certificate_get_key_id (certificate); + if (key_id) + printf (", \"keyid\": %s", json_quote_str (ctx_quote, key_id)); + } + + GMimeSignatureError errors =3D g_mime_signature_get_errors (signature); + if (errors !=3D GMIME_SIGNATURE_ERROR_NONE) { + printf (", \"errors\": %x", errors); + } =20 =2D printf ("}"); =2D signer =3D signer->next; + printf ("}"); } =20 printf ("]"); @@ -899,13 +903,10 @@ notmuch_show_command (void *ctx, unused=20 } else if ((STRNCMP_LITERAL (argv[i], "--verify") =3D=3D 0) || (STRNCMP_LITERAL (argv[i], "--decrypt") =3D=3D 0)) { if (params.cryptoctx =3D=3D NULL) { =2D GMimeSession* session =3D g_object_new(g_mime_session_get_type(), NULL= ); =2D if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(session, = "gpg"))) + if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(NULL, "gpg"= ))) fprintf (stderr, "Failed to construct gpg context.\n"); else g_mime_gpg_context_set_always_trust((GMimeGpgContext*)params.cryptoc= tx, FALSE); =2D g_object_unref (session); =2D session =3D NULL; } if (STRNCMP_LITERAL (argv[i], "--decrypt") =3D=3D 0) params.decrypt =3D 1; diff -up notmuch-0.6.1/show-message.c.gmime notmuch-0.6.1/show-message.c =2D-- notmuch-0.6.1/show-message.c.gmime 2011-07-17 16:20:51.000000000 +0200 +++ notmuch-0.6.1/show-message.c 2011-07-28 17:27:12.295304742 +0200 @@ -68,15 +68,16 @@ show_message_part (GMimeObject *part, g_mime_multipart_get_count (multipart)); } else { GMimeMultipartEncrypted *encrypteddata =3D GMIME_MULTIPART_ENCRYPTED (pa= rt); =2D decryptedpart =3D g_mime_multipart_encrypted_decrypt (encrypteddata, p= arams->cryptoctx, &err); + GMimeDecryptResult *decrypt_result =3D g_mime_decrypt_result_new (); + decryptedpart =3D g_mime_multipart_encrypted_decrypt (encrypteddata, par= ams->cryptoctx, &decrypt_result, &err); if (decryptedpart) { if ((selected || state->in_zone) && format->part_encstatus) format->part_encstatus (1); =2D const GMimeSignatureValidity *sigvalidity =3D g_mime_multipart_enc= rypted_get_signature_validity (encrypteddata); =2D if (!sigvalidity) =2D fprintf (stderr, "Failed to verify signed part: %s\n", (err ? err->me= ssage : "no error explanation given")); + GMimeSignatureList *siglist =3D g_mime_decrypt_result_get_signatures= (decrypt_result); + if (!siglist) + fprintf (stderr, "Failed to get signatures: %s\n", (err ? err->message = : "no error explanation given")); if ((selected || state->in_zone) && format->part_sigstatus) =2D format->part_sigstatus (sigvalidity); + format->part_sigstatus (siglist); } else { fprintf (stderr, "Failed to decrypt part: %s\n", (err ? err->message= : "no error explanation given")); if ((selected || state->in_zone) && format->part_encstatus) @@ -92,20 +93,14 @@ show_message_part (GMimeObject *part, "Error: %d part(s) for a multipart/signed message (should be exactly 2= )\n", g_mime_multipart_get_count (multipart)); } else { =2D /* For some reason the GMimeSignatureValidity returned =2D * here is not a const (inconsistent with that =2D * returned by =2D * g_mime_multipart_encrypted_get_signature_validity, =2D * and therefore needs to be properly disposed of. =2D * Hopefully the API will become more consistent. */ =2D GMimeSignatureValidity *sigvalidity =3D g_mime_multipart_signed_verify= (GMIME_MULTIPART_SIGNED (part), params->cryptoctx, &err); =2D if (!sigvalidity) { + GMimeSignatureList *siglist =3D g_mime_multipart_signed_verify (GMIME_MU= LTIPART_SIGNED (part), params->cryptoctx, &err); + if (!siglist) { fprintf (stderr, "Failed to verify signed part: %s\n", (err ? err->m= essage : "no error explanation given")); } if ((selected || state->in_zone) && format->part_sigstatus) =2D format->part_sigstatus (sigvalidity); =2D if (sigvalidity) =2D g_mime_signature_validity_free (sigvalidity); + format->part_sigstatus (siglist); + if (siglist) + g_object_unref (siglist); } } =20 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk7P/HsACgkQP1ao/7snsT4jeACfTnClmksLfTAA86htzmrAeUWb JHQAoK69Uqh3KGO7pgGLl+jtglyVTHD6 =Gs0G -----END PGP SIGNATURE----- --==-=-=--