diff --git a/g10/ChangeLog b/g10/ChangeLog index b9a984913..130ebd511 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,7 @@ +2008-10-24 Werner Koch + + * keyedit.c (change_passphrase): Clear passphrase cache. + 2008-10-20 Werner Koch * gpgv.c: Mark all args of the stub fucntions as unused. diff --git a/g10/keyedit.c b/g10/keyedit.c index cbb9d79bc..fd9f23b20 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1151,7 +1151,15 @@ change_passphrase( KBNODE keyblock ) no_primary_secrets = 1; } else { + u32 keyid[2]; + tty_printf(_("Key is protected.\n")); + + /* Clear the passphrase cache so that the user is required + to enter the old passphrase. */ + keyid_from_sk (sk, keyid); + passphrase_clear_cache (keyid, NULL, 0); + rc = check_secret_key( sk, 0 ); if( !rc ) passphrase = get_last_passphrase(); @@ -1233,7 +1241,17 @@ change_passphrase( KBNODE keyblock ) log_error("protect_secret_key failed: %s\n", g10_errstr(rc) ); else + { + u32 keyid[2]; + + /* Clear the cahce again so that the user is + required to enter the new passphrase at the + next operation. */ + keyid_from_sk (sk, keyid); + passphrase_clear_cache (keyid, NULL, 0); + changed++; + } break; } } diff --git a/po/be.po b/po/be.po index a664f82e6..8eabfa609 100644 --- a/po/be.po +++ b/po/be.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.2.2\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2003-10-30 16:35+0200\n" "Last-Translator: Ales Nyakhaychyk \n" "Language-Team: Belarusian \n" diff --git a/po/ca.po b/po/ca.po index 86112ae28..169b5c1ef 100644 --- a/po/ca.po +++ b/po/ca.po @@ -27,7 +27,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.4.0\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2005-02-04 02:04+0100\n" "Last-Translator: Jordi Mallach \n" "Language-Team: Catalan \n" diff --git a/po/cs.po b/po/cs.po index bf42d5c11..11d969b16 100644 --- a/po/cs.po +++ b/po/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-1.3.92\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2004-11-26 09:12+0200\n" "Last-Translator: Roman Pavlik \n" "Language-Team: Czech \n" diff --git a/po/da.po b/po/da.po index 7f8bc5b04..31b26be87 100644 --- a/po/da.po +++ b/po/da.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.0.0h\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2003-12-03 16:11+0100\n" "Last-Translator: Birger Langkjer \n" "Language-Team: Danish \n" diff --git a/po/de.po b/po/de.po index 7ec4952d6..eb696b69d 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-2.0.6\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2008-06-27 14:10+0200\n" "Last-Translator: Walter Koch \n" "Language-Team: German \n" diff --git a/po/el.po b/po/el.po index 5f6b5a496..e47f79072 100644 --- a/po/el.po +++ b/po/el.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-1.1.92\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2003-06-27 12:00+0200\n" "Last-Translator: Dokianakis Theofanis \n" "Language-Team: Greek \n" diff --git a/po/eo.po b/po/eo.po index 6c7944aec..79b69a017 100644 --- a/po/eo.po +++ b/po/eo.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.0.6d\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2002-04-14 14:33+0100\n" "Last-Translator: Edmund GRIMLEY EVANS \n" "Language-Team: Esperanto \n" diff --git a/po/es.po b/po/es.po index 56db256c7..99f8ec5f8 100644 --- a/po/es.po +++ b/po/es.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 2.0.9\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2008-05-27 22:38+0100\n" "Last-Translator: Jaime Suárez \n" "Language-Team: Spanish \n" diff --git a/po/et.po b/po/et.po index 091e5ca98..57df36e26 100644 --- a/po/et.po +++ b/po/et.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.2.2\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2004-06-17 11:04+0300\n" "Last-Translator: Toomas Soome \n" "Language-Team: Estonian \n" diff --git a/po/fi.po b/po/fi.po index 26c0fdac2..3f23e91a2 100644 --- a/po/fi.po +++ b/po/fi.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.2.2\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2004-06-16 22:40+0300\n" "Last-Translator: Tommi Vainikainen \n" "Language-Team: Finnish \n" diff --git a/po/fr.po b/po/fr.po index 296b81d1e..eba833277 100644 --- a/po/fr.po +++ b/po/fr.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.4.2rc2\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2008-09-30 19:38+0200\n" "Last-Translator: Gaël Quéri \n" "Language-Team: French \n" diff --git a/po/gl.po b/po/gl.po index cfe7b0a8d..465a7a644 100644 --- a/po/gl.po +++ b/po/gl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.2.4\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2003-12-04 11:39+0100\n" "Last-Translator: Jacobo Tarrio \n" "Language-Team: Galician \n" diff --git a/po/hu.po b/po/hu.po index 6644b6fd1..d0f024290 100644 --- a/po/hu.po +++ b/po/hu.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.2.5\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2004-06-19 21:53+0200\n" "Last-Translator: Nagy Ferenc László \n" "Language-Team: Hungarian \n" diff --git a/po/id.po b/po/id.po index 62d6ad91f..8ed7e6d15 100644 --- a/po/id.po +++ b/po/id.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-id\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2004-06-17 16:32+0700\n" "Last-Translator: Tedi Heriyanto \n" "Language-Team: Indonesian \n" diff --git a/po/it.po b/po/it.po index 6c6c35c37..cfe328763 100644 --- a/po/it.po +++ b/po/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.1.92\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2008-05-26 12:02+0200\n" "Last-Translator: Marco d'Itri \n" "Language-Team: Italian \n" diff --git a/po/ja.po b/po/ja.po index a7dd9e815..b514f9720 100644 --- a/po/ja.po +++ b/po/ja.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.3.92\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2004-11-23 11:14+0900\n" "Last-Translator: IIDA Yosiaki \n" "Language-Team: Japanese \n" diff --git a/po/nb.po b/po/nb.po index 32241a3c0..ff1a0b0a9 100644 --- a/po/nb.po +++ b/po/nb.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.4.3\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2006-06-13 20:31+0200\n" "Last-Translator: Trond Endrestøl \n" "Language-Team: Norwegian Bokmål \n" diff --git a/po/pl.po b/po/pl.po index 0f02e540b..92af85e39 100644 --- a/po/pl.po +++ b/po/pl.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-2.0.7\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2007-11-26 19:01+0100\n" "Last-Translator: Jakub Bogusz \n" "Language-Team: Polish \n" diff --git a/po/pt.po b/po/pt.po index 803d75d0c..b00aa953e 100644 --- a/po/pt.po +++ b/po/pt.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2002-09-13 18:26+0100\n" "Last-Translator: Pedro Morais \n" "Language-Team: pt \n" diff --git a/po/pt_BR.po b/po/pt_BR.po index 1419c1564..bfa4b34c7 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.0\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2007-08-16 11:35+0200\n" "Last-Translator:\n" "Language-Team: ?\n" diff --git a/po/ro.po b/po/ro.po index 66eddd735..34709270d 100644 --- a/po/ro.po +++ b/po/ro.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.4.2rc1\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2005-05-31 22:00-0500\n" "Last-Translator: Laurentiu Buzdugan \n" "Language-Team: Romanian \n" diff --git a/po/ru.po b/po/ru.po index 9f553b05b..a6a7831b0 100644 --- a/po/ru.po +++ b/po/ru.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: GnuPG 2.0.0\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2006-11-07 19:31+0300\n" "Last-Translator: Maxim Britov \n" "Language-Team: Russian \n" diff --git a/po/sk.po b/po/sk.po index d8ea76f88..861409d05 100644 --- a/po/sk.po +++ b/po/sk.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.2.5\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2004-07-20 15:52+0200\n" "Last-Translator: Michal Majer \n" "Language-Team: Slovak \n" diff --git a/po/sv.po b/po/sv.po index ff09b831b..f15cf1e10 100644 --- a/po/sv.po +++ b/po/sv.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg trunk\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2008-07-21 09:04+0200\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" diff --git a/po/tr.po b/po/tr.po index 5e8b10554..b43faf4ea 100644 --- a/po/tr.po +++ b/po/tr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.9.94\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2006-11-04 03:45+0200\n" "Last-Translator: Nilgün Belma Bugüner \n" "Language-Team: Turkish \n" diff --git a/po/zh_CN.po b/po/zh_CN.po index c749af227..bc28e3974 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.4.4\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2006-07-02 10:58+0800\n" "Last-Translator: Meng Jie \n" "Language-Team: Chinese (simplified) \n" diff --git a/po/zh_TW.po b/po/zh_TW.po index cb6642462..b53921a5b 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 2.0.9\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-23 21:02+0200\n" +"POT-Creation-Date: 2008-10-23 21:20+0200\n" "PO-Revision-Date: 2008-03-26 22:35+0800\n" "Last-Translator: Jedi Lin \n" "Language-Team: Chinese (traditional) \n" diff --git a/sm/ChangeLog b/sm/ChangeLog index ce129cfd6..749bc58ae 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,12 @@ +2008-10-28 Werner Koch + + * certdump.c (gpgsm_format_keydesc): Use xtryasprintf and xfree. + (gpgsm_es_print_name): Factor code out to ... + (gpgsm_es_print_name2): New function. + (gpgsm_format_name2, format_name_writer): Use estream so that it + works on all platforms. + (format_name_writer): Fix reallocation bug. + 2008-10-23 Werner Koch * import.c (popen_protect_tool): Add arg CTRL and assure that the diff --git a/sm/certdump.c b/sm/certdump.c index 2dfbce105..6c360a352 100644 --- a/sm/certdump.c +++ b/sm/certdump.c @@ -39,14 +39,6 @@ #include "keydb.h" #include "i18n.h" -#ifdef HAVE_FOPENCOOKIE -typedef ssize_t my_funopen_hook_ret_t; -typedef size_t my_funopen_hook_size_t; -#else -typedef int my_funopen_hook_ret_t; -typedef int my_funopen_hook_size_t; -#endif - struct dn_array_s { char *key; @@ -719,9 +711,9 @@ gpgsm_print_name (FILE *fp, const char *name) } -/* This is avariant of gpgsm_print_name sending it output to an estream. */ +/* This is a variant of gpgsm_print_name sending it output to an estream. */ void -gpgsm_es_print_name (estream_t fp, const char *name) +gpgsm_es_print_name2 (estream_t fp, const char *name, int translate) { const unsigned char *s = (const unsigned char *)name; int i; @@ -735,8 +727,13 @@ gpgsm_es_print_name (estream_t fp, const char *name) const char *s2 = strchr ( (char*)s+1, '>'); if (s2) - es_write_sanitized_utf8_buffer (fp, s + 1, s2 - (char*)s - 1, - NULL, NULL); + { + if (translate) + es_write_sanitized_utf8_buffer (fp, s + 1, s2 - (char*)s - 1, + NULL, NULL); + else + es_write_sanitized (fp, s + 1, s2 - (char*)s - 1, NULL, NULL); + } } else if (*s == '(') { @@ -754,7 +751,7 @@ gpgsm_es_print_name (estream_t fp, const char *name) es_fputs (_("[Error - invalid DN]"), fp); else { - print_dn_parts (NULL, fp, dn, 1); + print_dn_parts (NULL, fp, dn, translate); for (i=0; dn[i].key; i++) { xfree (dn[i].key); @@ -766,9 +763,13 @@ gpgsm_es_print_name (estream_t fp, const char *name) } +void +gpgsm_es_print_name (estream_t fp, const char *name) +{ + gpgsm_es_print_name2 (fp, name, 1); +} -#if defined (HAVE_FOPENCOOKIE) || defined (HAVE_FUNOPEN) /* A cookie structure used for the memory stream. */ struct format_name_cookie { @@ -779,32 +780,55 @@ struct format_name_cookie }; /* The writer function for the memory stream. */ -static my_funopen_hook_ret_t -format_name_writer (void *cookie, const char *buffer, - my_funopen_hook_size_t size) +static ssize_t +format_name_writer (void *cookie, const void *buffer, size_t size) { struct format_name_cookie *c = cookie; char *p; - if (c->buffer) - p = xtryrealloc (c->buffer, c->size + size + 1); + log_debug ("buffer: size=%d len=%d error=%d: adding %d bytes\n", + (int)c->size, (int)c->len, c->error, (int)size); + log_printhex ("Adding:", buffer, size); + if (!c->buffer) + { + p = xtrymalloc (size + 1 + 1); + if (p) + { + c->size = size + 1; + c->buffer = p; + c->len = 0; + } + } + else if (c->len + size < c->len) + { + p = NULL; + errno = ENOMEM; + } + else if (c->size < c->len + size) + { + p = xtryrealloc (c->buffer, c->len + size + 1); + if (p) + { + c->size = c->len + size; + c->buffer = p; + } + } else - p = xtrymalloc (size + 1); + p = c->buffer; if (!p) { c->error = errno; xfree (c->buffer); + c->buffer = NULL; errno = c->error; - return (my_funopen_hook_ret_t)(-1); + return -1; } - c->buffer = p; memcpy (p + c->len, buffer, size); c->len += size; p[c->len] = 0; /* Terminate string. */ - return (my_funopen_hook_ret_t)size; + return (ssize_t)size; } -#endif /*HAVE_FOPENCOOKIE || HAVE_FUNOPEN*/ /* Format NAME which is expected to be in rfc2253 format into a better @@ -815,24 +839,14 @@ format_name_writer (void *cookie, const char *buffer, char * gpgsm_format_name2 (const char *name, int translate) { -#if defined (HAVE_FOPENCOOKIE) || defined (HAVE_FUNOPEN) - FILE *fp; + estream_t fp; struct format_name_cookie cookie; + es_cookie_io_functions_t io = { NULL }; memset (&cookie, 0, sizeof cookie); -#ifdef HAVE_FOPENCOOKIE - { - cookie_io_functions_t io = { NULL }; - io.write = format_name_writer; - - fp = fopencookie (&cookie, "w", io); - } -#else /*!HAVE_FOPENCOOKIE*/ - { - fp = funopen (&cookie, NULL, format_name_writer, NULL, NULL); - } -#endif /*!HAVE_FOPENCOOKIE*/ + io.func_write = format_name_writer; + fp = es_fopencookie (&cookie, "w", io); if (!fp) { int save_errno = errno; @@ -840,8 +854,8 @@ gpgsm_format_name2 (const char *name, int translate) errno = save_errno; return NULL; } - gpgsm_print_name2 (fp, name, translate); - fclose (fp); + gpgsm_es_print_name2 (fp, name, translate); + es_fclose (fp); if (cookie.error || !cookie.buffer) { xfree (cookie.buffer); @@ -849,11 +863,9 @@ gpgsm_format_name2 (const char *name, int translate) return NULL; } return cookie.buffer; -#else /* No fun - use the name verbatim. */ - return xtrystrdup (name); -#endif /* No fun. */ } + char * gpgsm_format_name (const char *name) { @@ -920,7 +932,6 @@ gpgsm_fpr_and_name_for_status (ksba_cert_t cert) char * gpgsm_format_keydesc (ksba_cert_t cert) { - int rc; char *name, *subject, *buffer, *p; const char *s; ksba_isotime_t t; @@ -931,8 +942,10 @@ gpgsm_format_keydesc (ksba_cert_t cert) char *orig_codeset; name = ksba_cert_get_subject (cert, 0); + log_printhex ("XXXX NAME: ", name, strlen (name)); subject = name? gpgsm_format_name2 (name, 0) : NULL; ksba_free (name); name = NULL; + log_printhex ("YYYY NAME: ", subject, strlen (subject)); sexp = ksba_cert_get_serial (cert); sn = sexp? gpgsm_format_serial (sexp) : NULL; @@ -951,20 +964,19 @@ gpgsm_format_keydesc (ksba_cert_t cert) orig_codeset = i18n_switchto_utf8 (); - rc = asprintf (&name, - _("Please enter the passphrase to unlock the" - " secret key for the X.509 certificate:\n" - "\"%s\"\n" - "S/N %s, ID 0x%08lX,\n" - "created %s, expires %s.\n" ), - subject? subject:"?", - sn? sn: "?", - gpgsm_get_short_fingerprint (cert), - created, expires); - + name = xtryasprintf (_("Please enter the passphrase to unlock the" + " secret key for the X.509 certificate:\n" + "\"%s\"\n" + "S/N %s, ID 0x%08lX,\n" + "created %s, expires %s.\n" ), + subject? subject:"?", + sn? sn: "?", + gpgsm_get_short_fingerprint (cert), + created, expires); + i18n_switchback (orig_codeset); - - if (rc < 0) + + if (!name) { int save_errno = errno; xfree (subject); @@ -996,7 +1008,7 @@ gpgsm_format_keydesc (ksba_cert_t cert) *p++ = *s; } *p = 0; - free (name); + xfree (name); return buffer; } diff --git a/sm/gpgsm.h b/sm/gpgsm.h index 0ee557fe6..1460dc0d6 100644 --- a/sm/gpgsm.h +++ b/sm/gpgsm.h @@ -267,6 +267,7 @@ void gpgsm_print_time (estream_t fp, ksba_isotime_t t); void gpgsm_print_name2 (FILE *fp, const char *string, int translate); void gpgsm_print_name (FILE *fp, const char *string); void gpgsm_es_print_name (estream_t fp, const char *string); +void gpgsm_es_print_name2 (estream_t fp, const char *string, int translate); void gpgsm_cert_log_name (const char *text, ksba_cert_t cert);