aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-10-26 10:26:46 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-10-26 09:14:34 +0000
commit3b738a16eb986bf71e64adbf54bab7c2bed90998 (patch)
tree58674ca7b811659dcd0ab06d03f12dc35c5798b1 /lib
parent9c5f851ec9314042b58c696e219fd45c0bcdc615 (diff)
ntlm: Return CURLcode from Curl_ntlm_core_mk_lm_hash()
Diffstat (limited to 'lib')
-rw-r--r--lib/curl_ntlm_core.c10
-rw-r--r--lib/curl_ntlm_core.h6
-rw-r--r--lib/curl_ntlm_msgs.c6
3 files changed, 14 insertions, 8 deletions
diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c
index 49924f31e..68c82cad1 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -311,9 +311,9 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
/*
* Set up lanmanager hashed password
*/
-void Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
- const char *password,
- unsigned char *lmbuffer /* 21 bytes */)
+CURLcode Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
+ const char *password,
+ unsigned char *lmbuffer /* 21 bytes */)
{
CURLcode result;
unsigned char pw[14];
@@ -331,7 +331,7 @@ void Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
*/
result = Curl_convert_to_network(data, (char *)pw, 14);
if(result)
- return;
+ return result;
{
/* Create LanManager hashed password. */
@@ -371,6 +371,8 @@ void Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
memset(lmbuffer + 16, 0, 21 - 16);
}
+
+ return CURLE_OK;
}
#if USE_NTRESPONSES
diff --git a/lib/curl_ntlm_core.h b/lib/curl_ntlm_core.h
index fe41cddf6..0a6dd934c 100644
--- a/lib/curl_ntlm_core.h
+++ b/lib/curl_ntlm_core.h
@@ -53,9 +53,9 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
const unsigned char *plaintext,
unsigned char *results);
-void Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
- const char *password,
- unsigned char *lmbuffer /* 21 bytes */);
+CURLcode Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
+ const char *password,
+ unsigned char *lmbuffer /* 21 bytes */);
#if USE_NTRESPONSES
CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
diff --git a/lib/curl_ntlm_msgs.c b/lib/curl_ntlm_msgs.c
index 99df82f87..8f5ed58ee 100644
--- a/lib/curl_ntlm_msgs.c
+++ b/lib/curl_ntlm_msgs.c
@@ -830,8 +830,12 @@ CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], ntresp);
#endif
- Curl_ntlm_core_mk_lm_hash(data, passwdp, lmbuffer);
+ result = Curl_ntlm_core_mk_lm_hash(data, passwdp, lmbuffer);
+ if(result)
+ return result;
+
Curl_ntlm_core_lm_resp(lmbuffer, &ntlm->nonce[0], lmresp);
+
/* A safer but less compatible alternative is:
* Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], lmresp);
* See http://davenport.sourceforge.net/ntlm.html#ntlmVersion2 */