summaryrefslogtreecommitdiffstats
path: root/src/hwdb (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-02-16shared: use -EINVAL for _UNIT_FILE_CHANGE_TYPE_INVALIDBenjamin Robin2-3/+3
Follow-up of #11484
2021-02-16shared: use -EINVAL for _EXEC_COMMAND_FLAGS_INVALIDBenjamin Robin2-5/+7
Follow-up of #11484
2021-02-16basic: use -EINVAL for _MANAGED_OOM_PREFERENCE_INVALIDBenjamin Robin2-2/+2
Follow-up of #11484
2021-02-16logind: Restore chvt as non-root user without polkitJoshua Watt6-54/+44
4acf0cfd2f ("logind: check PolicyKit before allowing VT switch") broke the ability to write user sessions that run graphical sessions (e.g. weston/X11). This was partially amended in 19bb87fbfa ("login: allow non-console sessions to change vt") by changing the default PolicyKit policy so that non-root users with a session are again allowed to switch the VT. This makes the policy when PolKit is not enabled (as on many embedded systems) closer the default PolKit policy and allows launching graphical sessions as a non-root user. Closes #17473 Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2021-02-16stat-util: fix dir_is_empty_at without pathLuca Boccassi1-5/+10
Use the right FD, and do a fd_reopen instead of a dup, since the latter will still share the internal pointer which then gets moved by FOREACH_DIRENT, affecting the caller's FD.
2021-02-16resolved: unify code for trying a different DNS serverLennart Poettering1-14/+32
Let's unify some code, and add a common implementation of a function that checks whether we have tried all DNS servers yet, and retries the transaction if we don't. We already use this same code twice. Let's use it at some other places too now — basically all cases where we switch to a new server — with the one case of packet loss, where we too switch servers, but don#t care how many times we already tried to switch.
2021-02-16resolved: improve log message when retrying a transaction with a different ↵Lennart Poettering1-1/+6
server
2021-02-16resolved: never go below DNSSEC feature level in DNSSEC strict modeLennart Poettering2-24/+50
This adjusts our feature level handling: when DNSSEC strict mode is on, let's never lower the feature level below the lowest DNSSEC mode. Also, when asking whether DNSSEC is supproted, always say yes in strict mode. This means that error reporting about transactions that fail because of missing DNSSEC RRs will not report "incompatible-server" but instead "missing-signature" or suchlike. The main difference here is that DNSSEC failures become local to a transaction, instead of propagating into the feature level we reuse for future transactions. This is beneficial with routers that implement "mostly a DNS proxy", i.e. that propagate most DNS requests 1:1 to their upstream servers, but synthesize local answers for a select few domains. For example, AVM Fritz!Boxes operate that way: they proxy most traffic 1:1 upstream in an DNSSEC-compatible fashion, but synthesize the "fritz.box" locally, so that it can be used to configure the router. This local domain cannot be DNSSEC verified, it comes without signatures. Previously this would mean once that domain was resolved feature level would be downgraded, and we'd thus fail all future DNSSEC attempts. With this change, the immediate lookup for "fritz.box" will fail validation, but for all other unrelated future ones that comes without prejudice. (While we are at it, also make a couple of other downgrade paths a bit tighter.) Fixes: #10570 #14435 #6490
2021-02-16resolved: make feature level checks a bit more discriptiveLennart Poettering2-3/+6
The levels have an order, but the order is sometimes a bit arbitrary. Hence add simple macros to check for specific features and use those, so that the ordering leaks a bit less into all files.
2021-02-16resolved: when we can't parse a packet, downgrade feature levelLennart Poettering3-5/+48
So far we didn't really handle the case where we can't parse a reply packet. Since this apparently happens in real-life though, let's add some minimal logic, to downgrade/restart if we see this.
2021-02-16man: fix indentationYu Watanabe1-10/+9
2021-02-16resolved: paranoia — ensure DNS reply came over stream we sent it toLennart Poettering1-1/+2
2021-02-16Adding an explanation for CONFIG_NET requirement (#18600)heretoenhance1-1/+1
* README: replace CONFIG_NET with CONFIG_UNIX in requirements list
2021-02-16netlink: add nexthop related typesYu Watanabe1-0/+8
2021-02-16sd-netlink: add RTA_NH_ID attribute supportYu Watanabe1-1/+2
2021-02-16Rename unit_times_free to unit_times_free_arrayZbigniew Jędrzejewski-Szmek1-6/+6
It frees the whole array and the type is UnitTimes not UnitTime.
2021-02-16Rename strbuf_cleanup to strbuf_freeZbigniew Jędrzejewski-Szmek5-6/+6
It frees the whole object.
2021-02-16fuzz-systemctl-parse-argv: call static destuctorsZbigniew Jędrzejewski-Szmek2-0/+9
With all the preparatory work in previous PRs, we can now call static destructors repeatedly without issue. We need to do it here so that global variables allocated during parsing are properly freed.
2021-02-16systemctl: use free_and_replace on global variableZbigniew Jędrzejewski-Szmek2-4/+5
In normal usage we cannot set it multiple times, but from a fuzzer we may. Doing it this way is nicer anyway.
2021-02-16tree-wide: reset the cleaned-up variable in cleanup functionsZbigniew Jędrzejewski-Szmek31-56/+66
If the cleanup function returns the appropriate type, use that to reset the variable. For other functions (usually the foreign ones which return void), add an explicit value to reset to. This causes a bit of code churn, but I think it might be worth it. In a following patch static destructors will be called from a fuzzer, and this change allows them to be called multiple times. But I think such a change might help with detecting unitialized code reuse too. We hit various bugs like this, and things are more obvious when a pointer has been set to NULL. I was worried whether this change increases text size, but it doesn't seem to: -Dbuildtype=debug: before "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494520 Feb 16 15:06 build/systemd* after "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494576 Feb 16 15:10 build/systemd* now: -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494640 Feb 16 15:15 build/systemd* -Dbuildtype=release: before "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:09 build-rawhide/systemd* after "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:10 build-rawhide/systemd* now: -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:16 build-rawhide/systemd* I would expect that the compiler would be able to elide the setting of a variable if the variable is never used again. And this seems to be the case: in optimized builds there is no change in size whatsoever. And the change in size in unoptimized build is negligible. Something strange is happening with size of libsystemd: it's bigger in optimized builds. Something to figure out, but unrelated to this patch.
2021-02-16tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek52-165/+154
I started working on this because I wanted to change how DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's nice to make make things more consistent and predictable.
2021-02-16resolved: reduce indentation level a bitLennart Poettering1-14/+14
2021-02-16resolved: let's preferably route reverse lookups for local subnets to ↵Lennart Poettering3-1/+80
matching interfaces Let's preferably route traffic for reverse lookups to LLMNR/mDNS/DNS on the matching interface if the IP address is in the local subnet. Also, if looking up an IP address of our own host, let's avoid doing LLMNR/mDNS at all. This is useful if "~." is a routing domain to DNS, as it means, local reverse lookups still go to LLMNR/mDNS, too. Fixes: #16243 #10081
2021-02-16namespace: store and use original MountEntry paths when prefixingLuca Boccassi1-5/+29
Some paths (eg: mount_tmpfs) simply assumed that prefixing always happens and it always stores the original path in path_const, and the prefixed path in path_malloc. But if a MountEntry is set up in a helper function and thus uses only _malloc struct members, this assumption doesn't hold and there's a crash. Refactor so that prefixing is done with a helper which stores the original path in a separate struct member, and accessing it also uses a helper which does the right thing.
2021-02-16MountImages: actually support optional pathsLuca Boccassi1-0/+2
ENOENT did not cause an image mount to be skipped, fix it
2021-02-16networkd: make network_config_section_free() inlineZbigniew Jędrzejewski-Szmek2-6/+5
2021-02-16resolved: make dns_transaction_gc return a pointerZbigniew Jędrzejewski-Szmek2-8/+8
_gc() does cleanup if it is possible. So far it returned a bool to signal if it succeeded (false on success). When working on the resolved code I had to look at the definition every time, because the (arguably reversed) calling convention is unobvious. So let's return a pointer (non-NULL: gc has not been done, NULL: gc has been done). This fits nicely with the standard to return a pointer from all free functions obviously.
2021-02-16networkd-ndisc: drop confused freepp functionZbigniew Jędrzejewski-Szmek1-1/+0
The function to cleanup IPv6Token was defined using freep, i.e. the macro generated a freepp function. The correct way would be to do something like #define ipv6_token_free mfree DEFINE_TRIVIAL_CLEANUP_FUNC(IPv6Token *, ipv6_token_free); which would create ipv6_token_freep(). But since the cleanup function is unused, let's just drop it.
2021-02-16coredump: add typedef for structZbigniew Jędrzejewski-Szmek1-9/+8
2021-02-16basic/capability-util: add missing initializationZbigniew Jędrzejewski-Szmek1-1/+1
There was no error, because the pointer is unconditionally set below.
2021-02-16analyze: use typedefs for structs and inline iterator variable declsZbigniew Jędrzejewski-Szmek1-79/+73
2021-02-16resolved: log process info of clients requesting resolution via D-BusLennart Poettering3-0/+60
Let's make things more debuggable: when debug logging is on, let's say which client is asking for our services. This is helpful for easily figuring out which local process might interfere with your debugging sessions by issuing additional requests while you try to debug a request (I am looking at you, geoclue!).
2021-02-16resolved: propagate source where an RR from back to clientLennart Poettering7-7/+62
This is extremely useful when debugging stuff: knowing whether a result was cached, came from network, or was synthesized.
2021-02-16resolved: add "confidential" flag for replies passed to clientsLennart Poettering13-41/+95
Let's introduce a new flag that indicates whether the response was acquired in "confidential" mode, i.e. via encrypted DNS-over-TLS, or synthesized locally. Fixes: #12859
2021-02-16resolved: replace "answer_authenticated" bool by uint64_t query_flags fieldLennart Poettering6-84/+87
Let's use the same flags type we use for client communication, i.e. instead of "bool answer_authenticated", let's use "uint64_t answer_query_flags", with the SD_RESOLVED_AUTHENTICATED flag. This is mostly just search/replace, i.e. a refactoring, no change in behaviour. This becomes useful once in a later commit SD_RESOLVED_CONFIDENTIAL is added to indicate resolution that either were encrypted (DNS-over-TLS) or never left the local system.
2021-02-16resolvectl: clarify IDNA and search path logic in combination with ↵Lennart Poettering2-11/+65
"resolvectl query --type=" When low-level RR resolution is requested from "resolvectl query" via "--type=" or "--class=" no search domain logic is applied and no IDNA translation. Explain this in detail in the documentation, and also mentions this when users attempt to resolve single-label names or names with international characters in the output. I believe the current behaviour is correct, but it is indeed surprising. Hence the documentation and output improvement. Fixes: #11325 #10737
2021-02-16fuzz-systemctl-parse-argv: avoid "leak" of bus objectZbigniew Jędrzejewski-Szmek1-0/+3
Memory sanitizer would report leaked memory from --boot-load-entry=help. Maybe we should disable all bus connections from the fuzzer? It seems not appropriate to communicate with logind. OTOH, in a real fuzzing environment this call should just fail, so maybe that's OK.
2021-02-15journalctl: rotation is not a reason to warn, but certainly noteworthyLennart Poettering1-1/+1
Downgrade the phrasing, since it is a bit misleading. Fixes: #18465
2021-02-15resolved: close UDP socket when we received a network error on itLennart Poettering1-0/+2
2021-02-15resolved: instead of closing DNS UDP transaction fds right-away, add them to ↵Lennart Poettering6-10/+194
a socket "graveyard" The "socket graveyard" shall contain sockets we have sent a question out of, but not received a reply. If we'd close thus sockets immediately when we are not interested anymore, we'd trigger ICMP port unreachable messages once we after all *do* get a reply. Let's avoid that, by leaving the fds open for a bit longer, until a timeout is reached or a reply datagram received. Fixes: #17421
2021-02-15socket-util: tighten parsing of ifnamesLennart Poettering1-8/+8
Numeric ifnames should be acceptable only if that's enabled by flag, and refused otherwise. Hence, let's parse as ifindex first, and if that works decide. Finally, let's refuse any numeric ifnames that are not valid ifindexs, but look like them.
2021-02-15socket-util: fix indentationLennart Poettering1-3/+3
2021-02-15portabled: add DBUS documentationLuca Boccassi4-1/+431
2021-02-15portabled: use SD_BUS_METHOD_WITH_ARGSLuca Boccassi2-21/+129
2021-02-15portabled: use service_parse_argv/bus_add_implementationLuca Boccassi5-10/+31
Remove some boilerplate and allow introspection
2021-02-15resolved: don't redundantly switch DNS servers because of transaction failuresLennart Poettering7-19/+32
When a transaction fails and we decide to switch DNS servers, don#t do so unconditionally. Check if the current DNS server is still the same as when the transaction was initiated. And if not, do not do anything. That should reduce the number of redundant DNS server switches if many parallel transactions fail simultaneously (which is pretty likely if DNSSEC is on). Fixes: #17040
2021-02-15resolved: reuse check for link-local IP address lookupsLennart Poettering1-17/+13
Let's reuse accept_link_local_reverse_lookups() at one more place, where we check for the list of link local reverase address domains. Since we don't actually accept the domains here (but rather the opposite, not accept), let's rename the function a bit more generically with accept_ → match_. While we are at it invert the if branches, to make things more easily understandable: filter out the unwatnted stuff and have the "all good" state as main codepath.
2021-02-15rpm: restart services in %posttransZbigniew Jędrzejewski-Szmek3-1/+28
This fixes a long-standing issue in packaging scriptlets: daemon-reload was moved to the end of the transaction, but restarting services was still straightaway after package installation. https://bugzilla.redhat.com/show_bug.cgi?id=1614751 Note that daemon-reload is called twice. This wouldn't be hardly noticable, except that now a bunch of units (at least in Fedora) generate very verbose warnings about deprecated features. So we get those warnings twice… reload-or-restart --needing-restart is also called twice, but the second call is usually a noop, because the first clears the flag for restarted units. The second call is necessary for the case where we only uninstall packages, and the %transfiletriggerpostun trigger fires, but not the %transfiletriggerin scriptlet. Also note that this assumes that units are marked only for restart if paths under @systemunitdir@ or /etc/systemd/system have been touched. I would prefer make the trigger that does 'restart --needing-restart' fire always, but it seems rpm doesn't have such functionality. (Except as a %transfiletrigger that would trigger on "/*" to catch all transactions, but that seems ineffiecient and ugly.)
2021-02-15rpm: order sysctl/sysusers/tmpfiles execution before package scriptletsZbigniew Jędrzejewski-Szmek2-47/+47
P>1000000 is *before* "normal" scriptlets, P<1000000 is *after*. I think it makes sense to do stuff like execution of sysctl/sysusers/tmpfiles configuration before package scriptlets. I think that was the intent, but a single digit got dropped ;( Also, let's reorder the scriptlets in the file to match execution order, to make it easier to see what is going on. Most of those may happen in any order, but there are some exceptions: tmpfiles should be after sysusers, udevadm --reload should be after hwdb.
2021-02-15rpm: simplify daemon-reload triggerZbigniew Jędrzejewski-Szmek2-42/+8
The trigger was initially written to use %transfiletriggerun instead of %transfiletriggerpostun because the latter would not fire. It turned out to a buffer overread in rpm that since has been long fixed: https://bugzilla.redhat.com/show_bug.cgi?id=1284645 https://github.com/rpm-software-management/rpm/commit/f6521c50f6836374a0f7995f8f393aaf36e178ea