mirror of
https://github.com/systemd/systemd
synced 2025-12-26 10:54:45 +01:00
Compare commits
11 Commits
26a63b8132
...
3b493d94ae
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b493d94ae | ||
|
|
e25a0a69be | ||
|
|
77ad674b51 | ||
|
|
0950526afd | ||
|
|
ea223d3d3e | ||
|
|
581b2c7359 | ||
|
|
263a79642b | ||
|
|
0af05e485a | ||
|
|
9309a23b95 | ||
|
|
62ca7d3b38 | ||
|
|
abf6346c5e |
@ -274,7 +274,8 @@ static int create_disk(
|
|||||||
const char *device,
|
const char *device,
|
||||||
const char *password,
|
const char *password,
|
||||||
const char *keydev,
|
const char *keydev,
|
||||||
const char *options) {
|
const char *options,
|
||||||
|
const char *source) {
|
||||||
|
|
||||||
_cleanup_free_ char *n = NULL, *d = NULL, *u = NULL, *e = NULL,
|
_cleanup_free_ char *n = NULL, *d = NULL, *u = NULL, *e = NULL,
|
||||||
*keydev_mount = NULL, *keyfile_timeout_value = NULL,
|
*keydev_mount = NULL, *keyfile_timeout_value = NULL,
|
||||||
@ -343,7 +344,7 @@ static int create_disk(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = generator_write_cryptsetup_unit_section(f, arg_crypttab);
|
r = generator_write_cryptsetup_unit_section(f, source);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -540,7 +541,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
|||||||
if (proc_cmdline_value_missing(key, value))
|
if (proc_cmdline_value_missing(key, value))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
d = get_crypto_device(startswith(value, "luks-") ? value+5 : value);
|
d = get_crypto_device(startswith(value, "luks-") ?: value);
|
||||||
if (!d)
|
if (!d)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
@ -680,7 +681,7 @@ static int add_crypttab_devices(void) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = create_disk(name, device, keyfile, keydev, (d && d->options) ? d->options : options);
|
r = create_disk(name, device, keyfile, keydev, (d && d->options) ? d->options : options, arg_crypttab);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -715,7 +716,8 @@ static int add_proc_cmdline_devices(void) {
|
|||||||
device,
|
device,
|
||||||
d->keyfile ?: arg_default_keyfile,
|
d->keyfile ?: arg_default_keyfile,
|
||||||
d->keydev,
|
d->keydev,
|
||||||
d->options ?: arg_default_options);
|
d->options ?: arg_default_options,
|
||||||
|
"/proc/cmdline");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,7 +176,7 @@ int loop_device_make(
|
|||||||
.fd = fd,
|
.fd = fd,
|
||||||
.info = {
|
.info = {
|
||||||
/* Use the specified flags, but configure the read-only flag from the open flags, and force autoclear */
|
/* Use the specified flags, but configure the read-only flag from the open flags, and force autoclear */
|
||||||
.lo_flags = (loop_flags & ~LO_FLAGS_READ_ONLY) | ((loop_flags & O_ACCMODE) == O_RDONLY ? LO_FLAGS_READ_ONLY : 0) | LO_FLAGS_AUTOCLEAR,
|
.lo_flags = (loop_flags & ~LO_FLAGS_READ_ONLY) | ((open_flags & O_ACCMODE) == O_RDONLY ? LO_FLAGS_READ_ONLY : 0) | LO_FLAGS_AUTOCLEAR,
|
||||||
.lo_offset = offset,
|
.lo_offset = offset,
|
||||||
.lo_sizelimit = size == UINT64_MAX ? 0 : size,
|
.lo_sizelimit = size == UINT64_MAX ? 0 : size,
|
||||||
},
|
},
|
||||||
@ -198,7 +198,7 @@ int loop_device_make(
|
|||||||
if (loop < 0) {
|
if (loop < 0) {
|
||||||
/* Somebody might've gotten the same number from the kernel, used the device,
|
/* Somebody might've gotten the same number from the kernel, used the device,
|
||||||
* and called LOOP_CTL_REMOVE on it. Let's retry with a new number. */
|
* and called LOOP_CTL_REMOVE on it. Let's retry with a new number. */
|
||||||
if (errno != ENOENT)
|
if (!IN_SET(errno, ENOENT, ENXIO))
|
||||||
return -errno;
|
return -errno;
|
||||||
} else {
|
} else {
|
||||||
r = loop_configure(loop, &config);
|
r = loop_configure(loop, &config);
|
||||||
|
|||||||
@ -644,8 +644,8 @@ int mount_verbose_full(
|
|||||||
log_debug("Moving mount %s → %s (%s \"%s\")...",
|
log_debug("Moving mount %s → %s (%s \"%s\")...",
|
||||||
what, where, strnull(fl), strempty(o));
|
what, where, strnull(fl), strempty(o));
|
||||||
else
|
else
|
||||||
log_debug("Mounting %s on %s (%s \"%s\")...",
|
log_debug("Mounting %s (%s) on %s (%s \"%s\")...",
|
||||||
strna(type), where, strnull(fl), strempty(o));
|
strna(what), strna(type), where, strnull(fl), strempty(o));
|
||||||
|
|
||||||
if (follow_symlink)
|
if (follow_symlink)
|
||||||
r = mount(what, where, type, f, o) < 0 ? -errno : 0;
|
r = mount(what, where, type, f, o) < 0 ? -errno : 0;
|
||||||
|
|||||||
@ -318,7 +318,7 @@ static void test_protect_sysctl(void) {
|
|||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
#if defined __NR__sysctl && __NR__sysctl >= 0
|
#if defined __NR__sysctl && __NR__sysctl >= 0
|
||||||
assert_se(syscall(__NR__sysctl, NULL) < 0);
|
assert_se(syscall(__NR__sysctl, NULL) < 0);
|
||||||
assert_se(errno == EFAULT);
|
assert_se(IN_SET(errno, EFAULT, ENOSYS));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert_se(seccomp_protect_sysctl() >= 0);
|
assert_se(seccomp_protect_sysctl() >= 0);
|
||||||
|
|||||||
@ -60,4 +60,4 @@ check_result_qemu() {
|
|||||||
return $_ret
|
return $_ret
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test "$@" 24
|
do_test "$@" 02
|
||||||
@ -76,4 +76,4 @@ test_setup_cleanup() {
|
|||||||
cleanup_initdir
|
cleanup_initdir
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test "$@" 02
|
do_test "$@" 24
|
||||||
@ -7,7 +7,7 @@ if [ $# -gt 0 ]; then
|
|||||||
else
|
else
|
||||||
args="setup run clean-again"
|
args="setup run clean-again"
|
||||||
fi
|
fi
|
||||||
args_no_clean=$(sed -r 's/(^| )clean($| )/ /g' <<<$args)
|
args_no_clean=$(sed -r 's/\bclean\b//g' <<<$args)
|
||||||
do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? )
|
do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? )
|
||||||
|
|
||||||
ninja -C "$BUILD_DIR"
|
ninja -C "$BUILD_DIR"
|
||||||
@ -26,6 +26,8 @@ if [ $do_clean = 1 ]; then
|
|||||||
for TEST in TEST-??-* ; do
|
for TEST in TEST-??-* ; do
|
||||||
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean )
|
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean )
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[ -n "$args_no_clean" ] || exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pass_blacklist() {
|
pass_blacklist() {
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=TEST-02-CRYPTSETUP
|
Description=TEST-02-UNITTESTS
|
||||||
After=multi-user.target
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=rm -f /failed /testok
|
ExecStartPre=rm -f /failed /testok
|
||||||
ExecStart=sh -x -e -c 'mountpoint /var; systemctl --state=failed --no-legend --no-pager >/failed; echo OK >/testok'
|
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=TEST-24-UNIT-TESTS
|
Description=TEST-24-CRYPTSETUP
|
||||||
|
After=multi-user.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=rm -f /failed /testok
|
ExecStartPre=rm -f /failed /testok
|
||||||
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
ExecStart=sh -x -e -c 'mountpoint /var; systemctl --state=failed --no-legend --no-pager >/failed; echo OK >/testok'
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user