diff options
Diffstat (limited to 'lib/curl_sasl_sspi.c')
| -rw-r--r-- | lib/curl_sasl_sspi.c | 54 | 
1 files changed, 51 insertions, 3 deletions
| diff --git a/lib/curl_sasl_sspi.c b/lib/curl_sasl_sspi.c index d54d2ae42..a1c606492 100644 --- a/lib/curl_sasl_sspi.c +++ b/lib/curl_sasl_sspi.c @@ -38,7 +38,6 @@  #include "warnless.h"  #include "curl_memory.h"  #include "curl_multibyte.h" -#include "curl_ntlm_msgs.h"  #include "sendf.h"  #include "strdup.h" @@ -666,8 +665,57 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,                                               struct ntlmdata *ntlm,                                               char **outptr, size_t *outlen)  { -  return Curl_ntlm_create_type3_message(data, userp, passwdp, ntlm, outptr, -                                        outlen); +  CURLcode result = CURLE_OK; +  SecBuffer type_2_buf; +  SecBuffer type_3_buf; +  SecBufferDesc type_2_desc; +  SecBufferDesc type_3_desc; +  SECURITY_STATUS status; +  unsigned long attrs; +  TimeStamp expiry; /* For Windows 9x compatibility of SSPI calls */ + +  (void) passwdp; +  (void) userp; + +  /* Setup the type-2 "input" security buffer */ +  type_2_desc.ulVersion = SECBUFFER_VERSION; +  type_2_desc.cBuffers  = 1; +  type_2_desc.pBuffers  = &type_2_buf; +  type_2_buf.BufferType = SECBUFFER_TOKEN; +  type_2_buf.pvBuffer   = ntlm->input_token; +  type_2_buf.cbBuffer   = curlx_uztoul(ntlm->input_token_len); + +  /* Setup the type-3 "output" security buffer */ +  type_3_desc.ulVersion = SECBUFFER_VERSION; +  type_3_desc.cBuffers  = 1; +  type_3_desc.pBuffers  = &type_3_buf; +  type_3_buf.BufferType = SECBUFFER_TOKEN; +  type_3_buf.pvBuffer   = ntlm->output_token; +  type_3_buf.cbBuffer   = curlx_uztoul(ntlm->token_max); + +  /* Generate our type-3 message */ +  status = s_pSecFn->InitializeSecurityContext(ntlm->credentials, +                                               ntlm->context, +                                               (TCHAR *) TEXT(""), +                                               0, 0, SECURITY_NETWORK_DREP, +                                               &type_2_desc, +                                               0, ntlm->context, +                                               &type_3_desc, +                                               &attrs, &expiry); +  if(status != SEC_E_OK) { +    infof(data, "NTLM handshake failure (type-3 message): Status=%x\n", +          status); + +    return CURLE_RECV_ERROR; +  } + +  /* Base64 encode the response */ +  result = Curl_base64_encode(NULL, (char *) ntlm->output_token, +                              type_3_buf.cbBuffer, outptr, outlen); + +  Curl_sasl_ntlm_cleanup(ntlm); + +  return result;  }  /* | 
