Gnus development mailing list
 help / color / mirror / Atom feed
* pgg-passphrase-cache-expiry customization patch
@ 2002-10-30  5:18 Joseph Barillari
  2002-10-30 18:45 ` Simon Josefsson
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Barillari @ 2002-10-30  5:18 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]

Hi.

I've been off the list for a while (actually, I still am, so I'd
really appreciate it if you'd cc: me with any replies). Perhaps I
missed the debate on the issue (though I didn't see it in the
archives): why is pgg-passphrase-cache-expiry hardcoded to 16
and left with no customization option? One could change it with setq
in .gnus, but I assume that you'd rather have a defcustom.

The patch I attached replaces the boolean pgg-cache-passphrase with a
test for the non-zeroness of pgg-passphrase-cache-expiry, and adds a
corresponding defcustom.

Unfortunately, I haven't tested this: I'm running emacs and w3m-el
from Debian unstable and it seems to have broken my build process.  My
apologies for the untested-ness, but the patch is sufficiently trivial
that it should be evident if it works by visual inspection (I'm not an
elisp wizard, but lots of people on this list are).

If anyone's had the build problem, the log is below:

jdb@bigbox:~/dl/gnus-cvs/gnus$ ./configure 
                               <snip>
jdb@bigbox:~/dl/gnus-cvs/gnus$ make
cd lisp && make EMACS="emacs" lispdir="/usr/share/emacs/site-lisp" all
make[1]: Entering directory `/home/jdb/dl/gnus-cvs/gnus/lisp'
rm -f *.elc gnus-load.el
URLDIR=no W3DIR=no lispdir=/usr/share/emacs/site-lisp srcdir=. emacs -batch -q -no-site-file -l ./dgnushack.el -f dgnushack-make-cus-load .
Loading cus-dep...
Directory .
Generating cus-load.el...
Wrong type argument: stringp, (mm-inline-text-html-with-w3m-keymap custom-variable)
make[1]: *** [gnus-load.el] Error 255
make[1]: Leaving directory `/home/jdb/dl/gnus-cvs/gnus/lisp'
make: *** [lick] Error 2

Patch is attached.

Cheers,

--Joe



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.1: pgg-expiry-patch.patch --]
[-- Type: text/x-patch, Size: 2625 bytes --]

diff -ru gnus/lisp/pgg-def.el mygnus/lisp/pgg-def.el
--- gnus/lisp/pgg-def.el	2002-10-30 00:06:05.000000000 -0500
+++ mygnus/lisp/pgg-def.el	2002-10-30 00:05:09.000000000 -0500
@@ -58,10 +58,10 @@
   :group 'pgg
   :type 'boolean)
 
-(defcustom pgg-cache-passphrase t
-  "If t, cache passphrase."
+(defcustom pgg-passphrase-cache-expiry 60
+  "If nonzero, cache passphrase for this many seconds."
   :group 'pgg
-  :type 'boolean)
+  :type 'integer)
 
 (defvar pgg-messages-coding-system nil
   "Coding system used when reading from a PGP external process.")
diff -ru gnus/lisp/pgg-gpg.el mygnus/lisp/pgg-gpg.el
--- gnus/lisp/pgg-gpg.el	2002-10-30 00:06:05.000000000 -0500
+++ mygnus/lisp/pgg-gpg.el	2002-10-30 00:05:09.000000000 -0500
@@ -98,7 +98,7 @@
       (set-default-file-modes orig-mode))))
 
 (defun pgg-gpg-possibly-cache-passphrase (passphrase)
-  (if (and pgg-cache-passphrase
+  (if (and  (not (eq pgg-passphrase-cache-expiry 0))
 	   (progn
 	     (goto-char (point-min))
 	     (re-search-forward "^\\[GNUPG:] GOOD_PASSPHRASE\\>" nil t)))
diff -ru gnus/lisp/pgg-pgp.el mygnus/lisp/pgg-pgp.el
--- gnus/lisp/pgg-pgp.el	2002-10-30 00:06:06.000000000 -0500
+++ mygnus/lisp/pgg-pgp.el	2002-10-30 00:05:09.000000000 -0500
@@ -177,7 +177,7 @@
 			     (progn (beginning-of-line 2)
 				    (point))
 			     (point-max))))))
-	  (if pgg-cache-passphrase
+	  (if  (not (eq pgg-passphrase-cache-expiry 0))
 	      (pgg-add-passphrase-cache
 	       (cdr (assq 'key-identifier packet))
 	       passphrase)))))))
diff -ru gnus/lisp/pgg-pgp5.el mygnus/lisp/pgg-pgp5.el
--- gnus/lisp/pgg-pgp5.el	2002-10-30 00:06:06.000000000 -0500
+++ mygnus/lisp/pgg-pgp5.el	2002-10-30 00:05:09.000000000 -0500
@@ -189,7 +189,7 @@
 			     (progn (beginning-of-line 2)
 				    (point))
 			     (point-max))))))
-	  (if pgg-cache-passphrase
+	  (if (not (eq pgg-passphrase-cache-expiry 0))
 	      (pgg-add-passphrase-cache
 	       (cdr (assq 'key-identifier packet))
 	       passphrase)))))))
diff -ru gnus/lisp/pgg.el mygnus/lisp/pgg.el
--- gnus/lisp/pgg.el	2002-10-30 00:06:06.000000000 -0500
+++ mygnus/lisp/pgg.el	2002-10-30 00:05:09.000000000 -0500
@@ -99,7 +99,7 @@
 	    (setq pgg-read-passphrase 'read-passwd)
 	  (autoload 'ange-ftp-read-passwd "ange-ftp")
 	  (setq pgg-read-passphrase 'ange-ftp-read-passwd))))
-  (or (and pgg-cache-passphrase
+  (or (and (not (eq pgg-passphrase-cache-expiry 0))
 	   key (setq key (pgg-truncate-key-identifier key))
 	   (symbol-value (intern-soft key pgg-passphrase-cache)))
       (funcall pgg-read-passphrase prompt)))

[-- Attachment #2.2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pgg-passphrase-cache-expiry customization patch
  2002-10-30  5:18 pgg-passphrase-cache-expiry customization patch Joseph Barillari
@ 2002-10-30 18:45 ` Simon Josefsson
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Josefsson @ 2002-10-30 18:45 UTC (permalink / raw)
  Cc: ding

Joseph Barillari <jbarilla@princeton.edu> writes:

> Hi.
>
> I've been off the list for a while (actually, I still am, so I'd
> really appreciate it if you'd cc: me with any replies). Perhaps I
> missed the debate on the issue (though I didn't see it in the
> archives): why is pgg-passphrase-cache-expiry hardcoded to 16
> and left with no customization option? One could change it with setq
> in .gnus, but I assume that you'd rather have a defcustom.

Yup.

> The patch I attached replaces the boolean pgg-cache-passphrase with a
> test for the non-zeroness of pgg-passphrase-cache-expiry, and adds a
> corresponding defcustom.

IMHO it is better to keep the current variable names, if for no other
reason that people might have already started using them.  I committed
the patch below, please holler if you don't like it.

--- pgg.el.~6.8.~	2002-10-24 17:24:30.000000000 +0200
+++ pgg.el	2002-10-30 19:40:41.000000000 +0100
@@ -87,7 +87,6 @@
 	(set-buffer standard-output)
 	(insert-buffer-substring pgg-errors-buffer)))))
 
-(defvar pgg-passphrase-cache-expiry 16)
 (defvar pgg-passphrase-cache (make-vector 7 0))
 
 (defvar pgg-read-passphrase nil)
--- pgg-def.el.~6.2.~	2002-10-11 01:35:47.000000000 +0200
+++ pgg-def.el	2002-10-30 19:40:28.000000000 +0100
@@ -63,6 +63,13 @@
   :group 'pgg
   :type 'boolean)
 
+(defcustom pgg-passphrase-cache-expiry 16
+  "How many seconds the passphrase is cached.
+Whether the passphrase is cached at all is controlled by
+`pgg-cache-passphrase'."
+  :group 'pgg
+  :type 'integer)
+
 (defvar pgg-messages-coding-system nil
   "Coding system used when reading from a PGP external process.")
 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-10-30 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-30  5:18 pgg-passphrase-cache-expiry customization patch Joseph Barillari
2002-10-30 18:45 ` Simon Josefsson

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 NNTP newsgroup(s).