diff options
author | Tom Gundersen <teg@jklm.no> | 2016-02-04 18:05:32 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2016-02-04 18:05:32 +0100 |
commit | 6448e16d2102ecf38e25a2721f9f877638f4cb93 (patch) | |
tree | e6778b9654fd569cf2ab773412e3b270a3c6c01a /src/resolve/resolved-dns-query.c | |
parent | 145c990fc90277f3a89475db33bcca2af091458f (diff) | |
parent | 06d127543513a9d4881c4e915053901b77ec4fe0 (diff) |
Merge pull request #2524 from poettering/bag-of-stuff
Bag of stuff
Diffstat (limited to 'src/resolve/resolved-dns-query.c')
-rw-r--r-- | src/resolve/resolved-dns-query.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c index 06d30d7863..b8bdff9dfa 100644 --- a/src/resolve/resolved-dns-query.c +++ b/src/resolve/resolved-dns-query.c @@ -967,6 +967,17 @@ static int dns_query_cname_redirect(DnsQuery *q, const DnsResourceRecord *cname) if (r == 0 && k == 0) /* No actual cname happened? */ return -ELOOP; + if (q->answer_protocol == DNS_PROTOCOL_DNS) { + /* Don't permit CNAME redirects from unicast DNS to LLMNR or MulticastDNS, so that global resources + * cannot invade the local namespace. The opposite way we permit: local names may redirect to global + * ones. */ + + q->flags &= ~(SD_RESOLVED_LLMNR|SD_RESOLVED_MDNS); /* mask away the local protocols */ + } + + /* Turn off searching for the new name */ + q->flags |= SD_RESOLVED_NO_SEARCH; + dns_question_unref(q->question_idna); q->question_idna = nq_idna; nq_idna = NULL; @@ -977,10 +988,8 @@ static int dns_query_cname_redirect(DnsQuery *q, const DnsResourceRecord *cname) dns_query_free_candidates(q); dns_query_reset_answer(q); - q->state = DNS_TRANSACTION_NULL; - /* Turn off searching for the new name */ - q->flags |= SD_RESOLVED_NO_SEARCH; + q->state = DNS_TRANSACTION_NULL; return 0; } |