chiark / gitweb /
resolve: add distinct bus error code for hosts that exist but lack A or AAAA records
[elogind.git] / src / resolve / resolved-bus.c
index 4a011efc4db7669c6d4ced7285c852ac8ee40a23..50eb012f8e76b447fba0fa011adf2d300b4b98ff 100644 (file)
@@ -138,8 +138,10 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) {
                         added ++;
                 }
 
-                if (added <= 0)
-                        goto parse_fail;
+                if (added <= 0) {
+                        r = sd_bus_reply_method_errorf(q->request, BUS_ERROR_NO_SUCH_RR, "Hostname %s does not have RR of this type", q->request_hostname);
+                        break;
+                }
 
                 r = sd_bus_message_close_container(reply);
                 if (r < 0)
@@ -315,8 +317,10 @@ static void bus_method_resolve_address_complete(DnsQuery *q) {
                         added ++;
                 }
 
-                if (added <= 0)
-                        goto parse_fail;
+                if (added <= 0) {
+                        r = sd_bus_reply_method_errorf(q->request, BUS_ERROR_NO_SUCH_RR, "Address %s does not have RR of this type", ip);
+                        break;
+                }
 
                 r = sd_bus_message_close_container(reply);
                 if (r < 0)