Red Hat Bugzilla – Bug 139872
libnss_files.so does not process /etc/hosts file properly
Last modified: 2007-11-30 17:10:55 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041020
Description of problem:
nsswitch.conf file contains following line for 'hosts' key:
hosts: files dns
File /etc/hosts contains following lines:
127.000.000.001 localhost localhost.localdomain
In such case it is impossible to get any kind of information about
hosts listened above. If /etc/hosts is modified as below:
127.0.0.1 localhost localhost.localdomain
everythin is ok.
'getent' and 'ping' utilities were used to check whether host
information is available or not.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. vi /etc/hosts;
2. add '0' up to 3 symbols in every IP address byte (e.g. 127.0.0.1
Actual Results: 1. Usinf 'ping':
# ping localhost
ping: unknown host localhost
2. Using 'getent'
# getent hosts
< nothing >
Expected Results: # ping localhost
<something like below>
PING fox (127.0.0.1) 56(84) bytes of data.
64 bytes from fox (127.0.0.1): icmp_seq=0 ttl=64 time=0.036 ms
64 bytes from fox (127.0.0.1): icmp_seq=1 ttl=64 time=0.028 ms
64 bytes from fox (127.0.0.1): icmp_seq=2 ttl=64 time=0.034 ms
64 bytes from fox (127.0.0.1): icmp_seq=3 ttl=64 time=0.048 ms
64 bytes from fox (127.0.0.1): icmp_seq=4 ttl=64 time=0.030 ms
--- fox ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.028/0.035/0.048/0.008 ms, pipe 2
# getent hosts
127.0.0.1 localhost.localdomain localhost
This unexpected behaviour was found in FC3 only. FC2's libnss_files.so
127.000.000.001 is not a valid IP address for inet_pton (AF_INET, ...).
The inet_pton() function does not accept other formats (such as the octal numbers, hexadecimal numbers, and fewer than four numbers that inet_addr() accepts).
Your IP address has 3 octal numbers and one decimal, therefore it is not accepted.