mirror of
https://github.com/curl/curl.git
synced 2025-09-24 04:56:47 +03:00
sspi: Synchronization of cleanup code between auth mechanisms
This commit is contained in:
parent
d91d21f05b
commit
c1c16bea94
|
@ -341,25 +341,30 @@ CURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data,
|
||||||
#ifdef USE_WINDOWS_SSPI
|
#ifdef USE_WINDOWS_SSPI
|
||||||
void Curl_ntlm_sspi_cleanup(struct ntlmdata *ntlm)
|
void Curl_ntlm_sspi_cleanup(struct ntlmdata *ntlm)
|
||||||
{
|
{
|
||||||
Curl_safefree(ntlm->input_token);
|
/* Free our security context */
|
||||||
|
|
||||||
if(ntlm->context) {
|
if(ntlm->context) {
|
||||||
s_pSecFn->DeleteSecurityContext(ntlm->context);
|
s_pSecFn->DeleteSecurityContext(ntlm->context);
|
||||||
free(ntlm->context);
|
free(ntlm->context);
|
||||||
ntlm->context = NULL;
|
ntlm->context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free our credentials handle */
|
||||||
if(ntlm->credentials) {
|
if(ntlm->credentials) {
|
||||||
s_pSecFn->FreeCredentialsHandle(ntlm->credentials);
|
s_pSecFn->FreeCredentialsHandle(ntlm->credentials);
|
||||||
free(ntlm->credentials);
|
free(ntlm->credentials);
|
||||||
ntlm->credentials = NULL;
|
ntlm->credentials = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ntlm->token_max = 0;
|
/* Free our identity */
|
||||||
Curl_safefree(ntlm->output_token);
|
|
||||||
|
|
||||||
Curl_sspi_free_identity(ntlm->p_identity);
|
Curl_sspi_free_identity(ntlm->p_identity);
|
||||||
ntlm->p_identity = NULL;
|
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
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -258,25 +258,30 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
|
||||||
|
|
||||||
static void cleanup(struct negotiatedata *neg_ctx)
|
static void cleanup(struct negotiatedata *neg_ctx)
|
||||||
{
|
{
|
||||||
|
/* Free our security context */
|
||||||
if(neg_ctx->context) {
|
if(neg_ctx->context) {
|
||||||
s_pSecFn->DeleteSecurityContext(neg_ctx->context);
|
s_pSecFn->DeleteSecurityContext(neg_ctx->context);
|
||||||
free(neg_ctx->context);
|
free(neg_ctx->context);
|
||||||
neg_ctx->context = NULL;
|
neg_ctx->context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free our credentials handle */
|
||||||
if(neg_ctx->credentials) {
|
if(neg_ctx->credentials) {
|
||||||
s_pSecFn->FreeCredentialsHandle(neg_ctx->credentials);
|
s_pSecFn->FreeCredentialsHandle(neg_ctx->credentials);
|
||||||
free(neg_ctx->credentials);
|
free(neg_ctx->credentials);
|
||||||
neg_ctx->credentials = NULL;
|
neg_ctx->credentials = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
neg_ctx->token_max = 0;
|
/* Free our identity */
|
||||||
Curl_safefree(neg_ctx->output_token);
|
|
||||||
|
|
||||||
Curl_safefree(neg_ctx->server_name);
|
|
||||||
|
|
||||||
Curl_sspi_free_identity(neg_ctx->p_identity);
|
Curl_sspi_free_identity(neg_ctx->p_identity);
|
||||||
neg_ctx->p_identity = NULL;
|
neg_ctx->p_identity = NULL;
|
||||||
|
|
||||||
|
/* Free the SPN and output token */
|
||||||
|
Curl_safefree(neg_ctx->server_name);
|
||||||
|
Curl_safefree(neg_ctx->output_token);
|
||||||
|
|
||||||
|
/* Reset any variables */
|
||||||
|
neg_ctx->token_max = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Curl_cleanup_negotiate(struct SessionHandle *data)
|
void Curl_cleanup_negotiate(struct SessionHandle *data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user