diff options
author | Volker Lendecke <vl@sernet.de> | 2008-10-06 14:49:10 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-10-06 15:23:39 +0200 |
commit | f4095b62a8030cb9d929bb113f3488f3917b8f9b (patch) | |
tree | 33342b8ddfd59cb03ea1e9e5f03af36eefa17c5c /source3/libnet | |
parent | 6aa8613b11b596fed115849262e96524b84a8fbe (diff) | |
download | samba-f4095b62a8030cb9d929bb113f3488f3917b8f9b.tar.gz samba-f4095b62a8030cb9d929bb113f3488f3917b8f9b.tar.bz2 samba-f4095b62a8030cb9d929bb113f3488f3917b8f9b.zip |
If name_to_fqdn fails, retry with the dns domain the DC gave us
This is a workaround for the cases where you want to join under a netbios name
that is different from your hostname, i.e. a name that can not be found in
/etc/hosts or dns. In these cases, name_to_fqdn fails or gives invalid results.
Diffstat (limited to 'source3/libnet')
-rw-r--r-- | source3/libnet/libnet_join.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index a39dee676f..ab8af0be6b 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -357,10 +357,15 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx, strupper_m(spn); spn_array[0] = spn; - if (name_to_fqdn(my_fqdn, r->in.machine_name) && - !strequal(my_fqdn, r->in.machine_name)) { + if (!name_to_fqdn(my_fqdn, r->in.machine_name) + || (strchr(my_fqdn, '.') == NULL)) { + fstr_sprintf(my_fqdn, "%s.%s", r->in.machine_name, + r->out.dns_domain_name); + } + + strlower_m(my_fqdn); - strlower_m(my_fqdn); + if (!strequal(my_fqdn, r->in.machine_name)) { spn = talloc_asprintf(mem_ctx, "HOST/%s", my_fqdn); if (!spn) { return ADS_ERROR_LDAP(LDAP_NO_MEMORY); |