]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
basic_sspi_auth: several compile issues on MinGW
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 18 Oct 2012 08:55:04 +0000 (02:55 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 18 Oct 2012 08:55:04 +0000 (02:55 -0600)
* 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.

helpers/basic_auth/SSPI/basic_sspi_auth.cc
helpers/basic_auth/SSPI/valid.h

index ef43acfe3cec3818155ac391ddcde33791702f02..ce8c71bc88c8397bbea2532678760714435ab378 100644 (file)
@@ -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 <stdio.h>
@@ -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) {
index 86339e8e0cebfd3e8f69f7e3d0b451ed7cf3bc30..167d419790850c2c548d4c0704dc1088b37ab1f5 100644 (file)
 #ifndef _VALID_H_
 #define _VALID_H_
 
-#if _SQUID_CYGWIN_
+#include "sspwin32.h"
+
+#if HAVE_WINDOWS_H
 #include <windows.h>
 #endif
 #include <lm.h>
-#include "sspwin32.h"
+#include <sys/types.h>
 #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 <sys/types.h>
-
 /* Debugging stuff */
-
-#ifdef __GNUC__                        /* this is really a gcc-ism */
-#ifdef DEBUG
+#if defined(__GNUC__)                  /* this is really a gcc-ism */
 #include <stdio.h>
 #include <unistd.h>
 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__ */