#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;
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));
}
}