]> git.saurik.com Git - apple/configd.git/commitdiff
configd-212.2.tar.gz mac-os-x-1053 mac-os-x-1054 mac-os-x-1055 mac-os-x-1056 mac-os-x-1057 mac-os-x-1058 v212.2
authorApple <opensource@apple.com>
Fri, 30 May 2008 18:30:00 +0000 (18:30 +0000)
committerApple <opensource@apple.com>
Fri, 30 May 2008 18:30:00 +0000 (18:30 +0000)
22 files changed:
Plugins/ATconfig/Info.plist
Plugins/IPMonitor/Info.plist
Plugins/InterfaceNamer/Info.plist
Plugins/KernelEventMonitor/Info.plist
Plugins/Kicker/Info.plist
Plugins/LinkConfiguration/Info.plist
Plugins/NetworkIdentification/Info.plist
Plugins/PreferencesMonitor/Info.plist
SCMonitor/Info.plist
SCMonitor/monitor.c
SystemConfiguration.fproj/Info.plist
SystemConfiguration.fproj/SCDHostName.c
SystemConfiguration.fproj/SCNetworkReachability.c
SystemConfiguration.fproj/SCPrivate.h
configd.tproj/_configclose.c
configd.tproj/_configopen.c
configd.tproj/configd_server.c
configd.tproj/notify_server.c
configd.tproj/session.c
configd.tproj/session.h
configd.xcodeproj/project.pbxproj
scutil.tproj/prefs.c

index 93463cfbbf1e0dba4f72e27254a1feda6d49b0d7..83b7060858117703fd76caff281e0319edc3857d 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>Builtin</key>
        <true/>
        <key>Requires</key>
index 34dd24f68e64eee20b890c7ed0390dd85469b762..71a500e4c6029f71cb2cc60985bda2889ef7bfc0 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.IPConfiguration</string>
index db1a7b05c77089b7a61fe786c521d67341773f83..baee3f180192b19d4d0f2e9135797c5119e4695a 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>Builtin</key>
        <true/>
 </dict>
index fa16b156faaa8d429d0c2b091ebdd0c990ceb894..79c5601b506da2a1a6ec5aba36c4a19b8b490815 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
index 5102cde24d46a5a517eca152820280309e6d55e7..adc989c8d5b90a121cbdb14ba985e2ecd73ff5e4 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.ATconfig</string>
index 34a5eff2dbccfa6157ac5fc64ac32bc3c1c6ad7a..da65bbefa62fb8253b5b34bb26e3792aa593f76a 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
index b7a9070ef6b2a462630ccc96f5d1cdb0e9296a62..1651cefa91cc183b7a4e41f53019615ce736371e 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>Builtin</key>
        <true/>
 </dict>
index 0061104e4f6b79056644e8da3df4d090749f8318..80aa6254dea28c77f95f5588fd15a0e12dd36b7f 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>Builtin</key>
        <true/>
        <key>Requires</key>
index 85bea89eeb6bec1122c780a3cbc7eba8340142a8..3ecba743e508b375367c8aff89783ad4bb5893db 100644 (file)
@@ -17,9 +17,9 @@
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFPlugInDynamicRegistration</key>
        <string>NO</string>
        <key>CFPlugInFactories</key>
index 6ff25d623aaa8db9a1f17b7f4eee3ad7e4823887..0afa500b85f5c64f0ba2a7193bb9c7bebd7820c1 100644 (file)
@@ -48,6 +48,8 @@ typedef struct {
        CFUUIDRef                       _factoryID;
        UInt32                          _refCount;
 
+       Boolean                         no_user_intervention;
+
        CFRunLoopSourceRef              monitorRls;
 
        CFMutableSetRef                 knownInterfaces;
@@ -174,6 +176,7 @@ notify_reply(CFUserNotificationRef userNotification, CFOptionFlags response_flag
        return;
 }
 
+
 static void
 notify_add(MyType *myInstance)
 {
@@ -302,6 +305,99 @@ notify_add(MyType *myInstance)
 }
 
 
+static void
+notify_configure(MyType *myInstance)
+{
+       AuthorizationRef        authorization   = NULL;
+       CFIndex                 i;
+       CFIndex                 n;
+       Boolean                 ok;
+       SCPreferencesRef        prefs           = NULL;
+       SCNetworkSetRef         set             = NULL;
+
+       if (geteuid() == 0) {
+               prefs = SCPreferencesCreate(NULL, CFSTR("SCMonitor"), NULL);
+       } else {
+               AuthorizationFlags      flags           = kAuthorizationFlagDefaults;
+               OSStatus                status;
+
+               status = AuthorizationCreate(NULL,
+                                            kAuthorizationEmptyEnvironment,
+                                            flags,
+                                            &authorization);
+               if (status != errAuthorizationSuccess) {
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("AuthorizationCreate() failed: status = %d\n"),
+                             status);
+                       return;
+               }
+
+               prefs = SCPreferencesCreateWithAuthorization(NULL, CFSTR("SCMonitor"), NULL, authorization);
+       }
+
+       set = SCNetworkSetCopyCurrent(prefs);
+       if (set == NULL) {
+               set = SCNetworkSetCreate(prefs);
+               if (set == NULL) {
+                       goto done;
+               }
+       }
+
+       n = CFArrayGetCount(myInstance->userInterfaces);
+       for (i = 0; i < n; i++) {
+               SCNetworkInterfaceRef   interface;
+               
+               interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, i);
+               ok = SCNetworkSetEstablishDefaultInterfaceConfiguration(set, interface);
+               if (ok) {
+                       CFStringRef     name;
+
+                       name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+                       SCLog(TRUE, LOG_NOTICE, CFSTR("add service for %@"), name);
+               }
+       }
+       
+       ok = SCPreferencesCommitChanges(prefs);
+       if (!ok) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCPreferencesCommitChanges() failed: %s\n"),
+                     SCErrorString(SCError()));
+                goto done;
+        }
+               
+        ok = SCPreferencesApplyChanges(prefs);
+       if (!ok) {
+                SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCPreferencesApplyChanges() failed: %s\n"),
+                     SCErrorString(SCError()));
+                goto done;
+        }
+
+    done :
+       
+       if (set != NULL) {
+               CFRelease(set);
+               set = NULL;
+       }
+
+       if (prefs != NULL) {
+               CFRelease(prefs);
+               prefs = NULL;
+       }
+       
+        if (authorization != NULL) {
+                AuthorizationFree(authorization, kAuthorizationFlagDefaults);
+               //              AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
+                authorization = NULL;
+        }
+       
+       CFRelease(myInstance->userInterfaces);
+       myInstance->userInterfaces = NULL;
+       
+       return;
+}
+
+
 static void
 updateInterfaceList(SCDynamicStoreRef store, CFArrayRef changes, void * arg)
 {
@@ -400,9 +496,14 @@ updateInterfaceList(SCDynamicStoreRef store, CFArrayRef changes, void * arg)
 
     done :
 
-       // post notification
        if (myInstance->userInterfaces != NULL) {
-               notify_add(myInstance);
+               if (myInstance->no_user_intervention) {
+                       // add network services for new interfaces
+                       notify_configure(myInstance);
+               } else {
+                       // post notification
+                       notify_add(myInstance);
+               }
        }
 
        if (set != NULL) CFRelease(set);
@@ -432,12 +533,25 @@ watcher_remove(MyType *myInstance)
 static void
 watcher_add(MyType *myInstance)
 {
+       CFBundleRef             bundle;
        SCDynamicStoreContext   context = { 0, (void *)myInstance, NULL, NULL, NULL };
        CFDictionaryRef         dict;
        CFStringRef             key;
        CFArrayRef              keys;
        SCDynamicStoreRef       store;
 
+       bundle = CFBundleGetBundleWithIdentifier(MY_BUNDLE_ID);
+       if (bundle != NULL) {
+               CFDictionaryRef info;
+               CFBooleanRef    user_intervention;
+               
+               info = CFBundleGetInfoDictionary(bundle);
+               user_intervention = CFDictionaryGetValue(info, CFSTR("User Intervention"));
+               if (isA_CFBoolean(user_intervention)) {
+                       myInstance->no_user_intervention = !CFBooleanGetValue(user_intervention);
+               }
+       }
+
        store = SCDynamicStoreCreate(NULL, CFSTR("SCMonitor"), updateInterfaceList, &context);
        if (store == NULL) {
                SCLog(TRUE, LOG_ERR,
index 7df7a6fb431d1f799b13bbb3b5965f2550ae31ee..fb43f610c2a1c68a905e8a59e5a4f3eb291bca01 100644 (file)
@@ -7,7 +7,7 @@
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.1</string>
+       <string>1.9.2</string>
 </dict>
 </plist>
index 3a96c629b82fc51351aefef7993f3d84f2e24674..112b43267ad77dc646b01be07ffd5ef133dcb574 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #pragma mark ComputerName
 
 
+static CFStringRef
+_SCPreferencesCopyComputerName(SCPreferencesRef        prefs,
+                              CFStringEncoding *nameEncoding)
+{
+       CFDictionaryRef dict;
+       CFStringRef     name            = NULL;
+       CFStringRef     path;
+       Boolean         tempPrefs       = FALSE;
+
+       if (prefs == NULL) {
+               prefs = SCPreferencesCreate(NULL, CFSTR("_SCPreferencesCopyComputerName"), NULL);
+               if (prefs == NULL) {
+                       return NULL;
+               }
+               tempPrefs = TRUE;
+       }
+
+       path = CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("/%@/%@"),
+                                       kSCPrefSystem,
+                                       kSCCompSystem);
+       dict = SCPreferencesPathGetValue(prefs, path);
+       CFRelease(path);
+
+       if (dict != NULL) {
+               if (isA_CFDictionary(dict)) {
+                       name = CFDictionaryGetValue(dict, kSCPropSystemComputerName);
+                       name = isA_CFString(name);
+                       if (name != NULL) {
+                               CFRetain(name);
+                       }
+               }
+
+               if (nameEncoding != NULL) {
+                       CFNumberRef     num;
+
+                       num = CFDictionaryGetValue(dict,
+                                                  kSCPropSystemComputerNameEncoding);
+                       if (isA_CFNumber(num)) {
+                               CFNumberGetValue(num, kCFNumberIntType, nameEncoding);
+                       } else {
+                               *nameEncoding = CFStringGetSystemEncoding();
+                       }
+               }
+       }
+
+       if (tempPrefs)  CFRelease(prefs);
+       if (name == NULL) {
+               _SCErrorSet(kSCStatusNoKey);
+       }
+       return name;
+}
+
+
 CFStringRef
 SCDynamicStoreKeyCreateComputerName(CFAllocatorRef allocator)
 {
@@ -76,6 +131,13 @@ SCDynamicStoreCopyComputerName(SCDynamicStoreRef    store,
        dict = SCDynamicStoreCopyValue(store, key);
        CFRelease(key);
        if (dict == NULL) {
+               /*
+                * Let's try looking in the preferences.plist file until
+                * (a) we add an API to retrieve the name regardless of
+                *     where it is stored and
+                * (b) this API is deprecated
+                */
+               name = _SCPreferencesCopyComputerName(NULL, nameEncoding);
                goto done;
        }
        if (!isA_CFDictionary(dict)) {
@@ -121,9 +183,18 @@ SCPreferencesSetComputerName(SCPreferencesRef      prefs,
        Boolean                 ok;
        CFStringRef             path;
 
-       if (!isA_CFString(name)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+       if (name != NULL) {
+               CFIndex len;
+
+               if (!isA_CFString(name)) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+               }
+
+               len = CFStringGetLength(name);
+               if (len == 0) {
+                       name = NULL;
+               }
        }
 
        path = CFStringCreateWithFormat(NULL,
@@ -142,26 +213,36 @@ SCPreferencesSetComputerName(SCPreferencesRef     prefs,
                                                    &kCFTypeDictionaryValueCallBacks);
        }
 
-       CFDictionarySetValue(newDict, kSCPropSystemComputerName, name);
+       if ((name != NULL) && (CFStringGetLength(name) > 0)) {
+               CFDictionarySetValue(newDict, kSCPropSystemComputerName, name);
 
-       num = CFNumberCreate(NULL, kCFNumberSInt32Type, &encoding);
-       CFDictionarySetValue(newDict, kSCPropSystemComputerNameEncoding, num);
-       CFRelease(num);
+               num = CFNumberCreate(NULL, kCFNumberSInt32Type, &encoding);
+               CFDictionarySetValue(newDict, kSCPropSystemComputerNameEncoding, num);
+               CFRelease(num);
 
-       CFDictionaryRemoveValue(newDict, kSCPropSystemComputerNameRegion);
-       if (encoding == kCFStringEncodingMacRoman) {
-               UInt32  userEncoding    = 0;
-               UInt32  userRegion      = 0;
+               CFDictionaryRemoveValue(newDict, kSCPropSystemComputerNameRegion);
+               if (encoding == kCFStringEncodingMacRoman) {
+                       UInt32  userEncoding    = 0;
+                       UInt32  userRegion      = 0;
 
-               __CFStringGetUserDefaultEncoding(&userEncoding, &userRegion);
-               if ((userEncoding == kCFStringEncodingMacRoman) && (userRegion != 0)) {
-                       num = CFNumberCreate(NULL, kCFNumberSInt32Type, &userRegion);
-                       CFDictionarySetValue(newDict, kSCPropSystemComputerNameRegion, num);
-                       CFRelease(num);
+                       __CFStringGetUserDefaultEncoding(&userEncoding, &userRegion);
+                       if ((userEncoding == kCFStringEncodingMacRoman) && (userRegion != 0)) {
+                               num = CFNumberCreate(NULL, kCFNumberSInt32Type, &userRegion);
+                               CFDictionarySetValue(newDict, kSCPropSystemComputerNameRegion, num);
+                               CFRelease(num);
+                       }
                }
+       } else {
+               CFDictionaryRemoveValue(newDict, kSCPropSystemComputerName);
+               CFDictionaryRemoveValue(newDict, kSCPropSystemComputerNameEncoding);
+               CFDictionaryRemoveValue(newDict, kSCPropSystemComputerNameRegion);
        }
 
-       ok = SCPreferencesPathSetValue(prefs, path, newDict);
+       if (CFDictionaryGetCount(newDict) > 0) {
+               ok = SCPreferencesPathSetValue(prefs, path, newDict);
+       } else {
+               ok = SCPreferencesPathRemoveValue(prefs, path);
+       }
 
        CFRelease(path);
        CFRelease(newDict);
@@ -266,6 +347,49 @@ SCPreferencesSetHostName(SCPreferencesRef  prefs,
 #pragma mark LocalHostName
 
 
+static CFStringRef
+_SCPreferencesCopyLocalHostName(SCPreferencesRef       prefs)
+{
+       CFDictionaryRef dict;
+       CFStringRef     name            = NULL;
+       CFStringRef     path;
+       Boolean         tempPrefs       = FALSE;
+
+       if (prefs == NULL) {
+               prefs = SCPreferencesCreate(NULL, CFSTR("_SCPreferencesCopyLocalHostName"), NULL);
+               if (prefs == NULL) {
+                       return NULL;
+               }
+               tempPrefs = TRUE;
+       }
+
+       path = CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("/%@/%@/%@"),
+                                       kSCPrefSystem,
+                                       kSCCompNetwork,
+                                       kSCCompHostNames);
+       dict = SCPreferencesPathGetValue(prefs, path);
+       CFRelease(path);
+
+       if (dict != NULL) {
+               if (isA_CFDictionary(dict)) {
+                       name = CFDictionaryGetValue(dict, kSCPropNetLocalHostName);
+                       name = isA_CFString(name);
+                       if (name != NULL) {
+                               CFRetain(name);
+                       }
+               }
+       }
+
+       if (tempPrefs)  CFRelease(prefs);
+       if (name == NULL) {
+               _SCErrorSet(kSCStatusNoKey);
+       }
+       return name;
+}
+
+
 CFStringRef
 SCDynamicStoreKeyCreateHostNames(CFAllocatorRef allocator)
 {
@@ -300,6 +424,13 @@ SCDynamicStoreCopyLocalHostName(SCDynamicStoreRef store)
        dict = SCDynamicStoreCopyValue(store, key);
        CFRelease(key);
        if (dict == NULL) {
+               /*
+                * Let's try looking in the preferences.plist file until
+                * (a) we add an API to retrieve the name regardless of
+                *     where it is stored and
+                * (b) this API is deprecated
+                */
+               name = _SCPreferencesCopyLocalHostName(NULL);
                goto done;
        }
        if (!isA_CFDictionary(dict)) {
index 98a9f1e4955467b0529a95bd6b48201f38c82ca2..532c671b2e7b332863f0e7d4ebc3c9feadccb8bc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -94,6 +94,8 @@ typedef struct {
 
        /* target host name */
        const char                      *name;
+       const char                      *serv;
+       struct addrinfo                 hints;
        CFArrayRef                      resolvedAddress;        /* CFArray[CFData] */
        int                             resolvedAddressError;
 
@@ -971,7 +973,14 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
                        break;
                }
                case reachabilityTypeName : {
-                       CFStringAppendFormat(result, NULL, CFSTR("name = %s"), targetPrivate->name);
+                       if ((targetPrivate->name != NULL)) {
+                               CFStringAppendFormat(result, NULL, CFSTR("name = %s"), targetPrivate->name);
+                       }
+                       if ((targetPrivate->serv != NULL)) {
+                               CFStringAppendFormat(result, NULL, CFSTR("%sserv = %s"),
+                                                    targetPrivate->name != NULL ? ", " : "",
+                                                    targetPrivate->serv);
+                       }
                        if ((targetPrivate->resolvedAddress != NULL) || (targetPrivate->resolvedAddressError != NETDB_SUCCESS)) {
                                if (targetPrivate->resolvedAddress != NULL) {
                                        if (isA_CFArray(targetPrivate->resolvedAddress)) {
@@ -1030,6 +1039,9 @@ __SCNetworkReachabilityDeallocate(CFTypeRef cf)
        if (targetPrivate->name != NULL)
                CFAllocatorDeallocate(NULL, (void *)targetPrivate->name);
 
+       if (targetPrivate->serv != NULL)
+               CFAllocatorDeallocate(NULL, (void *)targetPrivate->serv);
+
        if (targetPrivate->resolvedAddress != NULL)
                CFRelease(targetPrivate->resolvedAddress);
 
@@ -1077,6 +1089,12 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef      allocator)
        pthread_mutex_init(&targetPrivate->lock, NULL);
 
        targetPrivate->name                             = NULL;
+       targetPrivate->serv                             = NULL;
+       bzero(&targetPrivate->hints, sizeof(targetPrivate->hints));
+       targetPrivate->hints.ai_flags = AI_ADDRCONFIG;
+#ifdef AI_PARALLEL
+       targetPrivate->hints.ai_flags |= AI_PARALLEL;
+#endif /* AI_PARALLEL */
 
        targetPrivate->resolvedAddress                  = NULL;
        targetPrivate->resolvedAddressError             = NETDB_SUCCESS;
@@ -1239,6 +1257,74 @@ SCNetworkReachabilityCreateWithName(CFAllocatorRef       allocator,
 }
 
 
+SCNetworkReachabilityRef
+SCNetworkReachabilityCreateWithOptions(CFAllocatorRef  allocator,
+                                      CFDictionaryRef  options)
+{
+       CFDataRef                       data;
+       struct addrinfo                 *hints  = NULL;
+       CFStringRef                     nodename;
+       CFStringRef                     servname;
+       SCNetworkReachabilityPrivateRef targetPrivate;
+
+       if (!isA_CFDictionary(options)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       nodename = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionNodeName);
+       if ((nodename != NULL) &&
+           (!isA_CFString(nodename) || (CFStringGetLength(nodename) == 0))) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+       servname = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionServName);
+       if ((servname != NULL) &&
+           (!isA_CFString(servname) || (CFStringGetLength(servname) == 0))) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+       data = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionHints);
+       if (data != NULL) {
+               if (!isA_CFData(data) || (CFDataGetLength(data) != sizeof(targetPrivate->hints))) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+
+               hints = (struct addrinfo *)CFDataGetBytePtr(data);
+               if ((hints->ai_addrlen   != 0)    ||
+                   (hints->ai_addr      != NULL) ||
+                   (hints->ai_canonname != NULL) ||
+                   (hints->ai_next      != NULL)) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+       }
+       if ((nodename == NULL) && (servname == NULL)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       targetPrivate = __SCNetworkReachabilityCreatePrivate(allocator);
+       if (targetPrivate == NULL) {
+               return NULL;
+       }
+       targetPrivate->type = reachabilityTypeName;
+       targetPrivate->flags |= kSCNetworkFlagsFirstResolvePending;
+       if (nodename != NULL) {
+               targetPrivate->name = _SC_cfstring_to_cstring(nodename, NULL, 0, kCFStringEncodingUTF8);
+       }
+       if (servname != NULL) {
+               targetPrivate->serv = _SC_cfstring_to_cstring(servname, NULL, 0, kCFStringEncodingUTF8);
+       }
+       if (hints != NULL) {
+               bcopy(hints, &targetPrivate->hints, sizeof(targetPrivate->hints));
+       }
+
+       return (SCNetworkReachabilityRef)targetPrivate;
+}
+
+
 CFTypeID
 SCNetworkReachabilityGetTypeID(void)
 {
@@ -1268,7 +1354,7 @@ SCNetworkReachabilityCopyResolvedAddress(SCNetworkReachabilityRef target,
        }
 
        if ((targetPrivate->resolvedAddress != NULL) || (targetPrivate->resolvedAddressError != NETDB_SUCCESS)) {
-               if (targetPrivate->resolvedAddress != NULL) {
+               if (isA_CFArray(targetPrivate->resolvedAddress)) {
                        return CFRetain(targetPrivate->resolvedAddress);
                } else {
                        /* if status is known but no resolved addresses to return */
@@ -1630,10 +1716,11 @@ dns_configuration_unwatch()
 
 
 Boolean
-_SC_checkResolverReachability(SCDynamicStoreRef                *storeP,
-                             SCNetworkConnectionFlags  *flags,
-                             Boolean                   *haveDNS,
-                             const char *              nodename)
+_SC_checkResolverReachability(SCDynamicStoreRef                        *storeP,
+                             SCNetworkConnectionFlags          *flags,
+                             Boolean                           *haveDNS,
+                             const char *                      nodename,
+                             const char *                      servname)
 {
        dns_resolver_t          *default_resolver;
        dns_configuration_t     *dns;
@@ -1655,10 +1742,12 @@ _SC_checkResolverReachability(SCDynamicStoreRef         *storeP,
        *flags   = kSCNetworkFlagsReachable;
        *haveDNS = FALSE;
 
-       len = strlen(fqdn);
+       len = (nodename != NULL) ? strlen(nodename) : 0;
        if (len == 0) {
-               // if no nodename, return not reachable
-               *flags = 0;
+               if ((servname == NULL) || (strlen(servname) == 0)) {
+                       // if no nodename or servname, return not reachable
+                       *flags = 0;
+               }
                return ok;
        }
 
@@ -1853,7 +1942,7 @@ _SC_checkResolverReachabilityByAddress(SCDynamicStoreRef  *storeP,
                        goto done;
        }
 
-       ok = _SC_checkResolverReachability(storeP, flags, haveDNS, ptr_name);
+       ok = _SC_checkResolverReachability(storeP, flags, haveDNS, ptr_name, NULL);
 
     done :
 
@@ -1869,8 +1958,12 @@ replyMPCopyDescription(const void *info)
 
        return CFStringCreateWithFormat(NULL,
                                        NULL,
-                                       CFSTR("<getaddrinfo_async_start reply MP> {name = %s, target = %p}"),
-                                       targetPrivate->name ? targetPrivate->name : "?",
+                                       CFSTR("<getaddrinfo_async_start reply MP> {%s%s%s%s%s, target = %p}"),
+                                       targetPrivate->name != NULL ? "name = " : "",
+                                       targetPrivate->name != NULL ? targetPrivate->name : "",
+                                       targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
+                                       targetPrivate->serv != NULL ? "serv = " : "",
+                                       targetPrivate->serv != NULL ? targetPrivate->serv : "",
                                        target);
 }
 
@@ -1884,7 +1977,6 @@ startAsyncDNSQuery(SCNetworkReachabilityRef target) {
                                                          , replyMPCopyDescription
                                                          };
        int                             error;
-       struct addrinfo                 hints;
        CFIndex                         i;
        CFIndex                         n;
        mach_port_t                     port;
@@ -1892,16 +1984,10 @@ startAsyncDNSQuery(SCNetworkReachabilityRef target) {
 
        (void) gettimeofday(&targetPrivate->dnsQueryStart, NULL);
 
-       bzero(&hints, sizeof(hints));
-       hints.ai_flags = AI_ADDRCONFIG;
-#ifdef AI_PARALLEL
-       hints.ai_flags |= AI_PARALLEL;
-#endif /* AI_PARALLEL */
-
        error = getaddrinfo_async_start(&port,
                                        targetPrivate->name,
-                                       NULL,
-                                       &hints,
+                                       targetPrivate->serv,
+                                       &targetPrivate->hints,
                                        __SCNetworkReachabilityCallbackSetResolvedAddress,
                                        (void *)target);
        if (error != 0) {
@@ -1999,7 +2085,6 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                case reachabilityTypeName : {
                        struct timeval                  dnsQueryStart;
                        int                             error;
-                       struct addrinfo                 hints;
                        SCNetworkConnectionFlags        ns_flags;
                        struct addrinfo                 *res;
 
@@ -2013,7 +2098,8 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                        ok = _SC_checkResolverReachability(storeP,
                                                           &ns_flags,
                                                           &targetPrivate->haveDNS,
-                                                          targetPrivate->name);
+                                                          targetPrivate->name,
+                                                          targetPrivate->serv);
                        if (!ok) {
                                /* if we could not get DNS server info */
                                goto error;
@@ -2059,7 +2145,13 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef                *storeP,
                                        break;
                                }
 
-                               SCLog(_sc_debug, LOG_INFO, CFSTR("start DNS query for \"%s\""), targetPrivate->name);
+                               SCLog(_sc_debug, LOG_INFO,
+                                     CFSTR("start DNS query for %s%s%s%s%s"),
+                                     targetPrivate->name != NULL ? "name = " : "",
+                                     targetPrivate->name != NULL ? targetPrivate->name : "",
+                                     targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
+                                     targetPrivate->serv != NULL ? "serv = " : "",
+                                     targetPrivate->serv != NULL ? targetPrivate->serv : "");
 
                                /*
                                 * initiate an async DNS query
@@ -2073,7 +2165,13 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef                *storeP,
                                break;
                        }
 
-                       SCLog(_sc_debug, LOG_INFO, CFSTR("check DNS for \"%s\""), targetPrivate->name);
+                       SCLog(_sc_debug, LOG_INFO,
+                             CFSTR("check DNS for %s%s%s%s%s"),
+                             targetPrivate->name != NULL ? "name = " : "",
+                             targetPrivate->name != NULL ? targetPrivate->name : "",
+                             targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
+                             targetPrivate->serv != NULL ? "serv = " : "",
+                             targetPrivate->serv != NULL ? targetPrivate->serv : "");
 
                        /*
                         * OK, all of the DNS name servers are available.  Let's
@@ -2083,13 +2181,10 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef               *storeP,
                                (void) gettimeofday(&dnsQueryStart, NULL);
                        }
 
-                       bzero(&hints, sizeof(hints));
-                       hints.ai_flags = AI_ADDRCONFIG;
-#ifdef AI_PARALLEL
-                       hints.ai_flags |= AI_PARALLEL;
-#endif /* AI_PARALLEL */
-
-                       error = getaddrinfo(targetPrivate->name, NULL, &hints, &res);
+                       error = getaddrinfo(targetPrivate->name,
+                                           targetPrivate->serv,
+                                           &targetPrivate->hints,
+                                           &res);
 
                        __log_query_time(((error == 0) && (res != NULL)),// if successful query
                                         FALSE,                         // sync
@@ -2357,7 +2452,8 @@ __SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef        store,
                                ok = _SC_checkResolverReachability(&store,
                                                                   &ns_flags,
                                                                   &targetPrivate->haveDNS,
-                                                                  targetPrivate->name);
+                                                                  targetPrivate->name,
+                                                                  targetPrivate->serv);
                                if (!ok || (rankReachability(ns_flags) < 2)) {
                                        /* if DNS servers are not reachable */
                                        dnsChanged = TRUE;
index 74a815671d53be9b70c11a551f3b3b8260161157..0741194a7e88069674ec204e322f386aa8850930 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -62,6 +62,42 @@ extern Boolean       _sc_debug;      /* TRUE if debugging enabled */
 extern Boolean _sc_verbose;    /* TRUE if verbose logging enabled */
 extern Boolean _sc_log;        /* TRUE if SCLog() output goes to syslog */
 
+/*!
+       @group SCNetworkReachabilityCreateWithOptions #defines
+       @discussion The following defines the keys and values that can
+               be passed to the SCNetworkReachabilityCreateWithOptions
+               API.
+ */
+
+/*!
+       @constant kSCNetworkReachabilityOptionNodeName
+       @discussion A CFString that will be passed to getaddrinfo(3).  An acceptable
+               value is either a valid host name or a numeric host address string
+               consisting of a dotted decimal IPv4 address or an IPv6 address.
+ */
+#define kSCNetworkReachabilityOptionNodeName   CFSTR("nodename")
+
+/*!
+       @constant kSCNetworkReachabilityOptionServName
+       @discussion A CFString that will be passed to getaddrinfo(3).  An acceptable
+               value is either a decimal port number or a service name listed in
+               services(5).
+ */
+#define kSCNetworkReachabilityOptionServName   CFSTR("servname")
+
+/*!
+       @constant kSCNetworkReachabilityOptionHints
+       @discussion A CFData wrapping a "struct addrinfo" that will be passed to
+               getaddrinfo(3).  The caller can supply any of the ai_family,
+               ai_socktype, ai_protocol, and ai_flags structure elements.  All
+               other elements must be 0 or the null pointer.
+ */
+#define kSCNetworkReachabilityOptionHints      CFSTR("hints")
+
+/*!
+       @group
+ */
+
 __BEGIN_DECLS
 
 /*!
@@ -266,6 +302,25 @@ void               SCTrace                         (Boolean                condition,
                                                 CFStringRef            formatString,
                                                 ...);
 
+/*!
+       @function SCNetworkReachabilityCreateWithOptions
+       @discussion Creates a reference to a specified network host.  The
+               options allow the caller to specify the node name and/or
+               the service name.  This reference can be used later to
+               monitor the reachability of the target host.
+       @param allocator The CFAllocator that should be used to allocate
+               memory for the SCNetworkReachability object.
+               This parameter may be NULL in which case the current
+               default CFAllocator is used. If this reference is not
+               a valid CFAllocator, the behavior is undefined.
+       @param options A CFDictionary containing options specifying the
+               network host.  The options reflect the arguments that would
+               be passed to getaddrinfo().
+  */
+SCNetworkReachabilityRef
+SCNetworkReachabilityCreateWithOptions         (CFAllocatorRef         allocator,
+                                                CFDictionaryRef        options);
+
 /*
  * DOS encoding/codepage
  */
index 40db4e8cffbf1bd369652dd080bd4ea73eba1df0..1e0942b5120a4678facdc6571cc2f0a77d8b56ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -213,6 +213,12 @@ _configclose(mach_port_t server, int *sc_status)
                return KERN_SUCCESS;
        }
 
+       /*
+        * Remove send and receive right
+        */
+       mach_port_mod_refs(mach_task_self(), mySession->key, MACH_PORT_RIGHT_SEND   , -1);
+       mach_port_mod_refs(mach_task_self(), mySession->key, MACH_PORT_RIGHT_RECEIVE, -1);
+
        /*
         * Remove the session entry.
         */
index 91b3065089bf63d4446332d51b6e93bd4b1f889a..1d40698a6385cb3c762d51894e4595626cdd73af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -97,18 +97,10 @@ _configopen(mach_port_t                     server,
            int                         *sc_status,
            audit_token_t               audit_token)
 {
-       CFMachPortContext               context         = { 0
-                                                         , (void *)1
-                                                         , NULL
-                                                         , NULL
-                                                         , openMPCopyDescription
-                                                         };
        CFDictionaryRef                 info;
-       CFMachPortRef                   mp;
        serverSessionRef                mySession;
        CFStringRef                     name            = NULL; /* name (un-serialized) */
        CFMutableDictionaryRef          newInfo;
-       serverSessionRef                newSession;
        mach_port_t                     oldNotify;
        CFDictionaryRef                 options         = NULL; /* options (un-serialized) */
        CFStringRef                     sessionKey;
@@ -158,7 +150,7 @@ _configopen(mach_port_t                     server,
        }
 
        mySession = getSession(server);
-       if (mySession->store != NULL) {
+       if ((mySession != NULL) && (mySession->store != NULL)) {
 #ifdef DEBUG
                SCLog(TRUE, LOG_DEBUG, CFSTR("_configopen(): session is already open."));
 #endif /* DEBUG */
@@ -166,23 +158,18 @@ _configopen(mach_port_t                   server,
                goto done;
        }
 
-       /* Create the server port for this session */
-       mp = CFMachPortCreate(NULL, configdCallback, &context, NULL);
-
-       /* return the newly allocated port to be used for this session */
-       *newServer = CFMachPortGetPort(mp);
-
        /*
         * establish the new session
         */
-       newSession = addSession(mp);
+       mySession = addSession(MACH_PORT_NULL, openMPCopyDescription);
+       *newServer = mySession->key;
 
        /*
         * get the credentials associated with the caller.
         */
        audit_token_to_au32(audit_token,
                            NULL,                       // auidp
-                           &newSession->callerEUID,    // euid
+                           &mySession->callerEUID,     // euid
                            NULL,                       // egid
                            NULL,                       // ruid
                            NULL,                       // rgid
@@ -191,9 +178,9 @@ _configopen(mach_port_t                     server,
                            NULL);                      // tid
 
        /* Create and add a run loop source for the port */
-       newSession->serverRunLoopSource = CFMachPortCreateRunLoopSource(NULL, mp, 0);
+       mySession->serverRunLoopSource = CFMachPortCreateRunLoopSource(NULL, mySession->serverPort, 0);
        CFRunLoopAddSource(CFRunLoopGetCurrent(),
-                          newSession->serverRunLoopSource,
+                          mySession->serverRunLoopSource,
                           kCFRunLoopDefaultMode);
 
        if (_configd_trace) {
@@ -203,8 +190,8 @@ _configopen(mach_port_t                     server,
                        name);
        }
 
-       *sc_status = __SCDynamicStoreOpen(&newSession->store, name);
-       storePrivate = (SCDynamicStorePrivateRef)newSession->store;
+       *sc_status = __SCDynamicStoreOpen(&mySession->store, name);
+       storePrivate = (SCDynamicStorePrivateRef)mySession->store;
 
        /*
         * Make the server port accessible to the framework routines.
index cdaf65535029c96bf3ef0a3c3811902cfe85e958..ef9fb13912ee42f032e7a7fd5bec7ad7d7b33fcd 100644 (file)
@@ -256,13 +256,7 @@ void
 server_init(mach_port_t                restart_service_port,
            Boolean             enableRestart)
 {
-       CFMachPortContext       context         = { 0
-                                                 , (void *)1
-                                                 , NULL
-                                                 , NULL
-                                                 , serverMPCopyDescription
-                                                 };
-
+       serverSessionRef        mySession;
        CFRunLoopSourceRef      rls;
        char                    *service_name;
        mach_port_t             service_port    = restart_service_port;
@@ -355,8 +349,9 @@ server_init(mach_port_t             restart_service_port,
        /* ... and make sure that the global "bootstrap_port" is also unpriviledged */
        bootstrap_port = unpriv_bootstrap_port;
 
-       /* Create the primary / new connection port */
-       configd_port = CFMachPortCreateWithPort(NULL, service_port, configdCallback, &context, NULL);
+       /* Create the primary / new connection port and backing session */
+       mySession = addSession(service_port, serverMPCopyDescription);
+       configd_port = mySession->serverPort;
 
        /*
         * Create and add a run loop source for the port and add this source
@@ -370,9 +365,6 @@ server_init(mach_port_t             restart_service_port,
        CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, CFSTR("locked"));
        CFRelease(rls);
 
-       /* Create a session for the primary / new connection port */
-       (void) addSession(configd_port);
-
        return;
 }
 
index 1d490d81da512cc70e532488f9e475f4ac0d8a2f..f4aea4b9128dfeef4fc386bd4ae4204bfec6273d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -57,10 +57,6 @@ notify_server(mach_msg_header_t *request, mach_msg_header_t *reply)
                              Request->not_header.msgh_local_port);
                        cleanupSession(Request->not_header.msgh_local_port);
 
-                       (void) mach_port_mod_refs(mach_task_self(),
-                                                Request->not_header.msgh_local_port,
-                                                MACH_PORT_RIGHT_RECEIVE, -1);
-
                        Reply->Head.msgh_bits           = 0;
                        Reply->Head.msgh_remote_port    = MACH_PORT_NULL;
                        Reply->RetCode                  = KERN_SUCCESS;
index 866ede4795101c6ff9725d659fb84057b4dd4786..968f39292d1e5cd75991eee3554577ac4f04da5d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -72,10 +72,10 @@ getSession(mach_port_t server)
 
 __private_extern__
 serverSessionRef
-addSession(CFMachPortRef server)
+addSession(mach_port_t server, CFStringRef (*copyDescription)(const void *info))
 {
-       int     i;
-       int     n = -1;
+       CFMachPortContext       context = { 0, NULL, NULL, NULL, NULL };
+       int                     n = -1;
 
        if (nSessions <= 0) {
                /* new session (actually, the first) found */
@@ -83,10 +83,13 @@ addSession(CFMachPortRef server)
                n = 0;
                nSessions = 1;
        } else {
+               int     i;
+
                for (i = 0; i < nSessions; i++) {
                        if (sessions[i] == NULL) {
                                /* found an empty slot, use it */
                                n = i;
+                               break;
                        }
                }
                /* new session identified */
@@ -99,10 +102,30 @@ addSession(CFMachPortRef server)
 
        // allocate a new session for this server
        sessions[n] = malloc(sizeof(serverSession));
-       sessions[n]->key                 = CFMachPortGetPort(server);
-       sessions[n]->serverPort          = server;
-       sessions[n]->serverRunLoopSource = NULL;
-       sessions[n]->store               = NULL;
+       bzero(sessions[n], sizeof(serverSession));
+
+       // create server port
+       context.info            = sessions[n];
+       context.copyDescription = copyDescription;
+
+       if (server == MACH_PORT_NULL) {
+               // SCDynamicStore client ports 
+               (void) mach_port_allocate(mach_task_self(),
+                                         MACH_PORT_RIGHT_RECEIVE,
+                                         &server);
+               (void) mach_port_insert_right(mach_task_self(),
+                                             server,
+                                             server,
+                                             MACH_MSG_TYPE_MAKE_SEND);
+       }
+       sessions[n]->key                 = server;
+       sessions[n]->serverPort          = CFMachPortCreateWithPort(NULL,
+                                                                   server,
+                                                                   configdCallback,
+                                                                   &context,
+                                                                   NULL);
+//     sessions[n]->serverRunLoopSource = NULL;
+//     sessions[n]->store               = NULL;
        sessions[n]->callerEUID          = 1;           /* not "root" */
 
        return sessions[n];
@@ -184,6 +207,15 @@ cleanupSession(mach_port_t server)
                         */
                        (void) __SCDynamicStoreClose(&thisSession->store, TRUE);
 
+                       /*
+                        * Our send right has already been removed. Remove our
+                        * receive right.
+                        */
+                       mach_port_mod_refs(mach_task_self(),
+                                          thisSession->key,
+                                          MACH_PORT_RIGHT_RECEIVE,
+                                          -1);
+                       
                        /*
                         * Lastly, remove the session entry.
                         */
index eb560102bb58f06b1fe3dbe9a844c7ffd3f44f64..bf25de1d5a998f028bc6de7ed2ddf7aad1b7d752 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2005-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -58,7 +58,8 @@ __BEGIN_DECLS
 
 serverSessionRef       getSession      (mach_port_t    server);
 
-serverSessionRef       addSession      (CFMachPortRef  server);
+serverSessionRef       addSession      (mach_port_t    server,
+                                        CFStringRef    (*copyDescription)(const void *info));
 
 void                   removeSession   (mach_port_t    server);
 
index 59f21e4f601041cf94e4a9753855868dde8a95a6..c994655c6327785c99c72f947210022fe18c6872 100644 (file)
@@ -79,6 +79,7 @@
                1508E39F07552B6A0062B350 /* atconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C707528B36004F8947 /* atconfig.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                1508E3A007552B6B0062B350 /* cfManager.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C507528B36004F8947 /* cfManager.c */; };
                1508E3A107552B720062B350 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
+               150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
                1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
                1520A3D0084682A30010B584 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
                1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
-                       remoteGlobalIDString = 151F5D990CCE98E50093AC3B /* SCMonitor */;
+                       remoteGlobalIDString = 151F5D990CCE98E50093AC3B;
                        remoteInfo = SCMonitor;
                };
                1520A385084681350010B584 /* PBXContainerItemProxy */ = {
                                15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */,
                                15E517680CCFBCD0008FFE82 /* SystemConfiguration.framework in Frameworks */,
                                15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */,
+                               150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                                DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 210;
+                               DYLIB_CURRENT_VERSION = 212.2;
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALLHDRS_COPY_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                                DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 210;
+                               DYLIB_CURRENT_VERSION = 212.2;
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALLHDRS_COPY_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 210;
+                               DYLIB_CURRENT_VERSION = 212.2;
                                INSTALLHDRS_COPY_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                                DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 210;
+                               DYLIB_CURRENT_VERSION = 212.2;
                                FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                                DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 210;
+                               DYLIB_CURRENT_VERSION = 212.2;
                                FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 210;
+                               DYLIB_CURRENT_VERSION = 212.2;
                                FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
                156EB63F0905594A00EEF749 /* Development */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CURRENT_PROJECT_VERSION = 210;
+                               CURRENT_PROJECT_VERSION = 212.2;
                                DEAD_CODE_STRIPPING = YES;
                                INSTALL_GROUP = wheel;
                                INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
                156EB6400905594A00EEF749 /* Deployment */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CURRENT_PROJECT_VERSION = 210;
+                               CURRENT_PROJECT_VERSION = 212.2;
                                DEAD_CODE_STRIPPING = YES;
                                INSTALL_GROUP = wheel;
                                INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
                156EB6410905594A00EEF749 /* Default */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CURRENT_PROJECT_VERSION = 210;
+                               CURRENT_PROJECT_VERSION = 212.2;
                                DEAD_CODE_STRIPPING = YES;
                                INSTALL_GROUP = wheel;
                                INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
index 855de89c39d45b780c74c7b4babd4d4f27d3d5e1..7137e0c121ec8ee31e9b56bf11b5b53188b5c9f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -427,13 +427,12 @@ get_LocalHostName(int argc, char **argv)
                                        SCErrorString(SCError()));
                                break;
                }
-               _prefs_close();
                exit (1);
        }
 
        SCPrint(TRUE, stdout, CFSTR("%@\n"), hostname);
        CFRelease(hostname);
-       _prefs_close();
+
        exit(0);
 }