machined: validate machine names at more places
When enumerating machines from /run, and when accepting machine names for operations, be more strict and always validate. Note that these checks are strictly speaking unnecessary, since enumeration happens only on the trusted /run...
This commit is contained in:
@@ -4913,6 +4913,9 @@ int container_get_leader(const char *machine, pid_t *pid) {
|
||||
assert(machine);
|
||||
assert(pid);
|
||||
|
||||
if (!machine_name_is_valid(machine))
|
||||
return -EINVAL;
|
||||
|
||||
p = strjoina("/run/systemd/machines/", machine);
|
||||
r = parse_env_file(p, NEWLINE, "LEADER", &s, "CLASS", &class, NULL);
|
||||
if (r == -ENOENT)
|
||||
|
||||
Reference in New Issue
Block a user