resolved: make outselves authoritative for /etc/hosts entries in full
authorLennart Poettering <lennart@poettering.net>
Tue, 5 Mar 2024 09:35:40 +0000 (10:35 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 5 Mar 2024 14:31:26 +0000 (15:31 +0100)
If you query for an MX RR of a host listed in /etc/hosts, let's return
an empty reply rather than NXDOMAIN, i.e. indicate that the name exists
but has no MX RR assigned, thus making ourselves authoritative.

The venerable "host" tool by default sends requests for A + AAAA + MX
and ensures we never propagate queries further on.

Fixes: #31223

src/resolve/resolved-etc-hosts.c

index bd129cd2ca5be28389f667855b636f71c8287643..2d334d38ddf280a52c79022b2654e5e83456acfe 100644 (file)
@@ -560,7 +560,7 @@ static int etc_hosts_lookup_by_name(
                         return r;
         }
 
-        return question_for_a || question_for_aaaa;
+        return true; /* We consider ourselves authoritative for the whole name, all RR types, not just A/AAAA */
 }
 
 int manager_etc_hosts_lookup(Manager *m, DnsQuestion *q, DnsAnswer **answer) {