diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-08-26 22:21:41 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-08-26 22:23:12 +0200 |
commit | 189cb2b15fbc566eb3c0268459c421af6bcdadf8 (patch) | |
tree | 2769cada9b80057859129f487cf508250e526ce2 /src | |
parent | resolvectl: make enum name consistent with the option name (diff) | |
download | systemd-189cb2b15fbc566eb3c0268459c421af6bcdadf8.tar.xz systemd-189cb2b15fbc566eb3c0268459c421af6bcdadf8.zip |
resolvconf: clear domains if nothing specified
Diffstat (limited to 'src')
-rw-r--r-- | src/resolve/resolvconf-compat.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/resolve/resolvconf-compat.c b/src/resolve/resolvconf-compat.c index bef95c0bb6..30570ad34f 100644 --- a/src/resolve/resolvconf-compat.c +++ b/src/resolve/resolvconf-compat.c @@ -268,9 +268,16 @@ int resolvconf_parse_argv(int argc, char *argv[]) { } else if (type == TYPE_PRIVATE) log_debug("Private DNS server data not supported, ignoring."); - if (!arg_set_dns) + if (strv_isempty(arg_set_dns)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No DNS servers specified, refusing operation."); + + if (strv_isempty(arg_set_domain)) { + /* When no domain/search is set, clear the current domains. */ + r = strv_extend(&arg_set_domain, ""); + if (r < 0) + return log_oom(); + } } return 1; /* work to do */ |