From 189cb2b15fbc566eb3c0268459c421af6bcdadf8 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 27 Aug 2024 05:21:41 +0900 Subject: [PATCH] resolvconf: clear domains if nothing specified --- src/resolve/resolvconf-compat.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 */