Commit Graph

46878 Commits

Author SHA1 Message Date
Lennart Poettering e5f1b999eb network: don't fail on various config parse errors
We typically don't fail on config parse errors (to maximize compat),
let's not do this in these cases either.
2020-09-09 23:43:16 +02:00
Lennart Poettering 40eb1b0ae8 tree-wide: prefer AF_xyz over PF_xyz
This really doesn't matter given that AF_xyz and PF_xyz are equivalent
in all ways, but we almost always use AF_xyz, hence stick to it
universally and convert the remaining PF_ to AF_
2020-09-09 23:42:55 +02:00
Lennart Poettering 8d29a1b9c5 man: document that sd_bus_message_close_container() may only be called at end of container
Prompted-by: https://lists.freedesktop.org/archives/systemd-devel/2020-September/045264.html
2020-09-09 22:46:52 +02:00
Zbigniew Jędrzejewski-Szmek 2bb4d58eba
Merge pull request #16985 from poettering/resolve-dns-stub-extra-fixlets
resolved: dns stub listener extra fixes
2020-09-09 22:03:31 +02:00
Zbigniew Jędrzejewski-Szmek 5887cd7130
Merge pull request #16997 from poettering/foreach-word-followup
fix two coverity issues
2020-09-09 22:00:27 +02:00
Mikael Szreder 664ad0f6f5
cryptsetup: Fix null pointer dereference (#16987)
cryptsetup: Fix null pointer dereference

Fix null pointer dereference in the pkcs11 related code of systemd-cryptsetup
2020-09-09 21:26:21 +02:00
Lennart Poettering 652d90407a tree-wide: copy hardlinks wherever we deal with possibly large OS-style trees
Fixes: #7382
2020-09-09 20:21:49 +02:00
Lennart Poettering dd480f7835 copy: optionally, reproduce hardlinks from source in destination
This is useful for duplicating trees that contain hardlinks: we keep
track of potential hardlinks and try to reproduce them within the
destination tree. (We do not hardlink between source and destination!).

This is useful for trees like ostree images which heavily use hardlinks
and which are otherwise exploded into separate copies of all files when
we duplicate the trees.
2020-09-09 20:21:29 +02:00
Lennart Poettering 7a7e97ad94 sd-login: fix memory leak
Fixes: CID1432652
2020-09-09 20:14:30 +02:00
Lennart Poettering 4934ba2121 socket: fix copy/paste error
Fixes: CID1432653
2020-09-09 20:14:25 +02:00
Lennart Poettering 197db625a3 logind: fix merge issue
The two PRs #16664 and #16635 individually passed CI, but when combined
cannot build. Since both are merged now, let's fix that.
2020-09-09 20:13:57 +02:00
Robert Marko adbb2b6afe login: Add KEY_RESTART handling
KEY_RESTART is widely used in Linux to indicate device reboot.
So lets handle it in the same fashion as KEY_POWER.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2020-09-09 18:40:13 +02:00
Franck Bui 6e220b4b88 logind.conf: document UserStopDelaySec in logind.conf 2020-09-09 17:46:00 +02:00
Lennart Poettering 12ce0f4173
Merge pull request #16635 from keszybz/do-not-for-each-word
Drop FOREACH_WORD
2020-09-09 17:43:38 +02:00
Lennart Poettering a6b3be1abf
Merge pull request #16972 from wusto/ambient-and-keep-caps-corrections
Ambient capabilities documenation and keep-caps usage corrections
2020-09-09 17:09:42 +02:00
Zbigniew Jędrzejewski-Szmek 172338d51b systemctl: list unit introspection verbs first, modification second
The list was rather ad hoc, with "reset-failed" sandwiched between
"help" and "list-dependencies". Since a person will usually either want
to introspect state in various ways or modify state in a certain way, let's
put all the introspection commands together and all the ones that actually
have an effect second.
2020-09-09 16:59:18 +02:00
Lennart Poettering 244d9793ee
Merge pull request #16984 from yuwata/make-log_xxx_error-void
Make log_xxx_error() or friends return void
2020-09-09 16:28:51 +02:00
Lennart Poettering 39c4e2c1a1
Merge pull request #16982 from yuwata/socket-buffer-size
Fixes for socket buffer size
2020-09-09 16:28:21 +02:00
Tobias Kaufmann 198dc17845 core: fix set keep caps for ambient capabilities
The securebit keep-caps retains the capabilities in the permitted set
over an UID change (ambient capabilities are cleared though).

Setting the keep-caps securebit after the uid change and before execve
doesn't make sense as it is cleared during execve and there is no
additional user ID change after this point.

Altough the documentation (man 7 capabilities) is ambigious, keep-caps
is reset during execve although keep-caps-locked is set. After execve
only keep-caps-locked is set and keep-caps is cleared.
2020-09-09 11:17:42 +02:00
Tobias Kaufmann 16fcb1918a core: fix comments on ambient capabilities
The comments on the code for ambient capabilities was wrong/outdated.
2020-09-09 11:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 90e30d767a Rename strv_split_extract() to strv_split_full()
Now that _full() is gone, we can rename _extract() to have the usual suffix
we use for the more featureful version.
2020-09-09 09:34:55 +02:00
Zbigniew Jędrzejewski-Szmek 03b62851a9 Remove FOREACH_WORD and friends 2020-09-09 09:34:55 +02:00
Zbigniew Jędrzejewski-Szmek 0645b83a40 tree-wide: replace strv_split_full() with strv_split_extract() everywhere
Behaviour is not identical, as shown by the tests in test-strv.
The combination of EXTRACT_UNQUOTE without EXTRACT_RELAX only appears in
the test, so it doesn't seem particularly important. OTOH, the difference
in handling of squished parameters could make a difference. New behaviour
is what both bash and python do, so I think we can ignore this corner case.

This change has the following advantages:
- the duplication of code paths that do a very similar thing is removed
- extract_one_word() / strv_split_extract() return a proper error code.
2020-09-09 09:34:55 +02:00
Zbigniew Jędrzejewski-Szmek d59d954d7f test-string-util: stop testing FOREACH_WORD 2020-09-09 09:34:55 +02:00
Zbigniew Jędrzejewski-Szmek 45638a63c0 shared/fstab-util: replace FOREACH_WORD_SEPARATOR() with open-coded loop
The tricky part here is that the function is not allowed to fail in this code
path. Initially, I wanted to change the return value to allow it to fail, but
this cascades through all the places where fstab_test_option() and friends are
used; updating all those sites would be a lot of work. And since quoting is not
allowed here, a simple loop with strcspn() is easy to do.
2020-09-09 09:34:55 +02:00
Zbigniew Jędrzejewski-Szmek 0e8d185938 shared/fstab-util: use free_and_str[n]dup()
No functional change. I'm keeping this separate to make review easier.
2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek ecaf258eb4 Use extract_first_word() in generated conf parsers 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek 087908c140 nspawn: use extract_first_word() 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek 2417658d6a getty-generator: use extract_first_word() 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek da277e90a4 sd-journal: use extract_first_word() 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek cc24f0b872 delta: use extract_first_word() 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek dd2fff3a18 cryptsetup: use extract_first_word() 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek 7896ad8f66 core/load-fragment: use extract_first_word()
This is much nicer, and also fixes a potential overflow when we used
'word' in log_error() as if it was a NUL-terminated string.
2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek dd630d3cac Let sd_machine_get_ifindices() omit the output param too
Nowadays we do that almost everywhere, let's also do it here.
2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek 0ef14adc1c Rewrite sd_machine_get_ifindices() to avoid FOREACH_WORD()
If we fail to parse the index, the failure is propogated as -EUNCLEAN.
(-EINVAL would be confused with invalid args to the function itself.)
2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek aa3b40c3f9 Fix output value of sd_seat_get_sessions() and drop FOREACH_WORD use
sd_seat_get_sessions() would return 0 in the 'n_uids' (now 'ret_n_uids') output
parameter when 'uid' (now 'ret_uids') was passed as NULL.

While at it, drop FOREACH_WORD() use.

Also use any whitespace as separator. In practice this shouldn't matter, since
logind always uses spaces, but it seems nicer to not specify this explicitly,
and the default is more flexible.
2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek 87a4d416e5 sd-device: use extract_first_word() 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek ae7ef63f21 basic/cgroup-util: port over to string_contains_word() 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek 46ed9f4ce1 logind: use extract_first_word() 2020-09-09 09:34:54 +02:00
Yu Watanabe e77f52e5f9 udev: warn if failed to set buffer size for device monitor 2020-09-09 06:46:54 +09:00
Yu Watanabe a725efb08b network: increase receive buffer size for device monitor
If networkd creates huge amount of netdevs, then the buffer of device
monitor becomes easily flowed.

Hopefully fixes #16865.
2020-09-09 06:39:05 +09:00
Yu Watanabe d31f33e3c9 network: do not start device monitor if /sys is read-only
Follow-up for bf331d8717.
2020-09-09 06:39:05 +09:00
Yu Watanabe e13af7bdb6 network: honor the buffer size specified in networkd.socket 2020-09-09 06:39:05 +09:00
Yu Watanabe ded71ab3bc core/socket: use fd_set_{rcv,snd}buf() 2020-09-09 06:39:05 +09:00
Yu Watanabe 2807a79424 sd-device-monitor: use fd_set_rcvbuf() 2020-09-09 06:39:05 +09:00
Yu Watanabe d9d9b2a0ae util: introduce fd_set_{snd,rcv}buf() 2020-09-09 06:39:05 +09:00
Yu Watanabe b92f350789 util: try to set with SO_{RCV,SND}BUFFORCE when requested size is larger than the kernel limit
The commit 10ce2e0681 inverts the order of
SO_{RCV,SND}BUFFORCE and SO_{RCV,SND}BUF. However, setting buffer size with
SO_{RCV,SND}BUF does not fail even if the requested size is larger than
the kernel limit. Hence, SO_{RCV,SND}BUFFORCE will not use anymore and
the buffer size is always limited by the kernel limit even if we have
the priviledge to ignore the limit.

This makes the buffer size is checked after configuring it with
SO_{RCV,SND}BUF, and if it is still not sufficient, then try to set it
with FORCE command. With this commit, if we have enough priviledge, the
requested buffer size is correctly set.

Hopefully fixes #14417.
2020-09-09 06:39:05 +09:00
Yu Watanabe 1263c85ef3 util: refuse to set too large value for socket buffer size 2020-09-09 06:39:05 +09:00
Yu Watanabe 8c63924c8d network: ignore error on increasing netlink receive buffer size 2020-09-09 06:39:05 +09:00
Lennart Poettering a1447e77a7
Merge pull request #16973 from poettering/btrfs-dev-root
print friendly error message if btrfs tells us /dev/root was backing block device of root fs
2020-09-08 19:55:12 +02:00