[systemd-commits] src/journal src/libsystemd src/shared
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Oct 22 14:22:55 PDT 2014
src/journal/sd-journal.c | 2 +-
src/libsystemd/sd-bus/sd-bus.c | 6 +++---
src/shared/logs-show.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
New commits:
commit affcf189153714f0de4d0986d18e2bc1b35c1b20
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 22 23:20:59 2014 +0200
machine: validate machine names using machine_name_is_valid() instead of string_is_safe()
After all, we know have this as generic validator, so let's be correct
and use it wherver applicable.
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index daa04ac..ac57f4f 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1735,7 +1735,7 @@ _public_ int sd_journal_open_container(sd_journal **ret, const char *machine, in
assert_return(machine, -EINVAL);
assert_return(ret, -EINVAL);
assert_return((flags & ~(SD_JOURNAL_LOCAL_ONLY|SD_JOURNAL_SYSTEM)) == 0, -EINVAL);
- assert_return(filename_is_safe(machine), -EINVAL);
+ assert_return(machine_name_is_valid(machine), -EINVAL);
p = strappenda("/run/systemd/machines/", machine);
r = parse_env_file(p, NEWLINE, "ROOT", &root, "CLASS", &class, NULL);
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index f379617..e677a88 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -767,7 +767,7 @@ static int parse_container_unix_address(sd_bus *b, const char **p, char **guid)
if (!machine)
return -EINVAL;
- if (!filename_is_safe(machine))
+ if (!machine_name_is_valid(machine))
return -EINVAL;
free(b->machine);
@@ -809,7 +809,7 @@ static int parse_container_kernel_address(sd_bus *b, const char **p, char **guid
if (!machine)
return -EINVAL;
- if (!filename_is_safe(machine))
+ if (!machine_name_is_valid(machine))
return -EINVAL;
free(b->machine);
@@ -1309,7 +1309,7 @@ _public_ int sd_bus_open_system_container(sd_bus **ret, const char *machine) {
assert_return(machine, -EINVAL);
assert_return(ret, -EINVAL);
- assert_return(filename_is_safe(machine), -EINVAL);
+ assert_return(machine_name_is_valid(machine), -EINVAL);
r = sd_bus_new(&bus);
if (r < 0)
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 3d74249..04e1165 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -1155,7 +1155,7 @@ static int get_boot_id_for_machine(const char *machine, sd_id128_t *boot_id) {
assert(machine);
assert(boot_id);
- if (!filename_is_safe(machine))
+ if (!machine_name_is_valid(machine))
return -EINVAL;
r = container_get_leader(machine, &pid);
More information about the systemd-commits
mailing list