Commit graph

7 commits

Author SHA1 Message Date
Lennart Poettering e8a7a31539 nss-myhostname: resolve 'localhost' so that /etc/hosts becomes optional
This makes sure nss-myhostname not only resolves the local host name to
127.0.0.2/::1 but also the host name 'localhost: to 127.0.0.1/::1. This
makes installation of /etc/passwd optional, as it usually only includes
a mapping for 'localhost'.

This change also resolves ::1 to the local hostname (as before), but
also lists 'localhost' as an alias. This means look-ups are now fully
reversible, even though they are 1:n mappings.

Finally, the module will no longer erroneously claim that local IP
addresses which aren't on the loopback device were.
2013-04-24 19:02:13 -03:00
Dave Reisner 1e335af70f nss-myhostname: ensure that glibc's assert is used 2013-04-19 16:31:52 -04:00
Harald Hoyer 7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Zbigniew Jędrzejewski-Szmek 1c6330456c Use initalization instead of explicit zeroing in more places 2013-04-10 18:59:42 -04:00
Eelco Dolstra d2f1f23ad2 nss-myhostname: copy first result to preallocated buffer
Fixes a segfault in nscd when using nss-myhostname.

Nscd expects that an NSS module's gethostbyname4_r function returns
its first result in the pre-allocated gaih_addrtuple denoted by **pat.
(See nscd/aicache.c in the Glibc sources.)  However, nss-myhostname
doesn't fill in **pat but allocates the first result in ‘buffer’, then
sets *pat.  So nscd crashes (e.g. when running ‘getent ahosts
my-machine’).

Hard to tell if this is a bug in nscd, since there doesn't seem to be
a proper API spec for gethostbyname4_r.  But in any case, this patch
fixes the crash by copying the first result to **pat.
2013-02-07 01:02:33 -05:00
Tom Gundersen cbc06dcd8f nss-myhostname: remove duplicate LICENCE
Also update the licence in the source files.
2013-01-07 15:15:57 +01:00
Tom Gundersen 8e6640f0fe nss-myhostname: move to subdirectory
In order to merge into the systemd repos.
2013-01-03 09:48:03 +01:00
Renamed from nss-myhostname.c (Browse further)