aboutsummaryrefslogtreecommitdiff
path: root/lib/curl_sasl.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-08-09 16:26:58 +0100
committerSteve Holme <steve_holme@hotmail.com>2014-08-09 16:40:24 +0100
commit1b69122810462cff569eb0929230961aa356bae0 (patch)
treeec25943700e724163629d40ae322f7c05d5a1b85 /lib/curl_sasl.c
parente9b4a96975e24ad75167e367d64f33daee887dcd (diff)
sasl: Introduced Curl_sasl_build_spn() for building a SPN
Various parts of the libcurl source code build a SPN for inclusion in authentication data. This information is either used by our own native generation routines or passed to authentication functions in third-party libraries such as SSPI. However, some of these instances use fixed buffers rather than dynamically allocated ones and not all of those that should, convert to wide character strings in Unicode builds. Implemented a common function that generates a SPN and performs the wide character conversion where necessary.
Diffstat (limited to 'lib/curl_sasl.c')
-rw-r--r--lib/curl_sasl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c
index a2dfe7755..75efca3e8 100644
--- a/lib/curl_sasl.c
+++ b/lib/curl_sasl.c
@@ -120,6 +120,26 @@ static CURLcode sasl_digest_get_qop_values(const char *options, int *value)
}
#endif
+#if !defined(USE_WINDOWS_SSPI)
+/*
+ * Curl_sasl_build_spn()
+ *
+ * This is used to build a SPN string in the format service/host.
+ *
+ * Parameters:
+ *
+ * serivce [in] - The service type such as www, smtp, pop or imap.
+ * instance [in] - The instance name such as the host nme or realm.
+ *
+ * Returns a pointer to the newly allocated SPN.
+ */
+char *Curl_sasl_build_spn(const char *service, const char *host)
+{
+ /* Generate and return our SPN */
+ return aprintf("%s/%s", service, host);
+}
+#endif
+
/*
* Curl_sasl_create_plain_message()
*