Commit graph

68 commits

Author SHA1 Message Date
Tom Gundersen d1ca51b153 nss-myhostname: port to sd-rtnl 2014-04-19 18:39:24 +02:00
Karel Zak 4561be3a64 Remove duplicate includes 2013-11-18 20:28:55 -05:00
Shawn Landden 05d3a17623 use #pragma once instead of foo*foo define guards 2013-11-18 20:28:54 -05:00
Zbigniew Jędrzejewski-Szmek 7ff7394d9e Never call qsort on potentially NULL arrays
This extends 62678ded 'efi: never call qsort on potentially
NULL arrays' to all other places where qsort is used and it
is not obvious that the count is non-zero.
2013-10-13 17:56:54 -04:00
Lennart Poettering c12d1eec7f build-sys: add makefile stub link to nss-myhostname/ 2013-04-30 08:36:02 -03:00
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
Zbigniew Jędrzejewski-Szmek 7464b33d80 nss-myhostname: do not use _cleanup_
mss-myhostname wasn't working because of underlinking. Instead of
fixing the underlinking, just remove the use of _cleanup_ macros.

It is impolite to use our utility functions in modules designed to be
loaded by others. So cleanup macros which (at some point) call assert
which calls log_assert_failed, should not be used. Revert this part of
commit d73c3269c.
2013-04-02 13:57:32 -04:00
Zbigniew Jędrzejewski-Szmek d73c3269cd nss-myhostname: use _cleanup_ and split function into two
The triply nested loop is just too much. Let's split out the
middle loop's body, so the whole thing is easier to read. Also
modernize the style a bit, using structure initialization to
avoid memset and such.
2013-03-31 14:32:32 -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 c4c2e6a695 nss-myhostname: remove redundant .gitignore 2013-01-07 15:15:57 +01:00
Tom Gundersen 16eb4da97e nss-myhostname: integrate documentation
Converted from html to xml and changed the style to fit into the other
manpages.
2013-01-07 15:15:57 +01:00
Tom Gundersen d562955eac nss-myhostname: integrate into systemd buildsystem
Note that there are still some rome for cleanups. In particular,
the .la files are now installed, which we probably don't want; and
some of the macros in Makefile.am are likely redundan.
2013-01-07 15:15:57 +01: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 07761ad65d nss-myhostname: remove non-Linux support 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