From: Apple Date: Mon, 5 Aug 2013 16:44:54 +0000 (+0000) Subject: mDNSResponder-379.38.1.tar.gz X-Git-Tag: mac-os-x-1084^0 X-Git-Url: https://git.saurik.com/apple/mdnsresponder.git/commitdiff_plain/d18b4be11d1f6d3f272126c6b435ef6da1babe24?ds=inline mDNSResponder-379.38.1.tar.gz --- diff --git a/Makefile b/Makefile index 37afef4..016b5ee 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ include $(MAKEFILEPATH)/pb_makefiles/platform.make -MVERS = "mDNSResponder-379.37" +MVERS = "mDNSResponder-379.38.1" DDNSWRITECONFIG = "$(DSTROOT)/Library/Application Support/Bonjour/ddnswriteconfig" VER = diff --git a/mDNSShared/dns_sd.h b/mDNSShared/dns_sd.h index 1ea13b6..cfcdff9 100644 --- a/mDNSShared/dns_sd.h +++ b/mDNSShared/dns_sd.h @@ -77,7 +77,7 @@ */ #ifndef _DNS_SD_H -#define _DNS_SD_H 3793700 +#define _DNS_SD_H 3793801 #ifdef __cplusplus extern "C" { @@ -1792,6 +1792,7 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord const void *rdata ); + /********************************************************************************************* * * NAT Port Mapping diff --git a/mDNSShared/dnssd_clientshim.c b/mDNSShared/dnssd_clientshim.c index fffeeab..0815b8d 100644 --- a/mDNSShared/dnssd_clientshim.c +++ b/mDNSShared/dnssd_clientshim.c @@ -795,4 +795,5 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord return(kDNSServiceErr_Unsupported); } + #endif // !MDNS_BUILDINGSTUBLIBRARY diff --git a/mDNSShared/dnssd_clientstub.c b/mDNSShared/dnssd_clientstub.c index fb4ae95..f5e382d 100644 --- a/mDNSShared/dnssd_clientstub.c +++ b/mDNSShared/dnssd_clientstub.c @@ -1929,6 +1929,7 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord return err; } + static void handle_port_mapping_response(DNSServiceOp *const sdr, const CallbackHeader *const cbh, const char *data, const char *const end) { union { uint32_t l; u_char b[4]; } addr; diff --git a/mDNSShared/uds_daemon.c b/mDNSShared/uds_daemon.c index 2514986..22b4159 100644 --- a/mDNSShared/uds_daemon.c +++ b/mDNSShared/uds_daemon.c @@ -2549,14 +2549,69 @@ mDNSlocal int AppendNewSearchDomain(mDNS *const m, DNSQuestion *question) #if APPLE_OSX_mDNSResponder -mDNSlocal mDNSBool DomainInSearchList(domainname *domain) +mDNSlocal mDNSBool DomainInSearchList(const domainname *domain, mDNSBool excludeLocal) { const SearchListElem *s; + int qcount, scount; + + qcount = CountLabels(domain); for (s=SearchList; s; s=s->next) - if (SameDomainName(&s->domain, domain)) return mDNStrue; + { + if (excludeLocal && SameDomainName(&s->domain, &localdomain)) + continue; + scount = CountLabels(&s->domain); + if (qcount >= scount) + { + // Note: When qcount == scount, we do a complete match of the domain + // which is expected by the callers. + const domainname *d = SkipLeadingLabels(domain, (qcount - scount)); + if (SameDomainName(&s->domain, d)) + { + return mDNStrue; + } + } + } return mDNSfalse; } +// The caller already checks that this is a dotlocal question. +mDNSlocal mDNSBool ShouldDeliverNegativeResponse(mDNS *const m, DNSQuestion *question) +{ + mDNSu16 qtype; + + // If the question matches the search domain exactly or the search domain is a + // subdomain of the question, it is most likely a valid unicast domain and hence + // don't suppress negative responses. + // + // If the user has configured ".local" as a search domain, we don't want + // to deliver a negative response for names ending in ".local" as that would + // prevent bonjour discovery. Passing mDNStrue for the last argument excludes + // ".local" search domains. + if (DomainInSearchList(&question->qname, mDNStrue)) + { + LogOperation("ShouldDeliverNegativeResponse: Question %##s (%s) in SearchList", question->qname.c, DNSTypeName(question->qtype)); + return mDNStrue; + } + + // Deliver negative response for A/AAAA if there was a positive response for AAAA/A respectively. + if (question->qtype != kDNSType_A && question->qtype != kDNSType_AAAA) + { + LogOperation("ShouldDeliverNegativeResponse: Question %##s (%s) not answering local question with negative unicast response", + question->qname.c, DNSTypeName(question->qtype)); + return mDNSfalse; + } + qtype = (question->qtype == kDNSType_A ? kDNSType_AAAA : kDNSType_A); + if (!mDNS_CheckForCacheRecord(m, question, qtype)) + { + LogOperation("ShouldDeliverNegativeResponse:Question %##s (%s) not answering local question with negative unicast response" + " (can't find positive record)", question->qname.c, DNSTypeName(question->qtype)); + return mDNSfalse; + } + LogOperation("ShouldDeliverNegativeResponse:Question %##s (%s) answering local with negative unicast response (found positive record)", + question->qname.c, DNSTypeName(question->qtype)); + return mDNStrue; +} + // Workaround for networks using Microsoft Active Directory using "local" as a private internal // top-level domain mDNSlocal mStatus SendAdditionalQuery(DNSQuestion *q, request_state *request, mStatus err) @@ -2636,7 +2691,7 @@ mDNSlocal mStatus SendAdditionalQuery(DNSQuestion *q, request_state *request, mS // "my-small-company.local" but *not* for "local", which is why the "local SOA" check would fail in that case. // We need to check against both ActiveDirectoryPrimaryDomain and SearchList. If it matches against either // of those, we don't want do the SOA check for the local - if (labels == 2 && !SameDomainName(&q->qname, &ActiveDirectoryPrimaryDomain) && !DomainInSearchList(&q->qname)) + if (labels == 2 && !SameDomainName(&q->qname, &ActiveDirectoryPrimaryDomain) && !DomainInSearchList(&q->qname, mDNSfalse)) { AssignDomainName(&q2->qname, &localdomain); q2->qtype = kDNSType_SOA; @@ -2835,23 +2890,14 @@ mDNSlocal void queryrecord_result_callback(mDNS *const m, DNSQuestion *question, { if (!answer->InterfaceID && IsLocalDomain(answer->name)) { - mDNSu16 qtype; // Sanity check: "q" will be set only if "question" is the .local unicast query. if (!q) { LogMsg("queryrecord_result_callback: ERROR!! answering multicast question with unicast cache record"); return; } - // Deliver negative response for A/AAAA if there was a positive response for AAAA/A respectively. - if (question->qtype != kDNSType_A && question->qtype != kDNSType_AAAA) - { - LogInfo("queryrecord_result_callback:Question %##s (%s) not answering local question with negative unicast response", question->qname.c, DNSTypeName(question->qtype)); - return; - } - qtype = (question->qtype == kDNSType_A ? kDNSType_AAAA : kDNSType_A); - if (!mDNS_CheckForCacheRecord(m, question, qtype)) + if (!ShouldDeliverNegativeResponse(m, question)) { - LogInfo("queryrecord_result_callback:Question %##s (%s) not answering local question with negative unicast response (can't find positive record)", question->qname.c, DNSTypeName(question->qtype)); return; } LogInfo("queryrecord_result_callback:Question %##s (%s) answering local with negative unicast response (found positive record)", question->qname.c, DNSTypeName(question->qtype));