ntlm: Moved the native Target Info clean-up from HTTP specific function
This commit is contained in:
parent
474442dd56
commit
40ee1ba0dc
@ -229,21 +229,11 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy)
|
|||||||
|
|
||||||
void Curl_http_ntlm_cleanup(struct connectdata *conn)
|
void Curl_http_ntlm_cleanup(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
#ifdef USE_WINDOWS_SSPI
|
|
||||||
Curl_sasl_ntlm_cleanup(&conn->ntlm);
|
Curl_sasl_ntlm_cleanup(&conn->ntlm);
|
||||||
Curl_sasl_ntlm_cleanup(&conn->proxyntlm);
|
Curl_sasl_ntlm_cleanup(&conn->proxyntlm);
|
||||||
#elif defined(NTLM_WB_ENABLED)
|
|
||||||
|
#if defined(NTLM_WB_ENABLED)
|
||||||
Curl_ntlm_wb_cleanup(conn);
|
Curl_ntlm_wb_cleanup(conn);
|
||||||
#else
|
|
||||||
(void)conn;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef USE_WINDOWS_SSPI
|
|
||||||
Curl_safefree(conn->ntlm.target_info);
|
|
||||||
conn->ntlm.target_info_len = 0;
|
|
||||||
|
|
||||||
Curl_safefree(conn->proxyntlm.target_info);
|
|
||||||
conn->proxyntlm.target_info_len = 0;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,6 +401,7 @@ CURLcode Curl_ntlm_create_type1_message(const char *userp,
|
|||||||
unsigned long attrs;
|
unsigned long attrs;
|
||||||
TimeStamp expiry; /* For Windows 9x compatibility of SSPI calls */
|
TimeStamp expiry; /* For Windows 9x compatibility of SSPI calls */
|
||||||
|
|
||||||
|
/* Clean up any former leftovers and initialise to defaults */
|
||||||
Curl_sasl_ntlm_cleanup(ntlm);
|
Curl_sasl_ntlm_cleanup(ntlm);
|
||||||
|
|
||||||
/* Query the security package for NTLM */
|
/* Query the security package for NTLM */
|
||||||
@ -493,7 +494,9 @@ CURLcode Curl_ntlm_create_type1_message(const char *userp,
|
|||||||
domain are empty */
|
domain are empty */
|
||||||
(void)userp;
|
(void)userp;
|
||||||
(void)passwdp;
|
(void)passwdp;
|
||||||
(void)ntlm;
|
|
||||||
|
/* Clean up any former leftovers and initialise to defaults */
|
||||||
|
Curl_sasl_ntlm_cleanup(ntlm);
|
||||||
|
|
||||||
#if USE_NTLM2SESSION
|
#if USE_NTLM2SESSION
|
||||||
#define NTLM2FLAG NTLMFLAG_NEGOTIATE_NTLM2_KEY
|
#define NTLM2FLAG NTLMFLAG_NEGOTIATE_NTLM2_KEY
|
||||||
@ -993,7 +996,11 @@ CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
|
|||||||
return CURLE_CONV_FAILED;
|
return CURLE_CONV_FAILED;
|
||||||
|
|
||||||
/* Return with binary blob encoded into base64 */
|
/* Return with binary blob encoded into base64 */
|
||||||
return Curl_base64_encode(NULL, (char *)ntlmbuf, size, outptr, outlen);
|
result = Curl_base64_encode(NULL, (char *)ntlmbuf, size, outptr, outlen);
|
||||||
|
|
||||||
|
Curl_sasl_ntlm_cleanup(ntlm);
|
||||||
|
|
||||||
|
return result;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1182,6 +1182,28 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
|
|||||||
return Curl_ntlm_create_type3_message(data, userp, passwdp, ntlm, outptr,
|
return Curl_ntlm_create_type3_message(data, userp, passwdp, ntlm, outptr,
|
||||||
outlen);
|
outlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(USE_WINDOWS_SSPI)
|
||||||
|
/*
|
||||||
|
* 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 the target info */
|
||||||
|
Curl_safefree(ntlm->target_info);
|
||||||
|
|
||||||
|
/* Reset any variables */
|
||||||
|
ntlm->target_info_len = 0;
|
||||||
|
}
|
||||||
|
#endif /* !USE_WINDOWS_SSPI */
|
||||||
|
|
||||||
#endif /* USE_NTLM */
|
#endif /* USE_NTLM */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1240,13 +1262,16 @@ void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused)
|
|||||||
if(authused == SASL_MECH_GSSAPI) {
|
if(authused == SASL_MECH_GSSAPI) {
|
||||||
Curl_sasl_gssapi_cleanup(&conn->krb5);
|
Curl_sasl_gssapi_cleanup(&conn->krb5);
|
||||||
}
|
}
|
||||||
#ifdef USE_NTLM
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_NTLM)
|
||||||
/* Cleanup the ntlm structure */
|
/* Cleanup the ntlm structure */
|
||||||
else if(authused == SASL_MECH_NTLM) {
|
if(authused == SASL_MECH_NTLM) {
|
||||||
Curl_sasl_ntlm_cleanup(&conn->ntlm);
|
Curl_sasl_ntlm_cleanup(&conn->ntlm);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
|
#if !defined(USE_KRB5) && !defined(USE_NTLM)
|
||||||
/* Reserved for future use */
|
/* Reserved for future use */
|
||||||
(void)conn;
|
(void)conn;
|
||||||
(void)authused;
|
(void)authused;
|
||||||
|
@ -149,10 +149,8 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
|
|||||||
struct ntlmdata *ntlm,
|
struct ntlmdata *ntlm,
|
||||||
char **outptr, size_t *outlen);
|
char **outptr, size_t *outlen);
|
||||||
|
|
||||||
#if defined(USE_WINDOWS_SSPI)
|
|
||||||
/* This is used to clean up the ntlm specific data */
|
/* This is used to clean up the ntlm specific data */
|
||||||
void Curl_sasl_ntlm_cleanup(struct ntlmdata *ntlm);
|
void Curl_sasl_ntlm_cleanup(struct ntlmdata *ntlm);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* USE_NTLM */
|
#endif /* USE_NTLM */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user