chiark / gitweb /
networkd: remove "*" from domains list
authorLennart Poettering <lennart@poettering.net>
Fri, 15 Aug 2014 13:36:17 +0000 (15:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 15 Aug 2014 13:36:17 +0000 (15:36 +0200)
Also, simplify things a bit and make sure we don't forget looking at one
of the entries.

src/network/networkd-network.c

index f3b2c68..6f0d1a1 100644 (file)
@@ -362,16 +362,16 @@ int config_parse_domains(const char *unit,
                 return r;
 
         strv_uniq(*domains);
-
-        if (strv_isempty(*domains))
-                network->wildcard_domain = false;
-        else if (strv_find(*domains, "*"))
-                network->wildcard_domain = true;
+        network->wildcard_domain = !!strv_find(*domains, "*");
 
         STRV_FOREACH(domain, *domains)
-                if (is_localhost(*domain) || !hostname_is_valid(*domain))
+                if (is_localhost(*domain) || !hostname_is_valid(*domain) || streq(*domain, "*")) {
                         strv_remove(*domains, *domain);
 
+                        /* We removed one entry, make sure we don't skip the next one */
+                        domain--;
+                }
+
         return 0;
 }