From d142639e38d5e2538ad79e50348616843b3712e1 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Thu, 24 Mar 2022 14:44:13 +0800 Subject: [PATCH] Add -v variable debug levels for server too -vvvv is equivalent to the old -v --- debug.h | 2 ++ dropbearconvert.c | 2 +- dropbearkey.c | 2 +- fuzz/fuzz-harness.c | 4 ++-- svr-runopts.c | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/debug.h b/debug.h index fcc0367..ab32fbd 100644 --- a/debug.h +++ b/debug.h @@ -48,6 +48,8 @@ /*#define DEBUG_KEXHASH*/ /*#define DEBUG_RSA*/ +/* The level of TRACE() statements */ +#define DROPBEAR_VERBOSE_LEVEL 4 #if DEBUG_TRACE extern int debug_trace; diff --git a/dropbearconvert.c b/dropbearconvert.c index 7285f23..950608b 100644 --- a/dropbearconvert.c +++ b/dropbearconvert.c @@ -69,7 +69,7 @@ int main(int argc, char ** argv) { #if DEBUG_TRACE /* It's hard for it to get in the way _too_ much */ - debug_trace = 1; + debug_trace = DROPBEAR_VERBOSE_LEVEL; #endif /* get the commandline options */ diff --git a/dropbearkey.c b/dropbearkey.c index 8d8c7c2..6d38901 100644 --- a/dropbearkey.c +++ b/dropbearkey.c @@ -195,7 +195,7 @@ int main(int argc, char ** argv) { break; #if DEBUG_TRACE case 'v': - debug_trace = 1; + debug_trace = DROPBEAR_VERBOSE_LEVEL; break; #endif default: diff --git a/fuzz/fuzz-harness.c b/fuzz/fuzz-harness.c index 2c661d9..40c8366 100644 --- a/fuzz/fuzz-harness.c +++ b/fuzz/fuzz-harness.c @@ -12,8 +12,8 @@ int main(int argc, char ** argv) { for (i = 1; i < argc; i++) { #if DEBUG_TRACE if (strcmp(argv[i], "-v") == 0) { - debug_trace = 1; - TRACE(("debug printing on")) + debug_trace++; + fprintf(stderr, "debug level -> %d\n", debug_trace); } #endif if (strcmp(argv[i], "-q") == 0) { diff --git a/svr-runopts.c b/svr-runopts.c index ac43db1..301d68c 100644 --- a/svr-runopts.c +++ b/svr-runopts.c @@ -109,7 +109,7 @@ static void printhelp(const char * progname) { #endif "-V Version\n" #if DEBUG_TRACE - "-v verbose (compiled with DEBUG_TRACE)\n" + "-v verbose (repeat for more verbose)\n" #endif ,DROPBEAR_VERSION, progname, #if DROPBEAR_DSS @@ -310,7 +310,7 @@ void svr_getopts(int argc, char ** argv) { #endif #if DEBUG_TRACE case 'v': - debug_trace = 1; + debug_trace++; break; #endif case 'V':