From b9a8d250810d4803bc9bf6b36932b528cb991d1e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 23 Aug 2015 14:33:50 +0200 Subject: 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... --- src/machine/machined.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/machine') diff --git a/src/machine/machined.c b/src/machine/machined.c index 109bab76c5..9b9a334838 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -118,6 +118,9 @@ int manager_enumerate_machines(Manager *m) { if (startswith(de->d_name, "unit:")) continue; + if (!machine_name_is_valid(de->d_name)) + continue; + k = manager_add_machine(m, de->d_name, &machine); if (k < 0) { log_error_errno(k, "Failed to add machine by file name %s: %m", de->d_name); -- cgit v1.2.3-54-g00ecf