diff options
Diffstat (limited to 'lib/vauth')
-rw-r--r-- | lib/vauth/ntlm.c | 6 | ||||
-rw-r--r-- | lib/vauth/ntlm_sspi.c | 14 | ||||
-rw-r--r-- | lib/vauth/vauth.h | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/lib/vauth/ntlm.c b/lib/vauth/ntlm.c index 1e0d4792e..ea5e56e37 100644 --- a/lib/vauth/ntlm.c +++ b/lib/vauth/ntlm.c @@ -355,6 +355,8 @@ static void unicodecpy(unsigned char *dest, const char *src, size_t length) * data [in] - The session handle. * userp [in] - The user name in the format User or Domain\User. * passdwp [in] - The user's password. + * service [in] - The service type such as http, smtp, pop or imap. + * host [in] - The host name. * ntlm [in/out] - The NTLM data struct being used and modified. * outptr [in/out] - The address where a pointer to newly allocated memory * holding the result will be stored upon completion. @@ -365,6 +367,8 @@ static void unicodecpy(unsigned char *dest, const char *src, size_t length) CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, const char *userp, const char *passwdp, + const char *service, + const char *hostname, struct ntlmdata *ntlm, char **outptr, size_t *outlen) { @@ -394,6 +398,8 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, domain are empty */ (void)userp; (void)passwdp; + (void)service, + (void)hostname, /* Clean up any former leftovers and initialise to defaults */ Curl_auth_ntlm_cleanup(ntlm); diff --git a/lib/vauth/ntlm_sspi.c b/lib/vauth/ntlm_sspi.c index 921524618..089c1a6d4 100644 --- a/lib/vauth/ntlm_sspi.c +++ b/lib/vauth/ntlm_sspi.c @@ -70,6 +70,8 @@ bool Curl_auth_is_ntlm_supported(void) * data [in] - The session handle. * userp [in] - The user name in the format User or Domain\User. * passdwp [in] - The user's password. + * service [in] - The service type such as http, smtp, pop or imap. + * host [in] - The host name. * ntlm [in/out] - The NTLM data struct being used and modified. * outptr [in/out] - The address where a pointer to newly allocated memory * holding the result will be stored upon completion. @@ -80,6 +82,8 @@ bool Curl_auth_is_ntlm_supported(void) CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, const char *userp, const char *passwdp, + const char *service, + const char *host, struct ntlmdata *ntlm, char **outptr, size_t *outlen) { @@ -143,6 +147,10 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, if(!ntlm->context) return CURLE_OUT_OF_MEMORY; + ntlm->spn = Curl_auth_build_spn(service, host, NULL); + if(!ntlm->spn) + return CURLE_OUT_OF_MEMORY; + /* Setup the type-1 "output" security buffer */ type_1_desc.ulVersion = SECBUFFER_VERSION; type_1_desc.cBuffers = 1; @@ -153,7 +161,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, /* Generate our type-1 message */ status = s_pSecFn->InitializeSecurityContext(ntlm->credentials, NULL, - (TCHAR *) TEXT(""), + ntlm->spn, 0, 0, SECURITY_NETWORK_DREP, NULL, 0, ntlm->context, &type_1_desc, @@ -271,7 +279,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data, /* Generate our type-3 message */ status = s_pSecFn->InitializeSecurityContext(ntlm->credentials, ntlm->context, - (TCHAR *) TEXT(""), + ntlm->spn, 0, 0, SECURITY_NETWORK_DREP, &type_2_desc, 0, ntlm->context, @@ -329,6 +337,8 @@ void Curl_auth_ntlm_cleanup(struct ntlmdata *ntlm) /* Reset any variables */ ntlm->token_max = 0; + + Curl_safefree(ntlm->spn); } #endif /* USE_WINDOWS_SSPI && USE_NTLM */ diff --git a/lib/vauth/vauth.h b/lib/vauth/vauth.h index dfaf985c6..f43064211 100644 --- a/lib/vauth/vauth.h +++ b/lib/vauth/vauth.h @@ -122,6 +122,8 @@ bool Curl_auth_is_ntlm_supported(void); CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, const char *userp, const char *passwdp, + const char *service, + const char *host, struct ntlmdata *ntlm, char **outptr, size_t *outlen); |