Subject: pkg/27034: PGG included with SEMI 1.14.6 doesn't cache GnuPG passphrase
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <carton@Ivy.NET>
List: pkgsrc-bugs
Date: 09/25/2004 16:03:03
>Number:         27034
>Category:       pkg
>Synopsis:       PGG included with SEMI 1.14.6 doesn't cache GnuPG passphrase
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 25 20:36:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Miles Nordin
>Release:        NetBSD 2.0_BETA
>Organization:
Le fascisme est la dictature ouverte de la bourgeoisie.
		-- Georg Dimitrov
>Environment:
	
	
System: NetBSD castrovalva 2.0_BETA NetBSD 2.0_BETA (CASTROVALVA-$Revision: 1.7 $) #0: Tue Sep 14 18:00:24 EDT 2004 carton@castrovalva:/scratch/src/sys/arch/alpha/compile/CASTROVALVA alpha
Architecture: alpha
Machine: alpha
>Description:
When using SEMI PGG for GnuPG <-> T-Gnus integration, PGG won't cache GnuPG 
passphrases.  The problem is with the function to canonify usernames into 
key IDs:

$ gpg --with-colons --no-greeting --batch --list-secret-keys carton@ivy.net    
sec::1024:1:89C205B4DA5BFE1D:1996-04-11::::Miles Nordin <carton@ivy.net>::escESC:
sec::1024:1:F09D755F657F8F51:1993-02-21::::Miles Nordin <carton@ivy.net>::esc:
$ 

The second :-delimited field is empty, meaning it's 'sec::1024' when
PGG expects something more like --list-keys's output of 'pub:u:1024' with 
a non-empty second field.  split-string will ignore separators at the 
beginning of the string when counting fields.  The small patch below fixes 
the problem for me, and should work either way.

I still have major problems decrypting/verifying GnuPG messages with 
T-Gnus, but sending them seems to be basically ok.

>How-To-Repeat:
1. install t-gnus from pkgsrc-wip

2. in .gnus:

(require 'pgg)
(setq pgg-default-scheme 'gpg)
(setq pgg-scheme 'gpg)

(setq pgg-cache-passphrase 't)                                    
(setq pgg-passphrase-cache-expiry 1800)
(setq mime-edit-pgp-user-id "carton@ivy.net")

3. send a signed message.  press C-c C-x s in Gnus's (SEMI's) 
   MIME-Edit mode.  PGG will ask for your GnuPG passphrase.

4. send another message within 1800 seconds.  PGG can't retrieve 
   the cached passphrase.

>Fix:
I tried to contact the SEMI developers, but I can't read Japanese and
couldn't find their email.  Maybe you can pass the patch up to them?

Index: distinfo
===================================================================
RCS file: /scratch/cvsroot/netbsd/pkgsrc/devel/semi/distinfo,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 distinfo
--- distinfo	20 Dec 2003 07:44:01 -0000	1.1.1.3
+++ distinfo	25 Sep 2004 20:00:20 -0000
@@ -1,6 +1,7 @@
 $NetBSD: distinfo,v 1.6 2003/04/13 03:55:52 uebayasi Exp $
 
 SHA1 (semi-1.14.6.tar.gz) = a7ed1b391abf837d3483243456936f51910f9894
 Size (semi-1.14.6.tar.gz) = 142549 bytes
 SHA1 (patch-ab) = 3d22b94d7609ff9bdbae20f583185a4b330b34b9
 SHA1 (patch-ac) = c5e7595bafbdc8c85b34d953626d9c4917aad1d6
+SHA1 (patch-ad) = 29b6cd26cc27ad58ea39713320c2492c57b0f085
Index: patches/patch-ad
===================================================================
RCS file: patches/patch-ad
diff -N patches/patch-ad
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-ad	25 Sep 2004 19:41:39 -0000
@@ -0,0 +1,15 @@
+$NetBSD: $
+
+--- pgg-gpg.el.orig	2004-09-25 15:17:14.000000000 -0400
++++ pgg-gpg.el	2004-09-25 15:41:03.000000000 -0400
+@@ -140,8 +140,8 @@
+       (goto-char (point-min))
+       (if (re-search-forward "^\\(sec\\|pub\\):"  nil t)
+ 	  (substring
+-	   (nth 3 (split-string
+-		   (buffer-substring (match-end 0)
++	   (nth 4 (split-string
++		   (buffer-substring (+ (match-end 0) -4)
+ 				     (progn (end-of-line)(point)))
+ 		   ":")) 8)))))
+ 
>Release-Note:
>Audit-Trail:
>Unformatted: