]> git.saurik.com Git - apple/mdnsresponder.git/commitdiff
mDNSResponder-379.38.1.tar.gz mac-os-x-1084 mac-os-x-1085 v379.38.1
authorApple <opensource@apple.com>
Mon, 5 Aug 2013 16:44:54 +0000 (16:44 +0000)
committerApple <opensource@apple.com>
Mon, 5 Aug 2013 16:44:54 +0000 (16:44 +0000)
Makefile
mDNSShared/dns_sd.h
mDNSShared/dnssd_clientshim.c
mDNSShared/dnssd_clientstub.c
mDNSShared/uds_daemon.c

index 37afef4b5eda4b01a71cbcd15093f1ae432e919f..016b5eefeac5c0738a1ff27e24be2eb4bf9d85a4 100644 (file)
--- 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 = 
index 1ea13b6c4deb251e15e6d4c5b04fca6bcc467b9e..cfcdff9f01ff6615da1c6cb2206d04a03436e8ae 100644 (file)
@@ -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
index fffeeab6612c859068a8a14e0f40fcde66d11fa8..0815b8d1514358b47dc238acfb2ee276976f48de 100644 (file)
@@ -795,4 +795,5 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
     return(kDNSServiceErr_Unsupported);
 }
 
+
 #endif  // !MDNS_BUILDINGSTUBLIBRARY
index fb4ae9532e59d30bcdd2e88c4d4e07ba84ea1730..f5e382d815391816cd9e48da5fec38cd71b299fa 100644 (file)
@@ -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;
index 25149864aaf589af32108e5e9b41864d4995103d..22b4159f91897712f777b27778b843c21ca4a88e 100644 (file)
@@ -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));