diff options
Diffstat (limited to 'src/resolve/resolved-bus.c')
-rw-r--r-- | src/resolve/resolved-bus.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c index bfb060d86b..6bd2b53b0e 100644 --- a/src/resolve/resolved-bus.c +++ b/src/resolve/resolved-bus.c @@ -275,7 +275,8 @@ static int bus_method_resolve_hostname(sd_bus *bus, sd_bus_message *message, voi if (!IN_SET(family, AF_INET, AF_INET6, AF_UNSPEC)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown address family %i", family); - if (!hostname_is_valid(hostname)) + r = dns_name_normalize(hostname, NULL); + if (r < 0) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid hostname '%s'", hostname); question = dns_question_new(family == AF_UNSPEC ? 2 : 1); @@ -566,6 +567,10 @@ static int bus_method_resolve_record(sd_bus *bus, sd_bus_message *message, void if (r < 0) return r; + r = dns_name_normalize(name, NULL); + if (r < 0) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid name '%s'", name); + question = dns_question_new(1); if (!question) return -ENOMEM; |