From: Amos Jeffries Date: Thu, 24 Jul 2014 08:40:53 +0000 (-0700) Subject: negotiate_sspi_auth: Portability fixes for MinGW X-Git-Tag: SQUID_3_4_7~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e698f04e2573e7bd1d2f32708bd77270e6cf1a8;p=thirdparty%2Fsquid.git negotiate_sspi_auth: Portability fixes for MinGW --- diff --git a/helpers/negotiate_auth/SSPI/Makefile.am b/helpers/negotiate_auth/SSPI/Makefile.am index d91a166010..8804f107d4 100644 --- a/helpers/negotiate_auth/SSPI/Makefile.am +++ b/helpers/negotiate_auth/SSPI/Makefile.am @@ -6,6 +6,7 @@ negotiate_sspi_auth_SOURCES = negotiate_sspi_auth.cc LDADD = \ -L$(top_builddir)/lib -lsspwin32 \ + $(top_builddir)/lib/libmiscencoding.la \ $(COMPAT_LIB) \ -ladvapi32 \ $(XTRA_LIBS) diff --git a/helpers/negotiate_auth/SSPI/negotiate_sspi_auth.cc b/helpers/negotiate_auth/SSPI/negotiate_sspi_auth.cc index 0356680523..72e3396310 100644 --- a/helpers/negotiate_auth/SSPI/negotiate_sspi_auth.cc +++ b/helpers/negotiate_auth/SSPI/negotiate_sspi_auth.cc @@ -37,8 +37,10 @@ * */ #include "squid.h" +#include "base64.h" #include "helpers/defines.h" -#include "libntlmauth/support_bits.cci" +#include "ntlmauth/ntlmauth.h" +#include "ntlmauth/support_bits.cci" #include "sspwin32.h" #include "util.h" @@ -135,7 +137,7 @@ try_again: if (fgets(buf, HELPER_INPUT_BUFFER, stdin)) return 0; - c = memchr(buf, '\n', HELPER_INPUT_BUFFER); /* safer against overrun than strchr */ + c = static_cast(memchr(buf, '\n', HELPER_INPUT_BUFFER)); if (c) { if (oversized) { SEND("BH illegal request received"); @@ -153,13 +155,13 @@ try_again: decodedLen = base64_decode(decoded, sizeof(decoded), buf+3); strncpy(helper_command, buf, 2); debug("Got '%s' from Squid with data:\n", helper_command); - hex_dump(decoded, decodedLen); + hex_dump(reinterpret_cast(decoded), decodedLen); } else debug("Got '%s' from Squid\n", buf); if (memcmp(buf, "YR ", 3) == 0) { /* refresh-request */ /* figure out what we got */ - decoded = base64_decode(buf + 3); + decodedLen = base64_decode(decoded, sizeof(decoded), buf + 3); if ((size_t)decodedLen < sizeof(ntlmhdr)) { /* decoding failure, return error */ SEND("NA * Packet format error, couldn't base64-decode"); return 1; @@ -176,7 +178,7 @@ try_again: decodedLen = base64_decode(decoded, sizeof(decoded), c); debug("sending 'AF' %s to squid with data:\n", cred); if (c != NULL) - hex_dump(decoded, decodedLen); + hex_dump(reinterpret_cast(decoded), decodedLen); else fprintf(stderr, "No data available.\n"); printf("AF %s %s\n", c, cred); @@ -186,7 +188,7 @@ try_again: if (Negotiate_packet_debug_enabled) { decodedLen = base64_decode(decoded, sizeof(decoded), c); debug("sending 'TT' to squid with data:\n"); - hex_dump(decoded, decodedLen); + hex_dump(reinterpret_cast(decoded), decodedLen); printf("TT %s\n", c); } else { SEND2("TT %s", c); @@ -236,7 +238,7 @@ try_again: decodedLen = base64_decode(decoded, sizeof(decoded), c); debug("sending 'AF' %s to squid with data:\n", cred); if (c != NULL) - hex_dump(decoded, decodedLen); + hex_dump(reinterpret_cast(decoded), decodedLen); else fprintf(stderr, "No data available.\n"); printf("AF %s %s\n", c, cred); @@ -248,7 +250,7 @@ try_again: if (Negotiate_packet_debug_enabled) { decodedLen = base64_decode(decoded, sizeof(decoded), c); debug("sending 'TT' to squid with data:\n"); - hex_dump(decoded, decodedLen); + hex_dump(reinterpret_cast(decoded), decodedLen); printf("TT %s\n", c); } else SEND2("TT %s", c);