1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpgv: New options --log-file and --debug

* g10/gpgv.c (oLoggerFile, oDebug): New consts.
(opts): Add options --log-file and --debug.
(main): Implement options.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2017-02-24 10:20:41 +01:00
parent 49b4a67614
commit 7af5d61c6e
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 42 additions and 0 deletions

View File

@ -111,6 +111,11 @@ file DETAILS in the documentation for a listing of them.
@opindex logger-fd @opindex logger-fd
Write log output to file descriptor @code{n} and not to stderr. Write log output to file descriptor @code{n} and not to stderr.
@item --log-file @code{file}
@opindex log-file
Same as @option{--logger-fd}, except the logger data is written to
file @code{file}. Use @file{socket://} to log to socket.
@item --ignore-time-conflict @item --ignore-time-conflict
@opindex ignore-time-conflict @opindex ignore-time-conflict
GnuPG normally checks that the timestamps associated with keys and GnuPG normally checks that the timestamps associated with keys and

View File

@ -61,9 +61,11 @@ enum cmd_and_opt_values {
oIgnoreTimeConflict, oIgnoreTimeConflict,
oStatusFD, oStatusFD,
oLoggerFD, oLoggerFD,
oLoggerFile,
oHomedir, oHomedir,
oWeakDigest, oWeakDigest,
oEnableSpecialFilenames, oEnableSpecialFilenames,
oDebug,
aTest aTest
}; };
@ -81,15 +83,37 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_i (oStatusFD, "status-fd", ARGPARSE_s_i (oStatusFD, "status-fd",
N_("|FD|write status info to this FD")), N_("|FD|write status info to this FD")),
ARGPARSE_s_i (oLoggerFD, "logger-fd", "@"), ARGPARSE_s_i (oLoggerFD, "logger-fd", "@"),
ARGPARSE_s_s (oLoggerFile, "log-file", "@"),
ARGPARSE_s_s (oHomedir, "homedir", "@"), ARGPARSE_s_s (oHomedir, "homedir", "@"),
ARGPARSE_s_s (oWeakDigest, "weak-digest", ARGPARSE_s_s (oWeakDigest, "weak-digest",
N_("|ALGO|reject signatures made with ALGO")), N_("|ALGO|reject signatures made with ALGO")),
ARGPARSE_s_n (oEnableSpecialFilenames, "enable-special-filenames", "@"), ARGPARSE_s_n (oEnableSpecialFilenames, "enable-special-filenames", "@"),
ARGPARSE_s_s (oDebug, "debug", "@"),
ARGPARSE_end () ARGPARSE_end ()
}; };
/* The list of supported debug flags. */
static struct debug_flags_s debug_flags [] =
{
{ DBG_PACKET_VALUE , "packet" },
{ DBG_MPI_VALUE , "mpi" },
{ DBG_CRYPTO_VALUE , "crypto" },
{ DBG_FILTER_VALUE , "filter" },
{ DBG_IOBUF_VALUE , "iobuf" },
{ DBG_MEMORY_VALUE , "memory" },
{ DBG_CACHE_VALUE , "cache" },
{ DBG_MEMSTAT_VALUE, "memstat" },
{ DBG_TRUST_VALUE , "trust" },
{ DBG_HASHING_VALUE, "hashing" },
{ DBG_IPC_VALUE , "ipc" },
{ DBG_CLOCK_VALUE , "clock" },
{ DBG_LOOKUP_VALUE , "lookup" },
{ DBG_EXTPROG_VALUE, "extprog" },
{ 0, NULL }
};
int g10_errors_seen = 0; int g10_errors_seen = 0;
@ -192,12 +216,25 @@ main( int argc, char **argv )
opt.list_sigs=1; opt.list_sigs=1;
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose); gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
break; break;
case oDebug:
if (parse_debug_flag (pargs.r.ret_str, &opt.debug, debug_flags))
{
pargs.r_opt = ARGPARSE_INVALID_ARG;
pargs.err = ARGPARSE_PRINT_ERROR;
}
break;
case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break; case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
case oOutput: opt.outfile = pargs.r.ret_str; break; case oOutput: opt.outfile = pargs.r.ret_str; break;
case oStatusFD: set_status_fd( pargs.r.ret_int ); break; case oStatusFD: set_status_fd( pargs.r.ret_int ); break;
case oLoggerFD: case oLoggerFD:
log_set_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1)); log_set_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
break; break;
case oLoggerFile:
log_set_file (pargs.r.ret_str);
log_set_prefix (NULL, (GPGRT_LOG_WITH_PREFIX
| GPGRT_LOG_WITH_TIME
| GPGRT_LOG_WITH_PID) );
break;
case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break; case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break;
case oWeakDigest: case oWeakDigest:
additional_weak_digest(pargs.r.ret_str); additional_weak_digest(pargs.r.ret_str);