]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ntlm: Disable NTLM v2 when 64-bit integers are not supported
authorSteve Holme <steve_holme@hotmail.com>
Fri, 12 Dec 2014 21:57:59 +0000 (21:57 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Fri, 12 Dec 2014 22:34:16 +0000 (22:34 +0000)
This fixes compilation issues with compilers that don't support 64-bit
integers through long long or __int64 which was introduced in commit
07b66cbfa4.

lib/curl_ntlm_core.c
lib/curl_ntlm_core.h
lib/curl_ntlm_msgs.c

index 9eb92ecb68d063dfb49bb4d96012df808d7f18d6..83ca5604805e85b787e4dc670dbfc9611617eb99 100644 (file)
@@ -472,6 +472,7 @@ static void write32_le(const int value, unsigned char *buffer)
   buffer[3] = (char)((value & 0xFF000000) >> 24);
 }
 
+#if (CURL_SIZEOF_CURL_OFF_T > 4)
 #if defined(HAVE_LONGLONG)
 static void write64_le(const long long value, unsigned char *buffer)
 #else
@@ -481,6 +482,7 @@ static void write64_le(const __int64 value, unsigned char *buffer)
   write32_le((int)value, buffer);
   write32_le((int)(value >> 32), buffer + 4);
 }
+#endif
 
 /*
  * Set up nt hashed passwords
@@ -550,7 +552,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct SessionHandle *data,
   return CURLE_OK;
 }
 
-#ifndef USE_WINDOWS_SSPI
+#if USE_NTLM_V2 && !defined(USE_WINDOWS_SSPI)
 
 /* This returns the HMAC MD5 digest */
 CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
index c9dde7e4c3f3777e46186f636e6c2f2fd9c3b6ef..c1689666c8ae1450b766d3cef56f0bde0e45895b 100644 (file)
@@ -36,6 +36,7 @@
 #  ifdef OPENSSL_NO_MD4
 #    define USE_NTRESPONSES 0
 #    define USE_NTLM2SESSION 0
+#    define USE_NTLM_V2 0
 #  endif
 #endif
 
 #define USE_NTLM2SESSION 1
 #endif
 
+/* Define USE_NTLM_V2 to 1 in order to allow the type-3 message to include the
+   LMv2 and NTLMv2 response messages, requires USE_NTRESPONSES defined to 1
+   and support for 64-bit integers. */
+#if !defined(USE_NTLM_V2) && USE_NTRESPONSES && (CURL_SIZEOF_CURL_OFF_T > 4)
+#define USE_NTLM_V2 1
+#endif
+
 void Curl_ntlm_core_lm_resp(const unsigned char *keys,
                             const unsigned char *plaintext,
                             unsigned char *results);
@@ -65,7 +73,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct SessionHandle *data,
                                    const char *password,
                                    unsigned char *ntbuffer /* 21 bytes */);
 
-#ifndef USE_WINDOWS_SSPI
+#if USE_NTLM_V2 && !defined(USE_WINDOWS_SSPI)
 
 CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
                        const unsigned char *data, unsigned int datalen,
@@ -87,7 +95,7 @@ CURLcode  Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
                                       unsigned char *challenge_server,
                                       unsigned char *lmresp);
 
-#endif /* !USE_WINDOWS_SSPI */
+#endif /* USE_NTLM_V2 && !USE_WINDOWS_SSPI */
 
 #endif /* USE_NTRESPONSES */
 
index b31952138b434aa1be31af6d093ad3334d3c975a..69e17899255bca899bc49b0087b431a489b6ec1f 100644 (file)
@@ -554,7 +554,7 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
     hostlen = strlen(host);
   }
 
-#if USE_NTRESPONSES
+#if USE_NTRESPONSES && USE_NTLM_V2
   if(ntlm->target_info_len) {
     unsigned char ntbuffer[0x18];
     unsigned int entropy[2];