* query.c (agent_askpin): Hack to show the right default prompt.

(agent_get_passphrase): Ditto.

* Makefile.am: Renamed the binary protect-tool to gpg-protect-tool.
* protect-tool.c: Removed the note about internal use only.

* gpg-agent.c (main): New option --daemon so that the program is
not accidently started in the background.
This commit is contained in:
Werner Koch 2002-08-21 11:11:04 +00:00
parent afc40938ec
commit cda3b913db
6 changed files with 37 additions and 27 deletions

View File

@ -1,5 +1,10 @@
2002-08-21 Werner Koch <wk@gnupg.org>
* query.c (agent_askpin): Hack to show the right default prompt.
(agent_get_passphrase): Ditto.
* trans.c: Removed and replaced all usages with standard _()
* divert-scd.c (getpin_cb): Pass a more descritive text to the
pinentry.

View File

@ -107,9 +107,6 @@ enum {
/*-- gpg-agent.c --*/
void agent_exit (int rc); /* also implemented in other tools */
/*-- trans.c --*/
const char *trans (const char *text);
/*-- command.c --*/
void start_command_handler (int, int);

View File

@ -27,7 +27,7 @@
#include <assert.h>
#include "agent.h"
#include "i18n.h"
static int
store_key (GCRY_SEXP private, const char *passphrase)
@ -79,7 +79,7 @@ reenter_compare_cb (struct pin_entry_info_s *pi)
if (!strcmp (pin1, pi->pin))
return 0; /* okay */
pi->cb_errtext = trans ("does not match - try again");
pi->cb_errtext = _("does not match - try again");
return -1;
}
@ -106,9 +106,9 @@ agent_genkey (CTRL ctrl, const char *keyparam, size_t keyparamlen,
/* Get the passphrase now, cause key generation may take a while. */
{
const char *text1 = trans ("Please enter the passphrase to%0A"
const char *text1 = _("Please enter the passphrase to%0A"
"to protect your new key");
const char *text2 = trans ("Please re-enter this passphrase");
const char *text2 = _("Please re-enter this passphrase");
pi = gcry_calloc_secure (2, sizeof (*pi) + 100);
pi2 = pi + (sizeof *pi + 100);

View File

@ -173,9 +173,9 @@ i18n_init (void)
set_gettext_file( PACKAGE );
#else
#ifdef ENABLE_NLS
/* gtk_set_locale (); HMMM: We have not yet called gtk_init */
bindtextdomain( PACKAGE, LOCALEDIR );
textdomain( PACKAGE );
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
#endif
#endif
}

View File

@ -133,9 +133,9 @@ i18n_init (void)
set_gettext_file( PACKAGE );
#else
#ifdef ENABLE_NLS
/* gtk_set_locale (); HMMM: We have not yet called gtk_init */
bindtextdomain( PACKAGE, LOCALEDIR );
textdomain( PACKAGE );
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
#endif
#endif
}

View File

@ -32,6 +32,7 @@
#endif
#include "agent.h"
#include "i18n.h"
#include "../assuan/assuan.h"
#ifdef _POSIX_OPEN_MAX
@ -235,6 +236,7 @@ agent_askpin (const char *desc_text, struct pin_entry_info_s *pininfo)
char line[ASSUAN_LINELENGTH];
struct entry_parm_s parm;
const char *errtext = NULL;
int is_pin;
if (opt.batch)
return 0; /* fixme: we should return BAD PIN */
@ -242,9 +244,11 @@ agent_askpin (const char *desc_text, struct pin_entry_info_s *pininfo)
if (!pininfo || pininfo->max_length < 1)
return seterr (Invalid_Value);
if (!desc_text)
desc_text = trans ("Please enter you PIN, so that the secret key "
"can be unlocked for this session");
desc_text = _("Please enter you PIN, so that the secret key "
"can be unlocked for this session");
is_pin = desc_text && strstr (desc_text, "PIN");
rc = start_pinentry ();
if (rc)
return rc;
@ -256,8 +260,8 @@ agent_askpin (const char *desc_text, struct pin_entry_info_s *pininfo)
return unlock_pinentry (map_assuan_err (rc));
rc = assuan_transact (entry_ctx,
pininfo->min_digits? "SETPROMPT PIN:"
: "SETPROMPT Passphrase:",
is_pin? "SETPROMPT PIN:"
: "SETPROMPT Passphrase:",
NULL, NULL, NULL, NULL, NULL, NULL);
if (rc)
return unlock_pinentry (map_assuan_err (rc));
@ -283,21 +287,21 @@ agent_askpin (const char *desc_text, struct pin_entry_info_s *pininfo)
rc = assuan_transact (entry_ctx, "GETPIN", getpin_cb, &parm,
NULL, NULL, NULL, NULL);
if (rc == ASSUAN_Too_Much_Data)
errtext = pininfo->min_digits? trans ("PIN too long")
: trans ("Passphrase too long");
errtext = is_pin? _("PIN too long")
: _("Passphrase too long");
else if (rc)
return unlock_pinentry (map_assuan_err (rc));
if (!errtext && pininfo->min_digits)
if (!errtext && is_pin)
{
/* do some basic checks on the entered PIN. */
if (!all_digitsp (pininfo->pin))
errtext = trans ("Invalid characters in PIN");
errtext = _("Invalid characters in PIN");
else if (pininfo->max_digits
&& strlen (pininfo->pin) > pininfo->max_digits)
errtext = trans ("PIN too long");
errtext = _("PIN too long");
else if (strlen (pininfo->pin) < pininfo->min_digits)
errtext = trans ("PIN too short");
errtext = _("PIN too short");
}
if (!errtext && pininfo->check_cb)
@ -308,8 +312,8 @@ agent_askpin (const char *desc_text, struct pin_entry_info_s *pininfo)
if (rc == -1 && pininfo->cb_errtext)
errtext = pininfo->cb_errtext;
else if (rc == GNUPG_Bad_Passphrase || rc == GNUPG_Bad_PIN)
errtext = (pininfo->min_digits? trans ("Bad PIN")
: trans ("Bad Passphrase"));
errtext = (is_pin? _("Bad PIN")
: _("Bad Passphrase"));
else if (rc)
return unlock_pinentry (map_assuan_err (rc));
}
@ -346,6 +350,10 @@ agent_get_passphrase (char **retpass, const char *desc, const char *prompt,
if (rc)
return rc;
if (!prompt)
prompt = desc && strstr (desc, "PIN")? "PIN": _("Passphrase");
if (desc)
snprintf (line, DIM(line)-1, "SETDESC %s", desc);
else
@ -355,7 +363,7 @@ agent_get_passphrase (char **retpass, const char *desc, const char *prompt,
if (rc)
return unlock_pinentry (map_assuan_err (rc));
snprintf (line, DIM(line)-1, "SETPROMPT %s", prompt? prompt : "Passphrase");
snprintf (line, DIM(line)-1, "SETPROMPT %s", prompt);
line[DIM(line)-1] = 0;
rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
if (rc)