assert.h \
compat.h \
compat_shared.h \
+ debug.h \
fdsetsize.h \
osdetect.h \
stdvarargs.h \
\
assert.cc \
compat.cc \
+ debug.cc \
GnuRegex.h \
GnuRegex.c
/*****************************************************/
/* 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"
--- /dev/null
+#include "config.h"
+
+/* default off */
+int debug_enabled = 0;
#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
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); \
/* 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 */
use vars qw/ %opt /;
# Disable output buffering
-$|=1;
+$|=1;
sub debug {
print STDERR "@_\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
$ans = &check($user, $group);
last if $ans eq "OK";
}
- &debug ("Sending $ans to squid");
+ &debug("Sending $ans to squid");
print "$ans\n";
}
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) {
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) {
/************* 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");
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) {
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);
}