[Pgp-tools-commit] r880 - in trunk: debian gpg-key2ps

Guilhem Moulin guilhem-guest at moszumanska.debian.org
Sat Sep 17 19:58:58 UTC 2016


Author: guilhem-guest
Date: 2016-09-17 19:58:58 +0000 (Sat, 17 Sep 2016)
New Revision: 880

Modified:
   trunk/debian/changelog
   trunk/gpg-key2ps/gpg-key2ps
Log:
gpg-key2ps: Ensure subkeys are hiden unless '--show-subkeys' is set.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2016-09-17 19:58:47 UTC (rev 879)
+++ trunk/debian/changelog	2016-09-17 19:58:58 UTC (rev 880)
@@ -11,6 +11,9 @@
   * gpg-key2ps:
     + Fix revoked UID stroke slant with "-r strike".  Thanks to Grégoire
       Détrez for the patch.
+    + Ensure subkeys are hiden unless '--show-subkeys' is set.  (As of GnuPG
+      2.1.15-3, `gpg --with-colons --list-keys` lists subkeys by defaults.)
+      Thanks to Grégoire Détrez for the patch.
 
  -- Guilhem Moulin <guilhem at guilhem.org>  Fri, 26 Aug 2016 15:11:09 +0200
 

Modified: trunk/gpg-key2ps/gpg-key2ps
===================================================================
--- trunk/gpg-key2ps/gpg-key2ps	2016-09-17 19:58:47 UTC (rev 879)
+++ trunk/gpg-key2ps/gpg-key2ps	2016-09-17 19:58:58 UTC (rev 880)
@@ -244,6 +244,7 @@
 # $numlines has the total number of lines so we'll know how many to put on page
 my $numlines = 0;
 my $started = 0;
+my $subkey = 0; # indicates whether the current key is a subkey
 while(<GPG>) {
 	# we don't use these
 	if ( /^(tru|uat):/ ) { next; }
@@ -251,12 +252,14 @@
 	if ( /^pub:/ ) {
 		start_postscript() unless $started;
 		$started = 1;
+        $subkey = 0;
 		$numlines++;
 	}
 	# primary uid
 	s/^pub:[^:]*:([^:]*):([0-9]*):.{8,8}(.{8,8}):([^:]*):[^:]*:[^:]*:[^:]*:([^:]*):[^:]*:[^:]*:.*/	($5) ($4) ($3) $2 ($1) pub/;
 	# fingerprint, format it nicely with spaces
 	if ( /^fpr:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:([^:]*):.*/ ) {
+        next if $subkey;
 		my $fpr = $1;
 		# v4 key
 		$fpr =~ s/(\w{4})(\w{4})(\w{4})(\w{4})(\w{4})(\w{4})(\w{4})(\w{4})(\w{4})(\w{4})/$1 $2 $3 $4 $5  $6 $7 $8 $9 $10/;
@@ -273,6 +276,7 @@
 		next if $revokestyle eq "hide";
 	}
 	# subkey
+    $subkey = 1 if /^sub:/;
 	if (s/^sub:[^r:]*:([^:]*):([0-9]*):.{8,8}(.{8,8}):([^:]*):[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:.*/	($4) ($3) $2 ($1) sbk/) {
 		next if ! $showsubkeys;
 	}




More information about the Pgp-tools-commit mailing list