diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-07-28 04:20:46 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-08-06 02:49:20 +0200 |
commit | 34ad609010244513e0c31fdde59ce1cf84d4c3f6 (patch) | |
tree | 27ae55d51d1783d69986c58c1a5e6c470ee00a86 /src | |
parent | hostname-util: add relax parameter to hostname_is_valid (diff) | |
download | systemd-34ad609010244513e0c31fdde59ce1cf84d4c3f6.tar.xz systemd-34ad609010244513e0c31fdde59ce1cf84d4c3f6.zip |
firstboot: allow a trailing dot on fqdn
Diffstat (limited to 'src')
-rw-r--r-- | src/firstboot/firstboot.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 43669d28bf..df98212da8 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -386,12 +386,13 @@ static int prompt_hostname(void) { break; } - if (!hostname_is_valid(h, false)) { + if (!hostname_is_valid(h, true)) { log_error("Specified hostname invalid."); continue; } - arg_hostname = h; + /* Get rid of the trailing dot that we allow, but don't want to see */ + arg_hostname = hostname_cleanup(h, false); h = NULL; break; } @@ -780,11 +781,12 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_HOSTNAME: - if (!hostname_is_valid(optarg, false)) { + if (!hostname_is_valid(optarg, true)) { log_error("Host name %s is not valid.", optarg); return -EINVAL; } + hostname_cleanup(optarg, false); if (free_and_strdup(&arg_hostname, optarg) < 0) return log_oom(); |