vauth: Introduced Curl_auth_is_<mechansism>_supported() functions

As Windows SSPI authentication calls fail when a particular mechanism
isn't available, introduced these functions for DIGEST, NTLM, Kerberos 5
and Negotiate to allow both HTTP and SASL authentication the opportunity
to query support for a supported mechanism before selecting it.

For now each function returns TRUE to maintain compatability with the
existing code when called.
This commit is contained in:
Steve Holme 2016-03-20 11:56:07 +00:00
parent cdd61dc35f
commit a0f212946b
9 changed files with 132 additions and 0 deletions

View File

@ -305,6 +305,20 @@ static CURLcode auth_decode_digest_md5_message(const char *chlg64,
return CURLE_OK;
}
/*
* Curl_auth_is_digest_supported()
*
* This is used to evaluate if DIGEST is supported.
*
* Parameters: None
*
* Returns TRUE as DIGEST as handled by libcurl.
*/
bool Curl_auth_is_digest_supported(void)
{
return TRUE;
}
/*
* Curl_auth_create_digest_md5_message()
*

View File

@ -43,6 +43,22 @@
#include "curl_memory.h"
#include "memdebug.h"
/*
* Curl_auth_is_digest_supported()
*
* This is used to evaluate if DIGEST is supported.
*
* Parameters: None
*
* Returns TRUE if DIGEST is supported by Windows SSPI.
*/
bool Curl_auth_is_digest_supported(void)
{
/* TODO: Return true for now which maintains compatability with the existing
code */
return TRUE;
}
/*
* Curl_auth_create_digest_md5_message()
*

View File

@ -41,6 +41,20 @@
#include "curl_memory.h"
#include "memdebug.h"
/*
* Curl_auth_is_gssapi_supported()
*
* This is used to evaluate if GSSAPI (Kerberos V5) is supported.
*
* Parameters: None
*
* Returns TRUE if Kerberos V5 is supported by the GSS-API library.
*/
bool Curl_auth_is_gssapi_supported(void)
{
return TRUE;
}
/*
* Curl_auth_create_gssapi_user_message()
*

View File

@ -39,6 +39,22 @@
#include "curl_memory.h"
#include "memdebug.h"
/*
* Curl_auth_is_gssapi_supported()
*
* This is used to evaluate if GSSAPI (Kerberos V5) is supported.
*
* Parameters: None
*
* Returns TRUE if Kerberos V5 is supported by Windows SSPI.
*/
bool Curl_auth_is_gssapi_supported(void)
{
/* TODO: Return true for now which maintains compatability with the existing
code */
return TRUE;
}
/*
* Curl_auth_create_gssapi_user_message()
*

View File

@ -216,6 +216,20 @@ static CURLcode ntlm_decode_type2_target(struct Curl_easy *data,
from the beginning of the NTLM message.
*/
/*
* Curl_auth_is_ntlm_supported()
*
* This is used to evaluate if NTLM is supported.
*
* Parameters: None
*
* Returns TRUE as NTLM as handled by libcurl.
*/
bool Curl_auth_is_ntlm_supported(void)
{
return TRUE;
}
/*
* Curl_auth_decode_ntlm_type2_message()
*

View File

@ -37,6 +37,22 @@
#include "curl_memory.h"
#include "memdebug.h"
/*
* Curl_auth_is_ntlm_supported()
*
* This is used to evaluate if NTLM is supported.
*
* Parameters: None
*
* Returns TRUE if NTLM is supported by Windows SSPI.
*/
bool Curl_auth_is_ntlm_supported(void)
{
/* TODO: Return true for now which maintains compatability with the existing
code */
return TRUE;
}
/*
* Curl_auth_create_ntlm_type1_message()
*

View File

@ -40,6 +40,20 @@
#include "curl_memory.h"
#include "memdebug.h"
/*
* Curl_auth_is_spnego_supported()
*
* This is used to evaluate if SPNEGO (Negotiate) is supported.
*
* Parameters: None
*
* Returns TRUE if Negotiate supported by the GSS-API library.
*/
bool Curl_auth_is_spnego_supported(void)
{
return TRUE;
}
/*
* Curl_auth_decode_spnego_message()
*

View File

@ -39,6 +39,22 @@
#include "curl_memory.h"
#include "memdebug.h"
/*
* Curl_auth_is_spnego_supported()
*
* This is used to evaluate if SPNEGO (Negotiate) is supported.
*
* Parameters: None
*
* Returns TRUE if Negotiate is supported by Windows SSPI.
*/
bool Curl_auth_is_spnego_supported(void)
{
/* TODO: Return true for now which maintains compatability with the existing
code */
return TRUE;
}
/*
* Curl_auth_decode_spnego_message()
*

View File

@ -83,6 +83,9 @@ CURLcode Curl_auth_create_cram_md5_message(struct Curl_easy *data,
const char *passwdp,
char **outptr, size_t *outlen);
/* This is used to evaluate if DIGEST is supported */
bool Curl_auth_is_digest_supported(void);
/* This is used to generate a base64 encoded DIGEST-MD5 response message */
CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
const char *chlg64,
@ -109,6 +112,9 @@ void Curl_auth_digest_cleanup(struct digestdata *digest);
#endif /* !CURL_DISABLE_CRYPTO_AUTH */
#if defined(USE_NTLM)
/* This is used to evaluate if NTLM is supported */
bool Curl_auth_is_ntlm_supported(void);
/* This is used to generate a base64 encoded NTLM type-1 message */
CURLcode Curl_auth_create_ntlm_type1_message(const char *userp,
const char *passwdp,
@ -140,6 +146,9 @@ CURLcode Curl_auth_create_oauth_bearer_message(struct Curl_easy *data,
const char *bearer,
char **outptr, size_t *outlen);
#if defined(USE_KERBEROS5)
/* This is used to evaluate if GSSAPI (Kerberos V5) is supported */
bool Curl_auth_is_gssapi_supported(void);
/* This is used to generate a base64 encoded GSSAPI (Kerberos V5) user token
message */
CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
@ -165,6 +174,9 @@ void Curl_auth_gssapi_cleanup(struct kerberos5data *krb5);
#endif /* USE_KERBEROS5 */
#if defined(USE_SPNEGO)
/* This is used to evaluate if SPNEGO (Negotiate) is supported */
bool Curl_auth_is_spnego_supported(void);
/* This is used to decode a base64 encoded SPNEGO (Negotiate) challenge
message */
CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,