Skip to content

Commit

Permalink
sasl: Updated SPN variables and comments for consistency
Browse files Browse the repository at this point in the history
In places the "host name" and "realm" variable was referred to as
"instance" whilst in others it was referred to as "host".
  • Loading branch information
captain-caveman2k committed Aug 31, 2015
1 parent eb8283b commit b850437
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions lib/curl_sasl.c
Expand Up @@ -263,19 +263,19 @@ static CURLcode sasl_digest_get_qop_values(const char *options, int *value)
/*
* Curl_sasl_build_spn()
*
* This is used to build a SPN string in the format service/host.
* 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.
* host [in] - The host name or realm.
* instance [in] - The host name or realm.
*
* Returns a pointer to the newly allocated SPN.
*/
char *Curl_sasl_build_spn(const char *service, const char *host)
char *Curl_sasl_build_spn(const char *service, const char *instance)
{
/* Generate and return our SPN */
return aprintf("%s/%s", service, host);
return aprintf("%s/%s", service, instance);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion lib/curl_sasl.h
Expand Up @@ -146,7 +146,7 @@ int Curl_sasl_digest_get_pair(const char *str, char *value, char *content,
const char **endptr);

#if defined(HAVE_GSSAPI)
char *Curl_sasl_build_gssapi_spn(const char *service, const char *host);
char *Curl_sasl_build_gssapi_spn(const char *service, const char *instance);
#endif

#ifndef CURL_DISABLE_CRYPTO_AUTH
Expand Down
10 changes: 5 additions & 5 deletions lib/curl_sasl_gssapi.c
Expand Up @@ -43,19 +43,19 @@
/*
* Curl_sasl_build_gssapi_spn()
*
* This is used to build a SPN string in the format service@host.
* This is used to build a SPN string in the format service@instance.
*
* Parameters:
*
* serivce [in] - The service type such as www, smtp, pop or imap.
* host [in] - The host name or realm.
* 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_sasl_build_gssapi_spn(const char *service, const char *host)
char *Curl_sasl_build_gssapi_spn(const char *service, const char *instance)
{
/* Generate and return our SPN */
return aprintf("%s@%s", service, host);
return aprintf("%s@%s", service, instance);
}

/*
Expand Down
10 changes: 5 additions & 5 deletions lib/curl_sasl_sspi.c
Expand Up @@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2014 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2014, Steve Holme, <steve_holme@hotmail.com>.
* Copyright (C) 2014 - 2015, Steve Holme, <steve_holme@hotmail.com>.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -49,16 +49,16 @@
/*
* Curl_sasl_build_spn()
*
* This is used to build a SPN string in the format service/host.
* This is used to build a SPN string in the format service/instance.
*
* Parameters:
*
* serivce [in] - The service type such as www, smtp, pop or imap.
* host [in] - The host name or realm.
* instance [in] - The host name or realm.
*
* Returns a pointer to the newly allocated SPN.
*/
TCHAR *Curl_sasl_build_spn(const char *service, const char *host)
TCHAR *Curl_sasl_build_spn(const char *service, const char *instance)
{
char *utf8_spn = NULL;
TCHAR *tchar_spn = NULL;
Expand All @@ -71,7 +71,7 @@ TCHAR *Curl_sasl_build_spn(const char *service, const char *host)
formulate the SPN instead. */

/* Allocate our UTF8 based SPN */
utf8_spn = aprintf("%s/%s", service, host);
utf8_spn = aprintf("%s/%s", service, instance);
if(!utf8_spn) {
return NULL;
}
Expand Down

1 comment on commit b850437

@michael-o
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not feel right to me. From RFC 4120, chapter 6.2.1:

The principal identifier for a server on a host will generally be
composed of two parts: (1) the realm of the KDC with which the server
is registered, and (2) a two-component name of type NT-SRV-HST, if
the host name is an Internet domain name, or a multi-component name
of type NT-SRV-XHST, if the name of the host is of a form (such as
X.500) that allows slash (/) separators. The first component of the
two- or multi-component name will identify the service, and the
latter components will identify the host. Where the name of the host
is not case sensitive (for example, with Internet domain names) the
name of the host MUST be lowercase. If specified by the application
protocol for services such as telnet and the Berkeley R commands that
run with system privileges, the first component MAY be the string
'host' instead of a service-specific identifier.

To be more specific, we have a service principal, thus service/host@realm. If you stay with UPNs, it would be almost correct: http://web.mit.edu/kerberos/krb5-1.5/krb5-1.5.4/doc/krb5-user/What-is-a-Kerberos-Principal_003f.html

What do you think?

Please sign in to comment.