[git] GnuPG - branch, STABLE-BRANCH-2-0, updated. gnupg-2.0.22-22-gce98935

by Werner Koch cvs at cvs.gnupg.org
Mon Jun 2 17:36:17 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, STABLE-BRANCH-2-0 has been updated
       via  ce989354fb7813022139838c26684a8db6d79ccf (commit)
      from  684b0bd4bfb846d03a531385e2d1251391dee1f5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ce989354fb7813022139838c26684a8db6d79ccf
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Jun 2 17:33:18 2014 +0200

    gpg: Simplify default key listing.
    
    * g10/mainproc.c (list_node): Rework.
    --
    
    The old code still merged the first user id into the key packet line
    which resulted in all kind of complexity.  --fixed-list-mode is
    meanwhile the default and thus we also change this part of the code.
    
    GnuPG-bug-id: 1640

diff --git a/g10/mainproc.c b/g10/mainproc.c
index d399455..551ab58 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -917,7 +917,6 @@ print_userid( PACKET *pkt )
 static void
 list_node( CTX c, KBNODE node )
 {
-    int any=0;
     int mainkey;
 
     if( !node )
@@ -945,47 +944,55 @@ list_node( CTX c, KBNODE node )
 	    if( mainkey && !opt.fast_list_mode )
 	      putchar( get_ownertrust_info (pk) );
 	    putchar(':');
-	    if( node->next && node->next->pkt->pkttype == PKT_RING_TRUST) {
-	      putchar('\n'); any=1;
-	      if( opt.fingerprint )
-		print_fingerprint( pk, NULL, 0 );
-	      printf("rtv:1:%u:\n",
-		     node->next->pkt->pkt.ring_trust->trustval );
-	    }
-	  }
+          }
 	else
-	  printf("%s  %4u%c/%s %s%s",
-		 mainkey? "pub":"sub", nbits_from_pk( pk ),
-		 pubkey_letter( pk->pubkey_algo ), keystr_from_pk( pk ),
-		 datestr_from_pk( pk ), mainkey?" ":"");
+          {
+            printf("%s  %4u%c/%s %s",
+                   mainkey? "pub":"sub", nbits_from_pk( pk ),
+                   pubkey_letter( pk->pubkey_algo ), keystr_from_pk( pk ),
+                   datestr_from_pk (pk));
+          }
+
+        if (pk->is_revoked)
+          {
+            printf(" [");
+            printf(_("revoked: %s"),revokestr_from_pk(pk));
+            printf("]\n");
+          }
+        else if (pk->expiredate && !opt.with_colons)
+          {
+            printf(" [");
+            printf(_("expires: %s"),expirestr_from_pk(pk));
+            printf("]\n");
+          }
+        else
+          putchar ('\n');
+
+        if ((mainkey && opt.fingerprint) || opt.fingerprint > 1)
+          print_fingerprint (pk, NULL, 0);
+
+	if (opt.with_colons)
+	  {
+	    if (node->next && node->next->pkt->pkttype == PKT_RING_TRUST)
+	      printf("rtv:1:%u:\n", node->next->pkt->pkt.ring_trust->trustval);
+	  }
 
 	if( mainkey ) {
 	    /* and now list all userids with their signatures */
 	    for( node = node->next; node; node = node->next ) {
 		if( node->pkt->pkttype == PKT_SIGNATURE ) {
-		    if( !any ) {
-			if( node->pkt->pkt.signature->sig_class == 0x20 )
-			    puts("[revoked]");
-			else
-			    putchar('\n');
-			any = 1;
-		    }
 		    list_node(c,  node );
 		}
 		else if( node->pkt->pkttype == PKT_USER_ID ) {
-		    if( any ) {
-			if( opt.with_colons )
-			    printf("%s:::::::::",
-			      node->pkt->pkt.user_id->attrib_data?"uat":"uid");
-			else
-			    printf( "uid%*s", 28, "" );
-		    }
+                    if( opt.with_colons )
+                      printf("%s:::::::::",
+                             node->pkt->pkt.user_id->attrib_data?"uat":"uid");
+                    else
+                      printf( "uid%*s", 28, "" );
 		    print_userid( node->pkt );
 		    if( opt.with_colons )
 			putchar(':');
 		    putchar('\n');
-		    if( opt.fingerprint && !any )
-			print_fingerprint( pk, NULL, 0 );
 		    if( opt.with_colons
                         && node->next
 			&& node->next->pkt->pkttype == PKT_RING_TRUST ) {
@@ -993,38 +1000,12 @@ list_node( CTX c, KBNODE node )
                                node->next->pkt->pkt.ring_trust?
                                node->next->pkt->pkt.ring_trust->trustval : 0);
 		    }
-		    any=1;
 		}
 		else if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) {
-		    if( !any ) {
-			putchar('\n');
-			any = 1;
-		    }
-		    list_node(c,  node );
+                  list_node(c,  node );
 		}
 	    }
 	}
-	else
-	  {
-	    /* of subkey */
-	    if( pk->is_revoked )
-	      {
-		printf(" [");
-		printf(_("revoked: %s"),revokestr_from_pk(pk));
-		printf("]");
-	      }
-	    else if( pk->expiredate )
-	      {
-		printf(" [");
-		printf(_("expires: %s"),expirestr_from_pk(pk));
-		printf("]");
-	      }
-	  }
-
-	if( !any )
-	    putchar('\n');
-	if( !mainkey && opt.fingerprint > 1 )
-	    print_fingerprint( pk, NULL, 0 );
     }
     else if( (mainkey = (node->pkt->pkttype == PKT_SECRET_KEY) )
 	     || node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
@@ -1040,55 +1021,39 @@ list_node( CTX c, KBNODE node )
 		   sk->pubkey_algo,
 		   (ulong)keyid[0],(ulong)keyid[1],
 		   colon_datestr_from_sk( sk ),
-		   colon_strtime (sk->expiredate)
-		   /* fixme: add LID */ );
+		   colon_strtime (sk->expiredate));
 	  }
 	else
 	  printf("%s  %4u%c/%s %s ", mainkey? "sec":"ssb",
 		 nbits_from_sk( sk ), pubkey_letter( sk->pubkey_algo ),
 		 keystr_from_sk( sk ), datestr_from_sk( sk ));
+
+        putchar ('\n');
+        if ((mainkey && opt.fingerprint) || opt.fingerprint > 1)
+          print_fingerprint (NULL, sk,0);
+
 	if( mainkey ) {
 	    /* and now list all userids with their signatures */
 	    for( node = node->next; node; node = node->next ) {
 		if( node->pkt->pkttype == PKT_SIGNATURE ) {
-		    if( !any ) {
-			if( node->pkt->pkt.signature->sig_class == 0x20 )
-			    puts("[revoked]");
-			else
-			    putchar('\n');
-			any = 1;
-		    }
 		    list_node(c,  node );
 		}
 		else if( node->pkt->pkttype == PKT_USER_ID ) {
-		    if( any ) {
-			if( opt.with_colons )
-			    printf("%s:::::::::",
-			      node->pkt->pkt.user_id->attrib_data?"uat":"uid");
-			else
-			    printf( "uid%*s", 28, "" );
-		    }
+                    if( opt.with_colons )
+		        printf("%s:::::::::",
+                               node->pkt->pkt.user_id->attrib_data?"uat":"uid");
+                    else
+                        printf( "uid%*s", 28, "" );
 		    print_userid( node->pkt );
 		    if( opt.with_colons )
 			putchar(':');
 		    putchar('\n');
-		    if( opt.fingerprint && !any )
-			print_fingerprint( NULL, sk, 0 );
-		    any=1;
 		}
 		else if( node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
-		    if( !any ) {
-			putchar('\n');
-			any = 1;
-		    }
-		    list_node(c,  node );
+                  list_node(c,  node );
 		}
 	    }
 	}
-	if( !any )
-	    putchar('\n');
-	if( !mainkey && opt.fingerprint > 1 )
-	    print_fingerprint( NULL, sk, 0 );
     }
     else if( node->pkt->pkttype == PKT_SIGNATURE  ) {
 	PKT_signature *sig = node->pkt->pkt.signature;

-----------------------------------------------------------------------

Summary of changes:
 g10/mainproc.c |  133 +++++++++++++++++++++-----------------------------------
 1 file changed, 49 insertions(+), 84 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list