From be9975404a963d1fd2172ca83ade1cc3c58efc2e Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 30 May 2008 18:30:00 +0000 Subject: [PATCH] configd-212.2.tar.gz --- Plugins/ATconfig/Info.plist | 4 +- Plugins/IPMonitor/Info.plist | 4 +- Plugins/InterfaceNamer/Info.plist | 4 +- Plugins/KernelEventMonitor/Info.plist | 4 +- Plugins/Kicker/Info.plist | 4 +- Plugins/LinkConfiguration/Info.plist | 4 +- Plugins/NetworkIdentification/Info.plist | 4 +- Plugins/PreferencesMonitor/Info.plist | 4 +- SCMonitor/Info.plist | 4 +- SCMonitor/monitor.c | 118 ++++++++++++- SystemConfiguration.fproj/Info.plist | 6 +- SystemConfiguration.fproj/SCDHostName.c | 167 ++++++++++++++++-- .../SCNetworkReachability.c | 164 +++++++++++++---- SystemConfiguration.fproj/SCPrivate.h | 57 +++++- configd.tproj/_configclose.c | 8 +- configd.tproj/_configopen.c | 31 +--- configd.tproj/configd_server.c | 16 +- configd.tproj/notify_server.c | 6 +- configd.tproj/session.c | 48 ++++- configd.tproj/session.h | 5 +- configd.xcodeproj/project.pbxproj | 22 +-- scutil.tproj/prefs.c | 5 +- 22 files changed, 550 insertions(+), 139 deletions(-) diff --git a/Plugins/ATconfig/Info.plist b/Plugins/ATconfig/Info.plist index 93463cf..83b7060 100644 --- a/Plugins/ATconfig/Info.plist +++ b/Plugins/ATconfig/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 Builtin Requires diff --git a/Plugins/IPMonitor/Info.plist b/Plugins/IPMonitor/Info.plist index 34dd24f..71a500e 100644 --- a/Plugins/IPMonitor/Info.plist +++ b/Plugins/IPMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 Requires com.apple.SystemConfiguration.IPConfiguration diff --git a/Plugins/InterfaceNamer/Info.plist b/Plugins/InterfaceNamer/Info.plist index db1a7b0..baee3f1 100644 --- a/Plugins/InterfaceNamer/Info.plist +++ b/Plugins/InterfaceNamer/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 Builtin diff --git a/Plugins/KernelEventMonitor/Info.plist b/Plugins/KernelEventMonitor/Info.plist index fa16b15..79c5601 100644 --- a/Plugins/KernelEventMonitor/Info.plist +++ b/Plugins/KernelEventMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 Requires com.apple.SystemConfiguration.InterfaceNamer diff --git a/Plugins/Kicker/Info.plist b/Plugins/Kicker/Info.plist index 5102cde..adc989c 100644 --- a/Plugins/Kicker/Info.plist +++ b/Plugins/Kicker/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 Requires com.apple.SystemConfiguration.ATconfig diff --git a/Plugins/LinkConfiguration/Info.plist b/Plugins/LinkConfiguration/Info.plist index 34a5eff..da65bbe 100644 --- a/Plugins/LinkConfiguration/Info.plist +++ b/Plugins/LinkConfiguration/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 Requires com.apple.SystemConfiguration.InterfaceNamer diff --git a/Plugins/NetworkIdentification/Info.plist b/Plugins/NetworkIdentification/Info.plist index b7a9070..1651cef 100644 --- a/Plugins/NetworkIdentification/Info.plist +++ b/Plugins/NetworkIdentification/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 Builtin diff --git a/Plugins/PreferencesMonitor/Info.plist b/Plugins/PreferencesMonitor/Info.plist index 0061104..80aa625 100644 --- a/Plugins/PreferencesMonitor/Info.plist +++ b/Plugins/PreferencesMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 Builtin Requires diff --git a/SCMonitor/Info.plist b/SCMonitor/Info.plist index 85bea89..3ecba74 100644 --- a/SCMonitor/Info.plist +++ b/SCMonitor/Info.plist @@ -17,9 +17,9 @@ CFBundleSignature ???? CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleVersion - 1.9.1 + 1.9.2 CFPlugInDynamicRegistration NO CFPlugInFactories diff --git a/SCMonitor/monitor.c b/SCMonitor/monitor.c index 6ff25d6..0afa500 100644 --- a/SCMonitor/monitor.c +++ b/SCMonitor/monitor.c @@ -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, diff --git a/SystemConfiguration.fproj/Info.plist b/SystemConfiguration.fproj/Info.plist index 7df7a6f..fb43f61 100644 --- a/SystemConfiguration.fproj/Info.plist +++ b/SystemConfiguration.fproj/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable SystemConfiguration CFBundleGetInfoString - 1.9.1 + 1.9.2 CFBundleIdentifier com.apple.SystemConfiguration CFBundleInfoDictionaryVersion @@ -17,10 +17,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 1.9.1 + 1.9.2 diff --git a/SystemConfiguration.fproj/SCDHostName.c b/SystemConfiguration.fproj/SCDHostName.c index 3a96c62..112b432 100644 --- a/SystemConfiguration.fproj/SCDHostName.c +++ b/SystemConfiguration.fproj/SCDHostName.c @@ -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@ * @@ -42,6 +42,61 @@ #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)) { diff --git a/SystemConfiguration.fproj/SCNetworkReachability.c b/SystemConfiguration.fproj/SCNetworkReachability.c index 98a9f1e..532c671 100644 --- a/SystemConfiguration.fproj/SCNetworkReachability.c +++ b/SystemConfiguration.fproj/SCNetworkReachability.c @@ -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(" {name = %s, target = %p}"), - targetPrivate->name ? targetPrivate->name : "?", + CFSTR(" {%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; diff --git a/SystemConfiguration.fproj/SCPrivate.h b/SystemConfiguration.fproj/SCPrivate.h index 74a8156..0741194 100644 --- a/SystemConfiguration.fproj/SCPrivate.h +++ b/SystemConfiguration.fproj/SCPrivate.h @@ -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 */ diff --git a/configd.tproj/_configclose.c b/configd.tproj/_configclose.c index 40db4e8..1e0942b 100644 --- a/configd.tproj/_configclose.c +++ b/configd.tproj/_configclose.c @@ -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. */ diff --git a/configd.tproj/_configopen.c b/configd.tproj/_configopen.c index 91b3065..1d40698 100644 --- a/configd.tproj/_configopen.c +++ b/configd.tproj/_configopen.c @@ -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. diff --git a/configd.tproj/configd_server.c b/configd.tproj/configd_server.c index cdaf655..ef9fb13 100644 --- a/configd.tproj/configd_server.c +++ b/configd.tproj/configd_server.c @@ -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; } diff --git a/configd.tproj/notify_server.c b/configd.tproj/notify_server.c index 1d490d8..f4aea4b 100644 --- a/configd.tproj/notify_server.c +++ b/configd.tproj/notify_server.c @@ -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; diff --git a/configd.tproj/session.c b/configd.tproj/session.c index 866ede4..968f392 100644 --- a/configd.tproj/session.c +++ b/configd.tproj/session.c @@ -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. */ diff --git a/configd.tproj/session.h b/configd.tproj/session.h index eb56010..bf25de1 100644 --- a/configd.tproj/session.h +++ b/configd.tproj/session.h @@ -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); diff --git a/configd.xcodeproj/project.pbxproj b/configd.xcodeproj/project.pbxproj index 59f21e4..c994655 100644 --- a/configd.xcodeproj/project.pbxproj +++ b/configd.xcodeproj/project.pbxproj @@ -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 */; }; @@ -336,7 +337,7 @@ isa = PBXContainerItemProxy; containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; proxyType = 1; - remoteGlobalIDString = 151F5D990CCE98E50093AC3B /* SCMonitor */; + remoteGlobalIDString = 151F5D990CCE98E50093AC3B; remoteInfo = SCMonitor; }; 1520A385084681350010B584 /* PBXContainerItemProxy */ = { @@ -821,6 +822,7 @@ 15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */, 15E517680CCFBCD0008FFE82 /* SystemConfiguration.framework in Frameworks */, 15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */, + 150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2888,7 +2890,7 @@ 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"; @@ -2909,7 +2911,7 @@ 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"; @@ -2929,7 +2931,7 @@ 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; @@ -2949,7 +2951,7 @@ 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; @@ -2981,7 +2983,7 @@ 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; @@ -3012,7 +3014,7 @@ 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; @@ -4018,7 +4020,7 @@ 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"; @@ -4039,7 +4041,7 @@ 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"; @@ -4060,7 +4062,7 @@ 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"; diff --git a/scutil.tproj/prefs.c b/scutil.tproj/prefs.c index 855de89..7137e0c 100644 --- a/scutil.tproj/prefs.c +++ b/scutil.tproj/prefs.c @@ -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); } -- 2.45.2