Commit Graph

1046 Commits

Author SHA1 Message Date
Lennart Poettering 4295fd9e82
Merge pull request #10163 from poettering/inhibit-format-table
systemd-inhibit --list: port to format-table.c
2018-09-25 10:24:30 +02:00
Lennart Poettering 6ac386855c logind: fix blacklist/whitelist confusion in comment (#10165)
Triggered by this:

602a41c22a (r30575293)
2018-09-25 07:02:41 +09:00
Lennart Poettering a942661787 inhibit: use format-table to format systemd-inhibit --list
This changes the output a bit, as the previous multi-line output of each
inhibitor is changed to a single line, but it does unify the output look
with the one of our other tools. Moreover this adds proper sorting.
2018-09-24 19:21:00 +02:00
Lennart Poettering 2f47ef04ea inhibit: normalize variable types
When we parse an "u" from an sd_bus_message then we need to do that into
a uint32_t, not a pid_t or uid_t, even if this is likely the same.

Also, let's count objects we keep in memory as size_t as usual.
2018-09-24 19:21:00 +02:00
Lennart Poettering 0e6872cdfc inhibit: normalize when we log about failures to list inhibitors
let's print log messages about all types of errors inside of the
function, since otherwise we might sometimes log twice about some
specific cases.
2018-09-24 19:21:00 +02:00
Yu Watanabe c679e12af1 tree-wide: drop unnecessary initializations 2018-09-23 17:18:50 +09:00
Yu Watanabe 8a80712bcd logind-acl: replace strdup()+set_consume() by set_put_strdup() 2018-09-23 17:18:50 +09:00
Yu Watanabe 403660c508 tree-wide: use streq() instead of streq_ptr() 2018-09-23 17:18:50 +09:00
Zbigniew Jędrzejewski-Szmek 9035119518
Merge pull request #9958 from yuwata/sd-device-enum-set
sd-device: make sd_device_enumerator_get_*_next() not destroy the list
2018-09-15 18:33:18 +02:00
Yu Watanabe eda193578e bus-util: make --property= optionally take value 2018-09-12 12:11:25 +09:00
Jürg Billeter da0da5eccf pam_systemd: support use in PID namespaces
Pass 0 as leader PID to CreateSession to let logind use the PID from the
D-Bus credentials. This allows use of pam_systemd in PID namespaces.
2018-09-10 19:04:21 +02:00
Yu Watanabe 8437c0593f tree-wide: replace device_enumerator_scan_devices()+FOREACH_DEVICE_AND_SUBSYSTEM() by FOREACH_DEVICE() 2018-09-10 16:48:37 +09:00
Yu Watanabe e132a04392 login/sysfs-show: use device_enumerator_get_devices() 2018-09-10 16:47:35 +09:00
Alan Jenkins 81375d8026 user-runtime-dir: fix selinux regression
Fix #9993.  When this code was split out to user-runtime-dir, it forgot to
include the call to mac_selinux_init().  So mkdir_label() stopped working.

Fixes: a9f0f5e501 ("logind: split %t directory creation to a helper
unit")
2018-09-03 14:09:21 +02:00
Franck Bui 49679ff70f logind: make use of vtnr_from_tty() in seat_read_active_vt() (#9923)
No functional changes.
2018-08-24 16:20:51 +09:00
Yu Watanabe e156d24b0a login/sysfs-show: replace udev_device by sd_device 2018-08-23 04:57:39 +09:00
Yu Watanabe 4f209af7da logind: replace udev_device by sd_device 2018-08-23 04:57:39 +09:00
Zbigniew Jędrzejewski-Szmek 7692fed98b
Merge pull request #9783 from poettering/get-user-creds-flags
beef up get_user_creds() a bit and other improvements
2018-08-21 10:09:33 +02:00
Lennart Poettering fafff8f1ff user-util: rework get_user_creds()
Let's fold get_user_creds_clean() into get_user_creds(), and introduce a
flags argument for it to select "clean" behaviour. This flags parameter
also learns to other new flags:

- USER_CREDS_SYNTHESIZE_FALLBACK: in this mode the user records for
  root/nobody are only synthesized as fallback. Normally, the synthesized
  records take precedence over what is in the user database.  With this
  flag set this is reversed, and the user database takes precedence, and
  the synthesized records are only used if they are missing there. This
  flag should be set in cases where doing NSS is deemed safe, and where
  there's interest in knowing the correct shell, for example if the
  admin changed root's shell to zsh or suchlike.

- USER_CREDS_ALLOW_MISSING: if set, and a UID/GID is specified by
  numeric value, and there's no user/group record for it accept it
  anyway. This allows us to fix #9767

This then also ports all users to set the most appropriate flags.

Fixes: #9767

[zj: remove one isempty() call]
2018-08-20 15:58:21 +02:00
Lennart Poettering 37ec0fdd34 tree-wide: add clickable man page link to all --help texts
This is a bit like the info link in most of GNU's --help texts, but we
don't do info but man pages, and we make them properly clickable on
terminal supporting that, because awesome.

I think it's generally advisable to link up our (brief) --help texts and
our (more comprehensive) man pages a bit, so this should be an easy and
straight-forward way to do it.
2018-08-20 11:33:04 +02:00
Yu Watanabe 4ae25393f3 tree-wide: shorten error logging a bit
Continuation of 4027f96aa0.
2018-08-07 10:14:33 +09:00
Yu Watanabe fb2367edd9 login: use free_and_replace() and TAKE_PTR() 2018-08-07 10:10:12 +09:00
Lennart Poettering 3a13442bbf user-runtime-dir: downgrade a few log messages to LOG_DEBUG that we ignore
As the comments already say it might be quite likely that
$XDG_RUNTIME_DIR is not set up as mount, and we shouldn't complain about
that.

Moreover, let's make this idempotent, so that a runtime dir that is
already gone and is removed again doesn't cause failure.
2018-08-03 10:38:49 +02:00
Lennart Poettering edda44605f sleep: offer hibernation only if the kernel image still exists
This makes hibernation unavailable if the kernel image we are currently
running was removed. This is supposed to be superficial protection
against hibernating a system we can never return from because the kernel
has been updated and the kernel we currently run is not available
anymore.

We look at a couple of places for the kernel, which should cover all
distributions I know off. Should I have missed a path I am sure people
will quickly notice and we can add more places to check. (or maybe
convince those distros to stick their kernels at a standard place)
2018-07-26 11:01:29 +02:00
Zbigniew Jędrzejewski-Szmek cf6e28f3cb
Merge pull request #9484 from poettering/permille-everywhere
Permille everywhere
2018-07-26 10:13:56 +02:00
Lennart Poettering f806dfd345 tree-wide: increase granularity of percent specifications all over the place to permille
We so far had various placed we'd parse percentages with
parse_percent(). Let's make them use parse_permille() instead, which is
downward compatible (as it also parses percent values), and increases
the granularity a bit. Given that on the wire we usually normalize
relative specifications to something like UINT32_MAX anyway changing
from base-100 to base-1000 calculations can be done easily without
breaking compat.

This commit doesn't document this change in the man pages. While
allowing more precise specifcations permille is not as commonly
understood as perent I guess, hence let's keep this out of the docs for
now.
2018-07-25 16:14:45 +02:00
Lennart Poettering d487e2d68d pam_systemd: cast calls whose result we knowingly ignore to (void) 2018-07-25 16:09:33 +02:00
Lennart Poettering 36a4dbae4b pam_systemd: reduce append_session_cg_weight() indentation level a bit by moving to early exit 2018-07-25 16:09:33 +02:00
Lennart Poettering f7b8b5c4fb pam_systemd: move socket_from_display() from util.[ch] to pam_systemd.c
It's highly specific, kinda legacy (X11…) and only used at one place,
let's move this out of the common code, and into pam_systemd.c where it
is used.
2018-07-25 16:09:33 +02:00
Lennart Poettering e37e5ed32e pam_systemd: sort includes properly 2018-07-25 16:09:33 +02:00
Lennart Poettering b2f74f079d pam_systemd: always set XDG_SESSION_{CLASS|TYPE|DESKTOP}
We likely get the data from the env block, but we might also determine
it from elsewhere (such as PAM module parameters). Let's set the env
vars on the env block explicitly, so that they are available always, and
apps can rely on it.
2018-07-25 16:09:33 +02:00
Lennart Poettering d6baaa6978 pam_systemd: simplify code which with we set environment variables
Let's shorten things a bit by splitting out common code in a new
function.
2018-07-25 16:09:33 +02:00
Lennart Poettering 5fdfbbd505 pam_systemd: tiny coding style fix 2018-07-25 16:09:33 +02:00
Lennart Poettering f5cb2820fd pam_systemd: also make $XDG_SESSION_DESKTOP configurable via PAM module command line
Let's make this symmetric with XDG_SESSION_CLASS and XDG_SESSION_TYPE,
so that PAM stacks can configure this easily without involving env vars,
in case there are PAM session managers which only support a single
desktop anyway.
2018-07-25 16:09:33 +02:00
Lennart Poettering 0ecc1c9d7c pam_systemd: simplify how we process env vars
Let's introduce a single unified getenv() implementation for the various
fields we need.

No change in behaviour.
2018-07-25 16:09:33 +02:00
Lennart Poettering 2b2b7228bf pam_systemd: drop setting DBUS_SESSION_BUS_ADDRESS
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.
2018-07-25 16:09:33 +02:00
Lennart Poettering 3a7369495b pam_systemd: explain in detail why pam_systemd does the PAM item mangling it does in comments
The old comments were imprecise, and misleading. Let's extend things and
explain the situation in more detail.
2018-07-25 12:31:50 +02:00
Zbigniew Jędrzejewski-Szmek 915fa28549
Merge pull request #9560 from mbiebl/uaccess-dev-kvm
Re-add uaccess tag for /dev/kvm
2018-07-23 20:10:38 +02:00
Carlo Caione ba9778d9b7 login1: policy: Authorize active users to boot to firmware
Currently to set the flag to reboot into the firmware setup an
authentication by an administrative user is required. Since we are
already enabling active users to reboot the system, it is advisable to
let the user decide if he wants to boot into the firmware setup without
any more hassle.
2018-07-23 11:12:33 +02:00
Yu Watanabe 948f7ce4fb login: fix typo in log message
Reported in #9590.
2018-07-17 03:10:32 +09:00
Yu Watanabe 86d18f3b09 login: use parse_uid() when unmounting user runtime directory
When unmounting user runtime directory, only UID is necessary,
and the corresponding user may not exist anymore.
This makes first try to parse the input by parse_uid(), and only if it
fails, prase the input by get_user_creds().

Fixes #9541.
2018-07-16 11:12:42 +02:00
Michael Biebl ace5e3111c Do not apply uaccess tag for /dev/kvm if mode is 0666 2018-07-13 23:38:55 +02:00
Michael Biebl fa53e24130 Re-add uaccess tag for /dev/kvm
If --dev-kvm-mode is set to something different then 0666, which we
explicitly support, it makes sense to still apply the uaccess tag to
/dev/kvm. For distros which opt to use the default 0666, this change is
a nop.

This partially reverts commit b8fd3d8220.
2018-07-10 14:51:50 +02:00
Yu Watanabe 1e5f4e8ba2 conf-parser,login: logs description of error in parsing size 2018-07-03 15:18:04 +02:00
Yu Watanabe afb76fdbff tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Yu Watanabe 31d99bd172 tree-wide: do not assign values if not used 2018-06-19 08:44:55 +02:00
Zbigniew Jędrzejewski-Szmek 0cd41d4dff Drop my copyright headers
perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
2018-06-14 13:03:20 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 0c69794138 tree-wide: remove Lennart's copyright lines
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.
2018-06-14 10:20:20 +02:00