diff options
author | Werner Koch <wk@gnupg.org> | 2008-10-28 12:41:52 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-10-28 12:41:52 +0100 |
commit | 3f8e827f635dc3da61ccb51645e291bcb4d09c91 (patch) | |
tree | f91f60ec930c081b1839d7f84983633d36fbd5d8 | |
parent | auto po updates. (diff) | |
download | gnupg2-3f8e827f635dc3da61ccb51645e291bcb4d09c91.tar.xz gnupg2-3f8e827f635dc3da61ccb51645e291bcb4d09c91.zip |
fixed a bug in the prompt formatter.
-rw-r--r-- | g10/ChangeLog | 4 | ||||
-rw-r--r-- | g10/keyedit.c | 18 | ||||
-rw-r--r-- | po/be.po | 2 | ||||
-rw-r--r-- | po/ca.po | 2 | ||||
-rw-r--r-- | po/cs.po | 2 | ||||
-rw-r--r-- | po/da.po | 2 | ||||
-rw-r--r-- | po/de.po | 2 | ||||
-rw-r--r-- | po/el.po | 2 | ||||
-rw-r--r-- | po/eo.po | 2 | ||||
-rw-r--r-- | po/es.po | 2 | ||||
-rw-r--r-- | po/et.po | 2 | ||||
-rw-r--r-- | po/fi.po | 2 | ||||
-rw-r--r-- | po/fr.po | 2 | ||||
-rw-r--r-- | po/gl.po | 2 | ||||
-rw-r--r-- | po/hu.po | 2 | ||||
-rw-r--r-- | po/id.po | 2 | ||||
-rw-r--r-- | po/it.po | 2 | ||||
-rw-r--r-- | po/ja.po | 2 | ||||
-rw-r--r-- | po/nb.po | 2 | ||||
-rw-r--r-- | po/pl.po | 2 | ||||
-rw-r--r-- | po/pt.po | 2 | ||||
-rw-r--r-- | po/pt_BR.po | 2 | ||||
-rw-r--r-- | po/ro.po | 2 | ||||
-rw-r--r-- | po/ru.po | 2 | ||||
-rw-r--r-- | po/sk.po | 2 | ||||
-rw-r--r-- | po/sv.po | 2 | ||||
-rw-r--r-- | po/tr.po | 2 | ||||
-rw-r--r-- | po/zh_CN.po | 2 | ||||
-rw-r--r-- | po/zh_TW.po | 2 | ||||
-rw-r--r-- | sm/ChangeLog | 9 | ||||
-rw-r--r-- | sm/certdump.c | 128 | ||||
-rw-r--r-- | sm/gpgsm.h | 1 |
32 files changed, 129 insertions, 85 deletions
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 <wk@g10code.com> + + * keyedit.c (change_passphrase): Clear passphrase cache. + 2008-10-20 Werner Koch <wk@g10code.com> * 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; } } @@ -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 <nab@mail.by>\n" "Language-Team: Belarusian <i18n@mova.org>\n" @@ -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 <jordi@gnu.org>\n" "Language-Team: Catalan <ca@dodds.net>\n" @@ -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 <rp@tns.cz>\n" "Language-Team: Czech <translations.cs@gnupg.cz>\n" @@ -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 <birger.langkjer@image.dk>\n" "Language-Team: Danish <dansk@klid.dk>\n" @@ -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 <koch@u32.de>\n" "Language-Team: German <de@li.org>\n" @@ -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 <madf@hellug.gr>\n" "Language-Team: Greek <nls@tux.hellug.gr>\n" @@ -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 <edmundo@rano.org>\n" "Language-Team: Esperanto <translation-team-eo@lists.sourceforge.net>\n" @@ -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 <jaime@mundocripto.com>\n" "Language-Team: Spanish <es@li.org>\n" @@ -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 <Toomas.Soome@microlink.ee>\n" "Language-Team: Estonian <et@li.org>\n" @@ -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 <Tommi.Vainikainen@iki.fi>\n" "Language-Team: Finnish <translation-team-fi@lists.sourceforge.net>\n" @@ -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 <gael@lautre.net>\n" "Language-Team: French <traduc@traduc.org>\n" @@ -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 <jtarrio@trasno.net>\n" "Language-Team: Galician <gpul-traduccion@ceu.fi.udc.es>\n" @@ -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ó <nfl@nfllab.com>\n" "Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net>\n" @@ -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 <tedi_h@gmx.net>\n" "Language-Team: Indonesian <translation-team-id@lists.sourceforge.net>\n" @@ -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 <md@linux.it>\n" "Language-Team: Italian <tp@lists.linux.it>\n" @@ -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 <iida@gnu.org>\n" "Language-Team: Japanese <translation-team-ja@lists.sourceforge.net>\n" @@ -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 <Trond.Endrestol@fagskolen.gjovik.no>\n" "Language-Team: Norwegian Bokmål <i18n-nb@lister.ping.uio.no>\n" @@ -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 <qboosh@pld-linux.org>\n" "Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n" @@ -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 <morais@kde.org>\n" "Language-Team: pt <morais@kde.org>\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" @@ -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 <lbuz@rolix.org>\n" "Language-Team: Romanian <translation-team-ro@lists.sourceforge.net>\n" @@ -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 <maxim.britov@gmail.com>\n" "Language-Team: Russian <gnupg-ru@gnupg.org>\n" @@ -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 <mmajer@econ.umb.sk>\n" "Language-Team: Slovak <sk-i18n@lists.linux.sk>\n" @@ -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 <po@danielnylander.se>\n" "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" @@ -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 <nilgun@belgeler.gen.tr>\n" "Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net>\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 <zuxyhere@eastday.com>\n" "Language-Team: Chinese (simplified) <i18n-translation@lists.linux.net.cn>\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 <Jedi@Jedi.org>\n" "Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\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 <wk@g10code.com> + + * 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 <wk@g10code.com> * 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); |