mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
krb5_wrap: pass client_realm to smb_krb5_get_realm_from_hostname()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12554 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
65228925ab
commit
f0c4fcace5
@ -2688,7 +2688,8 @@ static char *smb_krb5_get_default_realm_from_ccache(TALLOC_CTX *mem_ctx)
|
||||
************************************************************************/
|
||||
|
||||
static char *smb_krb5_get_realm_from_hostname(TALLOC_CTX *mem_ctx,
|
||||
const char *hostname)
|
||||
const char *hostname,
|
||||
const char *client_realm)
|
||||
{
|
||||
#if defined(HAVE_KRB5_REALM_TYPE)
|
||||
/* Heimdal. */
|
||||
@ -2719,6 +2720,9 @@ static char *smb_krb5_get_realm_from_hostname(TALLOC_CTX *mem_ctx,
|
||||
realm_list[0] != NULL &&
|
||||
realm_list[0][0] != '\0') {
|
||||
realm = talloc_strdup(mem_ctx, realm_list[0]);
|
||||
if (realm == NULL) {
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
const char *p = NULL;
|
||||
|
||||
@ -2731,9 +2735,16 @@ static char *smb_krb5_get_realm_from_hostname(TALLOC_CTX *mem_ctx,
|
||||
p = strchr_m(hostname, '.');
|
||||
if (p != NULL && p[1] != '\0') {
|
||||
realm = talloc_strdup_upper(mem_ctx, p + 1);
|
||||
if (realm == NULL) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (realm == NULL) {
|
||||
realm = talloc_strdup(mem_ctx, client_realm);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
if (ctx) {
|
||||
@ -2776,7 +2787,8 @@ char *smb_krb5_get_principal_from_service_hostname(TALLOC_CTX *mem_ctx,
|
||||
if (host) {
|
||||
/* DNS name. */
|
||||
realm = smb_krb5_get_realm_from_hostname(talloc_tos(),
|
||||
remote_name);
|
||||
remote_name,
|
||||
default_realm);
|
||||
} else {
|
||||
/* NetBIOS name - use our realm. */
|
||||
realm = smb_krb5_get_default_realm_from_ccache(talloc_tos());
|
||||
|
Loading…
x
Reference in New Issue
Block a user