diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-07-31 19:53:59 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-07-31 19:53:59 +0200 |
commit | 7b9f7afcc04e80b77a2567b0750aa2cd03c1a1cd (patch) | |
tree | c1258c8cef335152021087e5aabf9c6208c20b0b /src/resolve/resolved-bus.c | |
parent | 07bed172edc819cf85b72d5c67613511cbde5453 (diff) |
resolved: accept UTF-8 hostnames from bus clients
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; |