diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-10-26 14:51:05 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-10-26 14:51:58 +0000 |
commit | c1c16bea94d605664fd7fe8e332236f614c8a454 (patch) | |
tree | 05f554554bbc49efd93aa05626a869df9b8cb202 /lib | |
parent | d91d21f05bb2250be03bf0bf1407f0044f6368a3 (diff) |
sspi: Synchronization of cleanup code between auth mechanisms
Diffstat (limited to 'lib')
-rw-r--r-- | lib/curl_ntlm_msgs.c | 15 | ||||
-rw-r--r-- | lib/http_negotiate_sspi.c | 13 |
2 files changed, 19 insertions, 9 deletions
diff --git a/lib/curl_ntlm_msgs.c b/lib/curl_ntlm_msgs.c index 99eba7a64..92211aa97 100644 --- a/lib/curl_ntlm_msgs.c +++ b/lib/curl_ntlm_msgs.c @@ -341,25 +341,30 @@ CURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data, #ifdef USE_WINDOWS_SSPI void Curl_ntlm_sspi_cleanup(struct ntlmdata *ntlm) { - Curl_safefree(ntlm->input_token); - + /* 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; } - ntlm->token_max = 0; - Curl_safefree(ntlm->output_token); - + /* 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 diff --git a/lib/http_negotiate_sspi.c b/lib/http_negotiate_sspi.c index fd0f81781..8ec3bbc91 100644 --- a/lib/http_negotiate_sspi.c +++ b/lib/http_negotiate_sspi.c @@ -258,25 +258,30 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) static void cleanup(struct negotiatedata *neg_ctx) { + /* Free our security context */ if(neg_ctx->context) { s_pSecFn->DeleteSecurityContext(neg_ctx->context); free(neg_ctx->context); neg_ctx->context = NULL; } + /* Free our credentials handle */ if(neg_ctx->credentials) { s_pSecFn->FreeCredentialsHandle(neg_ctx->credentials); free(neg_ctx->credentials); neg_ctx->credentials = NULL; } - neg_ctx->token_max = 0; - Curl_safefree(neg_ctx->output_token); + /* Free our identity */ + Curl_sspi_free_identity(neg_ctx->p_identity); + neg_ctx->p_identity = NULL; + /* Free the SPN and output token */ Curl_safefree(neg_ctx->server_name); + Curl_safefree(neg_ctx->output_token); - Curl_sspi_free_identity(neg_ctx->p_identity); - neg_ctx->p_identity = NULL; + /* Reset any variables */ + neg_ctx->token_max = 0; } void Curl_cleanup_negotiate(struct SessionHandle *data) |