summaryrefslogtreecommitdiff
path: root/src/nss-resolve
Commit message (Collapse)AuthorAgeFilesLines
* nss-resolve: link lessZbigniew Jędrzejewski-Szmek2015-11-271-1/+0
| | | | | This reduces libraries reported by ldd by liblzma, liblz4, libgcrypt, libgpg-error, libacl, libidn, libseccomp.
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-271-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-6/+8
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* resolved: rework synthesizing logicLennart Poettering2015-08-211-46/+35
| | | | | | | | | | | | | | | | | | | With this change we'll now also generate synthesized RRs for the local LLMNR hostname (first label of system hostname), the local mDNS hostname (first label of system hostname suffixed with .local), the "gateway" hostname and all the reverse PTRs. This hence takes over part of what nss-myhostname already implemented. Local hostnames resolve to the set of local IP addresses. Since the addresses are possibly on different interfaces it is necessary to change the internal DnsAnswer object to track per-RR interface indexes, and to change the bus API to always return the interface per-address rather than per-reply. This change also patches the existing clients for resolved accordingly (nss-resolve + systemd-resolve-host). This also changes the routing logic for queries slightly: we now ensure that the local hostname is never resolved via LLMNR, thus making it trustable on the local system.
* sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering2015-07-031-3/+3
| | | | | | | | | | | | | | | | sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
* tree-wide: remove spurious spaceThomas Hindoe Paaboel Andersen2015-06-081-7/+7
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-5/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* sd-bus: move common errors src/shared/bus-errors.h → ↵Lennart Poettering2014-12-101-1/+1
| | | | | | src/libsystemd/sd-bus/bus-common-errors.h Stuff in src/shared/ should not use stuff from src/libsystemd/ really.
* nss: remove dead codeThomas Hindoe Paaboel Andersen2014-09-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | c > 0 is already guaranteed from earlier checks. We go from ms = ALIGN(l+1) + sizeof(char*) + (c > 0 ? c : 1) * ALIGN(alen) + (c > 0 ? c+1 : 2) * sizeof(char*); to ms = ALIGN(l+1) + sizeof(char*) + c * ALIGN(alen) + (c+1) * sizeof(char*); to ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*); Found by coverity. Fixes: CID#1237570 and CID#1237610
* nss-resolve: remove dead codeThomas Hindoe Paaboel Andersen2014-09-171-5/+0
| | | | | | ifindex < 0 was already checked before entering the loop Found by coverity. Fixes: CID#1237609
* resolved: allow passing on which protocol, family and interface to look ↵Lennart Poettering2014-08-141-30/+48
| | | | | | something up Also, return on which protocol/family/interface we found something.
* bus: always explicitly close bus from main programsLennart Poettering2014-08-041-3/+3
| | | | | | | | | | | | | | Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.
* nss: always explicitly reset all error variablesLennart Poettering2014-08-011-0/+15
| | | | | | | glibc appears to be broken if we don't explicitly reset all error variables, let's work around that. https://bugzilla.redhat.com/show_bug.cgi?id=1125975
* nss-resolve: fallback to the class NSS "dns" module if we cannot contact ↵Lennart Poettering2014-08-011-0/+87
| | | | | | resolved That way DNS resolution works both with and without resolved running.
* resolved: fix bus signatures to follow family as int changeLennart Poettering2014-07-181-2/+2
|
* change type for address family to "int"Lennart Poettering2014-07-181-16/+14
| | | | | | | | Let's settle on a single type for all address family values, even if UNIX is very inconsitent on the precise type otherwise. Given that socket() is the primary entrypoint for the sockets API, and that uses "int", and "int" is relatively simple and generic, we settle on "int" for this.
* shared: rename PROTO_ADDRESS_SIZE() to FAMILY_ADDRESS_SIZE()Lennart Poettering2014-07-181-3/+3
| | | | | We mostly use "family" to refer to AF_INET, AF_INET6, etc, let's use this terminology here, too
* resolved: properly pass canonical name information to resolving clientLennart Poettering2014-07-161-41/+58
| | | | Also, hook up nss-resolve to make use of this information
* resolved: add small NSS module that uses resolved to resolve DNS namesLennart Poettering2014-07-163-0/+605