From: Amos Jeffries Date: Thu, 27 Aug 2009 12:11:41 +0000 (+1200) Subject: Meld helper_debug into old debug. Now reserved for helepers X-Git-Tag: SQUID_3_2_0_1~741^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c19c2c0bf9fe61e3caf3406692f3acccfa40a2e3;p=thirdparty%2Fsquid.git Meld helper_debug into old debug. Now reserved for helepers --- diff --git a/compat/Makefile.am b/compat/Makefile.am index cf8c018e2b..3aa5b9751b 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -15,6 +15,7 @@ libcompat_la_SOURCES = \ assert.h \ compat.h \ compat_shared.h \ + debug.h \ fdsetsize.h \ osdetect.h \ stdvarargs.h \ @@ -37,6 +38,7 @@ libcompat_la_SOURCES = \ \ assert.cc \ compat.cc \ + debug.cc \ GnuRegex.h \ GnuRegex.c diff --git a/compat/compat.h b/compat/compat.h index 69f0be36eb..1600291711 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -80,7 +80,7 @@ /*****************************************************/ /* helper debugging requires some hacks to be clean */ -#include "compat/helper_debug.h" +#include "compat/debug.h" /* Valgrind API macros changed between two versions squid supports */ #include "compat/valgrind.h" diff --git a/compat/debug.cc b/compat/debug.cc new file mode 100644 index 0000000000..9d307d571a --- /dev/null +++ b/compat/debug.cc @@ -0,0 +1,4 @@ +#include "config.h" + +/* default off */ +int debug_enabled = 0; diff --git a/compat/helper_debug.h b/compat/debug.h similarity index 72% rename from compat/helper_debug.h rename to compat/debug.h index 59b5ff2428..01367403ad 100644 --- a/compat/helper_debug.h +++ b/compat/debug.h @@ -2,13 +2,13 @@ #include "config.h" #endif -#ifndef COMPAT_HELPER_DEBUG_H -#define COMPAT_HELPER_DEBUG_H +#ifndef COMPAT_DEBUG_H +#define COMPAT_DEBUG_H /* - * A debug method for use of external helpers. + * A debug method for use of external helpers and tools. * It shunts the debug messages down stderr for logging by Squid - * of display to the user instead of corrupting the stdout data stream. + * or display to the user instead of corrupting the stdout data stream. */ #if HAVE_STDIO_H @@ -25,7 +25,7 @@ SQUIDCEXTERN int debug_enabled; -#define helper_debug(X...) \ +#define debug(X...) \ if (debug_enabled) { \ fprintf(stderr, "%s(%d): pid=%ld :", __FILE__, __LINE__, (long)getpid() ); \ fprintf(stderr,X); \ @@ -35,11 +35,11 @@ SQUIDCEXTERN int debug_enabled; /* TODO: non-GCC compilers can't do the above macro define yet. */ inline void -helper_debug(char *format,...) +debug(char *format,...) { ; // nothing to do. } #endif -#endif /* COMPAT_HELPER_DEBUG_H */ +#endif /* COMPAT_DEBUG_H */ diff --git a/helpers/external_acl/wbinfo_group/wbinfo_group.pl b/helpers/external_acl/wbinfo_group/wbinfo_group.pl index 06e970a759..4df2cdccdc 100755 --- a/helpers/external_acl/wbinfo_group/wbinfo_group.pl +++ b/helpers/external_acl/wbinfo_group/wbinfo_group.pl @@ -34,7 +34,7 @@ use vars qw/ %opt /; # Disable output buffering -$|=1; +$|=1; sub debug { print STDERR "@_\n" if $opt{d}; @@ -86,7 +86,7 @@ print STDERR "Debugging mode ON.\n" if $opt{d}; # while () { chop; - &debug ("Got $_ from squid"); + &debug("Got $_ from squid"); ($user, @groups) = split(/\s+/); $user =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("c",hex($1))/eg; # test for each group squid send in it's request @@ -95,7 +95,7 @@ while () { $ans = &check($user, $group); last if $ans eq "OK"; } - &debug ("Sending $ans to squid"); + &debug("Sending $ans to squid"); print "$ans\n"; } diff --git a/helpers/ntlm_auth/smb_lm/libntlmssp.c b/helpers/ntlm_auth/smb_lm/libntlmssp.c index d6e58b5449..65bc9942ca 100644 --- a/helpers/ntlm_auth/smb_lm/libntlmssp.c +++ b/helpers/ntlm_auth/smb_lm/libntlmssp.c @@ -260,7 +260,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) pass[min(MAX_PASSWD_LEN,tmp.l)] = '\0'; #if 1 - debug ("Empty LM pass detection: user: '%s', ours:'%s', his: '%s'" + debug("Empty LM pass detection: user: '%s', ours:'%s', his: '%s'" "(length: %d)\n", user,lmencoded_empty_pass,tmp.str,tmp.l); if (memcmp(tmp.str,lmencoded_empty_pass,ENCODED_PASS_LEN)==0) { @@ -272,7 +272,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) tmp = ntlm_fetch_string ((char *) auth, auth_length, &auth->ntresponse); if (tmp.str != NULL && tmp.l != 0) { - debug ("Empty NT pass detection: user: '%s', ours:'%s', his: '%s'" + debug("Empty NT pass detection: user: '%s', ours:'%s', his: '%s'" "(length: %d)\n", user,ntencoded_empty_pass,tmp.str,tmp.l); if (memcmp(tmp.str,lmencoded_empty_pass,ENCODED_PASS_LEN)==0) { diff --git a/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.h b/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.h index 50a2aa199c..bfb296760c 100644 --- a/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.h +++ b/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.h @@ -41,32 +41,6 @@ /************* END CONFIGURATION ***************/ -#include - - -/* Debugging stuff */ -#ifndef debug /* already provided */ -#ifdef __GNUC__ /* this is really a gcc-ism */ -#ifdef DEBUG -#include -#include -static const char *__foo; -extern int debug_enabled; -#define debug(X...) if (debug_enabled) { \ - fprintf(stderr,"ntlm-auth[%ld](%s:%d): ", (long)getpid(), \ - ((__foo=strrchr(__FILE__,'/'))==NULL?__FILE__:__foo+1),\ - __LINE__);\ - fprintf(stderr,X); } -#else /* DEBUG */ -#define debug(X...) /* */ -#endif /* DEBUG */ -#else /* __GNUC__ */ -static void -debug(char *format,...) -{ -} -#endif -#endif /* debug already defined */ /* A couple of harmless helper macros */ #define SEND(X) debug("sending '%s' to squid\n",X); printf(X "\n"); diff --git a/helpers/url_rewrite/fake/fake.cc b/helpers/url_rewrite/fake/fake.cc index 218e189c9a..5b1a96e2da 100644 --- a/helpers/url_rewrite/fake/fake.cc +++ b/helpers/url_rewrite/fake/fake.cc @@ -75,7 +75,7 @@ main(int argc, char *argv[]) process_options(argc, argv); - helper_debug("%s build " __DATE__ ", " __TIME__ " starting up...\n", my_program_name); + debug("%s build " __DATE__ ", " __TIME__ " starting up...\n", my_program_name); while (fgets(buf, BUFFER_SIZE, stdin) != NULL) { @@ -86,11 +86,11 @@ main(int argc, char *argv[]) else buflen = strlen(buf); /* keep this so we only scan the buffer for \0 once per loop */ - helper_debug("Got %d bytes '%s' from Squid\n", buflen, buf); + debug("Got %d bytes '%s' from Squid\n", buflen, buf); /* send 'no-change' result back to Squid */ fprintf(stdout,"\n"); } - helper_debug("%s build " __DATE__ ", " __TIME__ " shutting down...\n", my_program_name); + debug("%s build " __DATE__ ", " __TIME__ " shutting down...\n", my_program_name); exit(0); }