From: Yu Watanabe Date: Sun, 23 Jan 2022 20:51:47 +0000 (+0900) Subject: Revert "resolve: refuse to resolve empty hostname" X-Git-Tag: v251-rc1~466^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c0601102a2fda3e8450203f7ce11c2375f65e74;p=thirdparty%2Fsystemd.git Revert "resolve: refuse to resolve empty hostname" This reverts commit 6e8ecb8974db74eba716bfd75231987172e10d83. --- diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c index 9978d35727b..48e5321d79a 100644 --- a/src/resolve/resolved-bus.c +++ b/src/resolve/resolved-bus.c @@ -433,9 +433,6 @@ static int bus_method_resolve_hostname(sd_bus_message *message, void *userdata, if (r != 0) return r; - if (dns_name_is_empty(hostname)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Empty hostname"); - r = dns_name_is_valid(hostname); if (r < 0) return r; @@ -743,9 +740,6 @@ static int bus_method_resolve_record(sd_bus_message *message, void *userdata, sd if (ifindex < 0) return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid interface index"); - if (dns_name_is_empty(name)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Empty name"); - r = dns_name_is_valid(name); if (r < 0) return r; diff --git a/src/resolve/resolved-varlink.c b/src/resolve/resolved-varlink.c index feca5f74f1f..cc684608a60 100644 --- a/src/resolve/resolved-varlink.c +++ b/src/resolve/resolved-varlink.c @@ -303,9 +303,6 @@ static int vl_method_resolve_hostname(Varlink *link, JsonVariant *parameters, Va if (p.ifindex < 0) return varlink_error_invalid_parameter(link, JSON_VARIANT_STRING_CONST("ifindex")); - if (dns_name_is_empty(p.name)) - return varlink_error_invalid_parameter(link, JSON_VARIANT_STRING_CONST("name")); - r = dns_name_is_valid(p.name); if (r < 0) return r; diff --git a/src/shared/dns-domain.h b/src/shared/dns-domain.h index 24bf00bd58b..c25fcaacc2a 100644 --- a/src/shared/dns-domain.h +++ b/src/shared/dns-domain.h @@ -60,10 +60,6 @@ static inline int dns_name_is_valid_ldh(const char *s) { return 1; } -static inline bool dns_name_is_empty(const char *s) { - return isempty(s) || streq(s, "."); -} - void dns_name_hash_func(const char *s, struct siphash *state); int dns_name_compare_func(const char *a, const char *b); extern const struct hash_ops dns_name_hash_ops;