summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Prep v240: qsort_r_missing.c : Remove glibc specific bitsSven Eden2018-11-08
| | | | | Bug: #83 Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
* Prep v240: Add check for qsort_r() and the function if not provided.Sven Eden2018-11-08
| | | | | | | | | | | | As elogind supports musl-libc, we have to remedy the situation that upstream decided to make use of qsort_r(). This function is not provided by musl-libc, so we have to provide an own variant. The variant is an adaption of the qsort_r() algorithm found in glibc-2.28, the disclaimer from their source files have been added. Bug: #83 Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
* pam_elogind: drop setting DBUS_SESSION_BUS_ADDRESSLennart Poettering2018-11-08
| | | | | | | | | | Since D-Bus 1.9.14 (2015-03-02) dbus looks in $XDG_RUNTIME_DIR/bus for the system bus on its own, hence we can finally drop setting this environment variable. gdbus since glib 2.45.3 (June 2015) also supports it. Closes: #87 Sigend-off-by: Sven Eden <sven.eden@prydeworx.com>
* Prep v240: Cleanup empty mask blocks and unused functions.Sven Eden2018-11-08
|
* sd-bus: enable support for user bus instancesCameron Nemo2018-11-08
| | | | | | | Bug: #87 Closes: #87 Signed-off-by: Cameron Nemo <camerontnorman@gmail.com> Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
* Prep v240 : Add busctl to be shipped with elogind.Sven Eden2018-11-08
| | | | | | | | | | | | | | | (emersion): > sd-bus is shipped with elogind, so it makes sense to ship the > busctl command, too. This is not only a nice helper tool to take a closer look at what is happening on the dbus, it will also prove to be usefull if something like issue #59 happens ever again. There we had to use dbus-send directly to dissect the bus traffic. Bug: #86 Closes: #86 Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
* Prep v240: Fix tests running on systems with non-UTF-8 locales.Sven Eden2018-11-08
| | | | | | Bug: #85 Closes: #85 Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
* Prep v240: Fix building with -Dselinux=trueSven Eden2018-11-08
| | | | | | Bug: #88 Closes: #88 Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
* Prep v239.2: Fix migration errors in testSven Eden2018-11-08
|
* Prep v239.2: Fix migration errors in sharedSven Eden2018-11-08
|
* Prep v239.2: Fix migration errors in loginSven Eden2018-11-08
|
* Prep v239.2: Fix migration errors in libelogindSven Eden2018-11-08
|
* Prep v239.2: Fix migration errors in basicSven Eden2018-11-08
|
* Add missing test sources to the c::b project fileSven Eden2018-11-08
|
* Prep v239.2: Update src/login/70-uaccess.rules to 70-uaccess.rules.m4Sven Eden2018-10-30
|
* test: add test case for recursive chown()ingLennart Poettering2018-10-29
| | | | (cherry picked from commit cb9e44db36caefcbb8ee7a12e14217305ed69ff2)
* fd-util: optimize fd_get_path() a bitLennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | | | | | journald calls fd_get_path() a lot (it probably shouldn't, there's some room for improvement there, but I'll leave that for another time), hence it's worth optimizing the call a bit, in particular as it's easy. Previously we'd open the dir /proc/self/fd/ first, before reading the symlink inside it. This means the whole function requires three system calls: open(), readlinkat(), close(). The reason for doing it this way is to distinguish the case when we see ENOENT because /proc is not mounted and the case when the fd doesn't exist. With this change we'll directly go for the readlink(), and only if that fails do an access() to see if /proc is mounted at all. This optimizes the common case (where the fd is valid and /proc mounted), in favour of the uncommon case (where the fd doesn#t exist or /proc is not mounted). (cherry picked from commit f267719c389de57ceda433f6288a505e7eeb2f8f)
* fs-util: increase start buffer size in readlinkat_malloc()Lennart Poettering2018-10-29
| | | | | | | | | | | | | | I noticed while profiling journald that we invoke readlinkat() a ton on open /proc/self/fd/<fd>, and that the returned paths are more often than not longer than the 99 chars used before, when we look at archived journal files. This means for these cases we generally need to execute two rather than one syscalls. Let's increase the buffer size a tiny bit, so that we reduce the number of syscalls executed. This is really a low-hanging fruit of optimization. (cherry picked from commit 8e060ec225b74bbf22e5bdbacd604efcc73294c0)
* sleep: rework what we do if a suspend fails.Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | | | First of all, let's fix logging: let's simply log the same message as we do on success, so that there's always the same pair of these messages around, regardless if the suspend was successful or not. To distuingish a successful suspend from a failed one, check the ERRNO= field of the structured message. In most ways a failed suspend cycle is not distuingishable from a successful one that took no time, hence let's treat it this way, and always pair the success message with a failure message. This also changes a more important concept: the post-suspend callouts are now called also called on failure, following the same logic: let's always run them in pairs: for every pre callout a post callout has to follow. (cherry picked from commit 14250f0942b0c1122a35d678e73945d7adf9cfa0)
* time-util: change parse_sec_fix_0() to accept "0s" for infinity too (#10501)Lennart Poettering2018-10-29
| | | | | | | | This function is about compatibility, nothing else, hence we should make it properly compatible. Fixes: #9556 (cherry picked from commit def34f63fe066c964764733242b332774070bac6)
* exec-util: errors are reported by non-zero, not negative by putenv()Lennart Poettering2018-10-29
| | | | (cherry picked from commit 8f7329ac276306dfaf6cc47920f3c5e71a0ab586)
* socket-util: add new sockaddr_un_unlink() helperLennart Poettering2018-10-29
| | | | | | | | | | | The helper is supposed to properly handle cases where .sun_path does not contain a NUL byte, and thus copies out the path suffix a NUL as necessary. This also reworks the more specific socket_address_unlink() to be a wrapper around the more generic sockaddr_un_unlink() (cherry picked from commit 9f20fc28f0a624ea49ac941bcde57b5435a01b6e)
* alloc-util: add alloca() counterparts for memdup() and memdup_suffix0()Lennart Poettering2018-10-29
| | | | (cherry picked from commit 242c41b850af8ebc0c7a0cd44be057e50b5a027a)
* logind: validate /run/user/1000 before we set itLennart Poettering2018-10-29
| | | | | | | | Let's be safe than sorry, in particular as logind doesn't set it up anymore, but user-runtime-dir@.service does, and logind doesn't really track success of that. (cherry picked from commit b92171124819305985ed292cc472f6668a027425)
* pam_systemd: explain in detail why pam_systemd does the PAM item mangling it ↵Lennart Poettering2018-10-29
| | | | | | | | | does in comments The old comments were imprecise, and misleading. Let's extend things and explain the situation in more detail. (cherry picked from commit 3a7369495bdbec38d897a48da511e126e373b253)
* logind: automatically GC lingering users for who now user@.service (nor ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | slice, not runtime dir service) is running anymore This heavily borrows from @intelfx' PR #5546, but watches all three units that are associated with a user now: the slice, the user@.service and user-runtime-dir@.service. The logic and reasoning behind it is the same though: there's no value in keeping lingering users around if all their three services are gone. Replaces: #5546 Fixes: #4162 (cherry picked from commit 4e5b605af202c770dfc8e3562d0f8d0440b2fe14)
* logind: improve error propagation of user_check_linger_file()Lennart Poettering2018-10-29
| | | | | | | | | | | Let's make this a bit prettier, and propagate unexpected access() errors correctly. (The callers of this function will suppress them, but it's nicer of they do that, rather than us doing that twice in both the callers and the callees) (cherry picked from commit 6996df9b864981980f5b713dc5c7d506a7a4b9bf)
* logind: add a RequiresMountsFor= dependency from the session scope unit to ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | | | the home directory of the user This is useful so that during shutdown scope units are always terminated before the mounts necessary for the home directory. (Ideally we'd also add a similar dependency from the user@.service instance to the home directory, but this isn't as easy as that service is defined statically and not dynamically, and hence not easy to modify dynamically, in particular when it comes to deps) (cherry picked from commit d5ac9d060267820aabdf9af509a54a1830b27b7d)
* logind: change user-runtime-dir to query runtime dir size from logind via ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | | the bus I think this is a slightly cleaner approach than parsing the configuration file at multiple places, as this way there's only a single reload cycle for logind.conf, and that's systemd-logind.service's runtime. This means that logind and dbus become a requirement of user-runtime-dir, but given that XDG_RUNTIME_DIR is not set anyway without logind and dbus around this isn't really any limitation. This also simplifies linking a bit as this means user-runtime-dir doesn't have to link against any code of logind itself. (cherry picked from commit 07ee5adb356b9fde500c8a5226f24a314789832b)
* logind: optionally watch utmp for login dataLennart Poettering2018-10-29
| | | | | | | | This allows us to determine the TTY an ssh session is for, which is useful to to proper idle detection for ssh sessions. Fixes: #9622 (cherry picked from commit 3d0ef5c7e00155bc74f6f71c34cad518a4ff56ba)
* logind: add hashtable for finding session by leader PIDLennart Poettering2018-10-29
| | | | | | | This is useful later on, when we quickly want to find the session for a leader PID. (cherry picked from commit 238794b15082e6f61d0ce2943d39205289fff7f0)
* logind: optionally, keep the user@.service instance for eached logged in ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | user around for a while This should speed up rapid logout/login cycles a bit. By default this timeout is now set to 10s. Fixes: #8410 Replaces: #4434 (cherry picked from commit 9afe9efb9340588db553950727a2a9672dc3db24)
* logind: minor session time handling tweaksLennart Poettering2018-10-29
| | | | (cherry picked from commit 061c6607a9f2e39a76ee74048f19b5de16c8fac3)
* logind: rework how we manage the slice and user-runtime-dir@.service unit ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | | | | | | for each user Instead of managing it explicitly, let's simplify things and rely on regular Wants=/Requires= dependencies to pull in these units from user@.service and the session scope, and StopWhenUneeded= to stop these auxiliary units again. This way, they can be pulled in easily by unrelated units too. This simplifies things quite a bit: for each session we now only need to manage the session scope, and for each user the user@.service, the other units are not something we need to manage anymore. This patch also makes sure that if user@.service of a user is masked we will continue to work, and user-runtime-dir@.service will still be correctly pulled in, as it is now a dependency of the scope unit. Fixes: #9461 Replaces: #5546 (cherry picked from commit 25a1ab4ed48b72e974f77a68dcbe3521014787bb)
* login: use free_and_replace() and TAKE_PTR()Yu Watanabe2018-10-29
| | | | (cherry picked from commit fb2367edd943d37f418725c90498a940016e80bd)
* logind: don't clobber bus error structure if we don't failLennart Poettering2018-10-29
| | | | (cherry picked from commit ea3a7cf6c34163834893f1f4c7af44c8245776ac)
* logind: propagate session stop errorsLennart Poettering2018-10-29
| | | | | | | | | | Let's propagate errors from stopping sessions via seat_stop(). This is similar to how we propagate such errors in user_stop() for all sessions associated with a user. Note that we propagate these errors, but we don't abort the function. (cherry picked from commit e6958b7ea33813b085966ac25817a957c0dad7f9)
* logind: introduce little helper that checks whether a session is readyLennart Poettering2018-10-29
| | | | (cherry picked from commit b1951bc83ffbbb92ba4de7b9cba845421c2f35b1)
* logind: use TAKE_PTR() where we canLennart Poettering2018-10-29
| | | | (cherry picked from commit 1b88ed3b7db37241323348f640f9adb61c0df47a)
* logind: prefer strjoin() over asprintf()Lennart Poettering2018-10-29
| | | | (cherry picked from commit d5ddc930150633f9ce38ed4a6dc9accfd7ceaaac)
* logind: don't rely on downgrade-to-boolLennart Poettering2018-10-29
| | | | (cherry picked from commit 709d058756da7139181355b63cfad2288eefddfe)
* logind: voidify a few callsLennart Poettering2018-10-29
| | | | (cherry picked from commit 75bbdf478c73d78bbe5bdee6f468c2e84a1844c6)
* logind: make better use of logging functionsLennart Poettering2018-10-29
| | | | (cherry picked from commit e555d12635007da7263d0a43ed7307e70a07720d)
* logind: never elect a session that is stopping as displayLennart Poettering2018-10-29
| | | | (cherry picked from commit 04857cd801022d9f9933efb484c6253572f09870)
* logind: make unit/job active checking more debuggableLennart Poettering2018-10-29
| | | | | | Let's log the error messages if we get any at debug level. (cherry picked from commit bd26aee1f6bea13fe25b3feb2a5e9cd1be522e7e)
* sd-bus: add new API call sd_bus_error_move()Lennart Poettering2018-10-29
| | | | | | | | | This new call move an sd_bus_error into another one. (cherry picked from commit 190128e407eb24a445554c0e1f956a1d51f97338) In the backport, the new function is made non-public, declared in bus-error.h not sd-bus.h.
* logind: fix bad error propagationLennart Poettering2018-10-29
| | | | (cherry picked from commit cce08496e7353e3e9903b42695aba3f9d259b90a)
* logind: correct bad clean-up pathLennart Poettering2018-10-29
| | | | (cherry picked from commit d88ffeeeefda4c3447223fd36f8e30f23c931e48)
* logind: save/restore User object's "stopping" field during restartsLennart Poettering2018-10-29
| | | | | | | Whether we are stopping or not is highly relevant, hence don't forget it across restarts. (cherry picked from commit d865bc024bf28c17120d7322a81e9a99997a59f6)
* logind: improve logging in manager_connect_console()Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | let's make sure we log about every failure Also, complain about systems where /dev/tty0 exists but /sys/class/tty/tty0/active does not. Such systems (usually container environments) are pretty broken as they mount something that is not a VC to /dev/tty0 and they really shouldn't. Systems should either have a VC or not, but not badly fake one by mounting things wildly. This just adds a warning message, as before we'll simply turn off VC handling in this case. (cherry picked from commit 0b6d55cae9b8adc507fbea95d1b2874729a77386)