netcfg lists manually specified domains in duplicate

Bug #160778 reported by AlainKnaff
This bug report is a duplicate of:  Bug #11019: Wrong FQDN definition. Edit Remove
2
Affects Status Importance Assigned to Milestone
netcfg (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: netcfg

Netcfg allows you to specify a fully-qualified hostname, but unfortunately the interpretation of such a name is buggy.

Steps to reproduce:
============

1. Make sure no DHCP server is available
2. Install (K)ubuntu
3. As a hostname, enter a hostname with a domain (such as arthur.hitchhiker.org.lu)

At end of installation the domainname will be set to hitchhiker.org.lu.hitchhiker.org.lu instead of just hitchhiker.org.lu . This domain name will be used by all kinds of apps (slapd, nis, ...)

Version information:
============

netcfg_1.39ubuntu4

Explanation of bug:
===========

In netcfg, if the hostname entered by the user contains a dot, the part after the first dot is considered to be the domain. However, unfortunately, the domain is also left in the hostname.

Later, an /etc/hosts is generated which contains a line such as the following:
$ip $hostname.$domainname $domainname

If the user entered arthur.hitchhiker.org.lu, then domainname becomes hitchhiker.org.lu, but hostname stays arthur.hitchhiker.org.lu. Thus /etc/hosts will contain:

158.64.137.20 arthur.hitchhiker.org.lu.hitchhiker.org.lu arthur.hitchhiker.org.lu

instead of

158.64.137.20 arthur.hitchhiker.org.lu arthur

The result of this is that all kinds of packages will end up believing that hitchhiker.org.lu.hitchhiker.org.lu is the domain name, rather than just hitchhiker.org.lu

Fix:
==

The follwoing patch fixes the issue

diff -ur netcfg.orig/netcfg-common.c netcfg/netcfg-common.c
--- netcfg.orig/netcfg-common.c 2007-06-17 12:10:49.000000000 +0200
+++ netcfg/netcfg-common.c 2007-11-07 11:24:19.000000000 +0100
@@ -610,6 +610,7 @@
             domain = strdup(s + 1);
             debconf_set(client, "netcfg/get_domain", domain);
             have_domain = 1;
+ *s='\0';
         }
     }
     return 0;

Revision history for this message
AlainKnaff (kubuntu-misc) wrote :
Revision history for this message
Colin Watson (cjwatson) wrote :

Thanks for your report. This is also bug 11019, but your patch looks good - I'll stare at it for a bit and probably merge it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.