summaryrefslogtreecommitdiff
path: root/src/test/test-nss-hosts.c
Commit message (Collapse)AuthorAgeFilesLines
* test: make make_addresses() actually return the addressesFrantisek Sumsal2023-03-301-1/+3
| | | | | I noticed missing coverage in the reports and turns out this has been broken since forever (i.e. 2016 - 9f7672b3bc), whoopsie.
* tree-wide: Fix format specifier warnings for %xJan Janssen2022-08-301-2/+2
| | | | | | Unfortunately, hex output can only be produced with unsigned types. Some cases can be fixed by producing the correct type, but a few simply have to be cast. At least casting makes it explicit.
* tree-wide: replace AF_LOCAL with AF_UNIXYu Watanabe2022-05-141-2/+2
|
* test: do not accept IPv6 local address if IPv6 is disabledYu Watanabe2022-04-231-5/+13
|
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-5/+0
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* tests: no longer load libnss_{files|dns}Evgeny Vereshchagin2022-01-031-1/+1
| | | | | Those libraries aren't provided by systemd so they shouldn't be included here
* nss-resolve: expose various source-disablement settings as variablesZbigniew Jędrzejewski-Szmek2021-12-211-1/+4
| | | | | | | | | | | | | | | Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2006761: > systemd-resolved always (reverse)-resolves the host's IP addresses and FQDN. > This can be harmful when an application (for instance, a DNS zone manager) is > installed on the same server instance. That application would expect > NXDOMAIN to be returned if the current server's IP does not belong in an > already managed reverse zone. This allows clients of nss-resolve to use the same config options that are available through the dbus api and as command-line options to resolvectl. The man page text is is mostly copied directly from c6f20515ab600098b5c2871bae2e9ecab3b41555.
* tree-wide: make format_ifname() or friends return negative errno on failureYu Watanabe2021-09-291-15/+5
| | | | | | | | Also, - drop unnecessary +1 from buffer size, as IF_NAMESIZE or IFNAMSIZ includes the nul at the end. - format_ifname() does not update buffer on failure, - introduces format_ifname_alloc(), FORMAT_IFNAME(), and their friends.
* tree-wide: voidify unchecked snprintf callsLuca Boccassi2021-08-201-1/+1
| | | | | | | | | | | | | | | According to Coverity, 194 ouf of 227 times we check for snprintf return code. Voidify the rest. CID#1461512 CID#1461513 CID#1461514 CID#1461515 CID#1461516 CID#1461518 CID#1461519 CID#1461520 CID#1461522
* alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()Lennart Poettering2021-05-191-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | We recently started making more use of malloc_usable_size() and rely on it (see the string_erase() story). Given that we don't really support sytems where malloc_usable_size() cannot be trusted beyond statistics anyway, let's go fully in and rework GREEDY_REALLOC() on top of it: instead of passing around and maintaining the currenly allocated size everywhere, let's just derive it automatically from malloc_usable_size(). I am mostly after this for the simplicity this brings. It also brings minor efficiency improvements I guess, but things become so much nicer to look at if we can avoid these allocation size variables everywhere. Note that the malloc_usable_size() man page says relying on it wasn't "good programming practice", but I think it does this for reasons that don't apply here: the greedy realloc logic specifically doesn't rely on the returned extra size, beyond the fact that it is equal or larger than what was requested. (This commit was supposed to be a quick patch btw, but apparently we use the greedy realloc stuff quite a bit across the codebase, so this ends up touching *a*lot* of code.)
* nss-myhostname: expose the "outbound" IP addresses under the synthetic ↵Lennart Poettering2021-04-231-2/+1
| | | | | | | | | | | "_outbound" hostname I found myself often looking for a quick way to determine "the local IP address", and then being lost in the "ip addr" output to find for the right one to use. This is supposed to help a bit with that. Let's introduce a new special hostname "_outbound" with semantics similar to "_gateway" that resolves to addresses that are the closest I could come up with that maps to "the" local IP address.
* test-nss-hosts: make buffer size configurable too and document itZbigniew Jędrzejewski-Szmek2021-03-231-6/+17
|
* test-nss-hosts: use _cleanup_, fix return value, assert on allocationsZbigniew Jędrzejewski-Szmek2021-03-231-27/+12
|
* test-nss-users: add new nss test that resolves users and groupsZbigniew Jędrzejewski-Szmek2021-03-231-41/+6
| | | | | | | | | | | | | | Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=1929936. This is similar to test-nss-hosts, but does users, groups, uid, gids. Functions tested are: _nss_*_getpwnam_r _nss_*_getgrnam_r _nss_*_getpwgid_r _nss_*_getgrgid_r Other entry points should be tested too, but it's not relevant to the bug I was investigating, so I'm leaving that for later ;)
* Rename test-nss to test-nss-hostsZbigniew Jędrzejewski-Szmek2021-03-121-0/+536