Bug 15522 - crash if dhcp server returns a domain with NO (0) dots in it
crash if dhcp server returns a domain with NO (0) dots in it
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: pump (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Erik Troan
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-08-05 17:45 EDT by Need Real Name
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-08-07 17:48:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2000-08-05 17:45:53 EDT
Verified fix

--- pump.c.orig Thu Feb 17 15:15:48 2000
+++ pump.c      Sat Aug  5 22:26:55 2000
@@ -164,9 +164,10 @@
        fprintf(f, "search");
        chptr = domain;
        do {
+           char *chptr2 = strchr(chptr, '.');
            /* If there is a single . in the search path, write it out
               only if the toplevel domain is com, edu, gov, mil, org */
-           if (!strchr(strchr(chptr, '.') + 1, '.')) {
+           if (chptr2 && !strchr(chptr2 + 1, '.')) {
                char * tail = strchr(chptr, '.');
                if (strcmp(tail, ".com") && strcmp(tail, ".edu") &&
                    strcmp(tail, ".gov") && strcmp(tail, ".mil") &&
@@ -174,7 +175,7 @@
            }
 
            fprintf(f, " %s", chptr);
-           chptr = strchr(chptr, '.');
+           chptr = chptr2;
            if (chptr) {
                chptr++;
                if (!strchr(chptr, '.'))
Comment 1 Bert de Bruijn 2000-08-05 18:54:21 EDT
unrelated to this bug, but related to bug #15192:
why isn't .net listed in this code fragment ?
Bug #15192 is about pump writing an empty search line in /etc/resolv.conf when
domain-name is my.net, but it works ok when domain-name is my.own.net...
Comment 2 Brian Smith 2000-08-06 22:26:10 EDT
Why does pump even care what the top-level domain is? Shouldn't it just pass
whatever the DHCP server says? Some organizations use bogus TLDs on their
internal networks, and this might be problematic for them. Besides, there'll
possibly be new TLDs on the internet soon, you don't want to be adding every
single one into the code, do you?
Comment 3 Erik Troan 2000-08-07 17:48:15 EDT
It's trying to know that it if a hostname is foo.bar.co.uk, the search path
should be

		search bar.co.uk

but if the hostname is foo.bar.oot.com, the search path should be

		search bar.oot.com oot.com

unfortunately, there isn't a good rule to get this right (which is why dhcp
servers should give us a proper search path rather then forcing us to use our
own), so use /etc/pump.conf :-(
Comment 4 Erik Troan 2000-08-07 17:50:25 EDT
diff -u -r1.52 pump.c
--- pump.c	2000/08/07 21:48:22	1.52
This patch (which seems easier) is in pump-0.8.1

+++ pump.c	2000/08/07 21:49:38
@@ -161,6 +161,8 @@
 
     if (domain && isSearchPath) {
 	fprintf(f, "search %s\n", domain);
+    } else if (domain && !strchr(chptr, '.')) {
+	fprintf(f, "search %s\n", domain);
     } else if (domain) {
 	fprintf(f, "search");
 	chptr = domain;

Note You need to log in before you can comment on or make changes to this bug.