Re: [PATCH] cli: crypto: tell gmime to use gpg-agent
authorJani Nikula <jani@nikula.org>
Wed, 27 Feb 2013 22:46:57 +0000 (00:46 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:47 +0000 (09:53 -0800)
b7/44b04cdc14dcf2dc2d22808bb4dd6b89fede43 [new file with mode: 0644]

diff --git a/b7/44b04cdc14dcf2dc2d22808bb4dd6b89fede43 b/b7/44b04cdc14dcf2dc2d22808bb4dd6b89fede43
new file mode 100644 (file)
index 0000000..2ce54e5
--- /dev/null
@@ -0,0 +1,123 @@
+Return-Path: <jani@nikula.org>\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 00112431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 27 Feb 2013 14:47:02 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 JiUv9yo+dElF for <notmuch@notmuchmail.org>;\r
+       Wed, 27 Feb 2013 14:47:01 -0800 (PST)\r
+Received: from mail-la0-f54.google.com (mail-la0-f54.google.com\r
+       [209.85.215.54]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 322FE431FAF\r
+       for <notmuch@notmuchmail.org>; Wed, 27 Feb 2013 14:47:01 -0800 (PST)\r
+Received: by mail-la0-f54.google.com with SMTP id gw10so1120191lab.41\r
+       for <notmuch@notmuchmail.org>; Wed, 27 Feb 2013 14:46:58 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=x-received:from:to:subject:in-reply-to:references:user-agent:date\r
+       :message-id:mime-version:content-type:x-gm-message-state;\r
+       bh=TtxRpLLI0G9/5YcgxVx8R/HW2eJdwnhhrEjL+pw1W0A=;\r
+       b=nzaJvkujXGEHYMk+U9Ync4EQsu4TaEoAulOkr+QOYlT1C/jMl2uVVfTC1UOFVhXAj4\r
+       fspAwpbSFFtzeZPzeWya7p7pxOe6bcVrc8LmwSKqwNysQVAPF8xEDFXZXF5LmOTtHaDU\r
+       keKfKVcaNTQjRknEdhsHK1zovlUz62oNzxieNZTl23kAj8m5huJwXI86v0sZo3IOuhp0\r
+       mvhFP3L8wqqPB2TPQWBAYfKmIPLcc810khVbfhBvKhqrAqZ3zYglRGDXZF5ugD4R6Xdt\r
+       DyMb4N1tTlXLlPG1l2y3OhrdycDMDJH4zToLxBFDm3eSfy/G503FE9/TiGNfHqIXPba0\r
+       Q69w==\r
+X-Received: by 10.112.99.65 with SMTP id eo1mr2832659lbb.78.1362005218272;\r
+       Wed, 27 Feb 2013 14:46:58 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id m1sm2257361lbh.5.2013.02.27.14.46.55\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Wed, 27 Feb 2013 14:46:56 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
+       David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] cli: crypto: tell gmime to use gpg-agent\r
+In-Reply-To: <87ehg1pt2u.fsf@servo.finestructure.net>\r
+References: <1361950838-22919-1-git-send-email-jani@nikula.org>\r
+       <87hakxpwcu.fsf@servo.finestructure.net>\r
+       <87r4k1znor.fsf@maritornes.cs.unb.ca>\r
+       <87ehg1pt2u.fsf@servo.finestructure.net>\r
+User-Agent: Notmuch/0.15.2+33~g98253a3 (http://notmuchmail.org) Emacs/24.2.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Thu, 28 Feb 2013 00:46:57 +0200\r
+Message-ID: <87txoxwf1a.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-Gm-Message-State:\r
+ ALoCoQl0zU3bUvTwwtY86o+YFcwdcMpqIB3Pp3XWqyayvrAjDYaD6B1AXitf8jLZldAeUfAHznUF\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: Wed, 27 Feb 2013 22:47:03 -0000\r
+\r
+On Wed, 27 Feb 2013, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
+> On Wed, Feb 27 2013, David Bremner <david@tethera.net> wrote:\r
+>> But right now we force people to enable the agent globally via use-agent\r
+>> if they want to decrypt mail in notmuch-cli/emacs. The proposed change\r
+>> allows them to use the agent only for notmuch.\r
+>\r
+> Doesn't the proposed change actually *force* the user to use gpg-agent?\r
+> How can the user opt out?\r
+\r
+If the user wants to have decryption in notmuch, the user *must* use\r
+gpg-agent, regardless of this change or the "use-agent" configuration\r
+option. There is no opt out if one wants to have decryption in notmuch,\r
+regardless of this change.\r
+\r
+The proposed change gives the user the possibility to opt out of\r
+*globally* using gpg-agent for everything, and still have decryption in\r
+notmuch.\r
+\r
+The proposed change merely passes the --use-agent option to gpg. It does\r
+not *force* anything. It tells gpg to *try* to connect to the gpg-agent\r
+before it asks for a passphrase. (Except that notmuch will never ask for\r
+a passphrase. It will fail if it can't connect to the gpg-agent. Without\r
+--use-agent or "use-agent" option it will unconditionally fail.)\r
+\r
+When I use gpg on the command line, I want it to prompt for the\r
+passphrase on the command line instead of popping up a gpg-agent\r
+dialog. I don't think that is unreasonable. To achieve that I have\r
+disabled the "use-agent" configuration option. Without the proposed\r
+change, if I still wanted to have this *and* decryption in notmuch, I\r
+would have to pass --no-use-agent on the gpg command line. I think that\r
+*is* unreasonable.\r
+\r
+>> I don't think we should directly care about the presence of an X session\r
+>> or not; the agent protocol doesn't depend on how the agent was started\r
+>> afaik. \r
+>\r
+> Maybe, but I would like some example of what happens if you force usage\r
+> of an agent and the agent is not present or there is no X session.\r
+\r
+There is no force anything. It tries to connect to the agent, and if one\r
+is not present, decryption fails like it would have failed without this\r
+change.\r
+\r
+Finally, look up the references I provided. The whole function in gmime\r
+was provided *exactly* for situations like we have: the caller will fail\r
+without the agent, so have a tiny bit of sanity and see if it's there\r
+before failing.\r
+\r
+\r
+BR,\r
+Jani.\r