From 9d4327ba4dc26fb33531ffecf07f673ba65d0637 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 23 Aug 2004 17:55:49 +0000 Subject: [PATCH] * keydb.h, getkey.c (get_user_id_printable): Rename to get_user_id_native and remove the printable stuff since we're print-ifying valid utf8 characters. Change all callers in import.c, sign.c, keylist.c, and encode.c. --- g10/ChangeLog | 5 +++++ g10/encode.c | 2 +- g10/getkey.c | 28 ++++++++++++---------------- g10/import.c | 12 ++++++------ g10/keydb.h | 6 +++--- g10/keylist.c | 6 +++--- g10/sign.c | 2 +- 7 files changed, 31 insertions(+), 30 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index b8ea1c7da..5e9c72f17 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,10 @@ 2004-08-23 David Shaw + * keydb.h, getkey.c (get_user_id_printable): Rename to + get_user_id_native and remove the printable stuff since we're + print-ifying valid utf8 characters. Change all callers in + import.c, sign.c, keylist.c, and encode.c. + * keyserver.c (keyserver_search_prompt): Make sure the search string is converted from UTF-8 before display. diff --git a/g10/encode.c b/g10/encode.c index 67b7ace52..84e1de0cc 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -814,7 +814,7 @@ write_pubkey_enc_from_list( PK_LIST pk_list, DEK *dek, IOBUF out ) log_error("pubkey_encrypt failed: %s\n", g10_errstr(rc) ); else { if( opt.verbose ) { - char *ustr = get_user_id_string_printable (enc->keyid); + char *ustr = get_user_id_string_native (enc->keyid); log_info(_("%s/%s encrypted for: \"%s\"\n"), pubkey_algo_to_string(enc->pubkey_algo), cipher_algo_to_string(dek->algo), ustr ); diff --git a/g10/getkey.c b/g10/getkey.c index b6c08a5f6..3002e1e9b 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1,5 +1,5 @@ /* getkey.c - Get a key from the database - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, * 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. @@ -2632,14 +2632,12 @@ get_user_id_string( u32 *keyid ) char* -get_user_id_string_printable ( u32 *keyid ) +get_user_id_string_native ( u32 *keyid ) { - char *p = get_user_id_string( keyid ); - char *p2 = utf8_to_native( p, strlen(p), 0 ); - m_free(p); - p = make_printable_string (p2, strlen (p2), 0); - m_free (p2); - return p; + char *p = get_user_id_string( keyid ); + char *p2 = utf8_to_native( p, strlen(p), 0 ); + m_free(p); + return p2; } @@ -2696,15 +2694,13 @@ get_user_id( u32 *keyid, size_t *rn ) } char* -get_user_id_printable( u32 *keyid ) +get_user_id_native( u32 *keyid ) { - size_t rn; - char *p = get_user_id( keyid, &rn ); - char *p2 = utf8_to_native( p, rn, 0 ); - m_free(p); - p = make_printable_string (p2, strlen (p2), 0); - m_free (p2); - return p; + size_t rn; + char *p = get_user_id( keyid, &rn ); + char *p2 = utf8_to_native( p, rn, 0 ); + m_free(p); + return p2; } KEYDB_HANDLE diff --git a/g10/import.c b/g10/import.c index 40ab7f296..a718e91d1 100644 --- a/g10/import.c +++ b/g10/import.c @@ -1,5 +1,5 @@ /* import.c - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, * 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. @@ -781,7 +781,7 @@ import_one( const char *fname, KBNODE keyblock, /* we are ready */ if( !opt.quiet ) { - char *p=get_user_id_printable (keyid); + char *p=get_user_id_native (keyid); log_info( _("key %s: public key \"%s\" imported\n"), keystr(keyid),p); m_free(p); @@ -861,7 +861,7 @@ import_one( const char *fname, KBNODE keyblock, /* we are ready */ if( !opt.quiet ) { - char *p=get_user_id_printable(keyid); + char *p=get_user_id_native(keyid); if( n_uids == 1 ) log_info( _("key %s: \"%s\" 1 new user ID\n"), keystr(keyid),p); @@ -898,7 +898,7 @@ import_one( const char *fname, KBNODE keyblock, if( !opt.quiet ) { - char *p=get_user_id_printable(keyid); + char *p=get_user_id_native(keyid); log_info( _("key %s: \"%s\" not changed\n"),keystr(keyid),p); m_free(p); } @@ -1215,7 +1215,7 @@ import_revoke_cert( const char *fname, KBNODE node, struct stats_s *stats ) /* we are ready */ if( !opt.quiet ) { - char *p=get_user_id_printable (keyid); + char *p=get_user_id_native (keyid); log_info( _("key %s: \"%s\" revocation certificate imported\n"), keystr(keyid),p); m_free(p); @@ -1766,7 +1766,7 @@ merge_blocks( const char *fname, KBNODE keyblock_orig, KBNODE keyblock, ++*n_sigs; if(!opt.quiet) { - char *p=get_user_id_printable (keyid); + char *p=get_user_id_native (keyid); log_info(_("key %s: \"%s\" revocation" " certificate added\n"), keystr(keyid),p); m_free(p); diff --git a/g10/keydb.h b/g10/keydb.h index ab1056682..c28ed5f52 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -1,5 +1,5 @@ /* keydb.h - Key database - * Copyright (C) 1998, 1999, 2000, 2001, 2003, + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, * 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. @@ -230,10 +230,10 @@ int enum_secret_keys( void **context, PKT_secret_key *sk, int with_subkeys, int with_spm ); void merge_keys_and_selfsig( KBNODE keyblock ); char*get_user_id_string( u32 *keyid ); -char*get_user_id_string_printable( u32 *keyid ); +char*get_user_id_string_native( u32 *keyid ); char*get_long_user_id_string( u32 *keyid ); char*get_user_id( u32 *keyid, size_t *rn ); -char*get_user_id_printable( u32 *keyid ); +char*get_user_id_native( u32 *keyid ); KEYDB_HANDLE get_ctx_handle(GETKEY_CTX ctx); /*-- keyid.c --*/ diff --git a/g10/keylist.c b/g10/keylist.c index c9402a201..9c18996d0 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -1,5 +1,5 @@ /* keylist.c - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, * 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. @@ -116,7 +116,7 @@ print_seckey_info (PKT_secret_key *sk) char *p; keyid_from_sk (sk, keyid); - p=get_user_id_printable(keyid); + p=get_user_id_native(keyid); tty_printf ("\nsec %4u%c/%s %s %s\n", nbits_from_sk (sk), @@ -136,7 +136,7 @@ print_pubkey_info (FILE *fp, PKT_public_key *pk) char *p; keyid_from_pk (pk, keyid); - p=get_user_id_printable(keyid); + p=get_user_id_native(keyid); if (fp) fprintf (fp, "pub %4u%c/%s %s %s\n", diff --git a/g10/sign.c b/g10/sign.c index 3ba6d6e0b..1550350bc 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -369,7 +369,7 @@ do_sign( PKT_secret_key *sk, PKT_signature *sig, log_error(_("signing failed: %s\n"), g10_errstr(rc) ); else { if( opt.verbose ) { - char *ustr = get_user_id_string_printable (sig->keyid); + char *ustr = get_user_id_string_native (sig->keyid); log_info(_("%s/%s signature from: \"%s\"\n"), pubkey_algo_to_string(sk->pubkey_algo), digest_algo_to_string(sig->digest_algo),