Bug 16475 - gethostbyaddr without /etc/{resolv,nsswitch}.conf
Summary: gethostbyaddr without /etc/{resolv,nsswitch}.conf
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: network (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-21 17:30 UTC by Ludovic Courtès
Modified: 2014-06-13 08:54 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ludovic Courtès 2014-01-21 17:30:11 UTC
(Initially discussed at <http://sourceware.org/ml/libc-alpha/2014-01/msg00351.html>.)

Consider an environment without /etc/resolv.conf.

When doing a host name lookup, ‘dns’ returns NSS_STATUS_UNAVAIL, so we go on with ‘files’ and /etc/hosts is honored as expected

Conversely, when doing a reverse lookup when /etc/resolv.conf is missing, the 'dns' name service returns NSS_STATUS_NOTFOUND, leading 'gethostbyaddr' to return immediately without invoking the 'files' NSS (thus ignoring /etc/hosts.)

It seems that 'dns' should instead always return UNAVAIL when resolv.conf is missing, but that is an ABI break.