From 9f6fa94486134b211a37c62bbe115587dd689b67 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Sun, 27 Apr 2003 20:22:09 +0000 Subject: [PATCH] * g10.c (main): Add --no-textmode. * export.c (do_export_stream), keyedit.c (show_key_with_all_names, menu_addrevoker), mainproc.c (check_sig_and_print), photoid.c (show_photos), sign.c (mk_notation_and_policy), trustdb.c (get_validity, reset_trust_records, validate_keys): Make some strings translatable. * mainproc.c (check_sig_and_print): Show digest algorithm and sig class when verifying a sig with --verbose on, and add version, pk and hash algorithms and sig class to VALIDSIG. * parse-packet.c (enum_sig_subpkt): Make a warning message a --verbose warning message since we don't need to warn every time we see an unknown critical (we only need to invalidate the signature). * trustdb.c (init_trustdb): Check the trustdb options even with TM_AUTO since the auto may become TM_CLASSIC or TM_OPENPGP. --- g10/ChangeLog | 22 ++++++++++++++++++++++ g10/export.c | 4 ++-- g10/g10.c | 3 +++ g10/keyedit.c | 18 +++++++++--------- g10/mainproc.c | 24 ++++++++++++++++++------ g10/parse-packet.c | 12 +++++++----- g10/photoid.c | 2 +- g10/trustdb.c | 14 ++++++++------ 8 files changed, 70 insertions(+), 29 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 246fa7729..d80849f07 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,25 @@ +2003-04-27 David Shaw + + * g10.c (main): Add --no-textmode. + + * export.c (do_export_stream), keyedit.c (show_key_with_all_names, + menu_addrevoker), mainproc.c (check_sig_and_print), photoid.c + (show_photos), sign.c (mk_notation_and_policy), trustdb.c + (get_validity, reset_trust_records, validate_keys): Make some + strings translatable. + + * mainproc.c (check_sig_and_print): Show digest algorithm and sig + class when verifying a sig with --verbose on, and add version, pk + and hash algorithms and sig class to VALIDSIG. + + * parse-packet.c (enum_sig_subpkt): Make a warning message a + --verbose warning message since we don't need to warn every time + we see an unknown critical (we only need to invalidate the + signature). + + * trustdb.c (init_trustdb): Check the trustdb options even with + TM_AUTO since the auto may become TM_CLASSIC or TM_OPENPGP. + 2003-04-26 David Shaw * sign.c (do_sign): Show the hash used when making a signature in diff --git a/g10/export.c b/g10/export.c index b1bec1f1c..3a9a324d7 100644 --- a/g10/export.c +++ b/g10/export.c @@ -396,8 +396,8 @@ do_export_stream( IOBUF out, STRLIST users, int secret, node->pkt->pkt.secret_key->protect.sha1chk) { /* I hope this warning doesn't confuse people. */ - log_info("WARNING: secret key %08lX does not have a " - "simple SK checksum\n",(ulong)sk_keyid[1]); + log_info(_("WARNING: secret key %08lX does not have a " + "simple SK checksum\n"),(ulong)sk_keyid[1]); sha1_warned=1; } diff --git a/g10/g10.c b/g10/g10.c index bd8fc2252..ffad7698e 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -130,6 +130,7 @@ enum cmd_and_opt_values { aNull = 0, aRefreshKeys, oTextmode, + oNoTextmode, oExpert, oNoExpert, oAskSigExpire, @@ -400,6 +401,7 @@ static ARGPARSE_OPTS opts[] = { { oCompress, NULL, 1, N_("|N|set compress level N (0 disables)") }, { oTextmodeShort, NULL, 0, "@"}, { oTextmode, "textmode", 0, N_("use canonical text mode")}, + { oNoTextmode, "no-textmode", 0, "@"}, { oExpert, "expert", 0, "@"}, { oNoExpert, "no-expert", 0, "@"}, { oAskSigExpire, "ask-sig-expire", 0, "@"}, @@ -1626,6 +1628,7 @@ main( int argc, char **argv ) break; case oTextmodeShort: opt.textmode = 2; break; case oTextmode: opt.textmode=1; break; + case oNoTextmode: opt.textmode=0; break; case oExpert: opt.expert = 1; break; case oNoExpert: opt.expert = 0; break; case oAskSigExpire: opt.ask_sig_expire = 1; break; diff --git a/g10/keyedit.c b/g10/keyedit.c index ce1d7ddf1..0324b4070 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -2073,9 +2073,9 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, else tty_printf("(%d) ", i); if ( uid->is_revoked ) - tty_printf ("[revoked] "); + tty_printf (_("[revoked] ")); if ( uid->is_expired ) - tty_printf ("[expired] "); + tty_printf (_("[expired] ")); tty_print_utf8_string( uid->name, uid->len ); tty_printf("\n"); if( with_prefs ) @@ -2485,9 +2485,9 @@ menu_delkey( KBNODE pub_keyblock, KBNODE sec_keyblock ) if( sec_keyblock ) commit_kbnode( &sec_keyblock ); - /* No need to set update_trust here since signing keys no longer - are used to certify other keys, so there is no change in trust - when revoking/removing them */ + /* No need to set update_trust here since signing keys are no + longer used to certify other keys, so there is no change in + trust when revoking/removing them */ } @@ -2636,14 +2636,14 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive ) print_fingerprint(revoker_pk,NULL,2); tty_printf("\n"); - tty_printf("WARNING: appointing a key as a designated revoker " - "cannot be undone!\n"); + tty_printf(_("WARNING: appointing a key as a designated revoker " + "cannot be undone!\n")); tty_printf("\n"); if(!cpr_get_answer_is_yes("keyedit.add_revoker.okay", - "Are you sure you want to appoint this " - "key as a designated revoker? (y/N): ")) + _("Are you sure you want to appoint this " + "key as a designated revoker? (y/N): "))) continue; free_public_key(revoker_pk); diff --git a/g10/mainproc.c b/g10/mainproc.c index 1911d0076..d2acdeadf 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1452,7 +1452,7 @@ check_sig_and_print( CTX c, KBNODE node ) if( !get_pubkey( pk, sig->keyid ) ) { byte array[MAX_FINGERPRINT_LEN], *p; - char buf[MAX_FINGERPRINT_LEN*4+73], *bufp; + char buf[MAX_FINGERPRINT_LEN*4+90], *bufp; size_t i, n; bufp = buf; @@ -1460,10 +1460,15 @@ check_sig_and_print( CTX c, KBNODE node ) p = array; for(i=0; i < n ; i++, p++, bufp += 2) sprintf(bufp, "%02X", *p ); - sprintf(bufp, " %s %lu %lu ", + /* TODO: Replace the reserved '0' in the field below + with bits for status flags (policy url, notation, + etc.). Remember to make the buffer larger to + match! */ + sprintf(bufp, " %s %lu %lu %d 0 %d %d %02X ", strtimestamp( sig->timestamp ), - (ulong)sig->timestamp, - (ulong)sig->expiredate ); + (ulong)sig->timestamp,(ulong)sig->expiredate, + sig->version,sig->pubkey_algo,sig->digest_algo, + sig->sig_class); bufp = bufp + strlen (bufp); if (!pk->is_primary) { u32 akid[2]; @@ -1493,11 +1498,18 @@ check_sig_and_print( CTX c, KBNODE node ) if(sig->flags.expired) { - log_info("Signature expired %s\n",asctimestamp(sig->expiredate)); + log_info(_("Signature expired %s\n"), + asctimestamp(sig->expiredate)); rc=G10ERR_GENERAL; /* need a better error here? */ } else if(sig->expiredate) - log_info("Signature expires %s\n",asctimestamp(sig->expiredate)); + log_info(_("Signature expires %s\n"),asctimestamp(sig->expiredate)); + + if(opt.verbose) + log_info(_("%s signature, digest algorithm %s\n"), + sig->sig_class==0x00?_("binary"): + sig->sig_class==0x01?_("textmode"):_("unknown"), + digest_algo_to_string(sig->digest_algo)); if( rc ) g10_errors_seen = 1; diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 7e390ae55..7b502067a 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1070,13 +1070,15 @@ enum_sig_subpkt( const subpktarea_t *pktbuf, sigsubpkttype_t reqtype, if( *critical ) { if( n-1 > buflen+1 ) goto too_short; - if( !can_handle_critical(buffer+1, n-1, type ) ) { - log_info(_("subpacket of type %d has critical bit set\n"), - type); + if( !can_handle_critical(buffer+1, n-1, type ) ) + { + if(opt.verbose) + log_info(_("subpacket of type %d has " + "critical bit set\n"),type); if( start ) - *start = seq; + *start = seq; return NULL; /* this is an error */ - } + } } } else if( reqtype < 0 ) /* list packets */ diff --git a/g10/photoid.c b/g10/photoid.c index 7f6b8be7c..b311bfa09 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -328,6 +328,6 @@ void show_photos(const struct user_attribute *attrs, return; fail: - log_error("unable to display photo ID!\n"); + log_error(_("unable to display photo ID!\n")); #endif } diff --git a/g10/trustdb.c b/g10/trustdb.c index 2a4751e1e..c97687653 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -440,8 +440,9 @@ init_trustdb() { /* Try and set the trust model off of whatever the trustdb says it is. */ - opt.trust_model=tdbio_read_model(); + + /* Sanity check this ;) */ if(opt.trust_model!=TM_CLASSIC && opt.trust_model!=TM_OPENPGP) { log_info(_("unable to use unknown trust model (%d) - " @@ -452,8 +453,9 @@ init_trustdb() if(opt.verbose) log_info(_("using %s trust model\n"),trust_model_string()); } - else if(!tdbio_db_matches_options() - && (opt.trust_model==TM_CLASSIC || opt.trust_model==TM_OPENPGP)) + + if((opt.trust_model==TM_CLASSIC || opt.trust_model==TM_OPENPGP) + && !tdbio_db_matches_options()) pending_check_trustdb=1; } @@ -997,7 +999,7 @@ get_validity (PKT_public_key *pk, PKT_user_id *uid) if (opt.no_auto_check_trustdb) { pending_check_trustdb = 1; - log_info ("please do a --check-trustdb\n"); + log_info (_("please do a --check-trustdb\n")); } else { @@ -1808,7 +1810,7 @@ reset_trust_records (KEYDB_HANDLE hd, KeyHashTable exclude) log_error ("keydb_search_next failed: %s\n", g10_errstr(rc)); } if (opt.verbose) - log_info ("%d keys processed (%d validity counts cleared)\n", + log_info (_("%d keys processed (%d validity counts cleared)\n"), count, nreset); } @@ -1862,7 +1864,7 @@ validate_keys (int interactive) * here when needed */ if (!utk_list) { - log_info ("no ultimately trusted keys found\n"); + log_info (_("no ultimately trusted keys found\n")); goto leave; }