aboutsummaryrefslogtreecommitdiff
path: root/lib/vauth/vauth.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2016-04-03 20:26:03 +0100
committerSteve Holme <steve_holme@hotmail.com>2016-04-03 20:26:03 +0100
commit9feb2676a4e153eef7f5536f940678af2df2cf9e (patch)
tree762af4c526bc0b6ac77da2375e925a1653aacf59 /lib/vauth/vauth.c
parente655ae0c80aa3ddbacc20cac349336e4696d7d74 (diff)
vauth: Removed the need for a separate GSS-API based SPN function
Diffstat (limited to 'lib/vauth/vauth.c')
-rw-r--r--lib/vauth/vauth.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/vauth/vauth.c b/lib/vauth/vauth.c
index 7ed60b11d..c74005fc2 100644
--- a/lib/vauth/vauth.c
+++ b/lib/vauth/vauth.c
@@ -35,27 +35,46 @@
/*
* Curl_auth_build_spn()
*
- * This is used to build a SPN string in the format service/instance.
+ * This is used to build a SPN string in the following formats:
+ *
+ * service/host@realm (Not currently used)
+ * service/host (Not used by GSS-API)
+ * service@realm (Not used by Windows SSPI)
*
* Parameters:
*
* service [in] - The service type such as www, smtp, pop or imap.
- * instance [in] - The host name or realm.
+ * host [in] - The host name.
+ * realm [in] - The realm.
*
* Returns a pointer to the newly allocated SPN.
*/
#if !defined(USE_WINDOWS_SSPI)
-char *Curl_auth_build_spn(const char *service, const char *instance)
+char *Curl_auth_build_spn(const char *service, const char *host,
+ const char *realm)
{
- /* Generate and return our SPN */
- return aprintf("%s/%s", service, instance);
+ char *spn = NULL;
+
+ /* Generate our SPN */
+ if(host && realm)
+ spn = aprintf("%s/%s@%s", service, host, realm);
+ else if(host)
+ spn = aprintf("%s/%s", service, host);
+ else if(realm)
+ spn = aprintf("%s@%s", service, realm);
+
+ /* Return our newly allocated SPN */
+ return spn;
}
#else
-TCHAR *Curl_auth_build_spn(const char *service, const char *instance)
+TCHAR *Curl_auth_build_spn(const char *service, const char *host,
+ const char *realm)
{
char *utf8_spn = NULL;
TCHAR *tchar_spn = NULL;
+ (void) realm;
+
/* Note: We could use DsMakeSPN() or DsClientMakeSpnForTargetServer() rather
than doing this ourselves but the first is only available in Windows XP
and Windows Server 2003 and the latter is only available in Windows 2000
@@ -63,8 +82,8 @@ TCHAR *Curl_auth_build_spn(const char *service, const char *instance)
Client Extensions are installed. As such it is far simpler for us to
formulate the SPN instead. */
- /* Allocate our UTF8 based SPN */
- utf8_spn = aprintf("%s/%s", service, instance);
+ /* Generate our UTF8 based SPN */
+ utf8_spn = aprintf("%s/%s", service, host);
if(!utf8_spn) {
return NULL;
}
@@ -85,22 +104,3 @@ TCHAR *Curl_auth_build_spn(const char *service, const char *instance)
}
#endif /* USE_WINDOWS_SSPI */
-#if defined(HAVE_GSSAPI)
-/*
- * Curl_auth_build_gssapi_spn()
- *
- * This is used to build a SPN string in the format service@instance.
- *
- * Parameters:
- *
- * service [in] - The service type such as www, smtp, pop or imap.
- * instance [in] - The host name or realm.
- *
- * Returns a pointer to the newly allocated SPN.
- */
-char *Curl_auth_build_gssapi_spn(const char *service, const char *instance)
-{
- /* Generate and return our SPN */
- return aprintf("%s@%s", service, instance);
-}
-#endif /* HAVE_GSSAPI */