]> git.saurik.com Git - apple/mdnsresponder.git/commitdiff
mDNSResponder-108.2.tar.gz mac-os-x-1048x86 v108.2
authorApple <opensource@apple.com>
Wed, 28 Jun 2006 01:34:38 +0000 (01:34 +0000)
committerApple <opensource@apple.com>
Wed, 28 Jun 2006 01:34:38 +0000 (01:34 +0000)
13 files changed:
Clients/PrinterSetupWizard/PrinterSetupWizardSheet.cpp
Clients/PrinterSetupWizard/SecondPage.cpp
Clients/PrinterSetupWizard/ThirdPage.cpp
Makefile
mDNSMacOSX/SamplemDNSClient.c
mDNSMacOSX/mDNSResponder.pbproj/project.pbxproj
mDNSShared/Java/DNSSD.java
mDNSShared/Java/DNSSDException.java
mDNSShared/Java/JNISupport.c
mDNSShared/dns-sd.1
mDNSShared/uds_daemon.c
mDNSWindows/ControlPanel/SharedSecret.cpp
mDNSWindows/SystemService/Service.c

index 34db5483fad131f6d79a38178c12e3a82848067f..6c0c9f3739a7ae467fe292baa1f9b390afa7d2b4 100644 (file)
@@ -27,7 +27,7 @@ Revision 1.34  2005/10/05 17:32:51  herscher
 <rdar://problem/4141221> Use a case insensitive compare operation to check whether a printer with the same name has already been installed.
 
 Revision 1.33  2005/07/11 20:17:15  shersche
-<rdar://4124524> UI fixes associated with CUPS printer workaround fix.
+<rdar://problem/4124524> UI fixes associated with CUPS printer workaround fix.
 
 Revision 1.32  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
index 3c9cedc48b10b8429f561d9434c2ece100b2eed9..c64030d203c31289dfff0f0ff25bdf62f501c81d 100644 (file)
@@ -27,7 +27,7 @@ Revision 1.18  2005/07/20 17:44:54  shersche
 <rdar://problem/4124524> UI fixes for CUPS workaround
 
 Revision 1.17  2005/07/11 20:17:15  shersche
-<rdar://4124524> UI fixes associated with CUPS printer workaround fix.
+<rdar://problem/4124524> UI fixes associated with CUPS printer workaround fix.
 
 Revision 1.16  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
index 3c554630e70eb240c50760f68c97bf829c564486..bf16fe2cc769c183baec938f6e528e8f9bd9e1ce 100644 (file)
@@ -27,7 +27,7 @@ Revision 1.27  2005/10/05 21:41:45  herscher
 <rdar://problem/4190104> Use "application/octet-stream" to determine if CUPS shared queue supports raw
 
 Revision 1.26  2005/07/11 20:17:15  shersche
-<rdar://4124524> UI fixes associated with CUPS printer workaround fix.
+<rdar://problem/4124524> UI fixes associated with CUPS printer workaround fix.
 
 Revision 1.25  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
index b6ce9e070ea3aa2bb177687c405b20ff52e5c6ee..ce810ebcb78c7c0bedbcc788d98bdc3ac86c915c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@
 
 include /Developer/Makefiles/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-108"
+MVERS = "mDNSResponder-108.2"
 
 install:
        cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild install     OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS)
index a387269247f4d26c1a2b0bddf92db585100325a8..be6081676b43ff01e1bd8dd12868fe26186ca2dd 100644 (file)
@@ -36,6 +36,9 @@
     Change History (most recent first):
 
 $Log: SamplemDNSClient.c,v $
+Revision 1.47  2006/01/10 02:29:22  cheshire
+<rdar://problem/4403861> Cosmetic IPv6 address display problem in mDNS test tool
+
 Revision 1.46  2004/11/02 01:32:34  cheshire
 <rdar://problem/3861705> Update code so it still compiles when DNSServiceDiscovery.h is deprecated
 
@@ -217,12 +220,14 @@ static void resolve_reply(struct sockaddr *interface, struct sockaddr *address,
         else if (address->sa_family == AF_INET6)
             {
             struct sockaddr_in6 *ip6 = (struct sockaddr_in6 *)address;
-            u_int16_t *w = ip6->sin6_addr.__u6_addr.__u6_addr16;
+            u_int8_t *b = ip6->sin6_addr.__u6_addr.__u6_addr8;
             union { uint16_t s; u_char b[2]; } port = { ip6->sin6_port };
             uint16_t PortAsNumber = ((uint16_t)port.b[0]) << 8 | port.b[1];
             char ipstring[40];
             char ifname[IF_NAMESIZE + 1] = "";
-            sprintf(ipstring, "%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X", w[0], w[1], w[2], w[3], w[4], w[5], w[6], w[7]);
+            sprintf(ipstring, "%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X",
+                               b[0x0], b[0x1], b[0x2], b[0x3], b[0x4], b[0x5], b[0x6], b[0x7],
+                               b[0x8], b[0x9], b[0xA], b[0xB], b[0xC], b[0xD], b[0xE], b[0xF]);
             if (ip6->sin6_scope_id) { ifname[0] = '%';  if_indextoname(ip6->sin6_scope_id, &ifname[1]); }
             printf("%s%s:%u", ipstring, ifname, PortAsNumber);
             }
index 6c923772b58c2618587bf59fc3e081f0805f9976..1df317300a3d28bc6e33c8fb7fd7ab8d98bb2832 100644 (file)
                                JAVA_ARCHIVE_COMPRESSION = YES;
                                JAVA_ARCHIVE_TYPE = JAR;
                                JAVA_COMPILER_DEBUGGING_SYMBOLS = NO;
-                               JAVA_COMPILER_TARGET_VM_VERSION = 1.2;
+                               JAVA_COMPILER_SOURCE_VERSION = 1.4;
+                               JAVA_COMPILER_TARGET_VM_VERSION = 1.4;
                                JAVA_SOURCE_SUBDIR = .;
                                LIBRARY_STYLE = STATIC;
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                PURE_JAVA = YES;
                                REZ_EXECUTABLE = YES;
                                SECTORDER_FLAGS = "";
+                               STRIPFLAGS = "-S";
                                WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
                        };
                        comments = "Multiplatform .jar file that implements Java interface to DNS-SD";
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "if [ -d ${OBJROOT}/mDNSResponder.build/${CONFIGURATION} ]; then BUILD_DIR=${OBJROOT}/mDNSResponder.build/${CONFIGURATION}; else BUILD_DIR=${OBJROOT}/mDNSResponder.build; fi\njavah -force -classpath ${BUILD_DIR}/dns_sd.jar.build/JavaClasses/ -o ${BUILD_DIR}/dns_sd.jar.build/DNSSD.java.h com.apple.dnssd.AppleDNSSD com.apple.dnssd.AppleBrowser com.apple.dnssd.AppleResolver com.apple.dnssd.AppleRegistration com.apple.dnssd.AppleQuery com.apple.dnssd.AppleDomainEnum com.apple.dnssd.AppleService";
+                       shellScript = "if [ -d ${OBJROOT}/mDNSResponder.build/${CONFIGURATION} ]; then BUILD_DIR=${OBJROOT}/mDNSResponder.build/${CONFIGURATION}; else BUILD_DIR=${OBJROOT}/mDNSResponder.build; fi\njavah -force -J-Xbootclasspath/p:${BUILD_DIR}/dns_sd.jar.build/JavaClasses -o ${BUILD_DIR}/dns_sd.jar.build/DNSSD.java.h com.apple.dnssd.AppleDNSSD com.apple.dnssd.AppleBrowser com.apple.dnssd.AppleResolver com.apple.dnssd.AppleRegistration com.apple.dnssd.AppleQuery com.apple.dnssd.AppleDomainEnum com.apple.dnssd.AppleService";
                };
                DB2CC4560662DE4500335AB3 = {
                        fileRef = DB2CC4430662DD1100335AB3;
                                PRODUCT_NAME = libjdns_sd.jnilib;
                                REZ_EXECUTABLE = YES;
                                SECTORDER_FLAGS = "";
+                               STRIPFLAGS = "-S";
                                WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
                        };
                        comments = "Platform-specific JNI library that bridges dns_sd.jar to <dns_sd.h>.";
                                PREBINDING = NO;
                                PRODUCT_NAME = Bonjour;
                                SECTORDER_FLAGS = "";
+                               STRIPFLAGS = "-S";
                                WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
                                WRAPPER_EXTENSION = prefPane;
                        };
                                PRODUCT_NAME = ddnswriteconfig;
                                REZ_EXECUTABLE = YES;
                                SECTORDER_FLAGS = "";
+                               STRIPFLAGS = "-S";
                                WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
                        };
                        dependencies = (
index d8a7ce1aba660215aef13e99c99cb2a7ce414b4c..50d29e411e7e2722ef69255afa867780652ffe4d 100644 (file)
@@ -23,6 +23,9 @@
     Change History (most recent first):
 
 $Log: DNSSD.java,v $
+Revision 1.9  2005/10/26 01:52:24  cheshire
+<rdar://problem/4316286> Race condition in Java code (doesn't work at all on Linux)
+
 Revision 1.8  2005/07/11 01:55:21  cheshire
 <rdar://problem/4175511> Race condition in Java API
 
@@ -652,8 +655,8 @@ class       AppleService implements DNSSDService, Runnable
 
        public void                             stop() { this.HaltOperation(); }
 
-       /* Block for timeout ms (or forever if -1). Returns 1 if data present, 0 if timed out, -1 if not browsing. */
-       protected native int    BlockForData( int msTimeout);
+       /* Block until data arrives, or one second passes. Returns 1 if data present, 0 otherwise. */
+       protected native int    BlockForData();
 
        /* Call ProcessResults when data appears on socket descriptor. */
        protected native int    ProcessResults();
@@ -672,7 +675,9 @@ class       AppleService implements DNSSDService, Runnable
        {
                while ( true )
                {
-                       // We have to be very careful here. Suppose our DNS-SD operation is stopped from some other thread,
+                       // Note: We want to allow our DNS-SD operation to be stopped from other threads, so we have to
+                       // block waiting for data *outside* the synchronized section. Because we're doing this unsynchronized
+                       // we have to write some careful code. Suppose our DNS-SD operation is stopped from some other thread,
                        // and then immediately afterwards that thread (or some third, unrelated thread) starts a new DNS-SD
                        // operation. The Unix kernel always allocates the lowest available file descriptor to a new socket,
                        // so the same file descriptor is highly likely to be reused for the new operation, and if our old
@@ -691,11 +696,11 @@ class     AppleService implements DNSSDService, Runnable
                        // locking DOESN'T prevent the callback routine from stopping its own operation, but DOES prevent
                        // any other thread from stopping it until after the callback has completed and returned to us here.
 
-                       int result = BlockForData(-1);
-                       if (result != 1) break; // If socket has been closed, time to terminate this thread
+                       int result = BlockForData();
                        synchronized (this)
                        {
                                if (fNativeContext == 0) break; // Some other thread stopped our DNSSD operation; time to terminate this thread
+                               if (result == 0) continue;              // If BlockForData() said there was no data, go back and block again
                                result = ProcessResults();
                                if (fNativeContext == 0) break; // Event listener stopped its own DNSSD operation; terminate this thread
                                if (result != 0) { fListener.operationFailed(this, result); break; }    // If error, notify listener
index 595e405463ffa02a8e9f9c620c6a4e62a8275ab7..0ab05875d402b3322509d113234b52ea4494af91 100644 (file)
@@ -23,6 +23,9 @@
     Change History (most recent first):
 
 $Log: DNSSDException.java,v $
+Revision 1.3  2005/07/10 22:19:01  cheshire
+Add missing error codes to list of public static final ints
+
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
@@ -50,11 +53,23 @@ abstract public class       DNSSDException extends Exception
     public static final int            BAD_FLAGS           = -65543;
     public static final int            UNSUPPORTED         = -65544;
     public static final int            NOT_INITIALIZED     = -65545;
+    public static final int            NO_CACHE            = -65546;
     public static final int            ALREADY_REGISTERED  = -65547;
     public static final int            NAME_CONFLICT       = -65548;
     public static final int            INVALID             = -65549;
+    public static final int            FIREWALL            = -65550;
     public static final int            INCOMPATIBLE        = -65551;
     public static final int            BAD_INTERFACE_INDEX = -65552;
+    public static final int            REFUSED             = -65553;
+    public static final int            NOSUCHRECORD        = -65554;
+    public static final int            NOAUTH              = -65555;
+    public static final int            NOSUCHKEY           = -65556;
+    public static final int            NATTRAVERSAL        = -65557;
+    public static final int            DOUBLENAT           = -65558;
+    public static final int            BADTIME             = -65559;
+    public static final int            BADSIG              = -65560;
+    public static final int            BADKEY              = -65561;
+    public static final int            TRANSIENT           = -65562;
 
        /** Returns the sub-code that identifies the particular error. */
        abstract public int                     getErrorCode();
index 902e85d02cefb95eb86823cbc54e1ec1cbabd158..d7c6243eb1798fc11a9d6642610c24e48c74c985 100644 (file)
@@ -23,6 +23,9 @@
     Change History (most recent first):
 
 $Log: JNISupport.c,v $
+Revision 1.13  2005/10/26 01:52:24  cheshire
+<rdar://problem/4316286> Race condition in Java code (doesn't work at all on Linux)
+
 Revision 1.12  2005/07/13 19:20:32  cheshire
 <rdar://problem/4175511> Race condition in Java API
 Additional cleanup suggested by Roger -- NewContext() doesn't need ownerClass parameter any more
@@ -262,15 +265,13 @@ JNIEXPORT void JNICALL Java_com_apple_dnssd_AppleService_HaltOperation( JNIEnv *
 }
 
 
-JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleService_BlockForData( JNIEnv *pEnv, jobject pThis, jint msTimeout)
-/* Block for timeout ms (or forever if -1). Returns 1 if data present, 0 if timed out, -1 if not browsing. */
+JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleService_BlockForData( JNIEnv *pEnv, jobject pThis)
+/* Block until data arrives, or one second passes. Returns 1 if data present, 0 otherwise. */
 {
-#if AUTO_CALLBACKS
-       return -1;                              // BlockForData() not supported with AUTO_CALLBACKS 
-#else // AUTO_CALLBACKS
+// BlockForData() not supported with AUTO_CALLBACKS 
+#if !AUTO_CALLBACKS
        jclass                  cls = (*pEnv)->GetObjectClass( pEnv, pThis);
        jfieldID                contextField = (*pEnv)->GetFieldID( pEnv, cls, "fNativeContext", "I");
-       jint                    rc = -1;
 
        if ( contextField != 0)
        {
@@ -279,18 +280,32 @@ JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleService_BlockForData( JNIEnv *p
                {
                        fd_set                  readFDs;
                        int                             sd = DNSServiceRefSockFD( pContext->ServiceRef);
-                       struct timeval  timeout = { msTimeout / 1000, 10 * (msTimeout % 1000) };
-                       struct timeval  *pTimeout = msTimeout == -1 ? NULL : &timeout;
-                       
+                       struct timeval  timeout = { 1, 0 };
                        FD_ZERO( &readFDs);
                        FD_SET( sd, &readFDs);
 
-                       rc = select( sd + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, pTimeout);
+                       // Q: Why do we poll here?
+                       // A: Because there's no other thread-safe way to do it.
+                       // Mac OS X terminates a select() call if you close one of the sockets it's listening on, but Linux does not,
+                       // and arguably Linux is correct (See <http://www.ussg.iu.edu/hypermail/linux/kernel/0405.1/0418.html>)
+                       // The problem is that the Mac OS X behaviour assumes that it's okay for one thread to close a socket while
+                       // some other thread is monitoring that socket in select(), but the difficulty is that there's no general way
+                       // to make that thread-safe, because there's no atomic way to enter select() and release a lock simultaneously.
+                       // If we try to do this without holding any lock, then right as we jump to the select() routine,
+                       // some other thread could stop our operation (thereby closing the socket),
+                       // and then that thread (or even some third, unrelated thread)
+                       // could do some other DNS-SD operation (or some other operation that opens a new file descriptor)
+                       // and then we'd blindly resume our fall into the select() call, now blocking on a file descriptor
+                       // that may coincidentally have the same numerical value, but is semantically unrelated
+                       // to the true file descriptor we thought we were blocking on.
+                       // We can't stop this race condition from happening, but at least if we wake up once a second we can detect
+                       // when fNativeContext has gone to zero, and thereby discover that we were blocking on the wrong fd.
+
+                       if (select( sd + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &timeout) == 1) return(1);
                }
        }
-
-       return rc;
-#endif // AUTO_CALLBACKS
+#endif // !AUTO_CALLBACKS
+       return(0);
 }
 
 
index 3611200db597036fc98a6f8bfb66e019fc779bab..6089ae655a07bafec13b1b50efb9dff2618b4cc4 100644 (file)
@@ -20,6 +20,9 @@
 .\" @APPLE_LICENSE_HEADER_END@
 .\"
 .\" $Log: dns-sd.1,v $
+.\" Revision 1.5  2005/07/04 23:12:35  cheshire
+.\" <rdar://problem/4103628> The dns-sd command first appeared in Mac OS X 10.4 (Tiger)
+.\"
 .\" Revision 1.4  2005/02/16 02:29:32  cheshire
 .\" Update terminology
 .\"
@@ -211,4 +214,4 @@ bugs are tracked in Apple Radar component "mDNSResponder".
 .Sh HISTORY
 The
 .Nm
-command first appeared in Mac OS X 10.3 (Panther).
+command first appeared in Mac OS X 10.4 (Tiger).
index 406b7ab520ed7370d002c22789cbbcd0097d0937..86ea29473de870c008cfd0000a752463055c50fd 100644 (file)
@@ -546,7 +546,7 @@ Revision 1.25  2003/10/22 23:37:49  ksekar
 <rdar://problem/3459141>: crash/hang in abort_client
 
 Revision 1.24  2003/10/21 20:59:40  ksekar
-<rdar://problem/3335216>: handle blocked clients moreefficiently
+<rdar://problem/3335216>: handle blocked clients more efficiently
 
 Revision 1.23  2003/09/23 02:12:43  cheshire
 Also include port number in list of services registered via new UDS API
index 8f0260bac3675abc51d272f06a85b9c5c84c3a31..7ba6a2a63464e3f676518865944be14639cc4962 100644 (file)
@@ -128,7 +128,7 @@ CSharedSecret::Commit( CString zone )
                m_key += '.';
        }
 
-       // <rdar://problem/ >
+       // <rdar://problem/4192119>
        //
        // Prepend "$" to the key name, so that there will
        // be no conflict between the zone name and the key
index f85b176e6438a46882d767c1550bf3fe31144851..768b589ab8a06ce83c537a1b7c4cea38dfe247d2 100644 (file)
@@ -30,7 +30,7 @@ Revision 1.37  2005/10/05 18:05:28  herscher
 <rdar://problem/4192011> Save Wide-Area preferences in a different spot in the registry so they don't get removed when doing an update install.
 
 Revision 1.36  2005/09/11 22:12:42  herscher
-<rdar://4247793> Remove dependency on WMI.  Ensure that the Windows firewall is turned on before trying to configure it.
+<rdar://problem/4247793> Remove dependency on WMI.  Ensure that the Windows firewall is turned on before trying to configure it.
 
 Revision 1.35  2005/06/30 18:29:49  shersche
 <rdar://problem/4090059> Don't overwrite the localized service description text