From: Yu Watanabe Date: Mon, 26 Aug 2024 20:21:41 +0000 (+0900) Subject: resolvconf: clear domains if nothing specified X-Git-Tag: v257-rc1~619^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=189cb2b15fbc566eb3c0268459c421af6bcdadf8;p=thirdparty%2Fsystemd.git resolvconf: clear domains if nothing specified --- diff --git a/src/resolve/resolvconf-compat.c b/src/resolve/resolvconf-compat.c index bef95c0bb64..30570ad34f2 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 */