summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* watchdog: Don't require WDIOC_SETOPTIONS/WDIOS_ENABLECARDJean Delvare2017-03-14
| | | | | | | | | | Not all watchdog drivers implement WDIOC_SETOPTIONS. Drivers which do not implement it have their device always enabled. So it's fine to report an error if WDIOS_DISABLECARD is passed and the ioctl is not implemented, however failing when WDIOS_ENABLECARD is passed and the ioctl is not implemented is not good: if the device was already enabled then WDIOS_ENABLECARD was a no-op and wasn't needed in the first place. So we can just ignore the error and continue.
* logind: save /run/systemd/users/UID before starting user@.serviceSimon McVittie2017-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, this had a race condition during a user's first login. Some component calls CreateSession (most likely by a PAM service other than 'systemd-user' running pam_systemd), with the following results: - logind: * create the user's XDG_RUNTIME_DIR * tell pid 1 to create user-UID.slice * tell pid 1 to start user@UID.service Then these two processes race: - logind: * save information including XDG_RUNTIME_DIR to /run/systemd/users/UID - the subprocess of pid 1 responsible for user@service: * start a 'systemd-user' PAM session, which reads XDG_RUNTIME_DIR and puts it in the environment * run systemd --user, which requires XDG_RUNTIME_DIR in the environment If logind wins the race, which usually happens, everything is fine; but if the subprocesses of pid 1 win the race, which can happen under load, then systemd --user exits unsuccessfully. To avoid this race, we have to write out /run/systemd/users/UID even though the service has not "officially" started yet; previously this did an early-return without saving anything. Record its state as OPENING in this case. Bug: https://github.com/systemd/systemd/issues/232 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
* turn kdbus support into a runtime optionKay Sievers2017-03-14
| | | | | | | | | | | | | ./configure --enable/disable-kdbus can be used to set the default behavior regarding kdbus. If no kdbus kernel support is available, dbus-dameon will be used. With --enable-kdbus, the kernel command line option "kdbus=0" can be used to disable kdbus. With --disable-kdbus, the kernel command line option "kdbus=1" is required to enable kdbus support.
* logind: apply selinux label to XDG_RUNTIME_DIRLennart Poettering2017-03-14
| | | | | As discussed in #257: we should ensure the selinux label is correctly applied to each user's XDG_RUNTIME_DIR.
* libsystemd: remove list of symbols to export only in the futureKay Sievers2017-03-14
|
* Stop talking about the "XDG" version of basename()Simon McVittie2017-03-14
| | | | | | | | | | | | | | | | XDG refers to X Desktop Group, a former name for freedesktop.org. This group is responsible for specifications like basedirs, .desktop files and icon naming, but as far as I know, it has never tried to redefine basename(). I think these references were meant to say XPG (X/Open Portability Guide), a precursor of POSIX. POSIX is better-known and less easily confused with XDG, and is how the basename(3) man page describes the libgen.h version of basename(). The other version of basename() is glibc-specific and is described in basename(3) as "the GNU version"; specifically mention that version, to disambiguate.
* sd-bus: suppress installing local bus matches server sideLennart Poettering2017-03-14
| | | | | | | | | Matches that can only match against messages from the org.freedesktop.DBus.Local service (or the local interfaces or path) should never be installed server side, suppress them hence. Similar, on kdbus matches that can only match driver messages shouldn't be passed to the kernel.
* build-sys: hide magic section variables from exported symbolsKay Sievers2017-03-14
| | | | https://github.com/systemd/systemd/issues/234
* sd-event: make errors on EPOLL_CTL_DEL pseudo-fatalDavid Herrmann2017-03-14
| | | | | | | | | If we call EPOLL_CTL_DEL, we *REALLY* expect the file-descriptor to be present in that given epoll-set. We actually track such state via our s->io.registered flag, so it better be true. Make sure if that's not true, we treat it similar to assert_return() (ie., print a loud warning).
* logind: rework display counting when detecting whether the system is dockedLennart Poettering2017-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we'd just count connected displays, and if there was 2 or more we assumed a "docked" state. With this change we now: - Only count external displays, ignore internal ones (which we detect by checking the connector name against a whitelist of known external plug types) - We ignore connectors which are explicitly disabled - We then compare the count with >= 1 rather than >= 2 as before This new logic has the benefit that systems that disconnect the internal display when the lid is closed are better supported. Also, explicitly disabled ports do not confuse the algorithm anymore. This new algorithm has been suggested here: http://lists.freedesktop.org/archives/intel-gfx/2015-June/068821.html This also makes two functions static, that are not used outside of their .c files.
* hashmap: allow NULL key in ordered_hashmap_next()Michal Schmidt2017-03-14
| | | | | | There is no reason to require key to be non-NULL. Change test_ordered_hashmap_next() to use trivial_hash_ops in order to test NULL key too.
* sd-bus: use proper cleanup macroUmut Tezduyar Lindskog2017-03-14
|
* logind: cast close() call to (void)Lennart Poettering2017-03-14
|
* everywhere: actually make use of DUAL_TIMESTAMP_NULL macroLennart Poettering2017-03-14
| | | | Let's use it as initializer where appropriate.
* logind: expose "Docked" bool as property on the busLennart Poettering2017-03-14
| | | | | We know the state anyway, let's expose it in the bus. It's useful for debugging at least, but it might be useful for DEs too.
* everywhere: port everything to sigprocmask_many() and friendsLennart Poettering2017-03-14
| | | | | | | | | | | This ports a lot of manual code over to sigprocmask_many() and friends. Also, we now consistly check for sigprocmask() failures with assert_se(), since the call cannot realistically fail unless there's a programming error. Also encloses a few sd_event_add_signal() calls with (void) when we ignore the return values for it knowingly.
* util: when creating temporary file names, allow including extra id string in itLennart Poettering2017-03-14
| | | | | | | | | | | This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(), tempfn_ranomd_child(). If non-NULL this string is included in the middle of the newly created file name. This is useful for being able to distuingish the kind of temporary file when we see one. This also adds tests for the three call. For now, we don't make use of this at all, but port all users over.
* firewall: rename fw-util.[ch] → firewall-util.[ch]Daniel Mack2017-03-14
| | | | | The names fw-util.[ch] are too ambiguous, better rename the files to firewall-util.[ch]. Also rename the test accordingly.
* hashmap: fix iterators to not skip entriesDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | Currently, the HASHMAP iterators stop at the first NULL entry in a hashmap. This is non-obvious and breaks users like sd-device, which legitimately store NULL values in a hashmap. Fix all the iterators by taking a pointer to the value storage, instead of returning it. The iterators now return a boolean that tells whether the end of the list was reached. Current users of HASHMAP_FOREACH() are *NOT* changed to explicitly check for NULL. If it turns out, there were users that inserted NULL into hashmaps, but didn't properly check for it during iteration, then we really want to find those and fix them.
* tree-wide: fix memory leaks in users of bus_map_all_properties()David Herrmann2017-03-14
| | | | | | | | | | If you use bus_map_all_properties(), you must be aware that it might touch output variables even though it may fail. This is, because we parse many different bus-properties and cannot tell how to clean them up, in case we fail deep down in the parser. Fix all callers of bus_map_all_properties() to correctly cleanup any context structures at all times.
* sd-netlink: rename from sd-rtnlTom Gundersen2017-03-14
|
* login: fix potential null pointer dereferenceRonny Chevalier2017-03-14
| | | | | | | Fix CID 1304686: Dereference after null check (FORWARD_NULL) However, this commit does not fix any bug in logind. It helps to keep the elect_display_compare() function generic.
* sd-rtnl: make joining broadcast groups implicitTom Gundersen2017-03-14
|
* sd-network: fix CID 1306198Susant Sahani2017-03-14
|
* bus: we now support path_namespace=/David Herrmann2017-03-14
| | | | | Our bloom-filters support root-path matching. Make sure we properly add the path_namespace= tag.
* bus: fix arg0path= two-way matchingDavid Herrmann2017-03-14
| | | | | | | | DBus spec clearly defines arg0path= to be a two-way matching. That is, either the matcher or the matchee can be a prefix of the other to match. This is not possible to implement with bloom-filters. Instead, we'd have to add a separate filter for each prefix. This is non-trivial, though. Hence, just skip the match for now and match locally.
* bus: fix pattern matchingDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | | | | DBus-spec defines two different pattern matchings: 1) Path and namespace prefix matching. In this case, A matches B either if both are equal, or if B is fully included in the namespace of A. In other words, A has to be a prefix of B, but end with a separator character (or the following character in B must be one). This is used for path_namespace= and arg0namespace= 2) The other pattern matching is used for arg0path= which does a two-way matching. That is, A must be a prefix of B, or B a prefix of A. Furthermore, the prefix must end with a separator. Fix the sd-bus helpers to reflect that. The 'simple_' and 'complex_' prefixes don't make any sense now, but.. eh..
* util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering2017-03-14
| | | | | It's only marginally shorter then the usual for() loop, but certainly more readable.
* sd-network: allow the state dir to be created after the monitorTom Gundersen2017-03-14
| | | | | We now listen for new subdirs of /run/systemd, and /run/systemd/netif in case /run/systemd/netif/links does not exist.
* bus: fix test-bus-kerne-bloom.c to match properlyDavid Herrmann2017-03-14
| | | | | | Make sure we actually verify our match-rules are executed properly. Right now all we test is the bloom-matches, which are non-reliable as they leave through false-positives.
* bus: fix bloom_add_prefixes() to add all required dataDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lets look at an example where we add arg0="/foo/bar/waldo" to a bloom-filter. The following strings are added: "arg0:/foo/bar/waldo" "arg0-slash-prefix:/foo/bar" "arg0-slash-prefix:/foo" Two problems arise: 1) If we match on "arg0path=/foo/bar/waldo", the dbus-spec explicitly states that equal strings are also considered prefixes. However, in the bloom-match, we can only provide a single match-filter. Therefore, we have to add "arg0-slash-prefix:/foo/bar/waldo" there, but this never occured in the bloom-mask of the message. Hence, this patch makes sure bloom_add_prefixes() adds the full path as prefix, too. 2) If we match on "arg0path=/foo/", the dbus-spec states that arg0path does prefix-matching with the trailing slash _included_, unlike path_namespace= matches, which does *not* include them. This is inconsistent, but we have to support the specs. Therefore, we must add prefixes with _and_ without trailing separators. Hence, this patch makes sure bloom_add_prefixes() adds all prefixes with the trailing slash included. The final set of strings added therefore is: "arg0:/foo/bar/waldo" "arg0-slash-prefix:/foo/bar/waldo" "arg0-slash-prefix:/foo/bar/" "arg0-slash-prefix:/foo/bar" "arg0-slash-prefix:/foo/" "arg0-slash-prefix:/foo" "arg0-slash-prefix:/"
* sd-network: allow NULL in sd_network_monitor_unrefTom Gundersen2017-03-14
| | | | Match rest of codebase, we always allow unref'ing NULL.
* sd-bus: remove ucred parameter from bus_message_from_header() since we don't ↵Lennart Poettering2017-03-14
| | | | use it anymore
* bus-message: remove shadow warning with log_debug_bus_message()Lennart Poettering2017-03-14
|
* sd-bus: Correct typoTorstein Husebø2017-03-14
|
* logind,sd-event: drop spurious new-linesLennart Poettering2017-03-14
|
* path-util: Fix path_is_mount_point for parent mount points in symlink modeMartin Pitt2017-03-14
| | | | | | | | | | | | | | | | When we have a structure like this: /bin -> /usr/bin /usr is a mount point Then path_is_mount_point("/bin", AT_SYMLINK_FOLLOW) needs to look at the pair /usr/bin and /usr, not at the pair / and /usr/bin, as the latter have different mount IDs. But we only want to consider the base name, not any parent. Thus we have to resolve the given path first to get the real parent when allowing symlinks. Bug: https://github.com/systemd/systemd/issues/61
* util: Introduce unquote_first_word_and_warnFilipe Brandenburger2017-03-14
| | | | | | | | | It will try to unquot_first_word, but if it runs into escaping problems it will retry it adding UNQUOTE_CUNESCAPE_RELAX to the flags. If it succeeds on the second try, it will log a warning about it. If it fails both times, it will log an error. Add test cases to confirm it behaves as expected.
* logind: fix delayed execution regressionDaniel Mack2017-03-14
| | | | | | | | | | | | | | | Commit c0f32805 ("logind: use sd_event timer source for inhibitor logic") reworked the main loop logic of logind so that it uses a real timeout callback handler to execute delayed functions. What the old code did, however, was to call those functions on every iteration in the main loop, not only when the timeout expired. Restore that behavior by bringing back manager_dispatch_delayed(), and call it from manager_run(). The internal event source callback manager_inhibit_timeout_handler() was turned into a wrapper of manager_dispatch_delayed() now.
* sd-bus: add async convenience method call APIUmut Tezduyar Lindskog2017-03-14
|
* sd-bus: store selinux context at connection timeZbigniew Jędrzejewski-Szmek2017-03-14
| | | | | | | | | | This appears to be the right time to do it for SOCK_STREAM unix sockets. Also: condition bus_get_owner_creds_dbus1 was reversed. Split it out to a separate variable for clarity and fix. https://bugzilla.redhat.com/show_bug.cgi?id=1224211
* sd-bus: do not use per-datagram auxiliary informationZbigniew Jędrzejewski-Szmek2017-03-14
| | | | | | | | | | | | SELinux information cannot be retrieved this way, since we are using stream unix sockets and SCM_SECURITY does not work for them. SCM_CREDENTIALS use dropped to be consistent. We also should get this information at connection time. https://bugzilla.redhat.com/show_bug.cgi?id=1224211 "SCM_SECURITY was only added for datagram sockets."
* bus: don't force send-masks on kdbus busesDavid Herrmann2017-03-14
| | | | | | | | | | Right now we always pass KDBUS_ITEM_ATTACH_FLAGS_RECV to KDBUS_CMD_BUS_MAKE, effectively forcing every bus connection to do the same during KDBUS_CMD_HELLO. This used to be a workaround to make sure all metadata is always present. However, we refrained from that approach and intend to make all metadata collection solely rely on /proc access restrictions. Therefore, there is no need to force the send-flags mask on newly created buses.
* bus: update kdbus.hDavid Herrmann2017-03-14
| | | | Sync with upstream.
* sd-event: don't touch fd's accross forksTom Gundersen2017-03-14
| | | | | | | | | | | | | | | | We protect most of the API from use accross forks, but we still allow both sd_event and sd_event_source objects to be unref'ed. This would cause problems as it would unregister sources from the underlying eventfd, hence also affecting the original instance in the parent process. This fixes the issue by not touching the fds on unref when done accross a fork, but still free the memory. This fixes a regression introduced by "udevd: move main-loop to sd-event": 693d371d30fee where the worker processes were disabling the inotify event source in the main daemon.
* kdbus: remove attach_flags_mask module parameter settingKay Sievers2017-03-14
|
* libudev: enumerate - accept NULL parameters in add_match()Tom Gundersen2017-03-14
| | | | This was a regression introduced when moving to sd-device.
* fstab-generator: cescape device name in root-fsck serviceAndrei Borzenkov2017-03-14
| | | | | | | We unescape ExecStart line when parsing it, so escape device name before adding it to unit file. fixes #50
* util: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_wordFilipe Brandenburger2017-03-14
| | | | | | | | | | | | | | | | The new flag UNQUOTE_UNESCAPE_RELAX preserves unrecognized escape sequences verbatim in unquote_first_word, either when it's a trailing backslash (similar to UNQUOTE_RELAX, but in this case keep the extra backslash in the output) or in the middle of a sequence string. Add unit test cases to ensure the new flag works as expected and to prevent regressions from being introduced. Tested with a follow up commit converting config_parse_exec() to start using unquote_first_word, in which case this flags makes it possible to preserve unrecognized escape sequences. Relevant bug: https://bugs.freedesktop.org/show_bug.cgi?id=90794
* fix double semicolon typoThomas Hindoe Paaboel Andersen2017-03-14
|