summaryrefslogtreecommitdiff
path: root/src/login/logind-dbus.c
Commit message (Collapse)AuthorAge
* 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: 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)
* logind: don't clobber bus error structure if we don't failLennart Poettering2018-10-29
| | | | (cherry picked from commit ea3a7cf6c34163834893f1f4c7af44c8245776ac)
* 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)
* logind: correct bad clean-up pathLennart Poettering2018-10-29
| | | | (cherry picked from commit d88ffeeeefda4c3447223fd36f8e30f23c931e48)
* login: avoid leak of name returned by uid_to_name()David Tardon2018-10-29
| | | | (cherry picked from commit e99742ef3e9d847da04e71fec0eb426063b25068)
* shared/sleep-config: forbid hibernation if resume= is not configuredZbigniew Jędrzejewski-Szmek2018-10-29
| | | | (cherry picked from commit 5fdf2d51c244288ac41443d1bd81365fab7b7b81)
* Prep v239: Add execution of executables in systemshutdowndirSven Eden2018-09-28
|
* Prep v239: Fix and add debug messages to method_can_shutdown_or_sleep()Sven Eden2018-08-31
|
* Prep v239: Only _HANDLE_ACTION_INVALID makes method_can_shutdown_or_sleep() ↵Sven Eden2018-08-30
| | | | answer 'no'
* Prep v239: A few cosmetic upgradesSven Eden2018-08-27
|
* Prep v239: Fix ustreams move of the unneeded target_table into its own also ↵Sven Eden2018-08-24
| | | | unneeded function.
* Prep v239: Add support for the new 'suspend-then-hibernate' method.Sven Eden2018-08-24
|
* Prep v239: Uncomment header inclusions that are new or needed now.Sven Eden2018-08-24
|
* Prep v239: Add missing updates that evaded migration.Sven Eden2018-08-24
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-08-24
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop !! casts to booleansZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | They are not needed, because anything that is non-zero is converted to true. C11: > 6.3.1.2: When any scalar value is converted to _Bool, the result is 0 if the > value compares equal to 0; otherwise, the result is 1. https://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c
* basic/log: add the log_struct terminator to macroZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | This way all callers do not need to specify it. Exhaustively tested by running test-log under valgrind ;)
* logind: let's change the type of the runtime directory size to uint64_tLennart Poettering2018-08-24
| | | | | | | Externally it's an uint64_t anyway, and internally we most just initialize it to physical_memory() which returns uint64_t, hence there's exactly zero value in using it as size_t internally. Hence, let's fix that, and use uint64_t everywhere.
* login: use BUS_DEFINE_PROPERTY_GET* macrosYu Watanabe2018-08-24
|
* login: do not wall message on cancelling shutdown when ↵Yu Watanabe2018-08-24
| | | | | | Manager.enable_wall_messages is false Fixes #8904.
* login: change variable type of enable_wall_messages as it matches ↵Yu Watanabe2018-08-24
| | | | Manager.enable_wall_messages
* logind: remove manager_start_slice()Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | It is now unused.
* Use a dash-truncated drop-in for user-%j.slice configurationZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | This removes the UserTasksMax= setting in logind.conf. Instead, the generic TasksMax= setting on the slice should be used. Instead of a transient unit we use a drop-in to tweak the default definition of a .slice. It's better to use the normal unit mechanisms instead of creating units on the fly. This will also make it easier to start user@.service independently of logind, or set additional settings like MemoryMax= for user slices. The setting in logind is removed, because otherwise we would have two sources of "truth": the slice on disk and the logind config. Instead of trying to coordinate those two sources of configuration (and maintainer overrides to both), let's just convert to the new one fully. Right now now automatic transition mechanism is provided. logind will emit a hint when it encounters the setting, but otherwise it will be ignored. Fixes #2556.
* tree-wide: drop redundant _cleanup_ macros (#8810)Lennart Poettering2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | This drops a good number of type-specific _cleanup_ macros, and patches all users to just use the generic ones. In most recent code we abstained from defining type-specific macros, and this basically removes all those added already, with the exception of the really low-level ones. Having explicit macros for this is not too useful, as the expression without the extra macro is generally just 2ch wider. We should generally emphesize generic code, unless there are really good reasons for specific code, hence let's follow this in this case too. Note that _cleanup_free_ and similar really low-level, libc'ish, Linux API'ish macros continue to be defined, only the really high-level OO ones are dropped. From now on this should really be the rule: for really low-level stuff, such as memory allocation, fd handling and so one, go ahead and define explicit per-type macros, but for high-level, specific program code, just use the generic _cleanup_() macro directly, in order to keep things simple and as readable as possible for the uninitiated. Note that before this patch some of the APIs (notable libudev ones) were already used with the high-level macros at some places and with the generic _cleanup_ macro at others. With this patch we hence unify on the latter.
* logind: enable limiting of user session scopes using pam context objects (#8397)Jan Synacek2018-08-24
|
* shared/sleep-config: return a custom message when not enough swap for ↵Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | hibernation $ sudo swapoff -av swapoff /dev/vda4 $ sudo systemctl hibernate Failed to hibernate system via logind: Not enough swap space for hibernation Fixes #6729.
* logind: refuse operations if the target unit is masked or unavailableZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | If hibernate.target is masked, and systemctl hibernate is invoked, havoc ensues. logind starts the hibernation operation, but then doesn't go through with it; gnome-shell segfaults. Let's be nice to the user and refuse doing anything in that case. $ sudo systemctl mask hibernate.target $ busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager CanHibernate s "no" $ sudo systemctl hibernate Failed to hibernate system via logind: Access denied Failed to start hibernate.target: Unit hibernate.target is masked. https://bugzilla.redhat.com/show_bug.cgi?id=1468003#c4
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* tree-wide: remove unused variables (#8612)Yu Watanabe2018-08-24
|
* Rename suspend-to-hibernate to suspend-then-hibernateMario Limonciello2018-08-24
| | | | | Per some discussion with Gnome folks, they would prefer this name as it's more descriptive of what's happening.
* tree-wide: warn when a directory path already exists but has bad mode/owner/typeZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | | | When we are attempting to create directory somewhere in the bowels of /var/lib and get an error that it already exists, it can be quite hard to diagnose what is wrong (especially for a user who is not aware that the directory must have the specified owner, and permissions not looser than what was requested). Let's print a warning in most cases. A warning is appropriate, because such state is usually a sign of borked installation and needs to be resolved by the adminstrator. $ build/test-fs-util Path "/tmp/test-readlink_and_make_absolute" already exists and is not a directory, refusing. (or) Directory "/tmp/test-readlink_and_make_absolute" already exists, but has mode 0775 that is too permissive (0755 was requested), refusing. (or) Directory "/tmp/test-readlink_and_make_absolute" already exists, but is owned by 1001:1000 (1000:1000 was requested), refusing. Assertion 'mkdir_safe(tempdir, 0755, getuid(), getgid(), MKDIR_WARN_MODE) >= 0' failed at ../src/test/test-fs-util.c:320, function test_readlink_and_make_absolute(). Aborting. No functional change except for the new log lines.
* basic/mkdir: convert bool flag to enumZbigniew Jędrzejewski-Szmek2018-08-24
| | | | In preparation for subsequent changes...
* logind: drop obsolete commentLennart Poettering2018-08-24
| | | | | | The code matching this comment was removed in a50df72b37ce2a7caf7775c70d18c3f9504b9e80 in 2014, let's drop the comment too.
* logind: use manager_get_user_by_pid() where appropriateLennart Poettering2018-08-24
| | | | | The current code reimplemented something like the manager_get_user_by_pid() logic on its own, manually. Let's unify this.
* manager_inhibit_timeout_handler() can be static again.Sven Eden2018-06-29
|
* Move method_do_shutdown_or_sleep() and its callers back to logind-sbus.cSven Eden2018-06-29
|
* Move bus_manager_shutdown_or_sleep_now_or_later() back to logind-dbus.cSven Eden2018-06-29
|
* Move delay_shutdown_or_sleep() back to logind-dbus.cSven Eden2018-06-29
|
* Move manager_dispatch_delayed() back to logind-dbus.cSven Eden2018-06-29
|
* login/elogind-dbus.c: Sync the following methods from systemctl.c:Sven Eden2018-06-29
| | | | * manager_scheduled_shutdown_handler()
* login: do not wall message on cancelling shutdown when ↵Yu Watanabe2018-06-28
| | | | | | | | Manager.enable_wall_messages is false Fixes #8904. (cherry picked from commit 6e78fa4afd474dae984f3ee4a8477c623296a519)
* login: fix user@.service case, so we don't allow nested sessions (#8051)Alan Jenkins2018-05-30
| | | | | | | | | | | | | | > logind sessions are mostly bound to the audit session concept, and audit > sessions remain unaffected by "su", in fact they are defined to be > "sealed off", i.e. in a way that if a process entered a session once, it > will always stay with it, and so will its children, i.e. the only way to > get a new session is by forking off something off PID 1 (or something > similar) that never has been part of a session. The code had a gap. user@.service is a special case PAM session which does not create a logind session. Let's remember to check for it. Fixes #8021
* nologin: extend the /run/nologin descriptions a bit (#8244)Lennart Poettering2018-05-30
| | | | | | | | | | | | This is an attempt to improve #8228 a bit, by extending the /run/nologin a bit, but still keeping it somewhat brief. On purpose I used the vague wording "unprivileged user" rather than "non-root user" so that pam_nologin can be updated to disable its behaviour for members of the "wheel" group one day, and our messages would still make sense. See #8228.
* login,user-sessions: always warn when we fail to remove nologin fileZbigniew Jędrzejewski-Szmek2018-05-30
| | | | | | | This usually is very annoying to users who then cannot log in, so make sure we always warn if that happens (selinux, or whatever other reason). This reverts a790812cb349c5cef95d1b4a20fc80ca08d3a145.
* Suspend on lid close based on power status. (#8016)Simon Fowler2018-05-30
| | | | | | | | This change adds support for controlling the suspend-on-lid-close behaviour based on the power status as well as whether the machine is docked or has an external monitor. For backwards compatibility the new configuration file variable is ignored completely by default, and must be set explicitly before being considered in any decisions.
* Move /var/lib/systemd/linger to /var/lib/elogind/.Sven Eden2018-04-23
|