Commit Graph
4748 Commits
Author SHA1 Message Date
Johannes Schauer Marin Rodrigues 3fa8a1148a sysusers: make sp_lstchg shadow field reproducible
If the environment variable SOURCE_DATE_EPOCH is set, use its value
instead of the current time.
2022-09-02 07:17:25 +02:00
Lennart Poettering 6eeadaa141 path-util: return error if fnmatch() fails 2022-08-31 17:31:11 +02:00
Lennart Poettering 8812f8fc65 hashmap: add comment explaining that set_fnmatch() handles fnmatch() errors as non-matches 2022-08-31 15:13:42 +02:00
Jan Janssen 63b9838639 tree-wide: Mark some constants as unsigned
All these are really unsigned and used as such. This silences some
-Wformat-signedness warnings with gcc.
2022-08-30 12:03:33 +02:00
Yu Watanabe 69a20cc3e4 Merge pull request #23888 from topimiettinen/networkd-netlabel-v2
network: NetLabel integration
2022-08-30 07:30:49 +09:00
Lennart Poettering bcfc0e8872 strv: modernize strv_fnmatch() a bit 2022-08-30 01:09:12 +09:00
Topi Miettinen 5b198025de sd-netlink: add NetLabel support 2022-08-29 14:23:17 +09:00
Topi Miettinen 3f36b9ed47 basic: generate netmasks for IPv6 and generic IP family addresses
Added functions to generate netmasks for IPv6 and generic IP family addresses.
2022-08-29 14:23:17 +09:00
Yu Watanabe 4492b5d804 devnum-util: split-out device_path_make_inaccessible() 2022-08-28 09:08:21 +09:00
Devendra Tewari 0f79b3469f systemd-growfs: use sd_device_new_from_devnum()
Use sd_device_new_from_devnum() instead of
device_path_make_major_minor_sysfs().
2022-08-26 20:33:03 +01:00
Yu Watanabe 72715f3d13 virt: fix alignment
Follow-up for f555830674.
2022-08-25 16:23:05 +00:00
Devendra Tewari aa181897cf systemd-growfs: remove dependency on udev symlinks
systemd-growfs currently requires that udev ran first to work (because
/dev/block/ symlinks must exist) but that is not what happens when
we're not using initrd and systemd is PID1.
2022-08-24 21:42:16 +01:00
Lennart Poettering 782c6e5c90 time-util: fix overflow condition in usec_sub_signed()
If the delta specified is INT64_MIN, and we negate that we'd end up at
INT64_MAX+1 which is outside of the int64_t type. Hence let's treat this
case specifically to avoid unintended overflows.
2022-08-24 21:41:40 +01:00
Richard Phibel 34683dbdd0 journald: use rate-limited logging to log 'Failed to write entry' message 2022-08-24 21:39:20 +01:00
Luca Boccassi 298b3de6d4 Merge pull request #24370 from keszybz/sysusers-equivs
Use /bin/bash for root shell and suppress some warnings from sysusers
2022-08-24 21:35:28 +01:00
Zbigniew Jędrzejewski-Szmek 8795d9bacd basic/user-util: rename output param to ret, shorten code 2022-08-24 10:02:46 +02:00
Zbigniew Jędrzejewski-Szmek 36bac2dcba basic/user-util: avoid filesystem access check
The check of u==UID_NOBODY is just a register comparison, but
synthesize_nobody() requires a system call, so let's invert the order in the
condition. Since most calls into this module are not for nobody, we should
save one syscall in the common case.
2022-08-24 10:02:46 +02:00
Zbigniew Jędrzejewski-Szmek 8a7adccbdb various: try to use DEFAULT_USER_SHELL for root too
/bin/sh as a shell is punishing. There is no good reason to make
the occasional root login unpleasant.

Since /bin/sh is usually /bin/bash in compat mode, i.e. if one is
available, the other will be too, /bin/bash is almost as good as a default.
But to avoid a regression in the situation where /bin/bash (or
DEFAULT_USER_SHELL) is not installed, we check with access() and fall back
to /bin/sh. This should make this change in behaviour less risky.

(FWIW, e.g. Fedora/RHEL use /bin/bash as default for root.)

This is a follow-up of sorts for 53350c7bba,
which added the default-user-shell option, but most likely with the idea
of using /bin/bash less ;)

Fixes #24369.
2022-08-24 10:02:46 +02:00
Lennart Poettering e820ca0193 Merge pull request #24071 from bluca/path_trigger_report
path/timer units: export env vars and D-Bus properties with reason that triggered the job
2022-08-24 09:35:59 +02:00
Zhaofeng Li f555830674 virt: Support detection of Apple Virtualization.framework guests 2022-08-24 09:34:54 +02:00
Luca Boccassi f52faaf923 glob: add glob_first(), returns first match
Note that which match is returned depends on the system and is
not guaranteed to be stable
2022-08-23 20:04:41 +01:00
Lennart Poettering 15e2182fb3 mkdir: don't allow us to get confused by symlinks in mkdir_p_root()'s chowning logic 2022-08-23 15:10:15 +02:00
Lennart Poettering e08c10a424 path-util: drop the now unused dirname_malloc() 2022-08-23 15:10:15 +02:00
Lennart Poettering 45519d13a4 tree-wide: port things dirname_malloc() → path_extract_directory() 2022-08-23 15:10:15 +02:00
Lennart Poettering 81a7eac1f7 chase-symlinks: refuse more chase_symlink() flags in the open/stat flavours
These flags make no sense when we try to access the final inode, hence
refuse.
2022-08-22 19:25:00 +01:00
Lennart Poettering 1d1c226f6c conf-files: port conf_files_list() over to chase_symlinks() from prefix_roota() 2022-08-22 14:08:48 +02:00
Lennart Poettering 2b2caea21d chase-symlinks: add chase_symlinks_and_access() helper
This is similar to chase_symlinks_and_access() but wraps access() rather
than stat()
2022-08-22 13:40:13 +02:00
Lennart Poettering 37b9bc56fc chase-symlinks: fix shortcut condition 2022-08-22 13:40:13 +02:00
Lennart Poettering 6957023208 chase-symlinks: honour CHASE_NOFOLLOW flag properly in some cases 2022-08-22 13:40:13 +02:00
Frantisek Sumsal 3b2b3d2985 hashmap: use assert_se() to make clang happy
Otherwise it complains about a set but unused variable:

```
../src/basic/hashmap.c:1070:48: error: variable 'n_rehashed' set but not used [-Werror,-Wunused-but-set-variable]
        unsigned old_n_buckets, new_n_buckets, n_rehashed, new_n_entries;
                                                       ^
                                                       1 error generated.
```
2022-08-20 21:57:18 +02:00
Lennart Poettering 558d96240b sha256: add sha256_direct()/SHA256_DIRECT() helpers 2022-08-19 12:53:04 +02:00
Frantisek Sumsal cd7ad0cbde Merge pull request #24054 from keszybz/initrd-no-reload
Don't do daemon-reload in the initrd
2022-08-18 13:15:14 +00:00
Lennart Poettering 582fc142da random-util: drop unnecessary header file
(And some minor reindents)
2022-08-17 21:59:28 +09:00
Lennart Poettering 86b4e141a5 fs-util: make touch() an inline function 2022-08-17 21:58:33 +09:00
Yu Watanabe 3b703fe269 path-util: introduce path_glob_can_match() 2022-08-17 14:30:20 +09:00
wineway c8340822cf core/cgroup: CPUWeight/CPUShares support idle input
Signed-off-by: wineway <wangyuweihx@gmail.com>
2022-08-11 14:25:58 +02:00
Yu Watanabe eff6bc9294 Merge pull request #24244 from yuwata/device-enumerator
sd-device-enumerator: fix sysattr match
2022-08-09 04:57:48 +09:00
Yu Watanabe 52be2b43f5 hash-funcs: introduce string_hash_ops_free_strv_free 2022-08-08 23:41:28 +09:00
Yu Watanabe 069f5df051 ether-addr-util: introduce hw_addr_set() helper function 2022-08-06 04:53:36 +09:00
Michal Sekletar 03860190fe scope: allow unprivileged delegation on scopes
Previously it was possible to set delegate property for scope, but you
were not able to allow unprivileged process to manage the scope's cgroup
hierarchy. This is useful when launching manager process that  will run
unprivileged but is supposed to manage its own (scope) sub-hierarchy.

Fixes #21683
2022-08-04 17:01:13 +02:00
Lennart Poettering 71c943dc40 mountpoint-util: make fd_is_mountpoint() work reasonably with AT_EMPTYPATH
Inspired by: https://github.com/systemd/systemd/pull/24141

Calling fd_is_mountpoint() with AT_EMPTYPATH and an empty filename can
only work if we have new statx() available. If we do not, we can still
make things work for directories, but not for other inodes (since there
we cannot query information about the parent inode to compare things.)

Hence, let's handle and test this explicitly, to support this to the
level this is possible.
2022-08-02 20:01:59 +02:00
Yu Watanabe 5162b2a1c4 tree-wide: fix typo 2022-08-02 02:43:38 +09:00
Cristian Rodríguez 91375fb9cf gcrypt: switch to system rng before gcry_check_version (#24162)
Current docs claim this must be done before gcry_check_version.
2022-08-01 14:04:27 +09:00
Eli Schwartz 6c8892828c meson: use files in run_command with relativized path
Passing a file as a command argument in string form assumes that
run_command has the current subdir as its cwd, but Meson's documentation
*explicitly* calls this out as undefined and wrong to use.

Indeed, muon has a different implementation that uses a different cwd,
and this argument cannot be found. Instead, passing a files() object
means that it's the job of meson itself to verify the file exists, then
pass it to the run_command in some format that guarantees it is a valid
path reference.
2022-07-30 13:58:22 +09:00
Cristian Rodríguez 80f967311a gcrypt: prefer the OS RNG
by default, gcrypt defaults to an userspace RNG, this is
the wrong thing (tm) to do on linux.

Switch to the SYSTEM rng instead.
2022-07-29 16:08:48 +02:00
Fei Li c15d1ac2c4 virt: detect KubeVirt instance
Kubevirt is currently technically based on KVM (but not xen yet[1]).
The systemd-detect-virt command, used to differentiate the current
virtualization environment, works fine on x86 relying on CPUID, while
fails to get the correct value (none instead of kvm) on aarch64.

Let's fix this by adding a new 'vendor[KubeVirt] = kvm' classification
considering the sys_vendor is always KubeVirt.

[1] https://groups.google.com/g/kubevirt-dev/c/C6cUgzTOsVg

Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
2022-07-29 11:10:29 +02:00
Yu Watanabe 0a58cd0045 home: drop conflicted headers
Fixes #24117.
2022-07-26 23:41:48 +09:00
Rudi Heitbaum 3657d3a01c glibc: Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36 2022-07-24 20:52:35 +09:00
Yu Watanabe 7c35b78a0b unit-file: avoid (null) in debugging logs
The variable `inst` was set to NULL by TAKE_PTR().

This fixes the following log message:
```
systemd[1]: Unit getty@tty2.service has alias (null).
```
2022-07-24 20:51:27 +09:00
Yu Watanabe d6985e76f2 sd-device: introduce device_unref_and_replace() 2022-07-23 08:16:38 +09:00