From 828abe6483d4e95a87cff82b12177c8b2a8fc0cf Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 21 Jul 2003 16:51:59 +0000 Subject: [PATCH] * trustdb.h, trustdb.c (read_trust_options): New. Returns items from the trustdb version record. * keylist.c (public_key_list): Use it here for the new "tru" record. --- g10/ChangeLog | 8 +++++++- g10/keylist.c | 29 +++++++++++++++++++++++++---- g10/trustdb.c | 20 ++++++++++++++++++-- g10/trustdb.h | 2 ++ 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 4760dd138..08c4a92f5 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,11 +1,17 @@ 2003-07-21 David Shaw + * trustdb.h, trustdb.c (read_trust_options): New. Returns items + from the trustdb version record. + + * keylist.c (public_key_list): Use it here for the new "tru" + record. + * sig-check.c (signature_check, signature_check2, check_key_signature, check_key_signature2): Allow passing NULLs for unused parameters in the x2 form of each function to avoid the need for dummy variables. getkey.c, mainproc.c: Change all callers. - + 2003-07-15 David Shaw * keygen.c (do_add_key_flags): Don't set the certify flag for diff --git a/g10/keylist.c b/g10/keylist.c index f102c4b7f..ec19dfd7e 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -57,10 +57,31 @@ static FILE *attrib_fp=NULL; void public_key_list( STRLIST list ) { - if( !list ) - list_all(0); - else - list_one( list, 0 ); + if(opt.with_colons) + { + byte trust_model; + ulong created,nextcheck; + + read_trust_options(&trust_model,&created,&nextcheck); + + printf("tru:"); + + if(nextcheck && nextcheck <= make_timestamp()) + printf("o"); + if(trust_model!=0) + printf("t"); + + /* We don't show marginals, completes, or cert_depth since + they are not accurate in 1.2.x - they are not updated when + the trustdb is rebuilt with different options. */ + + printf(":%d:%lu:%lu\n",trust_model,created,nextcheck); + } + + if( !list ) + list_all(0); + else + list_one( list, 0 ); } void diff --git a/g10/trustdb.c b/g10/trustdb.c index 55cc8d80e..a0e80c739 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -440,7 +440,6 @@ trust_letter (unsigned int value) } } - /**************** * Recreate the WoT but do not ask for new ownertrusts. Special * feature: In batch mode and without a forced yes, this is only done @@ -494,7 +493,24 @@ revalidation_mark (void) pending_check_trustdb = 1; } - +void +read_trust_options(byte *trust_model,ulong *created,ulong *nextcheck) +{ + TRUSTREC opts; + + init_trustdb(); + + read_record(0,&opts,RECTYPE_VER); + + if(trust_model) + *trust_model=opts.r.ver.trust_model; + if(created) + *created=opts.r.ver.created; + if(nextcheck) + *nextcheck=opts.r.ver.nextcheck; +} + + /*********************************************** *********** Ownertrust et al. **************** ***********************************************/ diff --git a/g10/trustdb.h b/g10/trustdb.h index 0210e2aae..9671287b5 100644 --- a/g10/trustdb.h +++ b/g10/trustdb.h @@ -59,6 +59,8 @@ int enum_cert_paths( void **context, ulong *lid, void enum_cert_paths_print( void **context, FILE *fp, int refresh, ulong selected_lid ); +void read_trust_options(byte *trust_model,ulong *created,ulong *nextcheck); + unsigned int get_ownertrust (PKT_public_key *pk); int get_ownertrust_info (PKT_public_key *pk); void update_ownertrust (PKT_public_key *pk, unsigned int new_trust );