]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Meld helper_debug into old debug. Now reserved for helepers
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 27 Aug 2009 12:11:41 +0000 (00:11 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 27 Aug 2009 12:11:41 +0000 (00:11 +1200)
compat/Makefile.am
compat/compat.h
compat/debug.cc [new file with mode: 0644]
compat/debug.h [moved from compat/helper_debug.h with 72% similarity]
helpers/external_acl/wbinfo_group/wbinfo_group.pl
helpers/ntlm_auth/smb_lm/libntlmssp.c
helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.h
helpers/url_rewrite/fake/fake.cc

index cf8c018e2b5f65af8da9d8ff891243d7959ca225..3aa5b9751bfc3534e776622a8e03f0449f5e490a 100644 (file)
@@ -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
 
index 69f0be36eb98eef6c17692fa3537c5bbd0cd88cc..160029171180cda5f86a060f0fa4ce7f462c08e1 100644 (file)
@@ -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 (file)
index 0000000..9d307d5
--- /dev/null
@@ -0,0 +1,4 @@
+#include "config.h"
+
+/* default off */
+int debug_enabled = 0;
similarity index 72%
rename from compat/helper_debug.h
rename to compat/debug.h
index 59b5ff2428fb299a0b0adf28f240b1a6c0518999..01367403ad3d9050daa5ef6350dc77cf0bde14a8 100644 (file)
@@ -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 */
index 06e970a7599e964cfc10a9e526784f6fbe563f35..4df2cdccdcd94d0b68bf14120eadec572635fce7 100755 (executable)
@@ -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 (<STDIN>) {
         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 (<STDIN>) {
                $ans = &check($user, $group);
                last if $ans eq "OK";
        }
-       &debug ("Sending $ans to squid");
+       &debug("Sending $ans to squid");
        print "$ans\n";
 }
 
index d6e58b54494da80e1e31092b83947244e9a431e9..65bc9942ca2735866ffa003070a11384b40e820a 100644 (file)
@@ -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) {
index 50a2aa199c64ff322a034b8145760d56a99d7afd..bfb296760c9f76eed2f2821eae4cd9abd12f94ea 100644 (file)
 
 /************* END CONFIGURATION ***************/
 
-#include <sys/types.h>
-
-
-/* Debugging stuff */
-#ifndef debug /* already provided */
-#ifdef __GNUC__                        /* this is really a gcc-ism */
-#ifdef DEBUG
-#include <stdio.h>
-#include <unistd.h>
-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");
index 218e189c9a10ce0451a6c1401bfeedc7f7abafe6..5b1a96e2da8f80eb157ee2cf2d2c60b94e911dc5 100644 (file)
@@ -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);
 }