aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2011-12-13 16:59:00 +0000
committerWerner Koch <[email protected]>2011-12-13 16:59:00 +0000
commit00c760f628f4cf0fc11e79d305c172f98123f815 (patch)
treeab9ddf55a16d46de5087273650beadd5f68371fa
parentscd: Introduce a virtual reader table. (diff)
downloadgnupg-00c760f628f4cf0fc11e79d305c172f98123f815.tar.gz
gnupg-00c760f628f4cf0fc11e79d305c172f98123f815.zip
scd: New option --debug-assuan-log-cats.
* scd/scdaemon.c (oDebugAssuanLogCats): New. (opts): Add option --debug-assuan-log-cats. (main): Implement option. * common/asshelp.c (set_libassuan_log_cats): New. -- The old way of setting the logging categories with an environment variable is awkward if sdaemon is spawned from a running gpg-agent.
-rw-r--r--common/asshelp.c13
-rw-r--r--common/asshelp.h1
-rw-r--r--doc/scdaemon.texi47
-rw-r--r--scd/scdaemon.c5
4 files changed, 47 insertions, 19 deletions
diff --git a/common/asshelp.c b/common/asshelp.c
index c5d8bdf84..7ac6ff0cc 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -97,6 +97,19 @@ setup_libassuan_logging (unsigned int *debug_var_address)
assuan_set_log_cb (my_libassuan_log_handler, debug_var_address);
}
+/* Change the Libassuan log categories to those given by NEWCATS.
+ NEWCATS is 0 the default category of ASSUAN_LOG_CONTROL is
+ selected. Note, that setup_libassuan_logging overrides the values
+ given here. */
+void
+set_libassuan_log_cats (unsigned int newcats)
+{
+ if (newcats)
+ log_cats = newcats;
+ else /* Default to log the control channel. */
+ log_cats = (1 << (ASSUAN_LOG_CONTROL - 1));
+}
+
static gpg_error_t
diff --git a/common/asshelp.h b/common/asshelp.h
index 0eb6553f9..728c03949 100644
--- a/common/asshelp.h
+++ b/common/asshelp.h
@@ -26,6 +26,7 @@
#include "session-env.h"
void setup_libassuan_logging (unsigned int *debug_var_address);
+void set_libassuan_log_cats (unsigned int newcats);
gpg_error_t
diff --git a/doc/scdaemon.texi b/doc/scdaemon.texi
index 3c8427997..9184ce202 100644
--- a/doc/scdaemon.texi
+++ b/doc/scdaemon.texi
@@ -21,16 +21,16 @@
.IR dir ]
.RB [ \-\-options
.IR file ]
-.RI [ options ]
-.B \-\-server
+.RI [ options ]
+.B \-\-server
.br
.B scdaemon
.RB [ \-\-homedir
.IR dir ]
.RB [ \-\-options
.IR file ]
-.RI [ options ]
-.B \-\-daemon
+.RI [ options ]
+.B \-\-daemon
.RI [ command_line ]
@end ifset
@@ -130,7 +130,7 @@ a numeric value or a keyword:
@item none
No debugging at all. A value of less than 1 may be used instead of
the keyword.
-@item basic
+@item basic
Some basic debug messages. A value between 1 and 2 may be used
instead of the keyword.
@item advanced
@@ -165,8 +165,8 @@ usual C-Syntax. The currently defined bits are:
@table @code
@item 0 (1)
command I/O
-@item 1 (2)
-values of big number integers
+@item 1 (2)
+values of big number integers
@item 2 (4)
low level crypto operations
@item 5 (32)
@@ -178,7 +178,7 @@ show memory statistics.
@item 9 (512)
write hashed data to files named @code{dbgmd-000*}
@item 10 (1024)
-trace Assuan protocol
+trace Assuan protocol. See also option @option{--debug-assuan-log-cats}.
@item 11 (2048)
trace APDU I/O to the card. This may reveal sensitive data.
@end table
@@ -215,6 +215,15 @@ dump. This options enables it and also changes the working directory to
@opindex debug-log-tid
This option appends a thread ID to the PID in the log output.
+@item --debug-assuan-log-cats @var{cats}
+@opindex debug-assuan-log-cats
+Changes the active Libassuan logging categories to @var{cats}. The
+value for @var{cats} is an unsigned integer given in usual C-Syntax.
+A value of of 0 switches to a default category. If this option is not
+used the categories are taken from the environment variable
+@samp{ASSUAN_DEBUG}. Note that this option has only an effect if the
+Assuan debug flag has also been with the option @option{--debug}. For
+a list of categories see the Libassuan manual.
@item --no-detach
@opindex no-detach
@@ -240,7 +249,7 @@ Use @var{library} to access the smartcard reader. The current default
is @file{libtowitoko.so}. Note that the use of this interface is
deprecated; it may be removed in future releases.
-@item --disable-ccid
+@item --disable-ccid
@opindex disable-ccid
Disable the integrated support for CCID compliant readers. This
allows to fall back to one of the other drivers even if the internal
@@ -325,7 +334,7 @@ stripping off the two leading dashes.
This application is currently only used by @command{gpg} but may in
future also be useful with @command{gpgsm}. Version 1 and version 2 of
-the card is supported.
+the card is supported.
The specifications for these cards are available at
@uref{http://g10code.com/docs/openpgp-card-1.0.pdf} and
@@ -395,7 +404,7 @@ about reader status changes. Its use is now deprecated in favor of
@end table
-@c
+@c
@c Examples
@c
@mansect examples
@@ -410,7 +419,7 @@ $ scdaemon --server -v
@c man end
-@c
+@c
@c Assuan Protocol
@c
@manpause
@@ -447,7 +456,7 @@ synchronizing access to a token between sessions.
* Scdaemon APDU:: Send a verbatim APDU to the card
@end menu
-@node Scdaemon SERIALNO
+@node Scdaemon SERIALNO
@subsection Return the serial number
This command should be used to check for the presence of a card. It is
@@ -470,7 +479,7 @@ Return the serial number of the card using a status response like:
@end example
The trailing 0 should be ignored for now, it is reserved for a future
-extension. The serial number is the hex encoded value identified by
+extension. The serial number is the hex encoded value identified by
the @code{0x5A} tag in the GDO file (FIX=0x2F02).
@@ -522,7 +531,7 @@ READKEY @var{hexified_certid}
@end example
Return the public key for the given cert or key ID as an standard
-S-Expression.
+S-Expression.
@@ -619,7 +628,7 @@ TO BE WRITTEN.
@example
PASSWD [--reset] [--nullpin] @var{chvno}
@end example
-
+
Change the PIN or reset the retry counter of the card holder
verification vector number @var{chvno}. The option @option{--nullpin}
is used to initialize the PIN of TCOS cards (6 byte NullPIN only).
@@ -663,11 +672,11 @@ and only if the retry counter is still at 3.
Restart the current connection; this is a kind of warm reset. It
deletes the context used by this connection but does not actually
-reset the card.
+reset the card.
This is used by gpg-agent to reuse a primary pipe connection and
may be used by clients to backup from a conflict in the serial
-command; i.e. to select another application.
+command; i.e. to select another application.
@@ -704,7 +713,7 @@ length up to N bytes. If N is not given a default value is used
@mansect see also
@ifset isman
@command{gpg-agent}(1),
-@command{gpgsm}(1),
+@command{gpgsm}(1),
@command{gpg2}(1)
@end ifset
@include see-also-note.texi
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index b4eee396e..c8905d4f0 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -72,6 +72,7 @@ enum cmd_and_opt_values
oDebugAllowCoreDump,
oDebugCCIDDriver,
oDebugLogTid,
+ oDebugAssuanLogCats,
oNoGreeting,
oNoOptions,
oHomedir,
@@ -121,6 +122,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_n (oDebugCCIDDriver, "debug-ccid-driver", "@"),
ARGPARSE_s_n (oDebugDisableTicker, "debug-disable-ticker", "@"),
ARGPARSE_s_n (oDebugLogTid, "debug-log-tid", "@"),
+ ARGPARSE_p_u (oDebugAssuanLogCats, "debug-assuan-log-cats", "@"),
ARGPARSE_s_n (oNoDetach, "no-detach", N_("do not detach from the console")),
ARGPARSE_s_s (oLogFile, "log-file", N_("|FILE|write a log to FILE")),
ARGPARSE_s_s (oReaderPort, "reader-port",
@@ -553,6 +555,9 @@ main (int argc, char **argv )
case oDebugLogTid:
log_set_pid_suffix_cb (tid_log_callback);
break;
+ case oDebugAssuanLogCats:
+ set_libassuan_log_cats (pargs.r.ret_ulong);
+ break;
case oOptions:
/* config files may not be nested (silently ignore them) */