1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

ntlm: Return CURLcode from Curl_ntlm_core_mk_lm_hash()

This commit is contained in:
Steve Holme 2014-10-26 10:26:46 +00:00
parent 9c5f851ec9
commit 3b738a16eb
3 changed files with 14 additions and 8 deletions

View File

@ -311,7 +311,7 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
/* /*
* Set up lanmanager hashed password * Set up lanmanager hashed password
*/ */
void Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data, CURLcode Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
const char *password, const char *password,
unsigned char *lmbuffer /* 21 bytes */) unsigned char *lmbuffer /* 21 bytes */)
{ {
@ -331,7 +331,7 @@ void Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
*/ */
result = Curl_convert_to_network(data, (char *)pw, 14); result = Curl_convert_to_network(data, (char *)pw, 14);
if(result) if(result)
return; return result;
{ {
/* Create LanManager hashed password. */ /* Create LanManager hashed password. */
@ -371,6 +371,8 @@ void Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
memset(lmbuffer + 16, 0, 21 - 16); memset(lmbuffer + 16, 0, 21 - 16);
} }
return CURLE_OK;
} }
#if USE_NTRESPONSES #if USE_NTRESPONSES

View File

@ -53,7 +53,7 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
const unsigned char *plaintext, const unsigned char *plaintext,
unsigned char *results); unsigned char *results);
void Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data, CURLcode Curl_ntlm_core_mk_lm_hash(struct SessionHandle *data,
const char *password, const char *password,
unsigned char *lmbuffer /* 21 bytes */); unsigned char *lmbuffer /* 21 bytes */);

View File

@ -830,8 +830,12 @@ CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], ntresp); Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], ntresp);
#endif #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); Curl_ntlm_core_lm_resp(lmbuffer, &ntlm->nonce[0], lmresp);
/* A safer but less compatible alternative is: /* A safer but less compatible alternative is:
* Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], lmresp); * Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], lmresp);
* See http://davenport.sourceforge.net/ntlm.html#ntlmVersion2 */ * See http://davenport.sourceforge.net/ntlm.html#ntlmVersion2 */