mirror of
https://github.com/systemd/systemd.git
synced 2025-01-26 14:04:03 +03:00
mount-util: use EXTRACT_KEEP_QUOTE to handle mount options
Otherwise, the quotes which wrap SELinux options are dropped.
This commit is contained in:
parent
25086b4c17
commit
9b23679e53
@ -679,7 +679,7 @@ int mount_option_mangle(
|
||||
_cleanup_free_ char *word = NULL;
|
||||
const struct libmnt_optmap *ent;
|
||||
|
||||
r = extract_first_word(&p, &word, ",", EXTRACT_UNQUOTE);
|
||||
r = extract_first_word(&p, &word, ",", EXTRACT_KEEP_QUOTE);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
|
@ -69,6 +69,11 @@ static void test_mount_option_mangle(void) {
|
||||
opts = mfree(opts);
|
||||
|
||||
assert_se(mount_option_mangle("rw,relatime,fmask=0022,dmask=0022,\"hogehoge", MS_RDONLY, &f, &opts) < 0);
|
||||
|
||||
assert_se(mount_option_mangle("mode=1777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=\"system_u:object_r:svirt_sandbox_file_t:s0:c0,c1\"", 0, &f, &opts) == 0);
|
||||
assert_se(f == 0);
|
||||
assert_se(streq(opts, "mode=1777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=\"system_u:object_r:svirt_sandbox_file_t:s0:c0,c1\""));
|
||||
opts = mfree(opts);
|
||||
}
|
||||
|
||||
static void test_bind_remount_recursive(void) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user