mirror of
git://git.gnupg.org/gnupg.git
synced 2024-06-05 23:07:49 +02:00
(get_passphrase): Make sure that the default
prompts passed to gpg-agent are utf-8 encoded.
This commit is contained in:
parent
9d864ebef7
commit
aac85ca314
|
@ -1,3 +1,8 @@
|
||||||
|
2004-08-18 Werner Koch <wk@g10code.de>
|
||||||
|
|
||||||
|
* protect-tool.c (get_passphrase): Make sure that the default
|
||||||
|
prompts passed to gpg-agent are utf-8 encoded.
|
||||||
|
|
||||||
2004-07-22 Werner Koch <wk@g10code.de>
|
2004-07-22 Werner Koch <wk@g10code.de>
|
||||||
|
|
||||||
* trustlist.c (read_list): Allow colons in the fingerprint.
|
* trustlist.c (read_list): Allow colons in the fingerprint.
|
||||||
|
|
|
@ -29,6 +29,12 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#ifdef HAVE_LOCALE_H
|
||||||
|
#include <locale.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LANGINFO_CODESET
|
||||||
|
#include <langinfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define JNLIB_NEED_LOG_LOGV
|
#define JNLIB_NEED_LOG_LOGV
|
||||||
#include "agent.h"
|
#include "agent.h"
|
||||||
|
@ -1138,10 +1144,29 @@ get_passphrase (int promptno)
|
||||||
char *pw;
|
char *pw;
|
||||||
int err;
|
int err;
|
||||||
const char *desc;
|
const char *desc;
|
||||||
|
char *orig_codeset = NULL;
|
||||||
|
|
||||||
if (opt_passphrase)
|
if (opt_passphrase)
|
||||||
return xstrdup (opt_passphrase);
|
return xstrdup (opt_passphrase);
|
||||||
|
|
||||||
|
#ifdef ENABLE_NLS
|
||||||
|
/* The Assuan agent protocol requires us to transmit utf-8 strings */
|
||||||
|
orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL);
|
||||||
|
#ifdef HAVE_LANGINFO_CODESET
|
||||||
|
if (!orig_codeset)
|
||||||
|
orig_codeset = nl_langinfo (CODESET);
|
||||||
|
#endif
|
||||||
|
if (orig_codeset && !strcmp (orig_codeset, "UTF-8"))
|
||||||
|
orig_codeset = NULL;
|
||||||
|
if (orig_codeset)
|
||||||
|
{
|
||||||
|
/* We only switch when we are able to restore the codeset later. */
|
||||||
|
orig_codeset = xstrdup (orig_codeset);
|
||||||
|
if (!bind_textdomain_codeset (PACKAGE_GT, "utf-8"))
|
||||||
|
orig_codeset = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (promptno == 1 && opt_prompt)
|
if (promptno == 1 && opt_prompt)
|
||||||
desc = opt_prompt;
|
desc = opt_prompt;
|
||||||
else
|
else
|
||||||
|
@ -1149,6 +1174,15 @@ get_passphrase (int promptno)
|
||||||
"needed to complete this operation.");
|
"needed to complete this operation.");
|
||||||
|
|
||||||
pw = simple_pwquery (NULL,NULL, _("Passphrase:"), desc, &err);
|
pw = simple_pwquery (NULL,NULL, _("Passphrase:"), desc, &err);
|
||||||
|
|
||||||
|
#ifdef ENABLE_NLS
|
||||||
|
if (orig_codeset)
|
||||||
|
{
|
||||||
|
bind_textdomain_codeset (PACKAGE_GT, orig_codeset);
|
||||||
|
xfree (orig_codeset);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!pw)
|
if (!pw)
|
||||||
{
|
{
|
||||||
if (err)
|
if (err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user