Yu Watanabe
e6faa55878
Merge pull request #26578 from thkukuk/main
...
sd-login: add sd_uid_get_login_time interface #26574
2023-02-26 07:54:11 +09:00
Yu Watanabe
9cddd36707
Merge pull request #26574 from YHNdnzj/sd-login-new-interface
...
sd-login: add two interfaces for retriving session info
2023-02-24 09:20:52 +09:00
Yu Watanabe
8b51c41fd0
test: add tests for format_timestamp() and parse_timestamp() with various timezone
2023-02-24 08:55:28 +09:00
Yu Watanabe
7a9afae604
time-util: make parse_timestamp() use the RFC-822/ISO 8601 standard timezone spec
...
If the timezone is specified with a number e.g. +0900 or so, then
let's parse the time as a UTC, and adjust it with the specified time
shift.
Otherwise, if an area has timezone change, e.g.
---
Africa/Casablanca Sun Jun 17 01:59:59 2018 UT = Sun Jun 17 01:59:59 2018 +00 isdst=0 gmtoff=0
Africa/Casablanca Sun Jun 17 02:00:00 2018 UT = Sun Jun 17 03:00:00 2018 +01 isdst=1 gmtoff=3600
Africa/Casablanca Sun Oct 28 01:59:59 2018 UT = Sun Oct 28 02:59:59 2018 +01 isdst=1 gmtoff=3600
Africa/Casablanca Sun Oct 28 02:00:00 2018 UT = Sun Oct 28 03:00:00 2018 +01 isdst=0 gmtoff=3600
---
then we could not determine isdst from the timezone (+01 in the above)
and mktime() will provide wrong results.
Fixes #26370 .
2023-02-24 08:55:27 +09:00
Yu Watanabe
97c5f7ba1f
time-util: drop unnecessary assignment of timezone name
...
As mktime() does not use timezone neme.
2023-02-24 08:55:27 +09:00
Yu Watanabe
a83c1baaeb
time-util: rename variables
...
No functional changes, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe
1d2c42c5dc
time-util: shorten code a bit
...
No functional change, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe
db43717e98
time-util: use usec_add() and usec_sub_unsigned()
...
And move the check with USEC_TIMESTAMP_FORMATTABLE_MAX at the end,
as usec_add() can handle overflow correctly.
2023-02-24 08:55:27 +09:00
Yu Watanabe
f2ecfd8bc1
time-util: use result from startswith_no_case()
...
No functional change, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe
804537bdc4
time-util: do not use strdupa()
...
The input string may come from command line, config files.
2023-02-24 08:55:27 +09:00
Yu Watanabe
17d1ebfc43
time-util: drop redundant else
2023-02-24 08:55:27 +09:00
Yu Watanabe
dff3bddc54
time-util: add assertions
2023-02-24 08:55:27 +09:00
Yu Watanabe
cf98b66d1a
time-util: rename variables
2023-02-24 08:55:27 +09:00
Yu Watanabe
e01a8fdd26
time-util: align string table
2023-02-24 08:55:27 +09:00
Yu Watanabe
d227a42aad
time-util: use DEFINE_STRING_TABLE_LOOKUP_TO_STRING() macro
2023-02-24 08:55:27 +09:00
Yu Watanabe
7464953f33
time-util: drop redundant space
2023-02-24 08:55:27 +09:00
Yu Watanabe
6b04af6072
time-util: drop unused definition of FORMAT_TIMESTAMP_WIDTH
2023-02-24 08:55:27 +09:00
Yu Watanabe
c73676dcbb
man,catalog: fix typo
...
Follow-up for #26448 .
2023-02-24 08:52:42 +09:00
Yu Watanabe
43823dfefd
systemctl: use bus_message_hash_ops
2023-02-23 19:10:00 +00:00
Yu Watanabe
500ecfd513
Merge pull request #26535 from yuwata/systemctl-list-cleanups
...
systemctl-list: several cleanups
2023-02-23 21:38:13 +09:00
Yu Watanabe
e47c426b5c
Merge pull request #26560 from yuwata/journal-send-fix-memleak-and-cleanups
...
sd-journal: several fixlets and cleanups for sd_journal_send()
2023-02-23 21:37:20 +09:00
Yu Watanabe
4de2b47bde
core/dbus-socket: check the socket path is absolute
...
In config_parse_socket_listen(), we have checked the path is absolute,
however we have not in the dbus method.
2023-02-23 21:34:16 +09:00
Yu Watanabe
1b7b956a9b
systemctl: cleanups for list-paths
...
- Rename struct path_info -> PathInfo,
- Drop struct path_infos,
- Use CLEANUP_ARRAY(),
No functional change, just refactoring.
2023-02-23 18:00:38 +09:00
Yu Watanabe
032b3f518c
systemctl: cleanups for list-automounts
...
- Rename struct automount_info -> AutomountInfo,
- use CLEANUP_ARRAY(), and etc.
No functional change, just refactoring.
2023-02-23 18:00:38 +09:00
Yu Watanabe
0e351e9a27
systemctl: cleanups for list-timers
...
- Rename struct timer_info -> TimerInfo,
- use CLEANUP_ARRAY().
No functional change, just refactoring.
2023-02-23 18:00:38 +09:00
Yu Watanabe
1b87606639
systemctl: cleanups for list-sockets
...
- Rename struct socket_info -> SocketInfo.
- Drop own_triggered field, and always copy the triggered field.
- Use CLEANUP_ARRAY().
No functional changes, just refactoring.
2023-02-23 18:00:24 +09:00
Yu Watanabe
1912f790fe
sd-event: fix error handling
...
Follow-up for 6d2326e036 .
2023-02-23 09:27:48 +01:00
Yu Watanabe
f2ccc0d3e1
systemctl-list-units: drop unused return value
2023-02-23 15:13:05 +09:00
Yu Watanabe
eef96911e1
systemctl-list-units: fix memleak on error
2023-02-23 15:13:05 +09:00
Yu Watanabe
5648ebaf40
sd-journal: fix memleak and freeing invalid pointers
...
This also makes
- use GREEDY_REALLOC() or GREEDY_REALLOC0(),
- use CLEANUP_ARRAY() macro.
2023-02-23 15:09:59 +09:00
Yu Watanabe
de5cc016b5
io-util: drop double evaluation in IOVEC_INIT_STRING()
...
This also makes IOVEC_INIT_STRING() and IOVEC_MAKE_STRING() identical.
2023-02-23 15:09:59 +09:00
Yu Watanabe
65e7d565e4
io-util: introduce IOVEC_NULL
2023-02-23 15:09:59 +09:00
Yu Watanabe
752e92615d
test-execute: add test for PrivateNetwork= with/without mount namespacing
2023-02-23 15:09:13 +09:00
Yu Watanabe
c2da3bf237
core/namespace: mount new sysfs when new network namespace is requested
...
Even when a mount namespace is created, previously host's sysfs is used,
especially with RootDirectory= or RootImage=, thus service processes can
still access the properties of the network interfaces in the main network
namespace through sysfs.
This makes, sysfs is remounted with the new network namespace tag, except
when PrivateMounts= is explicitly disabled. Hence, the properties of the
network interfaces in the main network namespace cannot be accessed by
service processes through sysfs.
Fixes #26422 .
2023-02-23 15:09:13 +09:00
Yu Watanabe
277b269e25
core/namespace: introduce a new namespace mount mode PRIVATE_SYSFS
...
This is useful when a service running with a new network namespace.
The mount mode is not used yet, but will be used in a later commit.
2023-02-23 15:09:13 +09:00
Yu Watanabe
10028263fd
core/namespace: rename SYSFS -> BIND_SYSFS
...
No functional change, just preparation for later commits.
2023-02-23 15:09:13 +09:00
Yu Watanabe
f63a2c4821
mount-util: introduce remount_sysfs()
...
This is useful when creating a new network namespace. Unlike procfs,
we need to remount sysfs, otherwise properties of the network interfaces
in the main network namespace are still accessible through the old sysfs,
e.g. /sys/class/net/eth0. All sub-mounts previously mounted on the sysfs
are moved onto the new sysfs mount.
The function will be used in later commits.
2023-02-23 15:09:13 +09:00
Yu Watanabe
2400212128
core/execute: make PrivateMounts= tristate
...
No functional change, just preparation for later commits.
2023-02-23 15:09:13 +09:00
Yu Watanabe
faac56d5d2
core/dbus-util: introduce bus_set_transient_tristate()
...
This will be used in later commits.
2023-02-23 15:09:13 +09:00
Yu Watanabe
ec1b4be82e
bus-util: introduce bus_property_get_tristate()
...
This will be used in later commits.
2023-02-23 15:09:13 +09:00
Yu Watanabe
fde36d2581
core/execute: introduce exec_needs_ipc_namespace() helper function
...
This also fixes a missing condition in exec_runtime_make().
2023-02-23 15:09:13 +09:00
Yu Watanabe
fbbb9697b6
core/execute: introduce exec_needs_network_namespace() helper function
2023-02-23 15:09:13 +09:00
Yu Watanabe
06b3a2f6f0
core/namespace: drop unused field in NamespaceInfo
2023-02-23 15:09:13 +09:00
Yu Watanabe
dcef5e293f
Merge pull request #26555 from poettering/cleanup-array
...
add gcc cleanup attribute based logic to destroy arrays
2023-02-23 15:08:56 +09:00
Yu Watanabe
63b1e67ed9
sd-event: fix error handling
...
Follow-up for 158fe190af .
2023-02-23 11:05:59 +09:00
Yu Watanabe
40c5d5d2a1
sd-event: fix use of uninitialized variable
...
Follow-up for 158fe190af .
Fixes CID#1505670.
2023-02-23 11:05:49 +09:00
Yu Watanabe
c7d941c527
Merge pull request #26557 from poettering/more-cap-utils
...
new helper for cap-list.[ch] + capability-util.[ch]
2023-02-23 10:44:53 +09:00
Yu Watanabe
2457a36d30
Merge pull request #26542 from medhefgo/boot-device-path
...
boot: Misc device path improvements
2023-02-23 10:26:40 +09:00
Yu Watanabe
6d2326e036
sd-event: always initialize sd_event.perturb
...
If the boot ID cannot be obtained, let's first fallback to the machine
ID, and if still cannot, then let's use 0.
Otherwise, no timer event source cannot be triggered.
Fixes #26549 .
2023-02-23 10:11:45 +09:00
Yu Watanabe
b59052be26
systemctl: show "Until:" field only for service and scope units
...
Only service and scope units have RuntimeMaxUSec bus property.
To suppress the "Until:" field for other unit types, the entry must be
initialized with USEC_INFINITY.
Fixes #26473 .
2023-02-22 23:04:43 +09:00
Yu Watanabe
58fbf167d7
Merge pull request #26528 from keszybz/valgrind-simplification
...
Drop the -Dvalgrind configuration option
2023-02-22 23:04:12 +09:00
Yu Watanabe
a2e41b817b
test: add another stress test for devlink creation
2023-02-22 19:08:26 +09:00
Yu Watanabe
60c5bd7759
tree-wide: fix typo
2023-02-22 14:46:19 +09:00
Yu Watanabe
4788f635e3
Merge pull request #26203 from medhefgo/meson
...
meson: Use dicts for test/fuzzer definitions
2023-02-22 10:27:16 +09:00
Yu Watanabe
b5eba967a9
Merge pull request #26529 from medhefgo/boot-misc
...
boot: Misc changes
2023-02-22 10:16:23 +09:00
Yu Watanabe
086234e39b
Merge pull request #26491 from dtardon/list-paths
...
Add systemctl list-paths
2023-02-22 09:29:54 +09:00
Yu Watanabe
a06f85a073
Merge pull request #26527 from mrc0mmand/more-tests
...
test: provide coverage for #26467 and #26483
2023-02-22 08:01:07 +09:00
Yu Watanabe
a2275dcb9d
core/manager: falling back to execute generators without sandboxing
...
When running in a container, like podman, docker or so, creating new mount
namespace may be disabled.
Fixes #26474 .
Fixes RHBZ#2165004 (https://bugzilla.redhat.com/show_bug.cgi?id=2165004 ).
2023-02-21 11:11:03 +01:00
Yu Watanabe
0c2aedb451
tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS
2023-02-21 07:39:18 +09:00
Yu Watanabe
911f8f0183
process-util: rename FORK_NULL_STDIO -> FORK_REARRANGE_STDIO
...
And make safe_fork_full() takes fds to be assigned to stdio.
2023-02-21 07:37:51 +09:00
Yu Watanabe
e814f8b246
Merge pull request #26506 from keszybz/tiny-cleanups
...
Various trivial cleanups and follow-ups
2023-02-21 06:41:01 +09:00
Yu Watanabe
53b3512f9c
Merge pull request #26499 from mrc0mmand/assorted-tweaks
...
A couple of test tweaks for recent CI fails
2023-02-21 05:55:37 +09:00
Yu Watanabe
135e5a201a
udev-node: make stack_directory_read_one() accept NULL for devnode
...
No functional change, as currently the function is always called with
non-NULL argument. Just a preparation for #26048 or #25839 .
2023-02-20 19:40:31 +09:00
Yu Watanabe
c207a57227
udev-node: drop unnecessary initialization
...
The priority of device node symlink can be negative. So the
initialization is confusing.
Fortunately, this changes no functionality, as we only compare the
priorities of symlinks only when we parsed at least one device node and
its priority.
2023-02-20 10:54:48 +01:00
Yu Watanabe
ced30d69fa
exec-util: use TAKE_FD()
2023-02-19 12:17:52 +09:00
Yu Watanabe
65cd9c7251
exec-util: propagate error in wait_for_terminate_and_check()
...
Then, the two error handlings becomes consistent with the one in
execute_directories().
2023-02-19 12:17:52 +09:00
Yu Watanabe
b9fadf2e2c
process-util: show requested process name in the log
...
This is useful for debugging issues like #26474 .
2023-02-19 12:17:52 +09:00
Yu Watanabe
2421dd7267
loop-util: fix error condition and return value
...
Fixes a bug introduced by da4fd28871 .
2023-02-19 05:20:53 +09:00
Yu Watanabe
ebc19b154c
hashmap: fix build with valgrind
...
Follow-up for a2b052b29f .
2023-02-17 22:56:37 +00:00
Yu Watanabe
d51e31ac41
test-execute: also mount tmpfs on /dev/shm
...
Otherwise, if /dev/shm has a directory that cannot be accessible by
unprivileged user, then we cannot pick a dynamic user, and test service
may fail with unexpected error code:
---
Failed to enter shared memory directory /dev/shm/systemd-watch-bind-BqAGlN: Permission denied
exec-dynamicuser-supplementarygroups.service: Failed to update dynamic user credentials: Device or resource busy
exec-dynamicuser-supplementarygroups.service: Failed at step USER spawning /bin/sh: Device or resource busy
src/test/test-execute.c:885:test_exec_dynamicuser: exec-dynamicuser-supplementarygroups.service: can_unshare=no: exit status 217, expected 216
---
Follow-up for 4e032f654b .
2023-02-17 09:55:05 +01:00
Yu Watanabe
8c2264abb9
cryptsetup: check the existence of salt by salt_size > 0
...
Follow-up for 504d0acf61 .
The function may be called with non-NULL salt and salt_size == 0.
2023-02-17 09:46:25 +01:00
Yu Watanabe
d7e32d0558
test: add tests for xsetxattr()
2023-02-17 11:42:14 +09:00
Yu Watanabe
c56c26c906
test: use mkdtemp_open()
2023-02-17 11:18:49 +09:00
Yu Watanabe
9c9e1ceecc
activate: use _cleanup_close_ attribute
2023-02-17 09:49:51 +09:00
Yu Watanabe
a723521fd2
activate: use log_set_open_when_needed()
...
Otherwise, several error logs may not be shown.
2023-02-17 09:49:51 +09:00
Yu Watanabe
a601e702d5
activate: fix typo
2023-02-17 09:49:51 +09:00
Yu Watanabe
8f3d186549
activate: use DEFINE_MAIN_FUNC() macro
2023-02-17 09:49:51 +09:00
Yu Watanabe
d6467dc604
journalctl: fix fd leak
2023-02-17 09:13:22 +09:00
Yu Watanabe
9556e79be5
journalctl: use DEFINE_MAIN_FUNCTION() macro
2023-02-17 09:12:06 +09:00
Yu Watanabe
5f904eb751
xattr-util: check if fd has O_PATH and do not try setxattr() twice
...
Follow-up for a4d2461c46 .
2023-02-17 07:34:49 +09:00
Yu Watanabe
ea61e2e9bd
fd-util: introduce a simple helper to check a file descriptor has O_PATH
2023-02-17 07:18:42 +09:00
Yu Watanabe
b038a44d44
Merge pull request #26271 from d-hatayama/fix_sulogin_shell
...
sulogin: fix control lost of the current terminal when default.target…
2023-02-17 06:52:03 +09:00
Yu Watanabe
dbfc096095
core/mount: fix default target for /sysusr/usr and its child
...
Follow-up for 29a24ab28e .
2023-02-16 14:49:30 +00:00
Yu Watanabe
c126c8ac81
ukify: fix padding length
2023-02-15 18:01:02 +00:00
Yu Watanabe
fff1edc9f9
Merge pull request #26424 from ldv-alt/fix-typos
...
Fix a few typos in NEWS, docs and comments
2023-02-16 00:10:18 +09:00
Yu Watanabe
729045ffae
NEWS: mention that the default mDNS mode is now "yes"
...
C.f. issue #25252 , PR #25255 , and
RHBZ#2169786 (https://bugzilla.redhat.com/show_bug.cgi?id=2169786 ).
2023-02-15 10:41:03 +00:00
Yu Watanabe
6f31095105
test-sysusers: add test for basic.conf
2023-02-15 10:54:25 +09:00
Yu Watanabe
9361a712f8
sysusers: also add root group
...
Follow-up for 49bb7fe5f8 .
Fixes an issue reported at
https://github.com/systemd/systemd/pull/26270#issuecomment-1428945403 .
2023-02-15 10:29:10 +09:00
Yu Watanabe
b7cca6cc5a
test-execute: add basic tests for LoadCredential= and SetCredential=
2023-02-15 10:10:54 +09:00
Yu Watanabe
4e032f654b
test-execute: drop capabilities when testing with user manager
...
Before this, tests are split into two categories, system and user, but
both are running in fully privileged environment. Hence, unprivileged
user scope was mostly not covered by the test.
Let's run all tests in both system and user scopes, and drop capabilities
when Manager is running in user scope.
This also makes the host environment protected more from the test run.
2023-02-15 10:10:54 +09:00
Yu Watanabe
f0353cf2e9
core/execute: fix comment
2023-02-15 10:10:13 +09:00
Yu Watanabe
0b75493da0
tree-wide: fix typo and comment style update
2023-02-15 10:08:16 +09:00
Yu Watanabe
939835cebb
Merge pull request #26400 from ml-/fix-directory-and-typos
...
Fix directory for user home bind mounts in log error and man page
2023-02-12 17:33:41 +09:00
Yu Watanabe
645063d1bb
cryptenroll: drop deadcode
...
Follow-up for b0fc23fae5 .
After the commit, 'signature_path' is now always non-NULL, hence the
condition can be dropped.
Fixes CID#1504492.
2023-02-10 10:45:19 +00:00
Yu Watanabe
1c3762937e
nss-myhostname: do not return empty result with NSS_STATUS_SUCCESS
...
Fixes a bug introduced by db50d326a4 .
Fixes RHBZ#2167468 (https://bugzilla.redhat.com/show_bug.cgi?id=2167468 ).
2023-02-09 06:07:16 +09:00
Yu Watanabe
a3b993ca3f
nss-myhostname: fix inverted condition in
...
Fixes a bug introduced by db50d326a4 .
2023-02-09 05:55:51 +09:00
Yu Watanabe
f3f2d02e97
tree-wide: set FORK_RLIMIT_NOFILE_SAFE flag
...
No functional changes, just refactoring.
2023-02-07 14:39:49 +09:00
Yu Watanabe
e955a7f460
udevd: configure a child process name for worker processes
...
This effectively reverts commit ff86c92e30 ,
and re-apply 49f3ee7e74 .
The change was dropped due to the process name was not correctly logged,
but the issue was fixed by dd15e4cb57 .
Let's set the child process name again.
2023-02-07 14:38:55 +09:00
Yu Watanabe
8586e8ab84
Merge pull request #26324 from yuwata/argv-util-update-short-name
...
argv-util: also update short invocation name
2023-02-07 12:08:07 +09:00
Yu Watanabe
5746c82968
Merge pull request #26322 from keszybz/log-errno-fix
...
Log errno fix
2023-02-07 12:07:45 +09:00