]> granicus.if.org Git - curl/commitdiff
vauth: Introduced Curl_auth_is_<mechansism>_supported() functions
authorSteve Holme <steve_holme@hotmail.com>
Sun, 20 Mar 2016 11:56:07 +0000 (11:56 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Thu, 18 Aug 2016 19:31:20 +0000 (20:31 +0100)
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.

lib/vauth/digest.c
lib/vauth/digest_sspi.c
lib/vauth/krb5_gssapi.c
lib/vauth/krb5_sspi.c
lib/vauth/ntlm.c
lib/vauth/ntlm_sspi.c
lib/vauth/spnego_gssapi.c
lib/vauth/spnego_sspi.c
lib/vauth/vauth.h

index 26ea7b5983edb92ad1ed10c8a531fef023cd1b6e..f4898404f287c441adb9ec0c15015365d00da8d4 100644 (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()
  *
index 6a7315eb5022391aadefb009a0486503d8d3b359..9254385e5908e7db2134983044779ff08d889754 100644 (file)
 #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()
  *
index 31c8c7da414da81d2c7f1a61231be2f67a76fa82..c754fae45208f3d4914823adba9207b1c3c7c379 100644 (file)
 #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()
  *
index 08774f6c9e7212c6706defe363b75d297997a8b7..e046900461436c2fc78bb033cbbdf60be8e9392b 100644 (file)
 #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()
  *
index c85fe429880abac96158c5dcf85c847eef4b4fd0..b484a011a2cd812e799a6ed394c416614859eef0 100644 (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()
  *
index 982a9d378c8450e03a9b1be1c8511f51187c4704..6f446780e0db52939dea12ab84500f6b1a427cfb 100644 (file)
 #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()
  *
index b256ee6167e79a9791d750540704f0d416ac44b4..8840db8fda26139fd9ae721a19a3a7e023012c02 100644 (file)
 #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()
  *
index b6176ece16699c08b018569eb320e4d6a39026f3..1222a654df8e15a0d5ac41107fba313497b913d9 100644 (file)
 #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()
  *
index 38806ee73b5cbd9cfd7e723b3325857555521c9d..3ad2139f9abe2123121b3bb57c7f87e7b224ea83 100644 (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,