[svn] GnuPG - r4778 - in trunk: . doc g10
svn author wk
cvs at cvs.gnupg.org
Wed Jun 11 10:08:00 CEST 2008
Author: wk
Date: 2008-06-11 10:07:54 +0200 (Wed, 11 Jun 2008)
New Revision: 4778
Modified:
trunk/NEWS
trunk/doc/DETAILS
trunk/doc/gpg.texi
trunk/g10/ChangeLog
trunk/g10/gpg.c
trunk/g10/keyid.c
trunk/g10/keylist.c
trunk/g10/options.h
Log:
Made --fixed-list-mode obsolete.
[The diff below has been truncated]
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2008-06-09 14:49:28 UTC (rev 4777)
+++ trunk/g10/ChangeLog 2008-06-11 08:07:54 UTC (rev 4778)
@@ -1,3 +1,13 @@
+2008-06-11 Werner Koch <wk at g10code.com>
+
+ * gpg.c: Make --fixed-list-mode a dummy.
+ * options.h (struct): Removed FIXED_LIST_MODE.
+ * keyid.c (colon_strtime, colon_datestr_from_pk)
+ (colon_datestr_from_sk, colon_datestr_from_sig)
+ (colon_expirestr_from_sig): Remove fixed_list_mode case.
+ * keylist.c (list_keyblock_colon): Ditto. Remove all now unsed
+ code and reindent.
+
2008-05-31 Werner Koch <wk at g10code.com>
* keygen.c (ask_user_id): Change the string printed as header of
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2008-06-09 14:49:28 UTC (rev 4777)
+++ trunk/NEWS 2008-06-11 08:07:54 UTC (rev 4778)
@@ -17,7 +17,9 @@
* gpg-connect-agent accepts commands given as command line arguments.
+ * The gpg2 option --fixed-list-mode is now implicitly used and obsolete.
+
Noteworthy changes in version 2.0.9 (2008-03-26)
------------------------------------------------
Modified: trunk/doc/DETAILS
===================================================================
--- trunk/doc/DETAILS 2008-06-09 14:49:28 UTC (rev 4777)
+++ trunk/doc/DETAILS 2008-06-11 08:07:54 UTC (rev 4778)
@@ -16,9 +16,9 @@
fpr:::::::::AB059359A3B81F410FCFF97F5CE086B5B5A18FF4:
The double --with-fingerprint prints the fingerprint for the subkeys
-too, --fixed-list-mode is themodern listing way printing dates in
+too. --fixed-list-mode is the modern listing way printing dates in
seconds since Epoch and does not merge the first userID with the pub
-record.
+record; gpg2 does this by default and the option is a dummy.
1. Field: Type of record
Modified: trunk/doc/gpg.texi
===================================================================
--- trunk/doc/gpg.texi 2008-06-09 14:49:28 UTC (rev 4777)
+++ trunk/doc/gpg.texi 2008-06-11 08:07:54 UTC (rev 4778)
@@ -1846,6 +1846,10 @@
@opindex fixed-list-mode
Do not merge primary user ID and primary key in @option{--with-colon}
listing mode and print all timestamps as seconds since 1970-01-01.
+ at ifclear gpgone
+Since GnuPG 2.0.10, this mode is always used and thus this option is
+obsolete; it does not harm to use it though.
+ at end ifclear
@item --with-fingerprint
@opindex with-fingerprint
Modified: trunk/g10/gpg.c
===================================================================
--- trunk/g10/gpg.c 2008-06-09 14:49:28 UTC (rev 4777)
+++ trunk/g10/gpg.c 2008-06-11 08:07:54 UTC (rev 4778)
@@ -2734,7 +2734,7 @@
"--keyserver-options ","http-proxy");
break;
case oFastListMode: opt.fast_list_mode = 1; break;
- case oFixedListMode: opt.fixed_list_mode = 1; break;
+ case oFixedListMode: /* Dummy */ break;
case oListOnly: opt.list_only=1; break;
case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break;
case oIgnoreValidFrom: opt.ignore_valid_from = 1; break;
Modified: trunk/g10/keyid.c
===================================================================
--- trunk/g10/keyid.c 2008-06-09 14:49:28 UTC (rev 4777)
+++ trunk/g10/keyid.c 2008-06-11 08:07:54 UTC (rev 4778)
@@ -607,60 +607,51 @@
const char *
colon_strtime (u32 t)
{
- if (!t)
- return "";
- if (opt.fixed_list_mode) {
- static char buf[15];
- sprintf (buf, "%lu", (ulong)t);
- return buf;
- }
- return strtimestamp(t);
+ static char buf[20];
+
+ if (!t)
+ return "";
+ snprintf (buf, sizeof buf, "%lu", (ulong)t);
+ return buf;
}
const char *
colon_datestr_from_pk (PKT_public_key *pk)
{
- if (opt.fixed_list_mode) {
- static char buf[15];
- sprintf (buf, "%lu", (ulong)pk->timestamp);
- return buf;
- }
- return datestr_from_pk (pk);
+ static char buf[20];
+
+ snprintf (buf, sizeof buf, "%lu", (ulong)pk->timestamp);
+ return buf;
}
const char *
colon_datestr_from_sk (PKT_secret_key *sk)
{
- if (opt.fixed_list_mode) {
- static char buf[15];
- sprintf (buf, "%lu", (ulong)sk->timestamp);
- return buf;
- }
- return datestr_from_sk (sk);
+ static char buf[20];
+
+ snprintf (buf, sizeof buf, "%lu", (ulong)sk->timestamp);
+ return buf;
}
const char *
colon_datestr_from_sig (PKT_signature *sig)
{
- if (opt.fixed_list_mode) {
- static char buf[15];
- sprintf (buf, "%lu", (ulong)sig->timestamp);
- return buf;
- }
- return datestr_from_sig (sig);
+ static char buf[20];
+
+ snprintf (buf, sizeof buf, "%lu", (ulong)sig->timestamp);
+ return buf;
}
const char *
colon_expirestr_from_sig (PKT_signature *sig)
{
- if(!sig->expiredate)
- return "";
- if (opt.fixed_list_mode) {
- static char buf[15];
- sprintf (buf, "%lu", (ulong)sig->expiredate);
- return buf;
- }
- return expirestr_from_sig (sig);
+ static char buf[20];
+
+ if (!sig->expiredate)
+ return "";
+
+ snprintf (buf, sizeof buf,"%lu", (ulong)sig->expiredate);
+ return buf;
}
Modified: trunk/g10/keylist.c
===================================================================
--- trunk/g10/keylist.c 2008-06-09 14:49:28 UTC (rev 4777)
+++ trunk/g10/keylist.c 2008-06-11 08:07:54 UTC (rev 4778)
@@ -1,6 +1,6 @@
/* keylist.c - print keys
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
- * 2004, 2005 Free Software Foundation, Inc.
+ * 2004, 2005, 2008 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -1062,367 +1062,324 @@
static void
list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
{
- int rc = 0;
- KBNODE kbctx;
- KBNODE node;
- PKT_public_key *pk;
- PKT_secret_key *sk;
- u32 keyid[2];
- int any=0;
- int trustletter = 0;
- int ulti_hack = 0;
- int i;
+ int rc = 0;
+ KBNODE kbctx;
+ KBNODE node;
+ PKT_public_key *pk;
+ PKT_secret_key *sk;
+ u32 keyid[2];
+ int trustletter = 0;
+ int ulti_hack = 0;
+ int i;
- /* get the keyid from the keyblock */
- node = find_kbnode( keyblock, secret? PKT_SECRET_KEY : PKT_PUBLIC_KEY );
- if( !node ) {
- log_error("Oops; key lost!\n");
- dump_kbnode( keyblock );
- return;
+ /* get the keyid from the keyblock */
+ node = find_kbnode( keyblock, secret? PKT_SECRET_KEY : PKT_PUBLIC_KEY );
+ if ( !node )
+ {
+ log_error("Oops; key lost!\n");
+ dump_kbnode( keyblock );
+ return;
}
- if( secret ) {
- pk = NULL;
- sk = node->pkt->pkt.secret_key;
- keyid_from_sk( sk, keyid );
- printf("sec::%u:%d:%08lX%08lX:%s:%s:::",
- nbits_from_sk( sk ),
- sk->pubkey_algo,
- (ulong)keyid[0],(ulong)keyid[1],
- colon_datestr_from_sk( sk ),
- colon_strtime (sk->expiredate)
- /* fixme: add LID here */ );
+ if ( secret )
+ {
+ pk = NULL;
+ sk = node->pkt->pkt.secret_key;
+ keyid_from_sk ( sk, keyid );
+ printf ("sec::%u:%d:%08lX%08lX:%s:%s:::",
+ nbits_from_sk( sk ),
+ sk->pubkey_algo,
+ (ulong)keyid[0],(ulong)keyid[1],
+ colon_datestr_from_sk( sk ),
+ colon_strtime (sk->expiredate)
+ /* fixme: add LID here */ );
}
- else {
- pk = node->pkt->pkt.public_key;
- sk = NULL;
- keyid_from_pk( pk, keyid );
- fputs( "pub:", stdout );
- if ( !pk->is_valid )
+ else
+ {
+ pk = node->pkt->pkt.public_key;
+ sk = NULL;
+ keyid_from_pk( pk, keyid );
+ fputs( "pub:", stdout );
+ if ( !pk->is_valid )
+ putchar ('i');
+ else if ( pk->is_revoked )
+ putchar ('r');
+ else if ( pk->has_expired )
+ putchar ('e');
+ else if ( opt.fast_list_mode || opt.no_expensive_trust_checks )
+ ;
+ else
+ {
+ trustletter = get_validity_info ( pk, NULL );
+ if ( trustletter == 'u' )
+ ulti_hack = 1;
+ putchar(trustletter);
+ }
+ printf (":%u:%d:%08lX%08lX:%s:%s::",
+ nbits_from_pk( pk ),
+ pk->pubkey_algo,
+ (ulong)keyid[0],(ulong)keyid[1],
+ colon_datestr_from_pk( pk ),
+ colon_strtime (pk->expiredate) );
+ if ( !opt.fast_list_mode && !opt.no_expensive_trust_checks )
+ putchar( get_ownertrust_info(pk) );
+ putchar(':');
+ }
+
+ putchar (':');
+ putchar (':');
+ print_capabilities (pk, sk, keyblock);
+ if (secret)
+ {
+ putchar (':'); /* End of field 13. */
+ putchar (':'); /* End of field 14. */
+ if (sk->protect.s2k.mode == 1001)
+ putchar ('#'); /* Key is just a stub. */
+ else if (sk->protect.s2k.mode == 1002)
+ {
+ /* Key is stored on an external token (card) or handled by
+ the gpg-agent. Print the serial number of that token
+ here. */
+ for (i=0; i < sk->protect.ivlen; i++)
+ printf ("%02X", sk->protect.iv[i]);
+ }
+ putchar (':'); /* End of field 15. */
+ }
+ putchar('\n');
+ if (pk)
+ print_revokers (pk);
+ if (fpr)
+ print_fingerprint (pk, sk, 0);
+ if (opt.with_key_data)
+ print_key_data (pk);
+
+
+ for ( kbctx=NULL; (node=walk_kbnode( keyblock, &kbctx, 0)) ; )
+ {
+ if ( node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode )
+ {
+ char *str;
+ PKT_user_id *uid=node->pkt->pkt.user_id;
+
+ if (attrib_fp && node->pkt->pkt.user_id->attrib_data != NULL)
+ dump_attribs (node->pkt->pkt.user_id,pk,sk);
+ /*
+ * Fixme: We need a is_valid flag here too
+ */
+ str = uid->attrib_data? "uat":"uid";
+ /* If we're listing a secret key, leave out the validity
+ values for now. This is handled better in 1.9. */
+ if (sk)
+ printf ("%s:::::",str);
+ else if ( uid->is_revoked )
+ printf ("%s:r::::",str);
+ else if ( uid->is_expired )
+ printf ("%s:e::::",str);
+ else if ( opt.no_expensive_trust_checks )
+ printf ("%s:::::",str);
+ else
+ {
+ int uid_validity;
+
+ if ( pk && !ulti_hack )
+ uid_validity=get_validity_info (pk, uid);
+ else
+ uid_validity = 'u';
+ printf ("%s:%c::::",str,uid_validity);
+ }
+
+ printf ("%s:", colon_strtime (uid->created));
+ printf ("%s:", colon_strtime (uid->expiredate));
+
+ namehash_from_uid (uid);
+
+ for (i=0; i < 20; i++ )
+ printf ("%02X",uid->namehash[i]);
+
+ printf ("::");
+
+ if (uid->attrib_data)
+ printf ("%u %lu",uid->numattribs,uid->attrib_len);
+ else
+ print_string (stdout,uid->name,uid->len, ':' );
+ putchar (':');
+ putchar ('\n');
+ }
+ else if ( node->pkt->pkttype == PKT_PUBLIC_SUBKEY )
+ {
+ u32 keyid2[2];
+ PKT_public_key *pk2 = node->pkt->pkt.public_key;
+
+ keyid_from_pk ( pk2, keyid2 );
+ fputs ("sub:", stdout );
+ if ( !pk2->is_valid )
putchar ('i');
- else if ( pk->is_revoked )
+ else if ( pk2->is_revoked )
putchar ('r');
- else if ( pk->has_expired )
+ else if ( pk2->has_expired )
putchar ('e');
- else if ( opt.fast_list_mode || opt.no_expensive_trust_checks )
+ else if ( opt.fast_list_mode || opt.no_expensive_trust_checks )
;
- else {
- trustletter = get_validity_info ( pk, NULL );
- if( trustletter == 'u' )
- ulti_hack = 1;
- putchar(trustletter);
+ else
+ {
+ /* TRUSTLETTER should always be defined here. */
+ if (trustletter)
+ printf ("%c", trustletter );
+ }
+ printf(":%u:%d:%08lX%08lX:%s:%s:::::",
+ nbits_from_pk( pk2 ),
+ pk2->pubkey_algo,
+ (ulong)keyid2[0],(ulong)keyid2[1],
+ colon_datestr_from_pk( pk2 ),
+ colon_strtime (pk2->expiredate)
+ /* fixme: add LID and ownertrust here */
+ );
+ print_capabilities (pk2, NULL, NULL);
+ putchar ('\n');
+ if ( fpr > 1 )
+ print_fingerprint ( pk2, NULL, 0 );
+ if ( opt.with_key_data )
+ print_key_data( pk2 );
}
- printf(":%u:%d:%08lX%08lX:%s:%s::",
- nbits_from_pk( pk ),
- pk->pubkey_algo,
- (ulong)keyid[0],(ulong)keyid[1],
- colon_datestr_from_pk( pk ),
- colon_strtime (pk->expiredate) );
- if( !opt.fast_list_mode && !opt.no_expensive_trust_checks )
- putchar( get_ownertrust_info(pk) );
- putchar(':');
- }
+ else if( node->pkt->pkttype == PKT_SECRET_SUBKEY )
+ {
+ u32 keyid2[2];
+ PKT_secret_key *sk2 = node->pkt->pkt.secret_key;
- if (opt.fixed_list_mode) {
- /* do not merge the first uid with the primary key */
- putchar(':');
- putchar(':');
- print_capabilities (pk, sk, keyblock);
- if (secret) {
+ keyid_from_sk ( sk2, keyid2 );
+ printf ("ssb::%u:%d:%08lX%08lX:%s:%s:::::",
+ nbits_from_sk( sk2 ),
+ sk2->pubkey_algo,
+ (ulong)keyid2[0],(ulong)keyid2[1],
+ colon_datestr_from_sk( sk2 ),
+ colon_strtime (sk2->expiredate)
+ /* fixme: add LID */ );
+ print_capabilities (NULL, sk2, NULL);
putchar(':'); /* End of field 13. */
putchar(':'); /* End of field 14. */
- if (sk->protect.s2k.mode == 1001)
- putchar('#'); /* Key is just a stub. */
- else if (sk->protect.s2k.mode == 1002) {
- /* Key is stored on an external token (card) or handled by
- the gpg-agent. Print the serial number of that token
- here. */
- for (i=0; i < sk->protect.ivlen; i++)
- printf ("%02X", sk->protect.iv[i]);
- }
+ if (sk2->protect.s2k.mode == 1001)
+ putchar ('#'); /* Key is just a stub. */
+ else if (sk2->protect.s2k.mode == 1002)
+ {
+ /* Key is stored on an external token (card) or handled by
+ the gpg-agent. Print the serial number of that token
+ here. */
+ for (i=0; i < sk2->protect.ivlen; i++)
+ printf ("%02X", sk2->protect.iv[i]);
+ }
putchar(':'); /* End of field 15. */
+ putchar ('\n');
+
+ if ( fpr > 1 )
+ print_fingerprint ( NULL, sk2, 0 );
}
- putchar('\n');
- if(pk)
- print_revokers(pk);
- if( fpr )
- print_fingerprint( pk, sk, 0 );
- if( opt.with_key_data )
- print_key_data( pk );
- any = 1;
- }
+ else if ( opt.list_sigs && node->pkt->pkttype == PKT_SIGNATURE )
+ {
+ PKT_signature *sig = node->pkt->pkt.signature;
+ int sigrc,fprokay=0;
+ char *sigstr;
+ size_t fplen;
+ byte fparray[MAX_FINGERPRINT_LEN];
+
+ if ( sig->sig_class == 0x20 || sig->sig_class == 0x28
+ || sig->sig_class == 0x30 )
+ sigstr = "rev";
+ else if ( (sig->sig_class&~3) == 0x10 )
+ sigstr = "sig";
+ else if ( sig->sig_class == 0x18 )
+ sigstr = "sig";
+ else if ( sig->sig_class == 0x1F )
+ sigstr = "sig";
+ else
+ {
+ printf ("sig::::::::::%02x%c:\n",
+ sig->sig_class, sig->flags.exportable?'x':'l');
+ continue;
+ }
- for( kbctx=NULL; (node=walk_kbnode( keyblock, &kbctx, 0)) ; ) {
- if( node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode ) {
- PKT_user_id *uid=node->pkt->pkt.user_id;
- if(attrib_fp && node->pkt->pkt.user_id->attrib_data!=NULL)
- dump_attribs(node->pkt->pkt.user_id,pk,sk);
- /*
- * Fixme: We need a is_valid flag here too
- */
- if( any ) {
- char *str=uid->attrib_data?"uat":"uid";
- /* If we're listing a secret key, leave out the
- validity values for now. This is handled better in
- 1.9. */
- if ( sk )
- printf("%s:::::",str);
- else if ( uid->is_revoked )
- printf("%s:r::::",str);
- else if ( uid->is_expired )
- printf("%s:e::::",str);
- else if ( opt.no_expensive_trust_checks )
- printf("%s:::::",str);
More information about the Gnupg-commits
mailing list