# HG changeset patch # User Matt Johnston # Date 1092844105 0 # Node ID c85c88500ea607946954ff8adfe5afeafa5977ef # Parent 5dda5a4d475c47eca5c951ac7b6362c7bd15a98b DEBUG_TRACE now only triggers with -v on the cmdline diff -r 5dda5a4d475c -r c85c88500ea6 cli-runopts.c --- a/cli-runopts.c Wed Aug 18 12:42:21 2004 +0000 +++ b/cli-runopts.c Wed Aug 18 15:48:25 2004 +0000 @@ -59,6 +59,9 @@ "-R Remote port forwarding\n" #endif "-l \n" +#ifdef DEBUG_TRACE + "-v verbose\n" +#endif ,DROPBEAR_VERSION, cli_opts.progname); } @@ -178,6 +181,11 @@ printhelp(); exit(EXIT_SUCCESS); break; +#ifdef DEBUG_TRACE + case 'v': + debug_trace = 1; + break; +#endif case 'F': case 'e': case 'c': diff -r 5dda5a4d475c -r c85c88500ea6 dbutil.c --- a/dbutil.c Wed Aug 18 12:42:21 2004 +0000 +++ b/dbutil.c Wed Aug 18 15:48:25 2004 +0000 @@ -66,6 +66,10 @@ void (*_dropbear_log)(int priority, const char* format, va_list param) = generic_dropbear_log; +#ifdef DEBUG_TRACE +int debug_trace = 0; +#endif + int usingsyslog = 0; /* set by runopts, but required externally to sessions */ #ifndef DISABLE_SYSLOG void startsyslog() { @@ -134,6 +138,10 @@ va_list param; + if (!debug_trace) { + return; + } + va_start(param, format); fprintf(stderr, "TRACE: "); vfprintf(stderr, format, param); diff -r 5dda5a4d475c -r c85c88500ea6 dbutil.h --- a/dbutil.h Wed Aug 18 12:42:21 2004 +0000 +++ b/dbutil.h Wed Aug 18 15:48:25 2004 +0000 @@ -42,6 +42,7 @@ #ifdef DEBUG_TRACE void dropbear_trace(const char* format, ...); void printhex(unsigned char* buf, int len); +extern int debug_trace; #endif char * stripcontrol(const char * text); unsigned char * getaddrstring(struct sockaddr_storage* addr, int withport); diff -r 5dda5a4d475c -r c85c88500ea6 debug.h --- a/debug.h Wed Aug 18 12:42:21 2004 +0000 +++ b/debug.h Wed Aug 18 15:48:25 2004 +0000 @@ -33,9 +33,11 @@ * etc. Don't use this normally, it might cause problems */ /* #define DEBUG_VALGRIND */ -/* Define this to print trace statements - very verbose */ -/* Caution: Don't use this in an unfriendly environment (ie unfirewalled), - * since the printing does not sanitise strings etc */ +/* Define this to compile in trace debugging printf()s. You'll need to + * run programs with "-v" to turn this on. + * Caution: Don't use this in an unfriendly environment (ie unfirewalled), + * since the printing may not sanitise strings etc. This will add a reasonable + * amount to your executable size. */ /* #define DEBUG_TRACE */ /* All functions writing to the cleartext payload buffer call diff -r 5dda5a4d475c -r c85c88500ea6 dropbearconvert.c --- a/dropbearconvert.c Wed Aug 18 12:42:21 2004 +0000 +++ b/dropbearconvert.c Wed Aug 18 15:48:25 2004 +0000 @@ -62,6 +62,11 @@ const char* infile; const char* outfile; +#ifdef DEBUG_TRACE + /* It's hard for it to get in the way _too_ much */ + debug_trace = 1; +#endif + /* get the commandline options */ if (argc != 5) { fprintf(stderr, "All arguments must be specified\n"); diff -r 5dda5a4d475c -r c85c88500ea6 dropbearkey.c --- a/dropbearkey.c Wed Aug 18 12:42:21 2004 +0000 +++ b/dropbearkey.c Wed Aug 18 15:48:25 2004 +0000 @@ -75,8 +75,11 @@ #endif "-f filename Use filename for the secret key\n" "-s bits Key size in bits, should be a multiple of 8 (optional)\n" - "-y Just print the publickey and fingerprint for the\n private key in .\n", - progname); + "-y Just print the publickey and fingerprint for the\n private key in .\n" +#ifdef DEBUG_TRACE + "-v verbose\n" +#endif + ,progname); } #if defined(DBMULTI_dropbearkey) || !defined(DROPBEAR_MULTI) @@ -127,6 +130,11 @@ printhelp(argv[0]); exit(EXIT_SUCCESS); break; +#ifdef DEBUG_TRACE + case 'v': + debug_trace = 1; + break; +#endif default: fprintf(stderr, "Unknown argument %s\n", argv[i]); printhelp(argv[0]); diff -r 5dda5a4d475c -r c85c88500ea6 svr-runopts.c --- a/svr-runopts.c Wed Aug 18 12:42:21 2004 +0000 +++ b/svr-runopts.c Wed Aug 18 15:48:25 2004 +0000 @@ -76,6 +76,9 @@ #ifdef INETD_MODE "-i Start for inetd\n" #endif +#ifdef DEBUG_TRACE + "-v verbose\n" +#endif ,DROPBEAR_VERSION, progname, #ifdef DROPBEAR_DSS DSS_PRIV_FILENAME, @@ -193,6 +196,11 @@ printhelp(argv[0]); exit(EXIT_FAILURE); break; +#ifdef DEBUG_TRACE + case 'v': + debug_trace = 1; + break; +#endif /* case '4': svr_opts.ipv4 = 0;