diff options
author | Jeremy Allison <jra@samba.org> | 2004-10-30 01:32:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:53:05 -0500 |
commit | 2d4725cfa6f93c5cf9e355b3b1ad199e7518b531 (patch) | |
tree | edebd433637a2cdfeddd40eafa24386401b24dd0 /source3/libads/kerberos_keytab.c | |
parent | cf47845b1c2e83d49f32bdfc455cd9114a234df8 (diff) | |
download | samba-2d4725cfa6f93c5cf9e355b3b1ad199e7518b531.tar.gz |
r3381: More merging of the #1717 patch. Fixup some erroneous assumptions about
memcpy's into fqdn names. I think the original intent was to create
MYNAME.fqdn.tail.part.
Will need testing to see I haven't broken keytab support.
Jeremy.
(This used to be commit 82acf83040654eb8b7e261518a3e5eb9caea7750)
Diffstat (limited to 'source3/libads/kerberos_keytab.c')
-rw-r--r-- | source3/libads/kerberos_keytab.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c index 5ece6e6ab25..90f5a376d6c 100644 --- a/source3/libads/kerberos_keytab.c +++ b/source3/libads/kerberos_keytab.c @@ -425,6 +425,7 @@ int ads_keytab_create_default(ADS_STRUCT *ads) krb5_keytab_entry kt_entry; krb5_kvno kvno; fstring my_fqdn, my_Fqdn, my_name, my_NAME; + char *p_fqdn; int i, found = 0; char **oldEntries = NULL, *princ_s[18];; @@ -441,14 +442,20 @@ int ads_keytab_create_default(ADS_STRUCT *ads) fstrcpy(my_name, global_myname()); strlower_m(my_name); + fstrcpy(my_NAME, global_myname()); strupper_m(my_NAME); - name_to_fqdn(my_Fqdn, global_myname()); - strlower_m(my_Fqdn); - memcpy(my_Fqdn, my_NAME, strlen(my_NAME)); + + my_fqdn[0] = '\0'; name_to_fqdn(my_fqdn, global_myname()); strlower_m(my_fqdn); + p_fqdn = strchr_m(my_fqdn, '.'); + fstrcpy(my_Fqdn, my_NAME); + if (p_fqdn) { + fstrcat(my_Fqdn, p_fqdn); + } + asprintf(&princ_s[0], "%s$@%s", my_name, lp_realm()); asprintf(&princ_s[1], "%s$@%s", my_NAME, lp_realm()); asprintf(&princ_s[2], "host/%s@%s", my_name, lp_realm()); |