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:
Lennart Poettering
2015-08-24 22:46:45 +02:00
parent 25300b5a1f
commit b9a8d25081
3 changed files with 7 additions and 1 deletions
+3
View File
@@ -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)