Lennart Poettering [Thu, 7 May 2020 08:38:38 +0000 (10:38 +0200)]
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.
Lennart Poettering [Tue, 12 May 2020 13:54:42 +0000 (15:54 +0200)]
Merge pull request #15785 from poettering/pam-sudo-fixes-part1
some simple PAM fixes split out of #15742
Zbigniew Jędrzejewski-Szmek [Tue, 12 May 2020 09:42:40 +0000 (11:42 +0200)]
Merge pull request #15789 from poettering/homed-bus-api
man: document homed bus API
Lennart Poettering [Mon, 11 May 2020 21:12:56 +0000 (23:12 +0200)]
update TODO
Lennart Poettering [Thu, 7 May 2020 08:35:48 +0000 (10:35 +0200)]
pam_systemd: also print debug lines when ending a session
Lennart Poettering [Thu, 7 May 2020 08:01:29 +0000 (10:01 +0200)]
pam_systemd: drop unused uid argument from export_legacy_dbus_address()
Lennart Poettering [Thu, 7 May 2020 08:49:52 +0000 (10:49 +0200)]
pam_systemd_home: use correct macro for converting ptr to fd
Lennart Poettering [Tue, 12 May 2020 06:55:28 +0000 (08:55 +0200)]
man: document homed D-Bus API
Lennart Poettering [Tue, 12 May 2020 07:02:47 +0000 (09:02 +0200)]
homed: fix parameter names on D-Bus methods
These arguments contain UserRecord structures serialized to JSON,
however only the "secret" part of it, not a whole user record. We do
this since the secret part is conceptually part of the user record and
in some contexts we need a user record in full with both secret and
non-secret part, and in others just the secret and in other just the
non-secret part, but we want to keep this in memory in the same logic.
Hence, let's rename the arguments where we expect a user record
consisting only of the secret part to "secret".
Lennart Poettering [Tue, 12 May 2020 08:37:28 +0000 (10:37 +0200)]
man: run man/update-dbus-docs again
Lennart Poettering [Thu, 23 Apr 2020 17:47:38 +0000 (19:47 +0200)]
netlink: port to recvmsg_safe()
This also makes sure the control buffer is properly aligned. This
matters, as otherwise the control buffer might not be aligned and the
cmsg buffer counting might be off. The incorrect alignment is becoming
visible by using recvmsg_safe() as we suddenly notice the MSG_CTRUNC bit
set because of this.
That said, apparently this isn't enough to make this work on all
kernels. Since I couldn't figure this out, we now add 1K to the buffer
to be sure. We do this once already, also for a pktinfo structure
(though an IPv4/IPv6) one. I am puzzled by this, but this shouldn't
matter much. it works locally just fine, except for those ubuntu CI
kernels...
While we are at it, make some other changes too, to simplify and
modernize the function.
Joel Shapiro [Sat, 9 May 2020 05:38:41 +0000 (00:38 -0500)]
Fix misuse of PAM_PROMPT_ECHO_OFF in systemd-homed
Previously pam_systemd_home.so was relying on `PAM_PROMPT_ECHO_OFF` to
display error messages to the user and also display the next prompt.
`PAM_PROMPT_ECHO_OFF` was never meant as a way to convey information to
the user, and following the example set in pam_unix.so you can see that
it's meant to _only_ display the prompt. Details about why the
authentication failed should be done in a `PAM_ERROR_MSG` before
displaying a short prompt as per usual using `PAM_PROMPT_ECHO_OFF`.
Zbigniew Jędrzejewski-Szmek [Mon, 11 May 2020 17:43:40 +0000 (19:43 +0200)]
Merge pull request #15762 from keszybz/gcc-10-build
Fix build with -O3 with gcc 10
Andrew Doran [Fri, 1 May 2020 14:30:31 +0000 (10:30 -0400)]
DHCP client: make SendOption work for DHCPv6 too.
Lennart Poettering [Mon, 11 May 2020 14:16:06 +0000 (16:16 +0200)]
Merge pull request #15460 from elmarco/network-dhcp-resolve1
network: fallback on resolve1 DNS for DHCP
Zbigniew Jędrzejewski-Szmek [Sat, 9 May 2020 07:09:11 +0000 (09:09 +0200)]
shared/ethtool-util: hush gcc warnings about array bounds
[127/1355] Compiling C object 'src/shared/
5afaae1@@systemd-shared-245@sta/ethtool-util.c.o'
../src/shared/ethtool-util.c: In function ‘ethtool_get_permanent_macaddr’:
../src/shared/ethtool-util.c:260:60: warning: array subscript 5 is outside the bounds of an interior zero-length array ‘__u8[0]’ {aka ‘unsigned char[]’} [-Wzero-length-bounds]
260 | ret->ether_addr_octet[i] = epaddr.addr.data[i];
| ~~~~~~~~~~~~~~~~^~~
In file included from ../src/shared/ethtool-util.c:5:
../src/shared/linux/ethtool.h:704:7: note: while referencing ‘data’
704 | __u8 data[0];
| ^~~~
../src/shared/ethtool-util.c: In function ‘ethtool_set_features’:
../src/shared/ethtool-util.c:488:31: warning: array subscript 0 is outside the bounds of an interior zero-length array ‘__u32[0]’ {aka ‘unsigned int[]’} [-Wzero-length-bounds]
488 | len = buffer.info.data[0];
| ~~~~~~~~~~~~~~~~^~~
In file included from ../src/shared/ethtool-util.c:5:
../src/shared/linux/ethtool.h:631:8: note: while referencing ‘data’
631 | __u32 data[0];
| ^~~~
The kernel should not define the length of the array, but it does. We can't fix
that, so let's use a cast to avoid the warning.
For https://github.com/systemd/systemd/issues/6119#issuecomment-
626073743.
v2:
- use #pragma instead of a cast. It seems the cast only works in some cases, and
gcc is "smart" enough to see beyond the cast. Unfortunately clang does not support
this warning, so we need to do a config check whether to try to suppress.
Zbigniew Jędrzejewski-Szmek [Mon, 11 May 2020 10:49:00 +0000 (12:49 +0200)]
Merge pull request #15768 from poettering/grnd-insecure
random-util: make use of GRND_INSECURE if we have it
Zbigniew Jędrzejewski-Szmek [Mon, 11 May 2020 10:46:36 +0000 (12:46 +0200)]
Merge pull request #15769 from poettering/man-tmpfiles-boot-override
man: document how "!" and conflicting lines play together in tmpfiles.d
Lennart Poettering [Mon, 11 May 2020 08:36:28 +0000 (10:36 +0200)]
man: clarify that exit status name mappings are unaffected by SuccessExitStatus=
Fixes: #15757
(Note there's quite some confusion regarding "exit status" vs. "exit
code" in the docs here. We should clean this up fully one day. This
change tries to fix some occasions of the wrong use, but not all.)
Benjamin Dahlhoff [Mon, 11 May 2020 08:25:02 +0000 (10:25 +0200)]
Added Chuwi Hibook Pro (Model: CWI526) (#15770)
Lennart Poettering [Sun, 10 May 2020 07:19:29 +0000 (09:19 +0200)]
seccomp-util: add new syscalls from kernel 5.6 to syscall filter table
Lennart Poettering [Sun, 10 May 2020 09:45:52 +0000 (11:45 +0200)]
tmpfiles: clarify that "!" lines are filtered before collisions are checked
Fixes: #15675
Lennart Poettering [Sun, 10 May 2020 09:44:53 +0000 (11:44 +0200)]
man: mention the exclamation mark and minus sign literally, to make things searchable
I was looking for the explanation for the exclamation mark in the text,
and couldn't find it, searching for "!". Let's make this easier, and
indicate the character meant.
Lennart Poettering [Sun, 10 May 2020 09:20:01 +0000 (11:20 +0200)]
update TODO
Lennart Poettering [Sun, 10 May 2020 09:15:16 +0000 (11:15 +0200)]
random-util: make use of GRND_INSECURE when it is defined
kernel 5.6 added support for a new flag for getrandom(): GRND_INSECURE.
If we set it we can get some random data out of the kernel random pool,
even if it is not yet initializated. This is great for us to initialize
hash table seeds and such, where it is OK if they are crap initially. We
used RDRAND for these cases so far, but RDRAND is only available on
newer CPUs and some archs. Let's now use GRND_INSECURE for these cases
as well, which means we won't needlessly delay boot anymore even on
archs/CPUs that do not have RDRAND.
Of course we never set this flag when generating crypto keys or uuids.
Which makes it different from RDRAND for us (and is the reason I think
we should keep explicit RDRAND support in): RDRAND we don't trust enough
for crypto keys. But we do trust it enough for UUIDs.
Lennart Poettering [Sun, 10 May 2020 09:14:10 +0000 (11:14 +0200)]
random-util: use ERRNO_IS_NOT_SUPPORTED() macro
Some container mgr or sandbox solution might block it with an unexpected
error code, hence let's be tolerant here.
Lennart Poettering [Sun, 10 May 2020 09:13:49 +0000 (11:13 +0200)]
random-util: actually encode our expectations on RAND_MAX
Lennart Poettering [Sun, 10 May 2020 08:19:05 +0000 (10:19 +0200)]
update TODO
Lennart Poettering [Thu, 7 May 2020 13:34:50 +0000 (15:34 +0200)]
fs-util: beef up path_is_encrypted() to deal with LVM block devices
Let's iterate through the slaves/ directory to find backing devices of
the block devices we care about.
Benjamin Robin [Fri, 8 May 2020 11:32:11 +0000 (13:32 +0200)]
tree-wide: Replace assert() by assert_se() when there is side effect
Lennart Poettering [Sat, 9 May 2020 09:10:56 +0000 (11:10 +0200)]
update TODO
Lennart Poettering [Sat, 9 May 2020 08:37:32 +0000 (10:37 +0200)]
update TODO
Zbigniew Jędrzejewski-Szmek [Sat, 9 May 2020 06:53:27 +0000 (08:53 +0200)]
core: fix compilation with gcc -O3
../src/core/path.c: In function ‘path_serialize’:
../src/core/path.c:616:24: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
616 | (void) serialize_item_format(f, "path-spec", "%s %%i %%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
617 | path_type_to_string(s->type) //,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
618 | // s->previous_exists,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
619 | // s->path
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
620 | );
| ~
In function ‘path_spec_dump’,
inlined from ‘path_dump’ at ../src/core/path.c:392:17:
../src/core/path.c:226:9: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
226 | fprintf(f,
| ^~~~~~~~~~
227 | "%s%s: %s\n",
| ~~~~~~~~~~~~~
228 | prefix,
| ~~~~~~~
229 | path_type_to_string(s->type),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230 | s->path);
| ~~~~~~~~
s->type should be valid here, so let's just add an assert.
For https://github.com/systemd/systemd/issues/6119#issuecomment-
626073743.
наб [Thu, 7 May 2020 19:34:39 +0000 (21:34 +0200)]
networkctl: use uint64_t for link speed throughout
format-table used size_t/uint64_t interchangeably for TABLE_BPS,
and ethtool-util used SIZE_MAX to indicate SPEED_UNKNOWN,
which worked only on ABIs with 64-bit pointers.
For example, the tg3 driver returns SPEED_UNKNOWN with no link (cf.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/broadcom/tg3.c?id=
3eb2efbea193789397c36f52b17d8692ac79bf68#n12190)
which on x32 (and other 32-bit ABIs, presumably) caused
"networkctl status" to mark it with "Speed: 4Gbps":
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 32-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /libx32/ld-linux-x32.so.2,
BuildID[sha1]=
36d684cb1fc8fb5060050d32b969e5aa172fa607, for GNU/Linux
3.4.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: 4Gbps
Whereas on 64-bit-pointer ABIs (here: amd64):
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=
7a3e406e54968d7774ad467fc3f6a9d35ff7aea2, for GNU/Linux
3.2.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
With this patch, networkctl returns, for x32:
nabijaczleweli@szarotka:~$ networkctl --version
systemd 245 (245.5-2.1~networkctl-4g-v2)
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 32-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /libx32/ld-linux-x32.so.2,
BuildID[sha1]=
36d684cb1fc8fb5060050d32b969e5aa172fa607, for GNU/Linux
3.4.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
And for amd64:
nabijaczleweli@szarotka:~$ file $(which networkctl)
/bin/networkctl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=
7a3e406e54968d7774ad467fc3f6a9d35ff7aea2, for GNU/Linux
3.2.0, stripped
nabijaczleweli@szarotka:~$ networkctl status onboard1
● 4: onboard1
Driver: tg3
Model: NetXtreme BCM5755 Gigabit Ethernet PCI Express
Speed: n/a
Frantisek Sumsal [Fri, 8 May 2020 18:14:19 +0000 (20:14 +0200)]
cifuzz: fuzz the master branch on push
Apart from running CIFuzz for each relevant PR, let's run it
unconditionally for each push to master to detect possible issues
(caused by ignored PRs, etc.).
Followup to
94f660a8fe6144b9153c8acaf9e6bb9e47e14b97.
Frantisek Sumsal [Fri, 8 May 2020 16:46:46 +0000 (18:46 +0200)]
cifuzz: run only for relevant PRs
Fuzz only PRs with relevant changes (source code and fuzzer corpora) to
save resources.
Zbigniew Jędrzejewski-Szmek [Fri, 8 May 2020 14:57:14 +0000 (16:57 +0200)]
Merge pull request #15703 from poettering/homed-tweak-default-storage
homed: avoid double encryption
Marc-André Lureau [Tue, 28 Apr 2020 15:59:47 +0000 (17:59 +0200)]
network: fallback on resolved resolv.conf for DHCP server settings
Zbigniew Jędrzejewski-Szmek [Fri, 8 May 2020 09:31:34 +0000 (11:31 +0200)]
Merge pull request #15651 from poettering/newlocale-check
check if locales are installed before using them
Lennart Poettering [Thu, 7 May 2020 16:47:28 +0000 (18:47 +0200)]
homectl: color disk free output if low on free space
Hans de Goede [Thu, 7 May 2020 21:16:21 +0000 (23:16 +0200)]
hwdb: Fix accel orientation quirk for Medion Akoya E2215T MD60198
Commit
3d864658ea01 ("hwdb: assume all Medion Akoya E-models have the
same matrix"), unified the entries for most Medion Akoya E* modes,
including the entry for the Medion Akoya E2215T MD60198.
But the accelerometer on the E2215T has an ACPI-id of KIOX000A, rather
then KIOX010A as the other models have, so that commit broke the
ACCEL_MOUNT_MATRIX for the E2215T.
Add a separate match for the E2215T so that it gets the correct
ACCEL_MOUNT_MATRIX again.
Zbigniew Jędrzejewski-Szmek [Fri, 8 May 2020 09:22:19 +0000 (11:22 +0200)]
Merge pull request #15718 from poettering/tmpfiles-offline
tmpfiles: read /etc/passwd + /etc/group with fgetpwent()/fgetgrent() if --root= is specified
Zbigniew Jędrzejewski-Szmek [Fri, 8 May 2020 09:05:06 +0000 (11:05 +0200)]
Merge pull request #15623 from poettering/cmsg-cleanup
various CMSG_xyz clean-ups, split out of #15571
Lennart Poettering [Tue, 5 May 2020 06:38:29 +0000 (08:38 +0200)]
update TODO
Lennart Poettering [Tue, 5 May 2020 09:02:12 +0000 (11:02 +0200)]
man: document homed.conf
Lennart Poettering [Tue, 5 May 2020 07:57:04 +0000 (09:57 +0200)]
homed: make default storage/file system type configurable in homed.conf
Lennart Poettering [Tue, 5 May 2020 07:55:53 +0000 (09:55 +0200)]
homed: move supported_fstype() to home-util.c
That way we can use it from other modules too. Just some shifting
around, no change in behaviour.
Lennart Poettering [Fri, 1 May 2020 17:42:56 +0000 (19:42 +0200)]
homed: tweak logic for picking a default storage and file system
Let's make the logic a bit smarter: if we detect that /home is
encrypted, let's avoid double encryption and prefer plain
directory/subvolumes instead of our regular luks images.
Also, allow configuration go storage/file system via an env var passed
to homework. In a later commit, let's then change homed to initialize
that env var from a config file setting, when invoking homework.
Lennart Poettering [Fri, 1 May 2020 17:40:39 +0000 (19:40 +0200)]
home: when adding a binding for a user record, use common code for determining automatic image path
Make use of the new user_record_build_image_path() helper the previous
commit added to share some code.
Also, let's make sure we update all parsed-out fields with the new data
from the binding, so that the parsed-out fields are definitely
up-to-date.
Lennart Poettering [Fri, 1 May 2020 17:39:07 +0000 (19:39 +0200)]
user-record: split out code that generates automatic image path for records
No change of behaviour, just some refactoring, so that we can use this
new helper function elswhere, too.
Lennart Poettering [Fri, 1 May 2020 17:37:24 +0000 (19:37 +0200)]
fs-util: add helper path_is_encrypted() that checks if a file system is encrypted
Lennart Poettering [Thu, 7 May 2020 21:30:06 +0000 (23:30 +0200)]
update TODO
Marc-André Lureau [Tue, 28 Apr 2020 15:58:24 +0000 (17:58 +0200)]
shared: move in_addr_ifindex_name_from_string_auto() there
Michal Sekletar [Thu, 7 May 2020 15:23:30 +0000 (17:23 +0200)]
core/cgroup: fix return value of unit_cgorup_freezer_action()
We should return 0 only if current freezer state, as reported by the
kernel, is already the desired state. Otherwise, we would dispatch
return dbus message prematurely in bus_unit_method_freezer_generic().
Thanks to Frantisek Sumsal for reporting the issue.
Lennart Poettering [Thu, 7 May 2020 20:18:59 +0000 (22:18 +0200)]
Merge pull request #15745 from keszybz/one-more-specifier
Add %l as specifier for short hostname
Lennart Poettering [Thu, 7 May 2020 17:17:48 +0000 (19:17 +0200)]
Merge pull request #15713 from poettering/home-discard-when-offline
homed: optionally, issue FITRIM ioctl when logging out
Lennart Poettering [Thu, 7 May 2020 13:07:26 +0000 (15:07 +0200)]
meson: re-run ninja update-man-rules
Split out of #15703, because it has nothing to do with that.
Follow-up for:
4f07ddfa9bc2242eaa6c288a15b8bce4e4383931
Vito Caputo [Thu, 7 May 2020 16:46:01 +0000 (09:46 -0700)]
Merge pull request #15681 from vcaputo/buslocator
*: switch to BusLocator-oriented helpers
Vito Caputo [Sun, 3 May 2020 07:03:16 +0000 (00:03 -0700)]
timedate: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:55:24 +0000 (23:55 -0700)]
systemctl: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:41:14 +0000 (23:41 -0700)]
run: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:39:14 +0000 (23:39 -0700)]
resolve: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:27:35 +0000 (23:27 -0700)]
portable: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:23:50 +0000 (23:23 -0700)]
nss-resolve: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:21:31 +0000 (23:21 -0700)]
nss-mymachines: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:18:27 +0000 (23:18 -0700)]
nspawn: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:14:23 +0000 (23:14 -0700)]
network: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:11:33 +0000 (23:11 -0700)]
mount: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 06:04:27 +0000 (23:04 -0700)]
machine: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 05:52:38 +0000 (22:52 -0700)]
login: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 05:45:52 +0000 (22:45 -0700)]
locale: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Sun, 3 May 2020 05:41:12 +0000 (22:41 -0700)]
analyze: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
Vito Caputo [Thu, 7 May 2020 07:58:25 +0000 (00:58 -0700)]
home: switch to shared bus_home_mgr
Largely mechanical change; s/&home_mgr/bus_home_mgr/g
Vito Caputo [Thu, 7 May 2020 08:16:59 +0000 (01:16 -0700)]
bus: introduce bus-locator.[ch]
Move BusLocator into its own header, introduce collection of
locators for use throughout the code.
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2020 14:25:36 +0000 (16:25 +0200)]
test-specifier: add a simple test which prints "global" specifiers
...i.e. those which can be resolved without a context parameter.
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2020 14:16:19 +0000 (16:16 +0200)]
Add %l as specifier for the hostname without any domain component
As described in #15603, it is a fairly common setup to use a fqdn as the
configured hostname. But it is often convenient to use just the actual
hostname, i.e. until the first dot. This adds support in tmpfiles, sysusers,
and unit files for %l which expands to that.
Fixes #15603.
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2020 15:30:02 +0000 (17:30 +0200)]
Add a basic test that the configured fallback hostname is OK
Ideally, assert_cc() would be used for this, so that it is not possible to even
compile systemd with something like '-Dfallback-hostname=.foo'. But to do a
proper check we need to call hostname_is_valid(), and we cannot depend on being
able to run code (e.g. during cross-compilation). So let's do a very superficial
check in meson, and a proper on in test-util.
Lennart Poettering [Thu, 30 Apr 2020 16:32:44 +0000 (18:32 +0200)]
tree-wide: port various bits over to locale_is_installed()
Lennart Poettering [Thu, 30 Apr 2020 16:32:55 +0000 (18:32 +0200)]
test: add test case for locale_is_installed()
Lennart Poettering [Thu, 30 Apr 2020 16:30:56 +0000 (18:30 +0200)]
locale-util: add new helper locale_is_installed()
This new helper checks whether the specified locale is installed. It's
distinct from locale_is_valid() which just superficially checks if a
string looks like something that could be a valid locale.
Heavily inspired by @jsynacek's #13964.
Replaces: #13964
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2020 15:01:59 +0000 (17:01 +0200)]
Merge pull request #15635 from keszybz/set-put-strdup
Let set_put_strdup() allocate the set and related changes
Lennart Poettering [Thu, 7 May 2020 14:39:54 +0000 (16:39 +0200)]
Merge pull request #15714 from poettering/homed-key-mgmt-doc
man: document homed key management
Lennart Poettering [Tue, 5 May 2020 21:23:00 +0000 (23:23 +0200)]
man: document the new tmpfiles --root= behaviour regarding users
Lennart Poettering [Tue, 5 May 2020 20:48:50 +0000 (22:48 +0200)]
sysusers/tmpfiles: use --root=/ as way to force offline operation (i.e. without NSS)
Lennart Poettering [Tue, 5 May 2020 20:45:54 +0000 (22:45 +0200)]
tmpfiles: optionally, read /etc/passwd + /etc/group without NSS
There are two libc APIs for accessing the user database: NSS/getpwuid(),
and fgetpwent(). if we run in --root= mode (i.e. "offline" mode), let's
use the latter. Otherwise the former. This means tmpfiles can use the
database included in the root environment for chowning, which is a lot
more appropriate.
Fixes: #14806
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2020 13:05:29 +0000 (15:05 +0200)]
man: put all pages which mention a specifier in the index
I wasn't 100% convinced that this is the right thing to do, hence the separate
commit. But e.g. for paths we index all mentions, so I think it's reasonable to
do the same here.
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2020 13:02:02 +0000 (15:02 +0200)]
man: fix indentation in sysusers.d.xml
Lennart Poettering [Tue, 5 May 2020 13:20:10 +0000 (15:20 +0200)]
update TODO
Lennart Poettering [Tue, 5 May 2020 16:48:47 +0000 (18:48 +0200)]
docs: document the new offline discard logic
Lennart Poettering [Tue, 5 May 2020 13:13:20 +0000 (15:13 +0200)]
homework: run fitrim or fallocate on logout based on the new user record property
Lennart Poettering [Tue, 5 May 2020 13:12:55 +0000 (15:12 +0200)]
homectl: add option for controlling new luksOfflineDiscard user record field
Lennart Poettering [Tue, 5 May 2020 13:05:59 +0000 (15:05 +0200)]
user-record: add new field for requesting LUKS discard on logout
We make this entirely independent of the regular discard field, i.e. the
one that controls discard behaviour when the home directory is online.
Not all combinations make a ridiculous amount of sense, but most do.
Specifically:
online-discard = yes, offline-discard = yes
→ Discard when activating explicitly, and during runtime using
the "discard" mount option, and discard explicitly when logging
out again.
online-discard = no, offline-discard = yes
→ The new default: when logging in allocate the full backing
store, and use no discard while active. When loging out discard
everything. This provides nice behaviour: we take minimal storage
when offline but provide allocation guarantees while online.
online-discard = no, offline-discard = no
→ Never, ever discard, always operate with fully allocated
backing store. The extra safe mode.
Lennart Poettering [Tue, 5 May 2020 16:27:37 +0000 (18:27 +0200)]
homed: allow overriding homework path via env var
Let's make debugging a bit easier: when invoking homed from the build
tree it's now possible to make sure homed invokes the build tree's
homework binary by setting an env var.
Lennart Poettering [Tue, 5 May 2020 17:36:21 +0000 (19:36 +0200)]
update TODO
Lennart Poettering [Tue, 5 May 2020 17:33:27 +0000 (19:33 +0200)]
man: document homed key management
Fixes: #15235
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2020 12:59:24 +0000 (14:59 +0200)]
man: add specifiers section to directives index
The hack with getparent().txt is not very pretty, but the whole
thing seems to work well enough. It is useful to figure out whihc
specifiers are supported where.
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2020 12:31:13 +0000 (14:31 +0200)]
tools: move directive index template to separate file
In the beginning, it was rather short, and reasonable to include inline.
Now it is long and unwieldy, let's split it out.
While at it, let's reindent and wrap using our current standards.
Lennart Poettering [Fri, 24 Apr 2020 21:54:25 +0000 (23:54 +0200)]
tree-wide: make sure our control buffers are properly aligned
We always need to make them unions with a "struct cmsghdr" in them, so
that things properly aligned. Otherwise we might end up at an unaligned
address and the counting goes all wrong, possibly making the kernel
refuse our buffers.
Also, let's make sure we initialize the control buffers to zero when
sending, but leave them uninitialized when reading.
Both the alignment and the initialization thing is mentioned in the
cmsg(3) man page.
Lennart Poettering [Fri, 24 Apr 2020 21:38:47 +0000 (23:38 +0200)]
tree-wide: remove redundant assignments
We already initialize the fields a few lines up to the very same values,
hence remove this.
Lennart Poettering [Fri, 24 Apr 2020 21:36:03 +0000 (23:36 +0200)]
tree-wide: use CMSG_SPACE() (and not CMSG_LEN()) to allocate control buffers
We need to use the CMSG_SPACE() macro to size the control buffers, not
CMSG_LEN(). The former is rounded up to next alignment boundary, the
latter is not. The former should be used for allocations, the latter for
encoding how much of it is actually initialized. See cmsg(3) man page
for details about this.
Given how confusing this is, I guess we don't have to be too ashamed
here, in most cases we actually did get this right.