Bug 139872 - libnss_files.so does not process /etc/hosts file properly
Summary: libnss_files.so does not process /etc/hosts file properly
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 3
Hardware: i686
OS: Linux
medium
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-11-18 15:55 UTC by Kovalevich Victor
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-11-18 17:37:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Kovalevich Victor 2004-11-18 15:55:53 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041020
Firefox/0.10.1

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):
glibc-devel-2.3.3-74

How reproducible:
Always

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
-> 127.000.000.001);


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


Additional info:

This unexpected behaviour was found in FC3 only. FC2's libnss_files.so
works properly.

Comment 1 Jakub Jelinek 2004-11-18 17:37:53 UTC
127.000.000.001 is not a valid IP address for inet_pton (AF_INET, ...).
See http://www.opengroup.org/onlinepubs/009695399/functions/inet_ntop.html
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.



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