summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-05-04 18:59:55 +0100
committerSteve Holme <steve_holme@hotmail.com>2014-05-04 19:07:17 +0100
commit4febbedc5ab07ab2f9d6d7a056b1db6596cd51d2 (patch)
tree4f31c20585347d535412a1065f859656bded2e1a
parent6ebc0d3bd8ccbedb664a917ff770e6f1e2540e30 (diff)
downloadcurl-4febbedc5ab07ab2f9d6d7a056b1db6596cd51d2.tar.gz
curl_ntlm_core: Fixed use of long long for VC6 and VC7
Commit 07b66cbfa4 unfortunately broke native NTLM message support in compilers, such as VC6, VC7 and others, that don't support long long type declarations. This commit fixes VC6 and VC7 as they support the __int64 extension, however, we should consider an additional fix for other compilers that don't support this.
-rw-r--r--lib/curl_ntlm_core.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c
index 442098194..4f30cc6e7 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -402,7 +402,11 @@ static void write32_le(const int value, unsigned char *buffer)
buffer[3] = (char)((value & 0xFF000000) >> 24);
}
+#if defined(HAVE_LONGLONG)
static void write64_le(const long long value, unsigned char *buffer)
+#else
+static void write64_le(const __int64 value, unsigned char *buffer)
+#endif
{
write32_le((int)value, buffer);
write32_le((int)(value >> 32), buffer + 4);
@@ -550,16 +554,27 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
unsigned int len = 0;
unsigned char *ptr = NULL;
unsigned char hmac_output[NTLM_HMAC_MD5_LEN];
+#if defined(HAVE_LONGLONG)
long long tw;
+#else
+ __int64 tw;
+#endif
CURLcode res = CURLE_OK;
/* Calculate the timestamp */
+#if defined(HAVE_LONGLONG)
#if defined(DEBUGBUILD)
tw = 11644473600ULL * 10000000ULL;
#else
tw = ((long long)time(NULL) + 11644473600ULL) * 10000000ULL;
#endif
-
+#else
+#if defined(DEBUGBUILD)
+ tw = 11644473600ui64 * 10000000ui64;
+#else
+ tw = ((__int64)time(NULL) + 11644473600ui64) * 10000000ui64;
+#endif
+#endif
/* Calculate the response len */
len = NTLM_HMAC_MD5_LEN + NTLMv2_BLOB_LEN;