diff options
author | Werner Koch <[email protected]> | 2005-07-26 19:08:11 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2005-07-26 19:08:11 +0000 |
commit | a7ea40e4f80bf9dc1a6c3936ad91c890ba12141f (patch) | |
tree | fc020c214544a9be7aa8f9e2cca51a61c769ed39 /g10/passphrase.c | |
parent | Preparing a release (diff) | |
download | gnupg-a7ea40e4f80bf9dc1a6c3936ad91c890ba12141f.tar.gz gnupg-a7ea40e4f80bf9dc1a6c3936ad91c890ba12141f.zip |
* passphrase.c (agent_get_passphrase): Make sure to release the
saved codeset.
(agent_open): Add arg ORIG_CODESET and switch back to it in case
of error. Changed all callers.
* zh_TW.po, fr.po, cs.po: Updated.
Diffstat (limited to '')
-rw-r--r-- | g10/passphrase.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c index 862411184..85b82ca4e 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -275,10 +275,12 @@ agent_send_all_options (assuan_context_t ctx) * Returns: -1 on error; on success an Assuan context for that * connection is returned. With TRY set to true, no error messages * are printed and the use of the agent won't get disabled on failure. + * If ORIG_CODESET is not NULL, the function will swithc the codeset + * back to that one before printing error messages. */ #ifdef ENABLE_AGENT_SUPPORT assuan_context_t -agent_open (int try) +agent_open (int try, const char *orig_codeset) { int rc; assuan_context_t ctx; @@ -295,6 +297,10 @@ agent_open (int try) { if (!try) { +#ifdef ENABLE_NLS + if (orig_codeset) + bind_textdomain_codeset (PACKAGE, orig_codeset); +#endif /*ENABLE_NLS*/ log_error (_("gpg-agent is not available in this session\n")); opt.use_agent = 0; } @@ -307,6 +313,10 @@ agent_open (int try) { if (!try) { +#ifdef ENABLE_NLS + if (orig_codeset) + bind_textdomain_codeset (PACKAGE, orig_codeset); +#endif /*ENABLE_NLS*/ log_error ( _("malformed GPG_AGENT_INFO environment variable\n")); opt.use_agent = 0; } @@ -322,6 +332,10 @@ agent_open (int try) { if (!try) { +#ifdef ENABLE_NLS + if (orig_codeset) + bind_textdomain_codeset (PACKAGE, orig_codeset); +#endif /*ENABLE_NLS*/ log_error (_("gpg-agent protocol version %d is not supported\n"), prot); opt.use_agent = 0; @@ -335,6 +349,10 @@ agent_open (int try) { if (!try) { +#ifdef ENABLE_NLS + if (orig_codeset) + bind_textdomain_codeset (PACKAGE, orig_codeset); +#endif /*ENABLE_NLS*/ log_error ( _("can't connect to `%s': %s\n"), infostr, assuan_strerror (rc)); opt.use_agent = 0; @@ -348,6 +366,10 @@ agent_open (int try) { if (!try) { +#ifdef ENABLE_NLS + if (orig_codeset) + bind_textdomain_codeset (PACKAGE, orig_codeset); +#endif /*ENABLE_NLS*/ log_error (_("problem with the agent - disabling agent use\n")); opt.use_agent = 0; } @@ -485,7 +507,7 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *cacheid, } #endif - if ( !(ctx = agent_open (0)) ) + if ( !(ctx = agent_open (0, orig_codeset)) ) goto failure; if (custom_description) @@ -633,7 +655,10 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *cacheid, failure: #ifdef ENABLE_NLS if (orig_codeset) - bind_textdomain_codeset (PACKAGE, orig_codeset); + { + bind_textdomain_codeset (PACKAGE, orig_codeset); + xfree (orig_codeset); + } #endif xfree (atext); agent_close (ctx); @@ -683,7 +708,7 @@ passphrase_clear_cache ( u32 *keyid, const char *cacheid, int algo ) else pk = NULL; - if ( !(ctx = agent_open (0)) ) + if ( !(ctx = agent_open (0, NULL)) ) goto failure; { |