From: Amos Jeffries Date: Thu, 18 Oct 2012 08:55:04 +0000 (-0600) Subject: basic_sspi_auth: several compile issues on MinGW X-Git-Tag: SQUID_3_4_0_1~560 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f7c83cac0526b14f4d3dfe70921edfb5a0518ac;p=thirdparty%2Fsquid.git basic_sspi_auth: several compile issues on MinGW * Fixes build issues with usage() function definition removing the use of global my_program_name * Fixes double definition of safe_free() * Removes the DEBUG macro. Helper API uses a -d run-time flag now. --- diff --git a/helpers/basic_auth/SSPI/basic_sspi_auth.cc b/helpers/basic_auth/SSPI/basic_sspi_auth.cc index ef43acfe3c..ce8c71bc88 100644 --- a/helpers/basic_auth/SSPI/basic_sspi_auth.cc +++ b/helpers/basic_auth/SSPI/basic_sspi_auth.cc @@ -26,7 +26,9 @@ #include "squid.h" #include "helpers/defines.h" +#include "rfc1738.h" #include "util.h" +#include "valid.h" #if HAVE_STDIO_H #include @@ -41,8 +43,6 @@ #error NON WINDOWS PLATFORM #endif -#include "valid.h" - static char NTGroup[256]; char * NTAllowedGroup; char * NTDisAllowedGroup; @@ -56,10 +56,8 @@ int debug_enabled = 0; * -D can specify a Windows Local Group name not allowed to authenticate. * -O can specify the default Domain against to authenticate. */ -char *my_program_name = NULL; - -void -usage() +static void +usage(const char *name) { fprintf(stderr, "Usage:\n%s [-A|D UserGroup][-O DefaultDomain][-d]\n" "-A can specify a Windows Local Group name allowed to authenticate\n" @@ -67,7 +65,7 @@ usage() "-O can specify the default Domain against to authenticate\n" "-d enable debugging.\n" "-h this message\n\n", - my_program_name); + name); } void @@ -100,7 +98,7 @@ process_options(int argc, char *argv[]) /* fall thru to default */ default: fprintf(stderr, "FATAL: Unknown option: -%c\n", opt); - usage(); + usage(argv[0]); exit(1); } } @@ -118,7 +116,6 @@ main(int argc, char **argv) char *p; int err = 0; - my_program_name = argv[0]; process_options(argc, argv); if (LoadSecurityDll(SSP_BASIC, NTLM_PACKAGE_NAME) == NULL) { diff --git a/helpers/basic_auth/SSPI/valid.h b/helpers/basic_auth/SSPI/valid.h index 86339e8e0c..167d419790 100644 --- a/helpers/basic_auth/SSPI/valid.h +++ b/helpers/basic_auth/SSPI/valid.h @@ -28,23 +28,16 @@ #ifndef _VALID_H_ #define _VALID_H_ -#if _SQUID_CYGWIN_ +#include "sspwin32.h" + +#if HAVE_WINDOWS_H #include #endif #include -#include "sspwin32.h" +#include #undef debug /************* CONFIGURATION ***************/ -/* - * define this if you want debugging - */ -#ifndef DEBUG -#define DEBUG -#endif - -#define safe_free(x) if (x) { free(x); x = NULL; } - /* SMB User verification function */ #define NTV_NO_ERROR 0 @@ -66,12 +59,8 @@ extern int debug_enabled; extern char Default_NTDomain[DNLEN+1]; extern const char * errormsg; -#include - /* Debugging stuff */ - -#ifdef __GNUC__ /* this is really a gcc-ism */ -#ifdef DEBUG +#if defined(__GNUC__) /* this is really a gcc-ism */ #include #include static char *__foo; @@ -80,15 +69,10 @@ static char *__foo; ((__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,...) { -#ifdef DEBUG -#if _SQUID_WINDOWS_ if (debug_enabled) { va_list args; @@ -97,8 +81,6 @@ debug(char *format,...) vfprintf(stderr, format, args); va_end(args); } -#endif /* _SQUID_WINDOWS_ */ -#endif /* DEBUG */ } #endif /* __GNUC__ */