From: Sascha Wilde <wilde@sha-bang.de>
Cc: "Daiki Ueno \(pgg author\)" <ueno@unixuser.org>,
ding@gnus.org, emacs-devel@gnu.org
Subject: Re: Small patch to enable use of gpg-agent with pgg
Date: Wed, 22 Mar 2006 09:36:51 +0100 [thread overview]
Message-ID: <m2slpadgf0.fsf@kenny.sha-bang.de> (raw)
In-Reply-To: <87pskfq361.fsf@latte.josefsson.org> (Simon Josefsson's message of "Tue, 21 Mar 2006 15:32:22 +0100")
[-- Attachment #1: Type: text/plain, Size: 1519 bytes --]
Simon Josefsson <jas@extundo.com> wrote:
Hi Simon,
first of all, fore some reasons you got lost from the list of CC's so
you missed some important messages in this thread, including a more
elaborated version of my patch...
> 1) Non-agent mode didn't work at all (the args list contained 'nil' so
> invoking gpg failed with a lisp error).
Yes. This was fixed in my second patch. (and in the attached, of cause)
> 2) After fixing the above, the patch made the passphrase be 't', which
> broke the passphrase cache, causing a lisp error.
Thanks, I used your strategy to fix this issue in my new patch (which
I attached).
> How about this patch instead? It works for me. I've also improved
> the pgg-use-agent default value.
This is very error prone. As I wrote before on emacs-devel: there are
certain situations in which using the agent will fail -- even if it is
available: for example: on an text console running the standard
pin-entry program (which uses curses) from within emacs won't work.
That's why I think this option should be explicitly enabled by the user.
Another problem is, that checking for $GPG_AGENT_INFO is not
sufficient, the environment variable will stay set, even is the agent
was killed.
Could you please consider committing the attached patch, which
reverses the default of pgg-gpg-use-agent to nil, and adds an check if
the agent is _really_ available, when pgg-gpg-use-agent is set to t?
(The patch is against the latest CVS, including your patch that is)
cheers
sascha
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pgg-gpg-agent.patch --]
[-- Type: text/x-patch, Size: 3869 bytes --]
Index: pgg-gpg.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/pgg-gpg.el,v
retrieving revision 1.6
diff -c -r1.6 pgg-gpg.el
--- pgg-gpg.el 21 Mar 2006 21:24:27 -0000 1.6
+++ pgg-gpg.el 22 Mar 2006 08:14:59 -0000
@@ -4,7 +4,8 @@
;; 2005, 2006 Free Software Foundation, Inc.
;; Author: Daiki Ueno <ueno@unixuser.org>
-;; Symmetric encryption added by: Sascha Wilde <wilde@sha-bang.de>
+;; Symmetric encryption and gpg-agent support added by:
+;; Sascha Wilde <wilde@sha-bang.de>
;; Created: 1999/10/28
;; Keywords: PGP, OpenPGP, GnuPG
@@ -51,10 +52,8 @@
:type '(choice (const :tag "New `--recipient' option" "--recipient")
(const :tag "Old `--remote-user' option" "--remote-user")))
-(defcustom pgg-gpg-use-agent (if (getenv "GPG_AGENT_INFO") t nil)
- "Whether to use gnupg agent for key caching.
-By default, it will be enabled iff the environment variable
-\"GPG_AGENT_INFO\" is set."
+(defcustom pgg-gpg-use-agent nil
+ "Whether to use gnupg agent for key caching."
:group 'pgg-gpg
:type 'boolean)
@@ -62,10 +61,11 @@
"GnuPG ID of your default identity.")
(defun pgg-gpg-process-region (start end passphrase program args)
- (let* ((output-file-name (pgg-make-temp-file "pgg-output"))
+ (let* ((use-agent (pgg-gpg-use-agent-p))
+ (output-file-name (pgg-make-temp-file "pgg-output"))
(args
`("--status-fd" "2"
- ,@(if pgg-gpg-use-agent '("--use-agent")
+ ,@(if use-agent '("--use-agent")
(if passphrase '("--passphrase-fd" "0")))
"--yes" ; overwrite
"--output" ,output-file-name
@@ -189,7 +189,7 @@
passphrase cache or user."
(let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id))
(passphrase (or passphrase
- (when (and sign (not pgg-gpg-use-agent))
+ (when (and sign (not (pgg-gpg-use-agent-p)))
(pgg-read-passphrase
(format "GnuPG passphrase for %s: "
pgg-gpg-user-id)
@@ -221,7 +221,7 @@
If optional PASSPHRASE is not specified, it will be obtained from the
passphrase cache or user."
(let* ((passphrase (or passphrase
- (when (not pgg-gpg-use-agent)
+ (when (not (pgg-gpg-use-agent-p))
(pgg-read-passphrase
"GnuPG passphrase for symmetric encryption: "))))
(args
@@ -250,7 +250,7 @@
(pgg-gpg-user-id (or key-id key
pgg-gpg-user-id pgg-default-user-id))
(passphrase (or passphrase
- (when (not pgg-gpg-use-agent)
+ (when (not (pgg-gpg-use-agent-p))
(pgg-read-passphrase
(format (if (pgg-gpg-symmetric-key-p message-keys)
"Passphrase for symmetric decryption: "
@@ -286,7 +286,7 @@
"Make detached signature from text between START and END."
(let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id))
(passphrase (or passphrase
- (when (not pgg-gpg-use-agent)
+ (when (not (pgg-gpg-use-agent-p))
(pgg-read-passphrase
(format "GnuPG passphrase for %s: "
pgg-gpg-user-id)
@@ -356,6 +356,25 @@
(append-to-buffer pgg-output-buffer (point-min)(point-max))
(pgg-process-when-success)))
+(defun pgg-gpg-update-agent ()
+ "Try to connet to gpg-agent and send UPDATESTARTUPTTY."
+ (let* ((agent-info (getenv "GPG_AGENT_INFO"))
+ (socket (and agent-info
+ (string-match "^\\([^:]*\\)" agent-info)
+ (match-string 1 agent-info)))
+ (conn (and socket
+ (make-network-process :name "gpg-agent-process"
+ :host 'local :family 'local
+ :service socket))))
+ (when (and conn (eq (process-status conn) 'open))
+ (process-send-string conn "UPDATESTARTUPTTY\n")
+ (delete-process conn)
+ t)))
+
+(defun pgg-gpg-use-agent-p ()
+ "Return t if `pgg-gpg-use-agent' is t and gpg-agent is available."
+ (and pgg-gpg-use-agent (pgg-gpg-update-agent)))
+
(provide 'pgg-gpg)
;;; arch-tag: 2aa5d5d8-93a0-4865-9312-33e29830e000
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
--
Sascha Wilde
"Unix was the first OS where you could carry the media and system
documentation around in a briefcase. This was fixed in BSD4.2."
[-- Attachment #4: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2006-03-22 8:36 UTC|newest]
Thread overview: 156+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-30 17:24 new version of allout.el - patch and ChangeLog Ken Manheimer
2005-09-30 21:06 ` Sascha Wilde
2005-09-30 21:52 ` Ken Manheimer
2005-10-01 8:20 ` Andreas Schwab
2005-10-01 12:41 ` Reiner Steib
2005-10-01 23:54 ` James Cloos
2005-10-01 16:28 ` Ken Manheimer
2005-10-02 10:48 ` Sascha Wilde
2005-10-02 14:23 ` Ken Manheimer
2005-10-02 20:31 ` Richard M. Stallman
2005-10-03 19:25 ` pgg symmetric encryption patch (was: new version of allout.el - patch and ChangeLog) Sascha Wilde
2005-10-03 19:50 ` Ken Manheimer
2005-10-04 10:53 ` Sascha Wilde
2005-10-04 12:46 ` pgg symmetric encryption patch Stefan Monnier
2005-10-05 16:19 ` Sascha Wilde
2005-10-05 19:16 ` Ken Manheimer
2005-10-10 4:15 ` Richard M. Stallman
2005-10-06 2:18 ` Daiki Ueno
2005-10-06 9:01 ` Sascha Wilde
2005-10-06 22:41 ` Ken Manheimer
2005-10-07 10:00 ` Sascha Wilde
2005-10-07 18:06 ` Ken Manheimer
2005-10-07 21:49 ` Sascha Wilde
2005-10-08 8:48 ` Simon Josefsson
2005-10-08 10:36 ` Sascha Wilde
2005-10-08 11:14 ` Simon Josefsson
2005-10-08 12:56 ` Ken Manheimer
2005-10-08 22:56 ` Richard M. Stallman
2005-10-10 21:50 ` Ken Manheimer
2005-10-11 14:44 ` Richard M. Stallman
2005-10-08 13:43 ` Sascha Wilde
2005-10-08 18:31 ` Ken Manheimer
2005-10-08 19:16 ` Ken Manheimer
2005-10-10 21:15 ` Ken Manheimer
2005-10-10 21:16 ` Ken Manheimer
2005-10-12 23:47 ` Ken Manheimer
2005-10-20 14:08 ` Ken Manheimer
2005-10-20 14:12 ` Simon Josefsson
2005-10-20 14:30 ` Ken Manheimer
2005-10-20 14:42 ` Sascha Wilde
2005-10-25 7:23 ` Sascha Wilde
2005-10-25 20:26 ` Ken Manheimer
2005-10-25 21:18 ` Sascha Wilde
2005-10-25 21:28 ` Ken Manheimer
2005-10-26 9:57 ` Sascha Wilde
2005-10-26 15:45 ` Ken Manheimer
2005-10-27 7:37 ` Sascha Wilde
2005-10-29 11:42 ` Eli Zaretskii
2005-10-29 19:50 ` Ken Manheimer
2005-10-31 17:30 ` Ken Manheimer
2005-11-04 14:45 ` Eli Zaretskii
2005-10-20 18:07 ` Relocating pgg*.el (was: pgg symmetric encryption patch) Reiner Steib
2005-10-20 22:22 ` Kim F. Storm
2005-10-21 4:49 ` Richard M. Stallman
2005-10-20 23:38 ` pgg symmetric encryption patch Richard M. Stallman
2005-10-21 7:07 ` Simon Josefsson
2006-03-18 21:17 ` Small patch to enable use of gpg-agent with pgg Sascha Wilde
2006-03-18 23:30 ` Daniel Pittman
2006-03-19 0:46 ` Miles Bader
2006-03-19 3:45 ` Daniel Pittman
2006-03-19 18:28 ` Miles Bader
2006-03-19 9:49 ` Sascha Wilde
2006-03-19 17:30 ` Sascha Wilde
2006-03-21 14:32 ` Simon Josefsson
2006-03-21 21:29 ` Reiner Steib
2006-03-22 9:49 ` Simon Josefsson
2006-03-22 8:36 ` Sascha Wilde [this message]
2006-03-22 9:16 ` Daiki Ueno
2006-03-22 9:48 ` Simon Josefsson
2006-03-22 11:03 ` Sascha Wilde
2006-03-22 11:13 ` Simon Josefsson
2006-03-22 12:25 ` Daiki Ueno
2006-03-23 10:40 ` Daiki Ueno
2006-03-23 11:00 ` Simon Josefsson
2006-03-23 12:18 ` Daiki Ueno
2006-03-23 13:08 ` Simon Josefsson
2006-03-24 5:51 ` Daiki Ueno
2006-03-26 0:29 ` Daiki Ueno
2006-03-26 1:08 ` Simon Josefsson
2006-03-26 3:29 ` Miles Bader
2006-03-26 5:06 ` Daiki Ueno
2006-03-26 17:05 ` Simon Josefsson
2006-03-26 18:24 ` Sascha Wilde
2006-03-27 9:36 ` Simon Josefsson
2006-03-23 12:52 ` Sascha Wilde
2006-03-23 20:07 ` Daiki Ueno
2006-03-23 22:16 ` Sascha Wilde
2006-04-05 9:13 ` pgg-gpg broken? Sascha Wilde
2006-04-05 9:42 ` Daiki Ueno
2006-04-05 10:18 ` Sascha Wilde
2006-04-05 21:33 ` Daiki Ueno
2006-04-06 9:00 ` Sascha Wilde
2006-04-06 9:21 ` Daiki Ueno
2006-04-06 9:58 ` Sascha Wilde
2006-04-06 10:13 ` Daiki Ueno
2006-04-07 10:32 ` gpg-agent support removed?! (was: pgg-gpg broken?) Sascha Wilde
2006-04-07 12:11 ` Simon Josefsson
2006-04-07 12:14 ` gpg-agent support removed?! Romain Francoise
2006-04-07 13:00 ` Sascha Wilde
2006-04-07 13:30 ` Simon Josefsson
2006-04-07 20:59 ` Reiner Steib
2006-04-08 9:36 ` Romain Francoise
2006-04-08 10:05 ` Sascha Wilde
2006-04-07 12:35 ` Reiner Steib
2006-04-07 13:02 ` Daiki Ueno
2006-04-07 13:08 ` Sascha Wilde
2006-04-07 13:26 ` Daiki Ueno
2006-04-09 16:04 ` Sascha Wilde
2006-04-10 18:04 ` Reiner Steib
2006-04-07 13:40 ` Reiner Steib
2006-04-07 14:05 ` Thomas Baumann
2006-04-07 14:40 ` Daiki Ueno
2006-04-07 15:45 ` Reiner Steib
2006-04-07 20:55 ` Daiki Ueno
2006-04-07 21:22 ` Reiner Steib
2006-04-08 7:03 ` Thomas Baumann
2006-04-08 10:18 ` Daiki Ueno
2006-04-07 21:36 ` Richard Stallman
2006-04-08 9:45 ` Romain Francoise
2006-04-08 10:11 ` Daiki Ueno
2006-04-08 11:30 ` Romain Francoise
2006-04-08 11:58 ` Daiki Ueno
2006-04-10 18:04 ` PGG maintainance (was: gpg-agent support removed?!) Reiner Steib
2006-04-10 22:40 ` gpg-agent support removed?! Ken Manheimer
2006-04-08 22:34 ` Richard Stallman
2006-04-05 16:14 ` pgg-gpg broken? Reiner Steib
2006-04-05 19:22 ` Sascha Wilde
2006-03-22 9:46 ` Small patch to enable use of gpg-agent with pgg Simon Josefsson
2006-03-22 16:13 ` Simon Josefsson
2006-03-22 23:01 ` Katsumi Yamaoka
2006-03-22 23:45 ` Simon Josefsson
2006-03-23 0:58 ` Katsumi Yamaoka
2006-03-23 9:12 ` Simon Josefsson
2006-03-23 10:26 ` Sascha Wilde
2006-03-23 10:54 ` Simon Josefsson
2006-03-23 11:12 ` Simon Josefsson
2006-03-23 11:16 ` Simon Josefsson
2006-03-23 12:51 ` Reiner Steib
2006-03-23 13:07 ` Sascha Wilde
2006-03-23 13:10 ` Simon Josefsson
2006-03-23 12:00 ` Sascha Wilde
2006-03-23 13:00 ` Simon Josefsson
2006-03-26 18:11 ` Sascha Wilde
[not found] ` <m2wtels74l.fsf@kenny.sha-bang .de>
2006-03-23 23:09 ` Miles Bader
2006-04-02 0:30 ` Ken Manheimer
2006-04-02 8:28 ` Daiki Ueno
2005-12-09 15:43 ` pgg symmetric encryption patch Simon Josefsson
2005-12-09 20:30 ` Stefan Monnier
2005-12-09 20:31 ` Stefan Monnier
2005-12-10 4:13 ` Richard M. Stallman
2005-12-10 10:50 ` Simon Josefsson
2005-12-11 13:32 ` Sascha Wilde
2005-12-11 13:42 ` Simon Josefsson
2005-10-02 17:08 ` new version of allout.el - patch and ChangeLog Richard M. Stallman
[not found] ` <E1ELj0L-0000Pn-3T@fencepost.gnu.org>
2005-10-01 22:33 ` Ken Manheimer
2005-10-20 13:57 ` Ken Manheimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2slpadgf0.fsf@kenny.sha-bang.de \
--to=wilde@sha-bang.de \
--cc=ding@gnus.org \
--cc=emacs-devel@gnu.org \
--cc=ueno@unixuser.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).