From: Roy Marples Date: Wed, 23 May 2007 14:48:02 +0000 (+0000) Subject: Don't strip the domain when looking up hostname via DNS X-Git-Tag: v3.2.3~248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd0e12b72b17d99479d534788f4c8266fce2133e;p=thirdparty%2Fdhcpcd.git Don't strip the domain when looking up hostname via DNS --- diff --git a/configure.c b/configure.c index 24ab6aaa..6ab860ac 100644 --- a/configure.c +++ b/configure.c @@ -496,7 +496,7 @@ int configure (const options_t *options, interface_t *iface, #endif /* Now we have made a resolv.conf we can obtain a hostname if we need it */ - if (options->dohostname && ! dhcp->hostname) { + if (options->dohostname && ! dhcp->hostname) { union { struct sockaddr sa; struct sockaddr_in sin; @@ -524,34 +524,8 @@ int configure (const options_t *options, interface_t *iface, freeaddrinfo (res); addr[0] = '\0'; logger (LOG_ERR, "malicious PTR record detected"); - } else if (*addr) { - /* Strip out the domain if it matches */ - char *p = addr; - char *token = strsep (&p, "."); - bool match_domain = false; - - if (p && *p) { - if (dhcp->dnssearch) { - char *s = xstrdup (dhcp->dnssearch); - char *sp = s; - char *t; - - while ((t = strsep (&sp, " "))) - if (strcmp (t, p) == 0) { - match_domain = true; - break; - } - free (s); - } else if (dhcp->dnsdomain) { - if (strcmp (dhcp->dnsdomain, p) == 0) - match_domain = true; - } - } - if (match_domain) - strlcpy (newhostname, token, sizeof (newhostname)); - else - snprintf (newhostname, sizeof (newhostname), "%s.%s", token, p); - } + } else if (*addr) + strlcpy (newhostname, addr, sizeof (newhostname)); } }