]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't strip the domain when looking up hostname via DNS
authorRoy Marples <roy@marples.name>
Wed, 23 May 2007 14:48:02 +0000 (14:48 +0000)
committerRoy Marples <roy@marples.name>
Wed, 23 May 2007 14:48:02 +0000 (14:48 +0000)
configure.c

index 24ab6aaab9489790de1e9adc85556d0116f8172b..6ab860ac4a2421d636d986839ca0d3908a32ce05 100644 (file)
@@ -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));
                }
        }