diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-11-16 12:58:04 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-11-16 13:59:11 +0000 |
commit | a3fead9706f2344d934e67cf4cb8ec434bc9a2e6 (patch) | |
tree | 792371013067f7a0064b856023741f4f0c74d3cb /lib/curl_sasl_sspi.c | |
parent | 201d0df50bb32b1d22539a43d511ebd98d52f575 (diff) |
ntlm: Moved the SSPI based Type-2 message decoding into the SASL module
Diffstat (limited to 'lib/curl_sasl_sspi.c')
-rw-r--r-- | lib/curl_sasl_sspi.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/curl_sasl_sspi.c b/lib/curl_sasl_sspi.c index 0665cf295..d54d2ae42 100644 --- a/lib/curl_sasl_sspi.c +++ b/lib/curl_sasl_sspi.c @@ -39,6 +39,7 @@ #include "curl_memory.h" #include "curl_multibyte.h" #include "curl_ntlm_msgs.h" +#include "sendf.h" #include "strdup.h" #define _MPRINTF_REPLACE /* use our functions only */ @@ -616,7 +617,29 @@ CURLcode Curl_sasl_decode_ntlm_type2_message(struct SessionHandle *data, const char *type2msg, struct ntlmdata *ntlm) { - return Curl_ntlm_decode_type2_message(data, type2msg, ntlm); + CURLcode result = CURLE_OK; + unsigned char *type2 = NULL; + size_t type2_len = 0; + + /* Decode the base-64 encoded type-2 message */ + if(strlen(type2msg) && *type2msg != '=') { + result = Curl_base64_decode(type2msg, &type2, &type2_len); + if(result) + return result; + } + + /* Ensure we have a valid type-2 message */ + if(!type2) { + infof(data, "NTLM handshake failure (empty type-2 message)\n"); + + return CURLE_BAD_CONTENT_ENCODING; + } + + /* Simply store the challenge for use later */ + ntlm->input_token = type2; + ntlm->input_token_len = type2_len; + + return result; } /* |