aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-08-21 08:18:23 +0000
committerWerner Koch <[email protected]>2002-08-21 08:18:23 +0000
commita71981baceb29b93d95fd02845a3168e45ca4cfd (patch)
tree2023b0372e2302cb4ae84d13edcd02fe8d19bba4
parent* options.skel: Document no-include-attributes for keyserver-options. (diff)
downloadgnupg-a71981baceb29b93d95fd02845a3168e45ca4cfd.tar.gz
gnupg-a71981baceb29b93d95fd02845a3168e45ca4cfd.zip
* divert-scd.c (getpin_cb): Pass a more descritive text to the
pinentry. * 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.
-rw-r--r--agent/ChangeLog11
-rw-r--r--agent/Makefile.am6
-rw-r--r--agent/divert-scd.c16
-rw-r--r--agent/gpg-agent.c19
-rw-r--r--agent/protect-tool.c14
5 files changed, 47 insertions, 19 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 006d53ebe..f43014f66 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,14 @@
+2002-08-21 Werner Koch <[email protected]>
+
+ * divert-scd.c (getpin_cb): Pass a more descritive text to the
+ pinentry.
+
+ * 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.
+
2002-08-16 Werner Koch <[email protected]>
* call-scd.c (learn_status_cb): Handle CERTINFO status.
diff --git a/agent/Makefile.am b/agent/Makefile.am
index 2204eba9d..89000cf35 100644
--- a/agent/Makefile.am
+++ b/agent/Makefile.am
@@ -22,7 +22,7 @@ localedir = $(datadir)/locale
INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\"
bin_PROGRAMS = gpg-agent
-pkglib_PROGRAMS = protect-tool
+pkglib_PROGRAMS = gpg-protect-tool
AM_CPPFLAGS = -I$(top_srcdir)/common $(LIBGCRYPT_CFLAGS) $(PTH_CFLAGS)
LDFLAGS = @LDFLAGS@
@@ -48,13 +48,13 @@ gpg_agent_SOURCES = \
gpg_agent_LDADD = ../jnlib/libjnlib.a ../assuan/libassuan.a \
../common/libcommon.a $(LIBGCRYPT_LIBS) $(PTH_LIBS)
-protect_tool_SOURCES = \
+gpg_protect_tool_SOURCES = \
protect-tool.c \
protect.c \
minip12.c minip12.h \
simple-pwquery.c simple-pwquery.h
-protect_tool_LDADD = ../jnlib/libjnlib.a \
+gpg_protect_tool_LDADD = ../jnlib/libjnlib.a \
../common/libcommon.a $(LIBGCRYPT_LIBS)
diff --git a/agent/divert-scd.c b/agent/divert-scd.c
index dfc10087a..40b6bcfa3 100644
--- a/agent/divert-scd.c
+++ b/agent/divert-scd.c
@@ -30,7 +30,7 @@
#include "agent.h"
#include "sexp-parse.h"
-
+#include "i18n.h"
static int
@@ -173,14 +173,16 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf)
{
struct pin_entry_info_s *pi;
int rc;
+ char *desc;
assert (!opaque);
if (maxbuf < 2)
return GNUPG_Invalid_Value;
- /* FIXME: keep PI and TRIES in OPAQUE. Actually this is a whole
- mess becuase we should call the card's verify function from the
+
+ /* FIXME: keep PI and TRIES in OPAQUE. Frankly this is a whole
+ mess because we should call the card's verify function from the
pinentry check pin CB. */
pi = gcry_calloc_secure (1, sizeof (*pi) + 100);
pi->max_length = maxbuf-1;
@@ -188,7 +190,13 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf)
pi->max_digits = 8;
pi->max_tries = 3;
- rc = agent_askpin (info, pi);
+ if ( asprintf (&desc, _("Please enter the PIN%s%s%s to unlock the card"),
+ info? " (`":"",
+ info? info:"",
+ info? "')":"") < 0)
+ desc = NULL;
+ rc = agent_askpin (desc?desc:info, pi);
+ free (desc);
if (!rc)
{
strncpy (buf, pi->pin, maxbuf-1);
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 96c220bb8..79bd960ed 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -66,6 +66,7 @@ enum cmd_and_opt_values
oNoGrab,
oLogFile,
oServer,
+ oDaemon,
oBatch,
oPinentryProgram,
@@ -88,8 +89,9 @@ static ARGPARSE_OPTS opts[] = {
{ 301, NULL, 0, N_("@Options:\n ") },
- { oServer, "server", 0, N_("run in server mode") },
- { oVerbose, "verbose", 0, N_("verbose") },
+ { oServer, "server", 0, N_("run in server mode (foreground)") },
+ { oDaemon, "daemon", 0, N_("run in daemon mode (background)") },
+ { oVerbose, "verbose", 0, N_("verbose") },
{ oQuiet, "quiet", 0, N_("be somewhat more quiet") },
{ oSh, "sh", 0, N_("sh-style command output") },
{ oCsh, "csh", 0, N_("csh-style command output") },
@@ -258,6 +260,7 @@ main (int argc, char **argv )
int greeting = 0;
int nogreeting = 0;
int pipe_server = 0;
+ int is_daemon = 0;
int nodetach = 0;
int csh_style = 0;
char *logfile = NULL;
@@ -274,15 +277,15 @@ main (int argc, char **argv )
/* check that the libraries are suitable. Do it here because
the option parsing may need services of the library */
- if (!gcry_check_version ( "1.1.5" ) )
+ if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
{
log_fatal( _("libgcrypt is too old (need %s, have %s)\n"),
- "1.1.5", gcry_check_version (NULL) );
+ NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
}
assuan_set_malloc_hooks (gcry_malloc, gcry_realloc, gcry_free);
#ifdef USE_GNU_PTH
- assuan_set_io_func (pth_read, pth_write);
+ assuan_set_io_func (pth_read, pth_write);
#endif
gcry_set_log_handler (my_gcry_logger, NULL);
@@ -397,6 +400,7 @@ main (int argc, char **argv )
case oCsh: csh_style = 1; break;
case oSh: csh_style = 0; break;
case oServer: pipe_server = 1; break;
+ case oDaemon: is_daemon = 1; break;
case oDisablePth: disable_pth = 1; break;
case oPinentryProgram: opt.pinentry_program = pargs.r.ret_str; break;
@@ -466,6 +470,11 @@ main (int argc, char **argv )
{ /* this is the simple pipe based server */
start_command_handler (-1, -1);
}
+ else if (!is_daemon)
+ {
+ log_info (_("please use the option `--daemon'"
+ " to run the program in the background\n"));
+ }
else
{ /* regular server mode */
int fd;
diff --git a/agent/protect-tool.c b/agent/protect-tool.c
index d9bbf8b4b..b762437a8 100644
--- a/agent/protect-tool.c
+++ b/agent/protect-tool.c
@@ -106,17 +106,17 @@ my_strusage (int level)
const char *p;
switch (level)
{
- case 11: p = "protect-tool (GnuPG)";
+ case 11: p = "gpg-protect-tool (GnuPG)";
break;
case 13: p = VERSION; break;
case 17: p = PRINTABLE_OS_NAME; break;
case 19: p = _("Please report bugs to <" PACKAGE_BUGREPORT ">.\n");
break;
case 1:
- case 40: p = _("Usage: protect-tool [options] (-h for help)\n");
+ case 40: p = _("Usage: gpg-protect-tool [options] (-h for help)\n");
break;
- case 41: p = _("Syntax: protect-tool [options] [args]]\n"
- "INTERNAL USE ONLY!\n");
+ case 41: p = _("Syntax: gpg-protect-tool [options] [args]]\n"
+ "Secret key maintenance tool\n");
break;
default: p = NULL;
@@ -812,13 +812,13 @@ main (int argc, char **argv )
set_strusage (my_strusage);
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
- log_set_prefix ("protect-tool", 1);
+ log_set_prefix ("gpg-protect-tool", 1);
i18n_init ();
- if (!gcry_check_version ( "1.1.5" ) )
+ if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
{
log_fatal( _("libgcrypt is too old (need %s, have %s)\n"),
- "1.1.5", gcry_check_version (NULL) );
+ NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
}
gcry_set_log_handler (my_gcry_logger, NULL);