]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Windows: C++ conversion for libsspwin32
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 12 Oct 2012 12:50:01 +0000 (06:50 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 12 Oct 2012 12:50:01 +0000 (06:50 -0600)
Updates this Squid convenience library to build as C++.

Also, fixed header include path for libntlmauth symbol definitions.

include/sspwin32.h
lib/Makefile.am
lib/sspwin32.cc [moved from lib/sspwin32.c with 98% similarity]

index 505c346b6d6a9f9924b3bea68df7389d18aae99e..8e7a2ec688affefa40128988317f1292da46f9f5 100644 (file)
 #ifndef _LIBSSPWIN32_H_
 #define _LIBSSPWIN32_H_
 
-#ifdef __cplusplus
+#if _SQUID_WINDOWS_
+
+#if defined(__cplusplus)
 extern "C" {
 #endif
 
-#if _SQUID_WINDOWS_
-
 #define SECURITY_WIN32
 #define NTLM_PACKAGE_NAME "NTLM"
 #define NEGOTIATE_PACKAGE_NAME "Negotiate"
@@ -79,8 +79,9 @@ extern "C" {
     extern BOOL Use_Unicode;
     extern BOOL NTLM_LocalCall;
 
-#ifdef __cplusplus
+#if defined(__cplusplus)
 }
 #endif
+
 #endif /* _SQUID_WINDOWS_ */
 #endif /* LIBSSPWIN32_H_ */
index bf97ce697daecdb1fb6163ffacd5bc3ef1554242..05d363e8c8ce0cb828a18cad78a1706de4b81044 100644 (file)
@@ -25,10 +25,10 @@ noinst_LTLIBRARIES = \
 #
 if ENABLE_WIN32SPECIFIC
 noinst_LTLIBRARIES += libsspwin32.la
-libsspwin32_la_SOURCES = sspwin32.c
+libsspwin32_la_SOURCES = sspwin32.cc
 else
 SUBDIRS += rfcnb smblib
-EXTRA_DIST += sspwin32.c
+EXTRA_DIST += sspwin32.cc
 endif
 if ENABLE_AUTH_NTLM
 SUBDIRS += ntlmauth
similarity index 98%
rename from lib/sspwin32.c
rename to lib/sspwin32.cc
index 6ffa912d9f67936390596c3c1cec68b08a159394..32acd0fb8a837c41c1a2ff233dd4d12fc1ae7713 100644 (file)
  */
 
 #include "squid.h"
-#include "util.h"
-
-#include "libntlmauth/ntlmauth.h"
+#include "base64.h"
+#include "ntlmauth/ntlmauth.h"
 #include "sspwin32.h"
+#include "util.h"
 
 typedef struct _AUTH_SEQ {
     BOOL fInitialized;
@@ -106,7 +106,7 @@ void UnloadSecurityDll(void)
     hModule = NULL;
 }
 
-HMODULE LoadSecurityDll(int mode, char * SSP_Package)
+HMODULE LoadSecurityDll(int mode, const char * SSP_Package)
 {
     TCHAR lpszDLL[MAX_PATH];
     OSVERSIONINFO VerInfo;
@@ -513,8 +513,8 @@ const char * WINAPI SSP_MakeChallenge(PVOID PNegotiateBuf, int NegotiateLen)
     } while (0);
     if (fResult != NULL) {
         challenge = (ntlm_challenge *) fResult;
-        Use_Unicode = NEGOTIATE_UNICODE & challenge->flags;
-        NTLM_LocalCall = NEGOTIATE_THIS_IS_LOCAL_CALL & challenge->flags;
+        Use_Unicode = NTLM_NEGOTIATE_UNICODE & challenge->flags;
+        NTLM_LocalCall = NTLM_NEGOTIATE_THIS_IS_LOCAL_CALL & challenge->flags;
         encoded = base64_encode_bin((char *) fResult, cbOut);
     }
     return encoded;