remove-name-to-fqdn-api [plain text]
Index: samba/source/libads/kerberos_verify.c
===================================================================
--- samba/source/libads/kerberos_verify.c.orig
+++ samba/source/libads/kerberos_verify.c
@@ -68,7 +68,7 @@ static BOOL ads_keytab_verify_ticket(krb
fstrcpy(my_name, global_myname());
my_fqdn[0] = '\0';
- name_to_fqdn(my_fqdn, global_myname());
+ get_mydnsfullname(my_fqdn);
asprintf(&valid_princ_formats[0], "%s$@%s", my_name, lp_realm());
asprintf(&valid_princ_formats[1], "host/%s@%s", my_name, lp_realm());
Index: samba/source/smbd/negprot.c
===================================================================
--- samba/source/smbd/negprot.c.orig
+++ samba/source/smbd/negprot.c
@@ -225,7 +225,8 @@ static DATA_BLOB negprot_spnego(void)
} else {
fstring myname;
char *host_princ_s = NULL;
- name_to_fqdn(myname, global_myname());
+ myname[0] = '\0';
+ get_mydnsfullname(myname);
strlower_m(myname);
asprintf(&host_princ_s, "cifs/%s@%s", myname, lp_realm());
blob = spnego_gen_negTokenInit(guid, OIDs_krb5, host_princ_s);
Index: samba/source/utils/net_ads.c
===================================================================
--- samba/source/utils/net_ads.c.orig
+++ samba/source/utils/net_ads.c
@@ -1036,7 +1036,8 @@ static ADS_STATUS net_set_machine_spn(TA
strupper_m(psp);
servicePrincipalName[0] = psp;
- name_to_fqdn(my_fqdn, machine_name);
+ my_fqdn[0] = '\0';
+ get_mydnsfullname(my_fqdn);
strlower_m(my_fqdn);
if ( !(psp = talloc_asprintf(ctx, "HOST/%s", my_fqdn)) )
goto done;
@@ -1377,11 +1378,12 @@ static NTSTATUS net_update_dns(TALLOC_CT
{
int num_addrs;
struct in_addr *iplist = NULL;
- fstring machine_name;
+ fstring machine_fqdn;
NTSTATUS status;
- name_to_fqdn( machine_name, global_myname() );
- strlower_m( machine_name );
+ machine_fqdn[0] = '\0';
+ get_mydnsfullname(machine_fqdn);
+ strlower_m( machine_fqdn );
/* Get our ip address (not the 127.0.0.x address but a real ip
* address) */
@@ -1393,7 +1395,7 @@ static NTSTATUS net_update_dns(TALLOC_CT
return NT_STATUS_INVALID_PARAMETER;
}
- status = net_update_dns_internal(mem_ctx, ads, machine_name,
+ status = net_update_dns_internal(mem_ctx, ads, machine_fqdn,
iplist, num_addrs);
SAFE_FREE( iplist );
return status;
Index: samba/source/lib/util.c
===================================================================
--- samba/source/lib/util.c.orig
+++ samba/source/lib/util.c
@@ -2920,52 +2920,6 @@ BOOL unix_wild_match(const char *pattern
}
/**********************************************************************
- Converts a name to a fully qualified domain name.
- Returns True if lookup succeeded, False if not (then fqdn is set to name)
-***********************************************************************/
-
-BOOL name_to_fqdn(fstring fqdn, const char *name)
-{
- struct hostent *hp = sys_gethostbyname(name);
-
- if ( hp && hp->h_name && *hp->h_name ) {
- char *full = NULL;
-
- /* find out if the fqdn is returned as an alias
- * to cope with /etc/hosts files where the first
- * name is not the fqdn but the short name */
- if (hp->h_aliases && (! strchr_m(hp->h_name, '.'))) {
- int i;
- for (i = 0; hp->h_aliases[i]; i++) {
- if (strchr_m(hp->h_aliases[i], '.')) {
- full = hp->h_aliases[i];
- break;
- }
- }
- }
- if (full && (StrCaseCmp(full, "localhost.localdomain") == 0)) {
- DEBUG(1, ("WARNING: your /etc/hosts file may be broken!\n"));
- DEBUGADD(1, (" Specifing the machine hostname for address 127.0.0.1 may lead\n"));
- DEBUGADD(1, (" to Kerberos authentication problems as localhost.localdomain\n"));
- DEBUGADD(1, (" may end up being used instead of the real machine FQDN.\n"));
- full = hp->h_name;
- }
-
- if (!full) {
- full = hp->h_name;
- }
-
- DEBUG(10,("name_to_fqdn: lookup for %s -> %s.\n", name, full));
- fstrcpy(fqdn, full);
- return True;
- } else {
- DEBUG(10,("name_to_fqdn: lookup for %s failed.\n", name));
- fstrcpy(fqdn, name);
- return False;
- }
-}
-
-/**********************************************************************
Extension to talloc_get_type: Abort on type mismatch
***********************************************************************/