summaryrefslogtreecommitdiff
path: root/src/login
Commit message (Collapse)AuthorAge
* logind: check return value from lseekZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | In practice this doesn't matter much because the read that follows will likely fail, but we'll get a better error message. CID #1368233.
* tree-wide: make bus_map_all_properties return a proper sd_bus_errorLennart Poettering2017-07-17
| | | | | | | | And then show it, to make things a bit friendlier to the user if we fail acquiring some props. In fact, this fixes a number of actual bugs, where we used an error structure for output that we actually never got an error in.
* logind: Don't try to emit a change signal for the 'Sessions' property (#5211)afrantzis2017-07-17
| | | | | | | | | The 'Sessions' property for both org.freedesktop.login1.User and org.freedesktop.login1.Seat is marked as EmitsChangedSignal(false). Trying to emit a change signal that includes the 'Sessions' property leads to the signal not being sent at all. Fixes #5210.
* shared/cgroup-show: extract funtion to query unit cgroup pathZbigniew Jędrzejewski-Szmek2017-07-17
| | | | …and use it where possible.
* logind: trivial simplificationZbigniew Jędrzejewski-Szmek2017-07-17
| | | | free_and_strdup() handles NULL arg, so make use of that.
* build-sys: add check for gperf lookup function signature (#5055)Mike Gilbert2017-07-17
| | | | | | | gperf-3.1 generates lookup functions that take a size_t length parameter instead of unsigned int. Test for this at configure time. Fixes: https://github.com/elogind/elogind/issues/5039
* tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853)Reverend Homer2017-07-17
|
* pam: include pam_keyinit.so in our PAM fragmentsLennart Poettering2017-07-17
| | | | | | We want that elogind --user gets its own keyring as usual, even if the barebones PAM snippet we ship upstream is used. If we don't do this we get the basic keyring elogind --system sets up for us.
* tree-wide: stop using canonicalize_file_name(), use chase_symlinks() insteadLennart Poettering2017-07-17
| | | | | | | | Let's use chase_symlinks() everywhere, and stop using GNU canonicalize_file_name() everywhere. For most cases this should not change behaviour, however increase exposure of our function to get better tested. Most importantly in a few cases (most notably nspawn) it can take the correct root directory into account when chasing symlinks.
* Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
* tree-wide: add SD_ID128_MAKE_STR, remove LOG_MESSAGE_IDZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Embedding sd_id128_t's in constant strings was rather cumbersome. We had SD_ID128_CONST_STR which returned a const char[], but it had two problems: - it wasn't possible to statically concatanate this array with a normal string - gcc wasn't really able to optimize this, and generated code to perform the "conversion" at runtime. Because of this, even our own code in coredumpctl wasn't using SD_ID128_CONST_STR. Add a new macro to generate a constant string: SD_ID128_MAKE_STR. It is not as elegant as SD_ID128_CONST_STR, because it requires a repetition of the numbers, but in practice it is more convenient to use, and allows gcc to generate smarter code: $ size .libs/elogind{,-logind,-journald}{.old,} text data bss dec hex filename 1265204 149564 4808 1419576 15a938 .libs/elogind.old 1260268 149564 4808 1414640 1595f0 .libs/elogind 246805 13852 209 260866 3fb02 .libs/elogind-logind.old 240973 13852 209 255034 3e43a .libs/elogind-logind 146839 4984 34 151857 25131 .libs/elogind-journald.old 146391 4984 34 151409 24f71 .libs/elogind-journald It is also much easier to check if a certain binary uses a certain MESSAGE_ID: $ strings .libs/elogind.old|grep MESSAGE_ID MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x $ strings .libs/elogind|grep MESSAGE_ID MESSAGE_ID=c7a787079b354eaaa9e77b371893cd27 MESSAGE_ID=b07a249cd024414a82dd00cd181378ff MESSAGE_ID=641257651c1b4ec9a8624d7a40a9e1e7 MESSAGE_ID=de5b426a63be47a7b6ac3eaac82e2f6f MESSAGE_ID=d34d037fff1847e6ae669a370e694725 MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5 MESSAGE_ID=1dee0369c7fc4736b7099b38ecb46ee7 MESSAGE_ID=39f53479d3a045ac8e11786248231fbf MESSAGE_ID=be02cf6855d2428ba40df7e9d022f03d MESSAGE_ID=7b05ebc668384222baa8881179cfda54 MESSAGE_ID=9d1aaa27d60140bd96365438aad20286
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/elogind -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libelogind/sd-bus -I ./src/libelogind/sd-event -I ./src/libelogind/sd-login -I ./src/libelogind/sd-netlink -I ./src/libelogind/sd-network -I ./src/libelogind/sd-hwdb -I ./src/libelogind/sd-device -I ./src/libelogind/sd-id128 -I ./src/libelogind-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
* Prep v232: Apply missing updates from upstreamSven Eden2017-07-05
|
* logind: don't hit assert when we try to free NULL manager objectLennart Poettering2017-07-05
| | | | Fixes: #4431
* tree-wide: use mfree moreZbigniew Jędrzejewski-Szmek2017-07-05
|
* loginctl: report tty in session listingsZbigniew Jędrzejewski-Szmek2017-07-05
| | | | | | | | | | | | | | | Without the tty it's really hard to tell which session is which. New output: $ ./loginctl SESSION UID USER SEAT TTY 13 1002 zbyszek seat0 tty3 c1 42 gdm seat0 /dev/tty1 11 1002 zbyszek seat0 tty4 3 1002 zbyszek seat0 /dev/tty2 17 1002 zbyszek seat0 tty5 18 1002 zbyszek seat0 tty6 6 sessions listed.
* loginctl: drop casts in printfZbigniew Jędrzejewski-Szmek2017-07-05
|
* elogind-user: add pam_unix account moduleFelipe Sateler2017-07-05
| | | | | | Otherwise elogind-user@ fails because elogind validates the account Fixes: #4342
* login: drop fedora-specific PAM config, add note to DISTRO_PORTING (#4314)Felipe Sateler2017-07-05
| | | | | | | | It is impossible to ship a fully generic PAM configuration upstream. Therefore, ship a minimal configuration with the elogind --user requirements, and add a note to DISTRO_PORTING documenting this. Fixes #4284
* tree-wide: remove consecutive duplicate words in commentsStefan Schweter2017-07-05
|
* logind: fix /run/user/$UID creation in apparmor-confined containers (#4154)Tomáš Janoušek2017-07-05
| | | | | | | | | | | | | | | | When a docker container is confined with AppArmor [1] and happens to run on top of a kernel that supports mount mediation [2], e.g. any Ubuntu kernel, mount(2) returns EACCES instead of EPERM. This then leads to: elogind-logind[33]: Failed to mount per-user tmpfs directory /run/user/1000: Permission denied login[42]: pam_elogind(login:session): Failed to create session: Access denied and user sessions don't start. This also applies to selinux that too returns EACCES on mount denial. [1] https://github.com/docker/docker/blob/master/docs/security/apparmor.md#understand-the-policies [2] http://bazaar.launchpad.net/~apparmor-dev/apparmor/master/view/head:/kernel-patches/4.7/0025-UBUNTU-SAUCE-apparmor-Add-the-ability-to-mediate-mou.patch
* logind: update empty and "infinity" handling for [User]TasksMax (#3835)Tejun Heo2017-07-05
| | | | | | | | | | | | | | | | | The parsing functions for [User]TasksMax were inconsistent. Empty string and "infinity" were interpreted as no limit for TasksMax but not accepted for UserTasksMax. Update them so that they're consistent with other knobs. * Empty string indicates the default value. * "infinity" indicates no limit. While at it, replace opencoded (uint64_t) -1 with CGROUP_LIMIT_MAX in TasksMax handling. v2: Update empty string to indicate the default value as suggested by Zbigniew Jędrzejewski-Szmek. v3: Fixed empty UserTasksMax handling.
* core: add RemoveIPC= settingLennart Poettering2017-07-05
| | | | | | | | | | | | | | | | | | This adds the boolean RemoveIPC= setting to service, socket, mount and swap units (i.e. all unit types that may invoke processes). if turned on, and the unit's user/group is not root, all IPC objects of the user/group are removed when the service is shut down. The life-cycle of the IPC objects is hence bound to the unit life-cycle. This is particularly relevant for units with dynamic users, as it is essential that no objects owned by the dynamic users survive the service exiting. In fact, this patch adds code to imply RemoveIPC= if DynamicUser= is set. In order to communicate the UID/GID of an executed process back to PID 1 this adds a new "user lookup" socket pair, that is inherited into the forked processes, and closed before the exec(). This is needed since we cannot do NSS from PID 1 due to deadlock risks, However need to know the used UID/GID in order to clean up IPC owned by it if the unit shuts down.
* Re-add the saving of the user state file when creating a new session.Sven Eden2017-07-03
|
* Prep v231.3: Only ask for reboot authorization when shutting down or rebooting.Sven Eden2017-06-29
| | | | | | | It is not needed to ask for authorization to put the system to sleep. Such a system is most commonly a single-user laptop, and no user, especially me, wants to enter the root password after hitting the suspend key. ;-)
* Prep v231.3: No authorization for setting the wall message.Sven Eden2017-06-29
| | | | | | elogind only calls this when shutting down, rebooting or cancelling a pending shutdown/reboot. Authorization is already needed there, so do not question the user twice, just because they forgot to sudo.
* Prep v231.2: Make sure logs go to syslog or kmsg if elogind was started in ↵Sven Eden2017-06-28
| | | | debug mode, even if it was started from a tty.
* Prep v231.2: Minor changes to make future patching easier.Sven Eden2017-06-28
|
* Prep v231.2: Move elogind specific code in logind-dbus.c to elogind-dbus.cSven Eden2017-06-28
|
* Prep v231.2: Do not set a wall message when suspending (none there anyway)Sven Eden2017-06-28
|
* Prep v231.2: elogind is a stand-alone daemon, so do not exit if suspending ↵Sven Eden2017-06-27
| | | | the system fails.
* Prep v231.2: Send processes the wakeup signal, even if suspending the system ↵Sven Eden2017-06-27
| | | | failed.
* Prep v231.2: Only check time and wall arguments for shutdown and reboot.Sven Eden2017-06-26
|
* Prep v231.2: elogind_log_special() : Add missing case breaks.Sven Eden2017-06-26
|
* Prep v231.2: Add mor debug messages to find out, why 'loginctl suspend' ↵Sven Eden2017-06-26
| | | | isn't working.
* Prep v231.2: Really set an extra wall message (if any) and display it when ↵Sven Eden2017-06-26
| | | | cancelling a pending shutdown/reboot
* Prep v231.2: loginctl: Move check for cancelling a scheduled shutdown to ↵Sven Eden2017-06-26
| | | | allow extra wall messages.
* Prep v231.2: Add log messages for loginctl invoking system commands.Sven Eden2017-06-22
|
* Prep v231.2: login1.policy vendor is the project, not it's description.Sven Eden2017-06-22
|
* Prep v321.2: Fix org.freedesktop.login1 where named org.freedesktop.elogindSven Eden2017-06-22
|
* Prep v231.2: Fix missing/double wall msgs on scheduled shutdown/rebootSven Eden2017-06-21
| | | | | | | | | | | | | | - Do not do anything in manager_setup_wall_message_timer() if wall messages are disabled anyway. - Set up a wall timer in any case there is time left. The original sources would not even set up a timer if the next messages would be now. As time is measured in USEC, that's pretty rare, but possible. - If less than 1 Second is left to the first message, delay it. - systemd would print out a message at once, if less than 15 minutes are left to the event. Do this only, if the next scheduled message wouldn't come within the next 3 seconds, or it might come to awkward double messages.
* Prep v231.2: login/elogind.c: Remove bus_forward_agent_released()Sven Eden2017-06-20
| | | | | | | | | | | | | | This method is called from a systemd manager that is the system instance to inform all user instances of systemd about the pending cgroup release. elogind on the other hand is always there just once. And the release of cgroups is handled by the local cgroups manager, which should be provided by the running init system. Even if there is no cgroup management, so elogind sets itself up as a small cgroups manager itself, there aren't any user instances that could react on the forwarding anyway.
* Prep v231.2: Apply some minor style fixesSven Eden2017-06-19
|
* logind: don't hit assert when we try to free NULL manager objectLennart Poettering2017-06-19
| | | | | Fixes: #4431 (cherry picked from commit 84a4e6608dbda38c724ab196a226db209a50b224)
* Revert "logind: really handle *KeyIgnoreInhibited options in logind.conf"Mantas Mikulėnas2017-06-19
| | | | | | | | | | | This reverts commit 8121f4d209eca85dcb11830800483cdfafbef9b7. The special 'key handling' inhibitors should always work regardless of any *IgnoreInhibited settings – otherwise they're nearly useless. Reverts: #3470 Fixes: #3897 (cherry picked from commit 06a70b918d4d753769a727239f75af8896006467)
* logind: 0% and 100% should be valid for UserTasksMax (#3836)Tejun Heo2017-06-19
| | | | | | | config_parse_user_tasks_max() was incorrectly accepting percentage value between 1 and 99. Update it to accept 0% and 100%. This brings it in line with TasksMax handling in elogind. (cherry picked from commit cb3e4417590196bd30e1b8097348dca6ba34bd15)
* Prep v229.6: Send wakeup call to suspended processes.Sven Eden2017-06-16
| | | | | | | | | | Somewhere in the update stream from 227.x to 228.x the sending of the wakeup signal to sleeping processes got lost. Re-add the sending of the wakeup signal. Fixes issue 17 ( https://github.com/elogind/elogind/issues/17 )
* Prep v231: Add missing line breaks in loginctl help textSven Eden2017-06-16
|
* Prep v231: Move elogind specific code in login/loginctl.c to login/eloginctl.cSven Eden2017-06-16
|
* Prep v231: Reorganize elogind specific code in login/logind-action.cSven Eden2017-06-16
| | | | | | | | | - Move elogind specific code in login/logind-action.c to login/elogind-action.c - Remove login/logind-sleep.* - Add src/sleep from upstream - Integrate the systemd-sleep utility, so future fixes and updates will be easier to spot and to apply.