mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-11 22:01:08 +02:00
* 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.
This commit is contained in:
parent
7606e3b33a
commit
61ba223221
@ -1,5 +1,9 @@
|
|||||||
2001-12-14 Werner Koch <wk@gnupg.org>
|
2001-12-14 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* 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
|
* command.c: Removed the conversion macros as they are now in
|
||||||
../common/util.h.
|
../common/util.h.
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ struct {
|
|||||||
int verbose; /* verbosity level */
|
int verbose; /* verbosity level */
|
||||||
int quiet; /* be as quiet as possible */
|
int quiet; /* be as quiet as possible */
|
||||||
int dry_run; /* don't change any persistent data */
|
int dry_run; /* don't change any persistent data */
|
||||||
|
int batch; /* batch mode */
|
||||||
const char *homedir; /* configuration directory name */
|
const char *homedir; /* configuration directory name */
|
||||||
const char *pinentry_program;
|
const char *pinentry_program;
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ enum cmd_and_opt_values
|
|||||||
oOptions,
|
oOptions,
|
||||||
oDebug,
|
oDebug,
|
||||||
oDebugAll,
|
oDebugAll,
|
||||||
|
oDebugWait,
|
||||||
oNoGreeting,
|
oNoGreeting,
|
||||||
oNoOptions,
|
oNoOptions,
|
||||||
oHomedir,
|
oHomedir,
|
||||||
@ -64,6 +65,7 @@ enum cmd_and_opt_values
|
|||||||
oFlush,
|
oFlush,
|
||||||
oLogFile,
|
oLogFile,
|
||||||
oServer,
|
oServer,
|
||||||
|
oBatch,
|
||||||
|
|
||||||
oPinentryProgram,
|
oPinentryProgram,
|
||||||
|
|
||||||
@ -83,12 +85,14 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oOptions, "options" , 2, N_("read options from file")},
|
{ oOptions, "options" , 2, N_("read options from file")},
|
||||||
{ oDebug, "debug" ,4|16, N_("set debugging flags")},
|
{ oDebug, "debug" ,4|16, N_("set debugging flags")},
|
||||||
{ oDebugAll, "debug-all" ,0, N_("enable full debugging")},
|
{ oDebugAll, "debug-all" ,0, N_("enable full debugging")},
|
||||||
|
{ oDebugWait,"debug-wait",1, "@"},
|
||||||
{ oNoDetach, "no-detach" ,0, N_("do not detach from the console")},
|
{ oNoDetach, "no-detach" ,0, N_("do not detach from the console")},
|
||||||
{ oNoGrab, "no-grab" ,0, N_("do not grab keyboard and mouse")},
|
{ oNoGrab, "no-grab" ,0, N_("do not grab keyboard and mouse")},
|
||||||
{ oClient, "client" ,0, N_("run in client mode for testing")},
|
{ oClient, "client" ,0, N_("run in client mode for testing")},
|
||||||
{ oLogFile, "log-file" ,2, N_("use a log file for the server")},
|
{ oLogFile, "log-file" ,2, N_("use a log file for the server")},
|
||||||
{ oShutdown, "shutdown" ,0, N_("shutdown the agent")},
|
{ oShutdown, "shutdown" ,0, N_("shutdown the agent")},
|
||||||
{ oFlush , "flush" ,0, N_("flush the cache")},
|
{ 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" },
|
{ oPinentryProgram, "pinentry-program", 2 , "Path of PIN Entry program" },
|
||||||
|
|
||||||
@ -252,6 +256,7 @@ main (int argc, char **argv )
|
|||||||
int grab = 0;
|
int grab = 0;
|
||||||
int csh_style = 0;
|
int csh_style = 0;
|
||||||
char *logfile = NULL;
|
char *logfile = NULL;
|
||||||
|
int debug_wait = 0;
|
||||||
|
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
||||||
@ -363,9 +368,11 @@ main (int argc, char **argv )
|
|||||||
{
|
{
|
||||||
case oQuiet: opt.quiet = 1; break;
|
case oQuiet: opt.quiet = 1; break;
|
||||||
case oVerbose: opt.verbose++; break;
|
case oVerbose: opt.verbose++; break;
|
||||||
|
case oBatch: opt.batch=1; break;
|
||||||
|
|
||||||
case oDebug: opt.debug |= pargs.r.ret_ulong; break;
|
case oDebug: opt.debug |= pargs.r.ret_ulong; break;
|
||||||
case oDebugAll: opt.debug = ~0; break;
|
case oDebugAll: opt.debug = ~0; break;
|
||||||
|
case oDebugWait: debug_wait = pargs.r.ret_int; break;
|
||||||
|
|
||||||
case oOptions:
|
case oOptions:
|
||||||
/* config files may not be nested (silently ignore them) */
|
/* config files may not be nested (silently ignore them) */
|
||||||
@ -496,6 +503,13 @@ main (int argc, char **argv )
|
|||||||
exit (1);
|
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 ();
|
start_command_handler ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -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
|
number here and repeat it as long as we have invalid formed
|
||||||
numbers. */
|
numbers. */
|
||||||
int
|
int
|
||||||
@ -146,6 +146,9 @@ agent_askpin (const char *desc_text,
|
|||||||
struct entry_parm_s parm;
|
struct entry_parm_s parm;
|
||||||
const char *errtext = NULL;
|
const char *errtext = NULL;
|
||||||
|
|
||||||
|
if (opt.batch)
|
||||||
|
return 0; /* fixme: we should return BAD PIN */
|
||||||
|
|
||||||
if (!pininfo || pininfo->max_length < 1)
|
if (!pininfo || pininfo->max_length < 1)
|
||||||
return seterr (Invalid_Value);
|
return seterr (Invalid_Value);
|
||||||
if (!desc_text)
|
if (!desc_text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user