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
Zbigniew Jędrzejewski-Szmek
434fef6de3
shared/sleep-config: more logging and port to extract_first_word()
2020-09-04 13:53:47 +02:00
Zbigniew Jędrzejewski-Szmek
46bf625aca
Add string_contains_word_strv()
...
I had to move STRV_MAKE to macro.h. There is a circular dependency between
extract-word.h, strv.h, and string-util.h that makes it hard to define the
inline function otherwise.
2020-09-04 12:59:26 +02:00
Zbigniew Jędrzejewski-Szmek
81823e6c12
sd-login: use string_contains_word()
2020-09-04 12:59:26 +02:00
Zbigniew Jędrzejewski-Szmek
53cd7f3374
basic: add string_contains_word()
...
This wraps the common pattern of using extract_first_word() in a loop
to look for a matching word.
2020-09-04 12:59:25 +02:00
Zbigniew Jędrzejewski-Szmek
0176728a73
test-string-util,test-extract-word: add log headers
2020-09-04 12:59:25 +02:00
Zbigniew Jędrzejewski-Szmek
459c41b9e2
Merge pull request #16881 from yuwata/network-routing-policy-rule-cleanups
...
network: routing policy rule cleanups
2020-09-04 12:57:20 +02:00
Zbigniew Jędrzejewski-Szmek
a36a23f52b
Merge pull request #16952 from yuwata/resolvectl-log-level-follow-ups
...
resolvectl: update help message
2020-09-04 12:21:15 +02:00
Yu Watanabe
2200c3cf56
network: fixes gateway assignment through DHCPv4
...
This fixes the following issue:
- If a DHCP lease does not contains router option, then routes with
`Gateway=_dhcp` setting introduce unexpected results.
This also makes several failure paths critical. And adjust warnings when
classless routes are provided.
2020-09-04 11:12:03 +02:00
Yu Watanabe
3605aae161
bash-completion: resolvectl: support 'log-level' command
2020-09-04 17:03:28 +09:00
Yu Watanabe
bde4bc9bd2
resolvectl: add 'log-level' to help message
...
Follow-up for df9578498f .
2020-09-04 16:58:36 +09:00
Lennart Poettering
5b49641015
resolved: ttl/hopcount sockopt is not a boolean
...
These are integer values, hence specify them as integers, not as
booleans.
2020-09-04 15:23:12 +09:00
Yu Watanabe
5c72a6d5d3
network: logs about unknown key
2020-09-04 08:48:08 +09:00
Yu Watanabe
f405179d65
network: honor already specified family when parsing from= or to= in serialized rule
2020-09-04 08:48:08 +09:00
Yu Watanabe
9d6282d120
network: do not reallocate buffer
2020-09-04 08:48:04 +09:00
Yu Watanabe
d0ac05613b
network: serialize InvertRule= in [RoutingPolicyRule]
2020-09-04 08:47:22 +09:00
Yu Watanabe
1680b11df4
network: add whitespace after family= and priority= in serialized routing policy rule
...
This also makes priority= serialized only when its value is non-zero.
2020-09-04 08:44:19 +09:00
Yu Watanabe
3c94b20dd3
network: downgrade error level when the error is ignored
2020-09-04 08:44:14 +09:00
Yu Watanabe
7e60a37d04
network: move routing_policy_rule_read_full_file()
2020-09-04 08:42:01 +09:00
Zbigniew Jędrzejewski-Szmek
908dbc70d6
Merge pull request #16044 from ssahani/resolved-interface
...
systemd-resolved: allow configurable bind address
2020-09-03 19:06:05 +02:00
Lennart Poettering
88fdff4e65
Merge pull request #16945 from poettering/udev-test-selinux
...
fix udev-test when used with selinux
2020-09-03 18:39:28 +02:00
Lennart Poettering
7d81d85a05
udev-test: don't mix alloca() and regular C stack allocation in one expression
2020-09-03 17:01:17 +02:00
Lennart Poettering
1e7a67ec22
udev-test: use SYNTHETIC_ERRNO() where useful
2020-09-03 17:01:17 +02:00
Lennart Poettering
91e0b0640e
udev-test: use mount_verbose() instead of mount(), to make debugging easier
2020-09-03 17:01:17 +02:00
Lennart Poettering
415df097fe
udev-test: make sure we run udev tests with selinux assumed off
...
This is cleaner that way given that we create our own half-virtualizes
device tree, and really shouldn't pull selinux labelling and access
control into that, we can only lose, in particular as our overmounted
/sys/ actually lacks /sys/fs/selinux.
(This fixes udev test woes introduced by #16821 where suddenly the test
would fail because libselinux assumed selinux was on, but selinuxfs
wasn't actually available)
2020-09-03 17:01:11 +02:00
Lennart Poettering
86e443de2f
Merge pull request #16915 from poettering/cryptsetup-dlopen
...
pid1,repart,growfs: make libcryptsetup a dlopen() style dep
2020-09-03 14:57:29 +02:00
Lennart Poettering
7cc60ea414
Merge pull request #16821 from cgzones/selinux_status
...
selinux: use SELinux status page
2020-09-03 14:55:08 +02:00
Lennart Poettering
c457bf4741
Merge pull request #16940 from keszybz/socket-enotconn-cleanup
...
Cleanup socket enotconn handling
2020-09-03 14:51:02 +02:00
Susant Sahani
1f05101fb6
resolve: allow configurable bind address
2020-09-03 08:27:41 +00:00
Glen Whitney
43c1f465bb
hwdb: Add Adesso AKB-805MAC keyboard, mfd by Ortek
2020-09-03 09:20:17 +02:00
afg
67d5d9d5ce
firstboot: don't create/modify passwd and shadow if not asked
2020-09-03 09:13:47 +02:00
Zbigniew Jędrzejewski-Szmek
5cf09553c3
core/socket: use _cleanup_ to close the connection fd
...
Removing the gotos would lead to a lot of duplicated code, so I left them
as they were.
2020-09-02 18:18:28 +02:00