1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-01 08:58:29 +03:00

integritysetup: also validate volume name

Exactly like for veritysetup/cryptsetup
This commit is contained in:
Lennart Poettering 2022-03-31 11:22:07 +02:00
parent 752d859442
commit e2bc5194af

View File

@ -124,6 +124,9 @@ static int run(int argc, char *argv[]) {
key_file = mangle_none(argc > 4 ? argv[4] : NULL);
options = mangle_none(argc > 5 ? argv[5] : NULL);
if (!filename_is_valid(volume))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Volume name '%s' is not valid.", volume);
if (key_file) {
r = load_key_file(key_file, &key_buf, &key_buf_size);
if (r < 0)
@ -174,6 +177,9 @@ static int run(int argc, char *argv[]) {
if (argc > 3)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "detach has a maximum of two arguments.");
if (!filename_is_valid(volume))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Volume name '%s' is not valid.", volume);
r = crypt_init_by_name(&cd, volume);
if (r == -ENODEV) {
log_info("Volume %s already inactive.", volume);