From 474442dd564cab52d7732403eba5cd630764ba26 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Thu, 9 Oct 2014 11:03:14 +0100 Subject: ntlm: Moved SSPI clean-up code into SASL module --- lib/curl_sasl_sspi.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'lib/curl_sasl_sspi.c') diff --git a/lib/curl_sasl_sspi.c b/lib/curl_sasl_sspi.c index 44f909f21..de247cc2c 100644 --- a/lib/curl_sasl_sspi.c +++ b/lib/curl_sasl_sspi.c @@ -485,6 +485,46 @@ void Curl_sasl_digest_cleanup(struct digestdata *digest) } #endif /* !CURL_DISABLE_CRYPTO_AUTH */ +#if defined USE_NTLM +/* + * Curl_sasl_ntlm_cleanup() + * + * This is used to clean up the ntlm specific data. + * + * Parameters: + * + * ntlm [in/out] - The ntlm data struct being cleaned up. + * + */ +void Curl_sasl_ntlm_cleanup(struct ntlmdata *ntlm) +{ + /* Free our security context */ + if(ntlm->context) { + s_pSecFn->DeleteSecurityContext(ntlm->context); + free(ntlm->context); + ntlm->context = NULL; + } + + /* Free our credentials handle */ + if(ntlm->credentials) { + s_pSecFn->FreeCredentialsHandle(ntlm->credentials); + free(ntlm->credentials); + ntlm->credentials = NULL; + } + + /* Free our identity */ + Curl_sspi_free_identity(ntlm->p_identity); + ntlm->p_identity = NULL; + + /* Free the input and output tokens */ + Curl_safefree(ntlm->input_token); + Curl_safefree(ntlm->output_token); + + /* Reset any variables */ + ntlm->token_max = 0; +} +#endif /* USE_NTLM */ + #if defined(USE_KRB5) /* * Curl_sasl_create_gssapi_user_message() -- cgit v1.2.3