mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
* call-agent.c (start_agent): Make copies of old locales and check
for setlocale. * configure.ac: Check for setlocale.
This commit is contained in:
parent
b4f8fcb0e1
commit
a2176634ae
@ -498,8 +498,11 @@ cmd_learn (ASSUAN_CONTEXT ctx, char *line)
|
||||
static int
|
||||
option_handler (ASSUAN_CONTEXT ctx, const char *key, const char *value)
|
||||
{
|
||||
CTRL ctrl = assuan_get_pointer (ctx);
|
||||
/* CTRL ctrl = assuan_get_pointer (ctx); */
|
||||
|
||||
/* FIXME: We should not change opt. here. It is not a problem right
|
||||
now but as soon as we are allowing concurrent connections we mess
|
||||
things up */
|
||||
if (!strcmp (key, "display"))
|
||||
{
|
||||
if (opt.display)
|
||||
|
@ -438,7 +438,7 @@ cmd_pksign (ASSUAN_CONTEXT ctx, char *line)
|
||||
/* We have to use a copy of the key ID because the function may use
|
||||
the pin_cb which in turn uses the assuan line buffer and thus
|
||||
overwriting the original line with the keyid */
|
||||
keyidstr = xtrystrdup (line);
|
||||
keyidstr = strdup (line);
|
||||
if (!keyidstr)
|
||||
return ASSUAN_Out_Of_Core;
|
||||
rc = card_sign (ctrl->card_ctx,
|
||||
@ -446,7 +446,7 @@ cmd_pksign (ASSUAN_CONTEXT ctx, char *line)
|
||||
pin_cb, ctx,
|
||||
ctrl->in_data.value, ctrl->in_data.valuelen,
|
||||
&outdata, &outdatalen);
|
||||
xfree (keyidstr);
|
||||
free (keyidstr);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("card_sign failed: %s\n", gnupg_strerror (rc));
|
||||
@ -477,7 +477,7 @@ cmd_pkdecrypt (ASSUAN_CONTEXT ctx, char *line)
|
||||
if ((rc = open_card (ctrl)))
|
||||
return rc;
|
||||
|
||||
keyidstr = xtrystrdup (line);
|
||||
keyidstr = strdup (line);
|
||||
if (!keyidstr)
|
||||
return ASSUAN_Out_Of_Core;
|
||||
rc = card_decipher (ctrl->card_ctx,
|
||||
@ -485,7 +485,7 @@ cmd_pkdecrypt (ASSUAN_CONTEXT ctx, char *line)
|
||||
pin_cb, ctx,
|
||||
ctrl->in_data.value, ctrl->in_data.valuelen,
|
||||
&outdata, &outdatalen);
|
||||
xfree (keyidstr);
|
||||
free (keyidstr);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("card_create_signature failed: %s\n", gnupg_strerror (rc));
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-04-25 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* call-agent.c (start_agent): Make copies of old locales and check
|
||||
for setlocale.
|
||||
|
||||
2002-04-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* call-agent.c (start_agent): Fix error handling logic so the
|
||||
|
@ -264,8 +264,14 @@ start_agent (void)
|
||||
if (rc)
|
||||
return map_assuan_err (rc);
|
||||
}
|
||||
#ifdef LC_CTYPE
|
||||
#if defined(HAVE_SETLOCALE) && defined(LC_CTYPE)
|
||||
old_lc = setlocale (LC_CTYPE, NULL);
|
||||
if (old_lc)
|
||||
{
|
||||
old_lc = strdup (old_lc);
|
||||
if (!old_lc)
|
||||
return GNUPG_Out_Of_Core;
|
||||
}
|
||||
dft_lc = setlocale (LC_CTYPE, "");
|
||||
#endif
|
||||
if (opt.lc_ctype || (dft_ttyname && dft_lc))
|
||||
@ -283,14 +289,23 @@ start_agent (void)
|
||||
rc = map_assuan_err (rc);
|
||||
}
|
||||
}
|
||||
#ifdef LC_CTYPE
|
||||
#if defined(HAVE_SETLOCALE) && defined(LC_CTYPE)
|
||||
if (old_lc)
|
||||
setlocale (LC_CTYPE, old_lc);
|
||||
{
|
||||
setlocale (LC_CTYPE, old_lc);
|
||||
free (old_lc);
|
||||
}
|
||||
#endif
|
||||
if (rc)
|
||||
return rc;
|
||||
#ifdef LC_MESSAGES
|
||||
#if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES)
|
||||
old_lc = setlocale (LC_MESSAGES, NULL);
|
||||
if (old_lc)
|
||||
{
|
||||
old_lc = strdup (old_lc);
|
||||
if (!old_lc)
|
||||
return GNUPG_Out_Of_Core;
|
||||
}
|
||||
dft_lc = setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
if (opt.lc_messages || (dft_ttyname && dft_lc))
|
||||
@ -308,9 +323,12 @@ start_agent (void)
|
||||
rc = map_assuan_err (rc);
|
||||
}
|
||||
}
|
||||
#ifdef LC_MESSAGES
|
||||
#if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES)
|
||||
if (old_lc)
|
||||
setlocale (LC_MESSAGES, old_lc);
|
||||
{
|
||||
setlocale (LC_MESSAGES, old_lc);
|
||||
free (old_lc);
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user