Systemd/src/login
Lennart Poettering dbe7fff476 pam_systemd/pam_systemd_home: rework how we cache user records
Since acquiring user records involves plenty of IPC we try to cache user
records in the PAM context between our various hooks. Previously we'd
just cache whatever we acquired, and use it from the on, forever until
the context is destroyed.

This is problematic however, since some programs (notably sudo) use the
same PAM context for multiple different operations. Specifically, sudo
first authenticates the originating user before creating a session for
the destination user, all with the same PAM context. Thankfully, there
was a safety check for this case in place that re-validated that the
cached user record actually matched our current idea of the user to
operate on, but this just meant the hook would fail entirely.

Let's rework this: let's key the cache by the user name, so that we do
not confused by the changing of the user name during the context's
lifecycle and always, strictly use the cached user record of the user we
operate on.

Essentially this just means we now include the user name in the PAM data
field.

Secondly, this gets rid of the extra PAM data field that indicates
whether a user record is from homed or something else. To simplify
things we instead just cache the user record twice: once for consumption
by pam_systemd_home (which only wants homed records) and once shared by
pam_systemd and pam_systemd_home (and whoever else wants it). The cache
entries simply have different field names.
2020-05-12 17:38:32 +02:00
..
70-power-switch.rules Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
70-uaccess.rules.m4 Re-add uaccess tag for /dev/dri/renderD* 2019-03-14 11:08:58 +01:00
71-seat.rules.in Revert "Support Plugable UD-PRO8 dock" 2020-02-10 17:19:52 +01:00
73-seat-late.rules.m4 login/meson.build: require ACL for uaccess rules 2018-01-27 10:55:32 +01:00
inhibit.c tree-wide: use table_log_add_error() 2020-01-10 18:28:30 +09:00
loginctl.c login: switch to BusLocator-oriented helpers 2020-05-07 08:46:43 -07:00
logind-acl.c basic/set: let set_put_strdup() create the set with string hash ops 2020-05-06 16:54:06 +02:00
logind-acl.h logind: replace udev_device by sd_device 2018-08-23 04:57:39 +09:00
logind-action.c Revert "logind: remove unused check" 2019-08-04 05:44:36 +09:00
logind-action.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
logind-brightness.c Fix typo in comment: overide -> override 2019-09-05 07:39:36 +09:00
logind-brightness.h logind: add SetBrightness() bus call for setting brightness of leds/backlight devices associated with a seat 2019-05-24 15:05:27 +02:00
logind-button.c tree-wide: drop input.h when missing_input.h is included 2019-11-04 00:30:32 +09:00
logind-button.h tree-wide: add whitespace between type and variable name 2018-12-04 09:29:54 +01:00
logind-core.c logind: avoid shadow lookups when doing userdb client side 2020-04-09 14:38:14 +02:00
logind-dbus.c login: switch to BusLocator-oriented helpers 2020-05-07 08:46:43 -07:00
logind-dbus.h logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
logind-device.c logind: drop {} 2019-10-21 09:33:19 +02:00
logind-device.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
logind-gperf.gperf logind: drop unused user_tasks_max field 2019-11-14 18:41:54 +01:00
logind-inhibit.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-inhibit.h logind: make id const, since it points into another buffer 2019-07-23 16:08:07 +02:00
logind-seat-dbus.c logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
logind-seat-dbus.h logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
logind-seat.c sd-login: get rid of seat_can_multi_session() 2020-04-17 16:15:30 +02:00
logind-seat.h sd-login: get rid of seat_can_multi_session() 2020-04-17 16:15:30 +02:00
logind-session-dbus.c logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
logind-session-dbus.h logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
logind-session-device.c tree-wide: drop input.h when missing_input.h is included 2019-11-04 00:30:32 +09:00
logind-session-device.h tree-wide: replace 'unsigned int' with 'unsigned' 2018-10-19 22:19:12 +02:00
logind-session.c Add SetType method to login Session interface 2020-04-30 21:29:26 +02:00
logind-session.h Add SetType method to login Session interface 2020-04-30 21:29:26 +02:00
logind-user-dbus.c logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
logind-user-dbus.h logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
logind-user.c logind: use loop instead of repeated code 2020-01-17 08:13:09 +01:00
logind-user.h logind: port to UserRecord object 2020-01-15 15:29:17 +01:00
logind-utmp.c tree-wide: drop pwd.h and grp.h when user-util.h is included 2019-11-04 00:30:32 +09:00
logind.c login: switch to BusLocator-oriented helpers 2020-05-07 08:46:43 -07:00
logind.conf.in Use a dash-truncated drop-in for user-%j.slice configuration 2018-04-25 16:18:45 +02:00
logind.h logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
meson.build login: move file definitions outside of the conditionalization 2019-07-05 17:55:49 +02:00
org.freedesktop.login1.conf Add SetType method to login Session interface 2020-04-30 21:29:26 +02:00
org.freedesktop.login1.policy login: allow non-console sessions to change vt 2020-03-19 09:29:23 +01:00
org.freedesktop.login1.service Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
pam_systemd.c pam_systemd/pam_systemd_home: rework how we cache user records 2020-05-12 17:38:32 +02:00
pam_systemd.sym logind: drop old-style header from .sym file in favour of SPDX 2019-07-04 12:35:14 +09:00
sysfs-show.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
sysfs-show.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
systemd-user.m4 login: include pam_systemd_home.so in the default PAM snippet we ship for user@.service 2020-05-06 22:30:07 +02:00
test-inhibit.c test: stop using dup() needlessly 2019-04-02 12:45:46 +02:00
test-login-shared.c Drop my copyright headers 2018-06-14 13:03:20 +02:00
test-login-tables.c Drop my copyright headers 2018-06-14 13:03:20 +02:00
user-runtime-dir.c core: create inaccessible nodes for users when making runtime dirs 2019-12-18 11:09:30 -08:00