Commit Graph

46986 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek a3709e3709 tests: when creating temp dirs, include test name in path
This makes it easier to figure out which directory we want to look at
when tests fail, and also which test left behind a directory when it
shouldn't.
2020-10-01 19:53:45 +02:00
Zbigniew Jędrzejewski-Szmek aa25270cb2 sysusers: look at login.defs when setting the default range to allocate users
Also, even if login.defs are not present, don't start allocating at 1, but at
SYSTEM_UID_MIN.

Fixes #9769.

The test is adjusted. Actually, it was busted before, because sysusers would
never use SYSTEM_GID_MIN, so if SYSTEM_GID_MIN was different than
SYSTEM_UID_MIN, the tests would fail. On all "normal" systems the two are
equal, so we didn't notice. Since sysusers now always uses the minimum of the
two, we only need to substitute one value.
2020-10-01 19:53:45 +02:00
Zbigniew Jędrzejewski-Szmek 044df624aa test-sysusers: fix how paths are calculated
We were looking at ${f%.*}, i.e. the $f with any suffix starting with a dot removed.
This worked fine for paths like /some/path/test-11.input. It also worked
for paths like /some/path/inline (there were no dots, so we got $f back unscathed).
But in the ubuntu CI the package is built in a temporary directory like
/tmp/autopkgtest-lxc.nnnfqb26/downtmp/build.UfW/ (yes, it has a dot, even two.).
That still worked for the first case, but in the second case we truncated things
after the first dot, and we would try to get
/tmp/autopkgtest-lxc.nnnfqb26/downtmp/build and try to load
/tmp/autopkgtest-lxc.nnnfqb26/downtmp/build.expected-password, which obviously
didn't work as expected. To avoid this issue, do the suffix removal only when
we know that there really is a suffix.

A second minor issue was that we would try to copy $1.expected-*, and sometimes
$1 would be given, and sometimes not. Effectively we were relying on there
not being any files matching .expected-*. There weren't any such files, but let's
avoid this ugliness and always pass $1.
2020-10-01 17:52:51 +02:00
Zbigniew Jędrzejewski-Szmek 69a7c5fb1f test-sysusers: sort examples
This shouldn't affect the outcome, but makes outputs easier to compare.
2020-10-01 17:52:51 +02:00
Zbigniew Jędrzejewski-Szmek bd7e6aa73a test/TEST-21-SYSUSERS: turn into a unit test
All this test does is manipulate text files in a subdir specified with --testroot.
It can be a normal unittest without the overhead of creating a machine image.

As a bonus, also test the .standalone version.
2020-10-01 17:52:51 +02:00
Zbigniew Jędrzejewski-Szmek d338bfff4a basic/fileio: add chase_symlinks_and_fopen_unlocked() 2020-10-01 17:52:50 +02:00
Zbigniew Jędrzejewski-Szmek 196b596867 shared/uid-range: reduce scope of iterator variables 2020-10-01 17:52:50 +02:00
Zbigniew Jędrzejewski-Szmek fc1a5d1a70 Also parse the minimum uid/gid values
We don't (and shouldn't I think) look at them when determining the type of the
user, but they should be used during user/group allocation. (For example, an
admin may specify SYS_UID_MIN==200 to allow statically numbered users that are
shared with other systems in the range 1–199.)
2020-10-01 17:52:41 +02:00
Zbigniew Jędrzejewski-Szmek 53393c894d Look at /etc/login.defs for the system_max_[ug]id values
It makes little sense to make the boundary between systemd and user guids
configurable. Nevertheless, a completely fixed compile-time define is not
enough in two scenarios:
- the systemd_uid_max boundary has moved over time. The default used to be
  500 for a long time. Systems which are upgraded over time might have users
  in the wrong range, but changing existing systems is complicated and
  expensive (offline disks, backups, remote systems, read-only media, etc.)
- systems are used in a heterogenous enviornment, where some vendors pick
  one value and others another.
So let's make this boundary overridable using /etc/login.defs.

Fixes #3855, #10184.
2020-10-01 17:49:31 +02:00
Zbigniew Jędrzejewski-Szmek 28add648a8 coredump: use uid_is_system() when appropriate 2020-09-25 17:18:56 +02:00
Zbigniew Jędrzejewski-Szmek 98dcb8f4c7 Move {uid,gid}_is_*() from basic to shared
Those are functions that express policy, and nothing in basic/ uses
(or should use) them.
2020-09-25 17:18:56 +02:00
Zbigniew Jędrzejewski-Szmek 960b585ba1
Merge pull request #17145 from poettering/kill-chmod-and-chown-unsafe
remove chmod_and_chown_unsafe()
2020-09-24 09:40:56 +02:00
Lennart Poettering bcaf20dc38
Merge pull request #17143 from keszybz/late-exec-resolution-alt
Late exec resolution (subset)
2020-09-24 09:38:36 +02:00
germanztz 73439a3d76
hwdb: add Medion Akoya E2221T MD60691 (#17147) 2020-09-24 09:33:43 +02:00
Charles Lee 19ad553442 Translated using Weblate (Chinese (Simplified))
Currently translated at 63.1% (118 of 187 strings)

Co-authored-by: Charles Lee <lchopn@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/zh_CN/
Translation: systemd/master
2020-09-24 09:30:56 +02:00
Kyle Huey fbccb980e5 random-util: Add an environment variable to disable RDRAND.
SYSTEMD_RDRAND=0 will prevent using RDRAND even on systems whose CPUID claims
to support it. All other values have no effect.

Fixes: #17112
2020-09-24 09:22:45 +02:00
Anita Zhang 6de6f4891f
Merge pull request #17142 from poettering/catalog-fix-de
catalog: add missing @ to German catalog file
2020-09-23 23:41:38 -07:00
Anita Zhang 8f4946dc8b
Merge pull request #17146 from poettering/use-more-proc-mounted
use proc_mounted() more
2020-09-23 23:39:20 -07:00
Lennart Poettering c7828862b3
Merge pull request #17118 from poettering/sync-shutdown-loop
fsync() block devices before detaching them during shutdown
2020-09-23 21:47:03 +02:00
Lennart Poettering dee1f028f5
Merge pull request #17144 from poettering/mount-nofollow
tree-wide: mostly avoid following symlinks when mounting
2020-09-23 21:46:02 +02:00
Lennart Poettering 1f40142721 update TODO 2020-09-23 18:57:37 +02:00
Lennart Poettering 890084db03 tree-wide: port remaining umount() calls to umount_verbose() 2020-09-23 18:57:37 +02:00
Lennart Poettering 21935150a0 tree-wide: switch remaining mount() invocations over to mount_nofollow_verbose()
(Well, at least the ones where that makes sense. Where it does't make
sense are the ones that re invoked on the root path, which cannot
possibly be a symlink.)
2020-09-23 18:57:37 +02:00
Lennart Poettering 30f5d10421 mount-util: rework umount_verbose() to take log level and flags arg
Let's make umount_verbose() more like mount_verbose_xyz(), i.e. take log
level and flags param. In particular the latter matters, since we
typically don't actually want to follow symlinks when unmounting.
2020-09-23 18:57:36 +02:00
Lennart Poettering 511a8cfe30 mount-util: switch most mount_verbose() code over to not follow symlinks 2020-09-23 18:57:36 +02:00
Lennart Poettering 5012d567a8 mount-util: make sure get_mount_flags() ever follows symlinks
It doesn't follow symlinks when we check for the mount flags via
libmount, hence it shouldn't do either when we go via statvfs().
2020-09-23 18:57:36 +02:00
Lennart Poettering 28126409b2 mount-util: add helpers for mount() without following symlinks 2020-09-23 18:57:36 +02:00
Lennart Poettering e55299da4d shutdown: also fsync() DM devices before going down
Similar reasons as the previous patch.
2020-09-23 18:33:48 +02:00
Lennart Poettering 32c4626c4c shutdown: also fsync() MD devices when going down
Let's make this explicit, just in case this suffers by the same issues
as the loopback devices, and drops in-flight IO when we disassemble it.
2020-09-23 18:33:48 +02:00
Lennart Poettering 1a269c4ee3 shutdown: don't compare pointers with 0 2020-09-23 18:33:48 +02:00
Lennart Poettering 4534b32c73 shutdown: fsync() before detaching loopback devices
This is a follow-up for cae1e8fb88c5a6b0960a2d0be3df8755f0c78462: we
also call the detach ioctls in the shutdown code, hence add the fsync()s
there too, just to be safe.
2020-09-23 18:33:48 +02:00
Lennart Poettering 4265a66a5e fs-util: check for /proc mounted in access_fd()
It's a very basic function very similar to other cases where we go via
/proc/self/fd/, hence do the explicit proc_mounted() check here too.
2020-09-23 18:20:38 +02:00
Lennart Poettering 48d837cd92 fs-util: use strna() on returned strings of fd_get_path() if we don't check its return value
Let's make sure to use strna() on the strings returned by fd_get_path()
where we knowingly ignore any failures. We got this right in most cases,
but two were missing.
2020-09-23 18:20:38 +02:00
Lennart Poettering 8fe8f3aaba basic: update fd_get_path() to use proc_mounted() helper
We use it pretty much everywhere else, hence use it here too.

This also changes the error generated from EOPNOTSUPP to ENOSYS, to
match the other cases where we do such a check. One user checked for
EOPNOTSUPP which is updated to check for ENOSYS instead.
2020-09-23 18:20:38 +02:00
Lennart Poettering 1e5bfa2ac8 fs-util: drop chmod_and_chown_unsafe() which is unused now 2020-09-23 18:00:19 +02:00
Lennart Poettering 62c03398ba sysusers: modernize file backup logic a bit
Let's use _cleanup_ magic to clean up files, let's fully operate by fds
whenever we can.
2020-09-23 18:00:19 +02:00
Lennart Poettering e59d030ff8 update TODO 2020-09-23 15:25:25 +02:00
Zbigniew Jędrzejewski-Szmek 8038b99d0d run: let systemd resolve the path with RootDirectory=/RootImage=
Fixes #13338.
2020-09-23 14:49:37 +02:00
Zbigniew Jędrzejewski-Szmek 526e3cbbdd core: don't try to load units from non-absolute paths
The error message disagreed with the check that was actually performed. Adjust the check.
2020-09-23 14:49:37 +02:00
Lennart Poettering 3142135098 catalog: add missing @ to German catalog file 2020-09-23 13:56:51 +02:00
Lennart Poettering 6333aa9d46 sd-radv: fix indentation
Fix-up for 97efde65d8
2020-09-23 13:44:26 +02:00
Lennart Poettering d5bc4e6898 machine: fix error code propagation in two cases 2020-09-23 13:24:25 +02:00
Lennart Poettering 6b6737119a
Merge pull request #17130 from keszybz/static-analyzer-cleanups
Trivial cleanups based on static analysis
2020-09-23 13:23:56 +02:00
Roy Chen (陳彥廷) f280aecd38 man: sd_bus_message_new: fix typo 2020-09-23 11:58:08 +02:00
Ronan Pigott 1f0541dace sd-path: include 'search' in search pathnames 2020-09-23 10:08:44 +02:00
Ronan Pigott cf18af825a zsh: add systemd-path completions 2020-09-23 10:07:14 +02:00
Lennart Poettering 2d52f8c46c
Merge pull request #17124 from bluca/copypasta
dissect-image: use correct path variable when reading verity signatures, do not refuse verity GPT without /usr partition
2020-09-23 09:43:39 +02:00
Lennart Poettering 3cbf74652b
Merge pull request #17127 from poettering/errno-fixup
make more use of errno-util.h macros
2020-09-23 09:43:18 +02:00
Zbigniew Jędrzejewski-Szmek a5d815bb7f
Merge pull request #16938 from poettering/homed-rtc-wrong
homed: don't refuse logins when RTC is wrong
2020-09-22 20:51:39 +02:00
Zbigniew Jędrzejewski-Szmek 2b2919a5ff
Merge pull request #17109 from fbuihuu/udev-opts-tweaks
Udev opts tweaks
2020-09-22 18:54:48 +02:00