aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS6
-rw-r--r--agent/ChangeLog5
-rw-r--r--agent/gpg-agent.c34
-rw-r--r--doc/gpg-agent.texi34
-rw-r--r--doc/gpg.texi28
-rw-r--r--doc/gpgsm.texi18
-rw-r--r--doc/scdaemon.texi20
-rw-r--r--g10/ChangeLog5
-rw-r--r--g10/gpg.c39
-rw-r--r--g13/g13.c27
-rw-r--r--scd/ChangeLog5
-rw-r--r--scd/scdaemon.c35
-rw-r--r--sm/ChangeLog5
-rw-r--r--sm/gpgsm.c36
14 files changed, 237 insertions, 60 deletions
diff --git a/NEWS b/NEWS
index 80013815d..070939b66 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
-Noteworthy changes in version 2.1 (under development)
--------------------------------------------------
+Noteworthy changes in version 2.1.x (under development)
+-------------------------------------------------------
* Encrypted OpenPGP messages with trailing data (e.g. other OpenPGP
packets) are now correctly parsed.
@@ -8,6 +8,8 @@ Noteworthy changes in version 2.1 (under development)
* The G13 tool for disk encryption key management has been added.
+ * Numerical values may now be used as an alternative to the
+ debug-level keywords.
Noteworthy changes in version 2.0.13 (2009-09-04)
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 139360d77..1c1c6e8e7 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-03 Werner Koch <[email protected]>
+
+ * gpg-agent.c (set_debug): Allow for numerical debug leveles. Print
+ active debug flags.
+
2009-12-02 Werner Koch <[email protected]>
* trustlist.c (read_trustfiles): Store the pointer returned from
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 07e620735..73f84ed82 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -361,19 +361,30 @@ my_strusage (int level)
static void
set_debug (void)
{
+ int numok = (debug_level && digitp (debug_level));
+ int numlvl = numok? atoi (debug_level) : 0;
+
if (!debug_level)
;
- else if (!strcmp (debug_level, "none"))
+ else if (!strcmp (debug_level, "none") || (numok && numlvl < 1))
opt.debug = 0;
- else if (!strcmp (debug_level, "basic"))
+ else if (!strcmp (debug_level, "basic") || (numok && numlvl <= 2))
opt.debug = DBG_ASSUAN_VALUE;
- else if (!strcmp (debug_level, "advanced"))
+ else if (!strcmp (debug_level, "advanced") || (numok && numlvl <= 5))
opt.debug = DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE;
- else if (!strcmp (debug_level, "expert"))
+ else if (!strcmp (debug_level, "expert") || (numok && numlvl <= 8))
opt.debug = (DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE
|DBG_CACHE_VALUE);
- else if (!strcmp (debug_level, "guru"))
- opt.debug = ~0;
+ else if (!strcmp (debug_level, "guru") || numok)
+ {
+ opt.debug = ~0;
+ /* Unless the "guru" string has been used we don't want to allow
+ hashing debugging. The rationale is that people tend to
+ select the highest debug value and would then clutter their
+ disk with debug files which may reveal confidential data. */
+ if (numok)
+ opt.debug &= ~(DBG_HASHING_VALUE);
+ }
else
{
log_error (_("invalid debug-level `%s' given\n"), debug_level);
@@ -391,6 +402,17 @@ set_debug (void)
if (opt.debug & DBG_CRYPTO_VALUE )
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1);
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
+
+ if (opt.debug)
+ log_info ("enabled debug flags:%s%s%s%s%s%s%s%s\n",
+ (opt.debug & DBG_COMMAND_VALUE)? " command":"",
+ (opt.debug & DBG_MPI_VALUE )? " mpi":"",
+ (opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
+ (opt.debug & DBG_MEMORY_VALUE )? " memory":"",
+ (opt.debug & DBG_CACHE_VALUE )? " cache":"",
+ (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
+ (opt.debug & DBG_HASHING_VALUE)? " hashing":"",
+ (opt.debug & DBG_ASSUAN_VALUE )? " assuan":"");
}
diff --git a/doc/gpg-agent.texi b/doc/gpg-agent.texi
index 74a30591f..344f41250 100644
--- a/doc/gpg-agent.texi
+++ b/doc/gpg-agent.texi
@@ -213,20 +213,26 @@ forth to @var{epoch} which is the number of seconds elapsed since the year
@item --debug-level @var{level}
@opindex debug-level
Select the debug level for investigating problems. @var{level} may be
-one of:
-
- @table @code
- @item none
- no debugging at all.
- @item basic
- some basic debug messages
- @item advanced
- more verbose debug messages
- @item expert
- even more detailed messages
- @item guru
- all of the debug messages you can get
- @end table
+a numeric value or a keyword:
+
+@table @code
+@item none
+No debugging at all. A value of less than 1 may be used instead of
+the keyword.
+@item basic
+Some basic debug messages. A value between 1 and 2 may be used
+instead of the keyword.
+@item advanced
+More verbose debug messages. A value between 3 and 5 may be used
+instead of the keyword.
+@item expert
+Even more detailed messages. A value between 6 and 8 may be used
+instead of the keyword.
+@item guru
+All of the debug messages you can get. A value greater than 8 may be
+used instead of the keyword. The creation of hash tracing files is
+only enabled if the keyword is used.
+@end table
How these messages are mapped to the actual debugging flags is not
specified and may change with newer releases of this program. They are
diff --git a/doc/gpg.texi b/doc/gpg.texi
index 8ec755648..b405e5b71 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -2146,6 +2146,34 @@ therefore enables a fast listing of the encryption keys.
@opindex interactive
Prompt before overwriting any files.
+@item --debug-level @var{level}
+@opindex debug-level
+Select the debug level for investigating problems. @var{level} may be
+a numeric value or by a keyword:
+
+@table @code
+@item none
+No debugging at all. A value of less than 1 may be used instead of
+the keyword.
+@item basic
+Some basic debug messages. A value between 1 and 2 may be used
+instead of the keyword.
+@item advanced
+More verbose debug messages. A value between 3 and 5 may be used
+instead of the keyword.
+@item expert
+Even more detailed messages. A value between 6 and 8 may be used
+instead of the keyword.
+@item guru
+All of the debug messages you can get. A value greater than 8 may be
+used instead of the keyword. The creation of hash tracing files is
+only enabled if the keyword is used.
+@end table
+
+How these messages are mapped to the actual debugging flags is not
+specified and may change with newer releases of this program. They are
+however carefully selected to best aid in debugging.
+
@item --debug @var{flags}
@opindex debug
Set debugging flags. All flags are or-ed and @var{flags} may
diff --git a/doc/gpgsm.texi b/doc/gpgsm.texi
index 5835c7213..ffa325aa8 100644
--- a/doc/gpgsm.texi
+++ b/doc/gpgsm.texi
@@ -617,19 +617,25 @@ is given as fingerprint or keygrip.
@item --debug-level @var{level}
@opindex debug-level
Select the debug level for investigating problems. @var{level} may be
-one of:
+a numeric value or by a keyword:
@table @code
@item none
-no debugging at all.
+No debugging at all. A value of less than 1 may be used instead of
+the keyword.
@item basic
-some basic debug messages
+Some basic debug messages. A value between 1 and 2 may be used
+instead of the keyword.
@item advanced
-more verbose debug messages
+More verbose debug messages. A value between 3 and 5 may be used
+instead of the keyword.
@item expert
-even more detailed messages
+Even more detailed messages. A value between 6 and 8 may be used
+instead of the keyword.
@item guru
-all of the debug messages you can get
+All of the debug messages you can get. A value greater than 8 may be
+used instead of the keyword. The creation of hash tracing files is
+only enabled if the keyword is used.
@end table
How these messages are mapped to the actual debugging flags is not
diff --git a/doc/scdaemon.texi b/doc/scdaemon.texi
index 86ce9c03b..3c8427997 100644
--- a/doc/scdaemon.texi
+++ b/doc/scdaemon.texi
@@ -123,20 +123,26 @@ verbose commands to @command{gpgsm}, such as @samp{-vv}.
@item --debug-level @var{level}
@opindex debug-level
-Select the debug level for investigating problems. @var{level} may be
-one of:
+Select the debug level for investigating problems. @var{level} may be
+a numeric value or a keyword:
@table @code
@item none
-no debugging at all.
+No debugging at all. A value of less than 1 may be used instead of
+the keyword.
@item basic
-some basic debug messages
+Some basic debug messages. A value between 1 and 2 may be used
+instead of the keyword.
@item advanced
-more verbose debug messages
+More verbose debug messages. A value between 3 and 5 may be used
+instead of the keyword.
@item expert
-even more detailed messages
+Even more detailed messages. A value between 6 and 8 may be used
+instead of the keyword.
@item guru
-all of the debug messages you can get
+All of the debug messages you can get. A value greater than 8 may be
+used instead of the keyword. The creation of hash tracing files is
+only enabled if the keyword is used.
@end table
How these messages are mapped to the actual debugging flags is not
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 67a2eeafa..044369d06 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-03 Werner Koch <[email protected]>
+
+ * gpg.c (set_debug): Allow for numerical debug leveles. Print
+ active debug flags.
+
2009-11-27 Werner Koch <[email protected]>
* keyedit.c (cmds, keyedit_menu): New command "checkbkupkey".
diff --git a/g10/gpg.c b/g10/gpg.c
index 720c9f4d8..dc46016b8 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -976,19 +976,30 @@ set_opt_session_env (const char *name, const char *value)
static void
set_debug (const char *level)
{
+ int numok = (level && digitp (level));
+ int numlvl = numok? atoi (level) : 0;
+
if (!level)
;
- else if (!strcmp (level, "none"))
+ else if (!strcmp (level, "none") || (numok && numlvl < 1))
opt.debug = 0;
- else if (!strcmp (level, "basic"))
+ else if (!strcmp (level, "basic") || (numok && numlvl <= 2))
opt.debug = DBG_MEMSTAT_VALUE;
- else if (!strcmp (level, "advanced"))
+ else if (!strcmp (level, "advanced") || (numok && numlvl <= 5))
opt.debug = DBG_MEMSTAT_VALUE|DBG_TRUST_VALUE|DBG_EXTPROG_VALUE;
- else if (!strcmp (level, "expert"))
+ else if (!strcmp (level, "expert") || (numok && numlvl <= 8))
opt.debug = (DBG_MEMSTAT_VALUE|DBG_TRUST_VALUE|DBG_EXTPROG_VALUE
|DBG_CACHE_VALUE|DBG_FILTER_VALUE|DBG_PACKET_VALUE);
- else if (!strcmp (level, "guru"))
- opt.debug = ~0;
+ else if (!strcmp (level, "guru") || numok)
+ {
+ opt.debug = ~0;
+ /* Unless the "guru" string has been used we don't want to allow
+ hashing debugging. The rationale is that people tend to
+ select the highest debug value and would then clutter their
+ disk with debug files which may reveal confidential data. */
+ if (numok)
+ opt.debug &= ~(DBG_HASHING_VALUE);
+ }
else
{
log_error (_("invalid debug-level `%s' given\n"), level);
@@ -1006,6 +1017,22 @@ set_debug (const char *level)
if (opt.debug & DBG_IOBUF_VALUE )
iobuf_debug_mode = 1;
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
+
+ if (opt.debug)
+ log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ (opt.debug & DBG_PACKET_VALUE )? " packet":"",
+ (opt.debug & DBG_MPI_VALUE )? " mpi":"",
+ (opt.debug & DBG_CIPHER_VALUE )? " cipher":"",
+ (opt.debug & DBG_FILTER_VALUE )? " filter":"",
+ (opt.debug & DBG_IOBUF_VALUE )? " iobuf":"",
+ (opt.debug & DBG_MEMORY_VALUE )? " memory":"",
+ (opt.debug & DBG_CACHE_VALUE )? " cache":"",
+ (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
+ (opt.debug & DBG_TRUST_VALUE )? " trust":"",
+ (opt.debug & DBG_HASHING_VALUE)? " hashing":"",
+ (opt.debug & DBG_EXTPROG_VALUE)? " extprog":"",
+ (opt.debug & DBG_CARD_IO_VALUE)? " cardio":"",
+ (opt.debug & DBG_ASSUAN_VALUE )? " assuan":"");
}
diff --git a/g13/g13.c b/g13/g13.c
index 8444b197e..5058d2c46 100644
--- a/g13/g13.c
+++ b/g13/g13.c
@@ -258,18 +258,25 @@ wrong_args (const char *text)
static void
set_debug (void)
{
+ int numok = (debug_level && digitp (debug_level));
+ int numlvl = numok? atoi (debug_level) : 0;
+
if (!debug_level)
;
- else if (!strcmp (debug_level, "none"))
+ else if (!strcmp (debug_level, "none") || (numok && numlvl < 1))
opt.debug = 0;
- else if (!strcmp (debug_level, "basic"))
+ else if (!strcmp (debug_level, "basic") || (numok && numlvl <= 2))
opt.debug = DBG_ASSUAN_VALUE|DBG_MOUNT_VALUE;
- else if (!strcmp (debug_level, "advanced"))
+ else if (!strcmp (debug_level, "advanced") || (numok && numlvl <= 5))
opt.debug = DBG_ASSUAN_VALUE|DBG_MOUNT_VALUE;
- else if (!strcmp (debug_level, "expert"))
+ else if (!strcmp (debug_level, "expert") || (numok && numlvl <= 8))
opt.debug = (DBG_ASSUAN_VALUE|DBG_MOUNT_VALUE|DBG_CRYPTO_VALUE);
- else if (!strcmp (debug_level, "guru"))
- opt.debug = ~0;
+ else if (!strcmp (debug_level, "guru") || numok)
+ {
+ opt.debug = ~0;
+ /* if (numok) */
+ /* opt.debug &= ~(DBG_HASHING_VALUE); */
+ }
else
{
log_error (_("invalid debug-level `%s' given\n"), debug_level);
@@ -286,6 +293,14 @@ set_debug (void)
if (opt.debug & DBG_CRYPTO_VALUE )
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1);
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
+
+ if (opt.debug)
+ log_info ("enabled debug flags:%s%s%s%s%s\n",
+ (opt.debug & DBG_MOUNT_VALUE )? " mount":"",
+ (opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
+ (opt.debug & DBG_MEMORY_VALUE )? " memory":"",
+ (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
+ (opt.debug & DBG_ASSUAN_VALUE )? " assuan":"");
}
diff --git a/scd/ChangeLog b/scd/ChangeLog
index 965e07bbb..fed5e0e46 100644
--- a/scd/ChangeLog
+++ b/scd/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-03 Werner Koch <[email protected]>
+
+ * scdaemon.c (set_debug): Allow for numerical debug leveles. Print
+ active debug flags.
+
2009-11-25 Marcus Brinkmann <[email protected]>
* command.c (scd_command_handler): Use assuan_fd_t and
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 5823c9948..fd7d6a22f 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -289,19 +289,30 @@ tid_log_callback (void)
static void
set_debug (const char *level)
{
+ int numok = (level && digitp (level));
+ int numlvl = numok? atoi (level) : 0;
+
if (!level)
;
- else if (!strcmp (level, "none"))
+ else if (!strcmp (level, "none") || (numok && numlvl < 1))
opt.debug = 0;
- else if (!strcmp (level, "basic"))
+ else if (!strcmp (level, "basic") || (numok && numlvl <= 2))
opt.debug = DBG_ASSUAN_VALUE;
- else if (!strcmp (level, "advanced"))
+ else if (!strcmp (level, "advanced") || (numok && numlvl <= 5))
opt.debug = DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE;
- else if (!strcmp (level, "expert"))
+ else if (!strcmp (level, "expert") || (numok && numlvl <= 8))
opt.debug = (DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE
|DBG_CACHE_VALUE|DBG_CARD_IO_VALUE);
- else if (!strcmp (level, "guru"))
- opt.debug = ~0;
+ else if (!strcmp (level, "guru") || numok)
+ {
+ opt.debug = ~0;
+ /* Unless the "guru" string has been used we don't want to allow
+ hashing debugging. The rationale is that people tend to
+ select the highest debug value and would then clutter their
+ disk with debug files which may reveal confidential data. */
+ if (numok)
+ opt.debug &= ~(DBG_HASHING_VALUE);
+ }
else
{
log_error (_("invalid debug-level `%s' given\n"), level);
@@ -319,6 +330,18 @@ set_debug (const char *level)
if (opt.debug & DBG_CRYPTO_VALUE )
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1);
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
+
+ if (opt.debug)
+ log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s\n",
+ (opt.debug & DBG_COMMAND_VALUE)? " command":"",
+ (opt.debug & DBG_MPI_VALUE )? " mpi":"",
+ (opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
+ (opt.debug & DBG_MEMORY_VALUE )? " memory":"",
+ (opt.debug & DBG_CACHE_VALUE )? " cache":"",
+ (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
+ (opt.debug & DBG_HASHING_VALUE)? " hashing":"",
+ (opt.debug & DBG_ASSUAN_VALUE )? " assuan":"",
+ (opt.debug & DBG_CARD_IO_VALUE)? " cardio":"");
}
diff --git a/sm/ChangeLog b/sm/ChangeLog
index 167316330..39ae4df40 100644
--- a/sm/ChangeLog
+++ b/sm/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-03 Werner Koch <[email protected]>
+
+ * gpgsm.c (set_debug): Allow for numerical debug leveles. Print
+ active debug flags.
+
2009-12-02 Werner Koch <[email protected]>
* verify.c (gpgsm_verify): Add audit info on hash algorithms.
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index 6e7cd8406..834bcce23 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -648,23 +648,34 @@ set_opt_session_env (const char *name, const char *value)
static void
set_debug (void)
{
+ int numok = (debug_level && digitp (debug_level));
+ int numlvl = numok? atoi (debug_level) : 0;
+
if (!debug_level)
;
- else if (!strcmp (debug_level, "none"))
+ else if (!strcmp (debug_level, "none") || (numok && numlvl < 1))
opt.debug = 0;
- else if (!strcmp (debug_level, "basic"))
+ else if (!strcmp (debug_level, "basic") || (numok && numlvl <= 2))
opt.debug = DBG_ASSUAN_VALUE;
- else if (!strcmp (debug_level, "advanced"))
+ else if (!strcmp (debug_level, "advanced") || (numok && numlvl <= 5))
opt.debug = DBG_ASSUAN_VALUE|DBG_X509_VALUE;
- else if (!strcmp (debug_level, "expert"))
+ else if (!strcmp (debug_level, "expert") || (numok && numlvl <= 8))
opt.debug = (DBG_ASSUAN_VALUE|DBG_X509_VALUE
|DBG_CACHE_VALUE|DBG_CRYPTO_VALUE);
- else if (!strcmp (debug_level, "guru"))
- opt.debug = ~0;
+ else if (!strcmp (debug_level, "guru") || numok)
+ {
+ opt.debug = ~0;
+ /* Unless the "guru" string has been used we don't want to allow
+ hashing debugging. The rationale is that people tend to
+ select the highest debug value and would then clutter their
+ disk with debug files which may reveal confidential data. */
+ if (numok)
+ opt.debug &= ~(DBG_HASHING_VALUE);
+ }
else
{
log_error (_("invalid debug-level `%s' given\n"), debug_level);
- gpgsm_exit(2);
+ gpgsm_exit (2);
}
opt.debug |= debug_value;
@@ -679,6 +690,17 @@ set_debug (void)
if (opt.debug & DBG_CRYPTO_VALUE )
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1);
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
+
+ if (opt.debug)
+ log_info ("enabled debug flags:%s%s%s%s%s%s%s%s\n",
+ (opt.debug & DBG_X509_VALUE )? " x509":"",
+ (opt.debug & DBG_MPI_VALUE )? " mpi":"",
+ (opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
+ (opt.debug & DBG_MEMORY_VALUE )? " memory":"",
+ (opt.debug & DBG_CACHE_VALUE )? " cache":"",
+ (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
+ (opt.debug & DBG_HASHING_VALUE)? " hashing":"",
+ (opt.debug & DBG_ASSUAN_VALUE )? " assuan":"" );
}