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);
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;