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 61917429E26 for ; Sat, 10 Dec 2011 13:19:25 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.29 X-Spam-Level: X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] 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 VJPAWwXGeeav for ; Sat, 10 Dec 2011 13:19:25 -0800 (PST) Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu [131.215.239.19]) by olra.theworths.org (Postfix) with ESMTP id E8803431FB6 for ; Sat, 10 Dec 2011 13:19:24 -0800 (PST) Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1]) by earth-doxen-postvirus (Postfix) with ESMTP id 904AE66E015B; Sat, 10 Dec 2011 13:19:24 -0800 (PST) X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com [76.174.137.84]) (Authenticated sender: jrollins) by earth-doxen-submit (Postfix) with ESMTP id CA33166E013A; Sat, 10 Dec 2011 13:19:21 -0800 (PST) Received: by finestructure.net (Postfix, from userid 1000) id 7069450F; Sat, 10 Dec 2011 16:19:21 -0500 (EST) From: Jameson Graef Rollins To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH 2/4] Introduce a generic tree-like abstraction for MIME traversal. In-Reply-To: <1323460468-4030-3-git-send-email-amdragon@mit.edu> References: <1323027100-10307-1-git-send-email-amdragon@mit.edu> <1323460468-4030-1-git-send-email-amdragon@mit.edu> <1323460468-4030-3-git-send-email-amdragon@mit.edu> User-Agent: Notmuch/0.10.2+74~g994a706 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Sat, 10 Dec 2011 13:19:21 -0800 Message-ID: <87liqk5dly.fsf@servo.finestructure.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" 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: Sat, 10 Dec 2011 21:19:25 -0000 --=-=-= On Fri, 9 Dec 2011 14:54:26 -0500, Austin Clements wrote: > + /* Handle PGP/MIME parts */ > + if (GMIME_IS_MULTIPART_ENCRYPTED (part) && out->ctx->decrypt) { > + if (out->children != 2) { > + /* this violates RFC 3156 section 4, so we won't bother with it. */ > + fprintf (stderr, "Error: %d part(s) for a multipart/encrypted " > + "message (should be exactly 2)\n", > + out->children); > + } else { > + out->is_encrypted = TRUE; As per Dmitry's previous point, maybe it's better to do something like: if (GMIME_IS_MULTIPART_ENCRYPTED (part)) { out->is_encrypted = TRUE; if (out->ctx->decrypt) { if (out->children != 2) { ... And similarly for is_signed. > + GMimeMultipartEncrypted *encrypteddata = > + GMIME_MULTIPART_ENCRYPTED (part); > + out->decrypted_child = g_mime_multipart_encrypted_decrypt > + (encrypteddata, out->ctx->cryptoctx, &err); > + if (out->decrypted_child) { > + out->decrypt_success = TRUE; > + out->is_signed = TRUE; > + out->sig_validity = g_mime_multipart_encrypted_get_signature_validity (encrypteddata); Encrypted messages are not necessarily signed, so we need to be careful about setting is_signed = TRUE based just on decryption status. The problem is that gmime's handling of this stuff (at least last I looked in 2.4) is not so good. g_mime_multipart_encrypted_get_signature_validity () should return GMIME_SIGNATURE_STATUS_UNKNOWN if there's no signature, so I think is_signed should be set TRUE only if sig_validity is not UNKNOWN. I've really been meaning to overhaul this stuff for gmime 2.6. Hopefully I'll start looking at that after these patches go through. jamie. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBCAAGBQJO48zZAAoJEO00zqvie6q83/oP/Ag9WhT8EENXOZwkZKzciUyT GK32zjjTpFsH6hUUpCdaLSsvM9GfIpAuepLIb18ldPc8JSH+NoHu9ZFn2r99GD5I ERnXvYBFmMGvt6p5AIg93h4CoHZpGOyhEzYblc/0aj6mwf6LwP9wQ+WE1AY2jc4F A+sFdrIG1CmHD2TMkAc2qs/B2q0xi/Y7J8rbGHvnjl82MQbxsX8UWZoTg0ZQdOC4 7PkuuiVaXVHPn3MO5764Wq6zR0eWm4I23sarISamc3DXJ2FtLwdg7rKCNyq5Gfya cEC5KaVZYs8MGKEDj0848LMlQTWmbZ83YLMCiyqeP7kzRZdvak1e/igNxe1n2mRZ U19psMcHWSTDih8nXIw4fST22SLenqnaxgYldUbMpwxYmDwAwEcNUgXzgYZgR7QE msBtGSBFw4Li1cMWr+/KDfYMB+U+PfXFBNBQzU1JG35JufJaE/jMiz1FZHhruZz0 T8SXXEfcL058c8GI1Ux06IkFrNoCDrXxaLumyN2pM5Q1iRHBlkVrCwqDHbbdCLM6 CuaNsdf1lXTC0gX06iH0YuonYEWvUjwDheq2Lai2+BeuB4MP+AGfc+594cYzLmOm OmUY07kqJztDruUs0AGrUCbWvIsPV+Gl6JLlq6ikGkCLgDxqnOLOPbxN4eIShKt/ 4IRvUASm89TrtmmiCflt =JrFN -----END PGP SIGNATURE----- --=-=-=--