]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolvconf: clear domains if nothing specified
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 26 Aug 2024 20:21:41 +0000 (05:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 26 Aug 2024 20:23:12 +0000 (05:23 +0900)
src/resolve/resolvconf-compat.c

index bef95c0bb64313f81314850c9505c47e1dc38639..30570ad34f20159014e01588413a89fb0a5b8a40 100644 (file)
@@ -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 */