summaryrefslogtreecommitdiff
path: root/src/import/importd.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-12-11 16:40:45 +0100
committerLennart Poettering <lennart@poettering.net>2020-12-15 17:59:48 +0100
commit52ef5dd7989d886945e18ab50de31bf5a21ba158 (patch)
treeed64c0d2c22b0ea1a1375c24ca692fdad3e4e07e /src/import/importd.c
parent9e815cf2c2d8463e58c6609edb6a33f9bb62e7b5 (diff)
downloadsystemd-52ef5dd7989d886945e18ab50de31bf5a21ba158.tar.gz
hostname-util: flagsify hostname_is_valid(), drop machine_name_is_valid()
Let's clean up hostname_is_valid() a bit: let's turn the second boolean argument into a more explanatory flags field, and add a flag that accepts the special name ".host" as valid. This is useful for the container logic, where the special hostname ".host" refers to the "root container", i.e. the host system itself, and can be specified at various places. let's also get rid of machine_name_is_valid(). It was just an alias, which is confusing and even more so now that we have the flags param.
Diffstat (limited to 'src/import/importd.c')
-rw-r--r--src/import/importd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/import/importd.c b/src/import/importd.c
index 63f80e0e38..b5cff4aca8 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -717,7 +717,7 @@ static int method_import_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_
if (!S_ISREG(st.st_mode) && !S_ISFIFO(st.st_mode))
return -EINVAL;
- if (!machine_name_is_valid(local))
+ if (!hostname_is_valid(local, 0))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
"Local name %s is invalid", local);
@@ -787,7 +787,7 @@ static int method_import_fs(sd_bus_message *msg, void *userdata, sd_bus_error *e
if (r < 0)
return r;
- if (!machine_name_is_valid(local))
+ if (!hostname_is_valid(local, 0))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
"Local name %s is invalid", local);
@@ -852,7 +852,7 @@ static int method_export_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_
if (r < 0)
return r;
- if (!machine_name_is_valid(local))
+ if (!hostname_is_valid(local, 0))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
"Local name %s is invalid", local);
@@ -932,7 +932,7 @@ static int method_pull_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_er
if (isempty(local))
local = NULL;
- else if (!machine_name_is_valid(local))
+ else if (!hostname_is_valid(local, 0))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
"Local name %s is invalid", local);