summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-bus.c12
-rw-r--r--src/resolve/resolved-dns-query.c9
2 files changed, 11 insertions, 10 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 4a011efc4d..50eb012f8e 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -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)
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c
index a9880524e6..dd812150cf 100644
--- a/src/resolve/resolved-dns-query.c
+++ b/src/resolve/resolved-dns-query.c
@@ -107,12 +107,9 @@ int dns_query_transaction_reply(DnsQueryTransaction *t, DnsPacket *p) {
t->packet = dns_packet_ref(p);
- if (DNS_PACKET_RCODE(p) == DNS_RCODE_SUCCESS) {
- if( be16toh(DNS_PACKET_HEADER(p)->ancount) > 0)
- dns_query_transaction_set_state(t, DNS_QUERY_SUCCESS);
- else
- dns_query_transaction_set_state(t, DNS_QUERY_INVALID_REPLY);
- } else
+ if (DNS_PACKET_RCODE(p) == DNS_RCODE_SUCCESS)
+ dns_query_transaction_set_state(t, DNS_QUERY_SUCCESS);
+ else
dns_query_transaction_set_state(t, DNS_QUERY_FAILURE);
return 0;