aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--agent/ChangeLog4
-rw-r--r--agent/agent.h1
-rw-r--r--agent/gpg-agent.c14
-rw-r--r--agent/query.c5
4 files changed, 23 insertions, 1 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 6971b206c..c167c0886 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,5 +1,9 @@
2001-12-14 Werner Koch <[email protected]>
+ * gpg-agent.c (main): New option --batch. New option --debug-wait
+ n, so that it is possible to attach gdb when used in server mode.
+ * query.c (agent_askpin): Don't ask in batch mode.
+
* command.c: Removed the conversion macros as they are now in
../common/util.h.
diff --git a/agent/agent.h b/agent/agent.h
index 3cf340ccb..71cb2ecb3 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -33,6 +33,7 @@ struct {
int verbose; /* verbosity level */
int quiet; /* be as quiet as possible */
int dry_run; /* don't change any persistent data */
+ int batch; /* batch mode */
const char *homedir; /* configuration directory name */
const char *pinentry_program;
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 2e65080ce..de33825fd 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -54,6 +54,7 @@ enum cmd_and_opt_values
oOptions,
oDebug,
oDebugAll,
+ oDebugWait,
oNoGreeting,
oNoOptions,
oHomedir,
@@ -64,6 +65,7 @@ enum cmd_and_opt_values
oFlush,
oLogFile,
oServer,
+ oBatch,
oPinentryProgram,
@@ -83,12 +85,14 @@ static ARGPARSE_OPTS opts[] = {
{ oOptions, "options" , 2, N_("read options from file")},
{ oDebug, "debug" ,4|16, N_("set debugging flags")},
{ oDebugAll, "debug-all" ,0, N_("enable full debugging")},
+ { oDebugWait,"debug-wait",1, "@"},
{ oNoDetach, "no-detach" ,0, N_("do not detach from the console")},
{ oNoGrab, "no-grab" ,0, N_("do not grab keyboard and mouse")},
{ oClient, "client" ,0, N_("run in client mode for testing")},
{ oLogFile, "log-file" ,2, N_("use a log file for the server")},
{ oShutdown, "shutdown" ,0, N_("shutdown the agent")},
{ oFlush , "flush" ,0, N_("flush the cache")},
+ { oBatch , "batch" ,0, N_("run without asking a user")},
{ oPinentryProgram, "pinentry-program", 2 , "Path of PIN Entry program" },
@@ -252,6 +256,7 @@ main (int argc, char **argv )
int grab = 0;
int csh_style = 0;
char *logfile = NULL;
+ int debug_wait = 0;
set_strusage (my_strusage);
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
@@ -363,9 +368,11 @@ main (int argc, char **argv )
{
case oQuiet: opt.quiet = 1; break;
case oVerbose: opt.verbose++; break;
+ case oBatch: opt.batch=1; break;
case oDebug: opt.debug |= pargs.r.ret_ulong; break;
case oDebugAll: opt.debug = ~0; break;
+ case oDebugWait: debug_wait = pargs.r.ret_int; break;
case oOptions:
/* config files may not be nested (silently ignore them) */
@@ -496,6 +503,13 @@ main (int argc, char **argv )
exit (1);
}
+ if (debug_wait)
+ {
+ log_debug ("waiting for debugger - my pid is %u .....\n",
+ (unsigned int)getpid());
+ sleep (debug_wait);
+ log_debug ("... okay\n");
+ }
start_command_handler ();
}
else
diff --git a/agent/query.c b/agent/query.c
index dd2139fad..98a5b2639 100644
--- a/agent/query.c
+++ b/agent/query.c
@@ -134,7 +134,7 @@ all_digitsp( const char *s)
-/* Call the Entry and ask for the PIN. We do chekc for a valid PIN
+/* Call the Entry and ask for the PIN. We do check for a valid PIN
number here and repeat it as long as we have invalid formed
numbers. */
int
@@ -146,6 +146,9 @@ agent_askpin (const char *desc_text,
struct entry_parm_s parm;
const char *errtext = NULL;
+ if (opt.batch)
+ return 0; /* fixme: we should return BAD PIN */
+
if (!pininfo || pininfo->max_length < 1)
return seterr (Invalid_Value);
if (!desc_text)