<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.0.1d1</string>
+ <string>1.9.1</string>
<key>Builtin</key>
<true/>
<key>Requires</key>
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.0.1d1</string>
+ <string>1.9.1</string>
<key>Requires</key>
<array>
<string>com.apple.SystemConfiguration.IPConfiguration</string>
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.0.1d1</string>
+ <string>1.9.1</string>
<key>Builtin</key>
<true/>
</dict>
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.0.1d1</string>
+ <string>1.9.1</string>
<key>Requires</key>
<array>
<string>com.apple.SystemConfiguration.InterfaceNamer</string>
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.0.1d1</string>
+ <string>1.9.1</string>
<key>Requires</key>
<array>
<string>com.apple.SystemConfiguration.ATconfig</string>
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.0.1d1</string>
+ <string>1.9.1</string>
<key>Requires</key>
<array>
<string>com.apple.SystemConfiguration.InterfaceNamer</string>
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.0.1d1</string>
+ <string>1.9.1</string>
<key>Builtin</key>
<true/>
</dict>
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.0.1d1</string>
+ <string>1.9.1</string>
<key>Builtin</key>
<true/>
<key>Requires</key>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.SystemConfiguration.${EXECUTABLE_NAME}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.9.1</string>
+ <key>CFBundleVersion</key>
+ <string>1.9.1</string>
+ <key>CFPlugInDynamicRegistration</key>
+ <string>NO</string>
+ <key>CFPlugInFactories</key>
+ <dict>
+ <key>FB86416D-6164-2070-726F-70735C216EC0</key>
+ <string>UserEventAgentFactory</string>
+ </dict>
+ <key>CFPlugInTypes</key>
+ <dict>
+ <key>FC86416D-6164-2070-726F-70735C216EC0</key>
+ <array>
+ <string>FB86416D-6164-2070-726F-70735C216EC0</string>
+ </array>
+ </dict>
+ <key>CFPlugInUnloadFunction</key>
+ <string></string>
+</dict>
+</plist>
--- /dev/null
+/*
+ * Copyright (c) 2007 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/*
+ * Modification History
+ *
+ * October 24, 2007 Allan Nathanson <ajn@apple.com>
+ * - initial revision
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCPrivate.h>
+#include <ApplicationServices/ApplicationServices.h>
+#include "UserEventAgentInterface.h"
+
+#define MY_BUNDLE_ID CFSTR("com.apple.SystemConfiguration.SCMonitor")
+#define MY_ICON_PATH "/System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns"
+
+#define NETWORK_PREF_APP "/System/Library/PreferencePanes/Network.prefPane"
+#define NETWORK_PREF_CMD "New Interface"
+
+typedef struct {
+ UserEventAgentInterfaceStruct *_UserEventAgentInterface;
+ CFUUIDRef _factoryID;
+ UInt32 _refCount;
+
+ CFRunLoopSourceRef monitorRls;
+
+ CFMutableSetRef knownInterfaces;
+
+ CFMutableArrayRef userInterfaces;
+ CFUserNotificationRef userNotification;
+ CFRunLoopSourceRef userRls;
+} MyType;
+
+static CFMutableDictionaryRef notify_to_instance = NULL;
+
+
+#pragma mark -
+#pragma mark Watch for new [network] interfaces
+
+
+static void
+open_NetworkPrefPane(void)
+{
+ AEDesc aeDesc = { typeNull, NULL };
+ CFArrayRef prefArray;
+ CFURLRef prefURL;
+ LSLaunchURLSpec prefSpec;
+ OSStatus status;
+
+ prefURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
+ CFSTR(NETWORK_PREF_APP),
+ kCFURLPOSIXPathStyle,
+ FALSE);
+ prefArray = CFArrayCreate(NULL, (const void **)&prefURL, 1, &kCFTypeArrayCallBacks);
+ CFRelease(prefURL);
+
+ status = AECreateDesc('ptru',
+ (const void *)NETWORK_PREF_CMD,
+ strlen(NETWORK_PREF_CMD),
+ &aeDesc);
+ if (status != noErr) {
+ SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: AECreateDesc() failed: %d"), status);
+ }
+
+ prefSpec.appURL = NULL;
+ prefSpec.itemURLs = prefArray;
+ prefSpec.passThruParams = &aeDesc;
+ prefSpec.launchFlags = kLSLaunchAsync | kLSLaunchDontAddToRecents;
+ prefSpec.asyncRefCon = NULL;
+
+ status = LSOpenFromURLSpec(&prefSpec, NULL);
+ if (status != noErr) {
+ SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: LSOpenFromURLSpec() failed: %d"), status);
+ }
+
+ CFRelease(prefArray);
+ if (aeDesc.descriptorType != typeNull) AEDisposeDesc(&aeDesc);
+ return;
+}
+
+
+static void
+notify_remove(MyType *myInstance, Boolean cancel)
+{
+ if (myInstance->userInterfaces != NULL) {
+ CFRelease(myInstance->userInterfaces);
+ myInstance->userInterfaces = NULL;
+ }
+
+ if (myInstance->userRls != NULL) {
+ CFRunLoopSourceInvalidate(myInstance->userRls);
+ CFRelease(myInstance->userRls);
+ myInstance->userRls = NULL;
+ }
+
+ if (myInstance->userNotification != NULL) {
+ if (cancel) {
+ SInt32 status;
+
+ status = CFUserNotificationCancel(myInstance->userNotification);
+ if (status != 0) {
+ SCLog(TRUE, LOG_ERR,
+ CFSTR("SCMonitor: CFUserNotificationCancel() failed, status=%d"),
+ status);
+ }
+ }
+ CFRelease(myInstance->userNotification);
+ myInstance->userNotification = NULL;
+ }
+
+ return;
+}
+
+
+static void
+notify_reply(CFUserNotificationRef userNotification, CFOptionFlags response_flags)
+{
+ MyType *myInstance = NULL;
+
+ // get instance for notification
+ if (notify_to_instance != NULL) {
+ myInstance = (MyType *)CFDictionaryGetValue(notify_to_instance, userNotification);
+ if (myInstance != NULL) {
+ CFDictionaryRemoveValue(notify_to_instance, userNotification);
+ if (CFDictionaryGetCount(notify_to_instance) == 0) {
+ CFRelease(notify_to_instance);
+ notify_to_instance = NULL;
+ }
+ }
+ }
+ if (myInstance == NULL) {
+ SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: can't find user notification"));
+ return;
+ }
+
+ // process response
+ switch (response_flags & 0x3) {
+ case kCFUserNotificationDefaultResponse:
+ // user asked to configure interface
+ open_NetworkPrefPane();
+ break;
+ default:
+ // user cancelled
+ break;
+ }
+
+ notify_remove(myInstance, FALSE);
+ return;
+}
+
+static void
+notify_add(MyType *myInstance)
+{
+ CFBundleRef bundle;
+ CFMutableDictionaryRef dict = NULL;
+ SInt32 error = 0;
+ CFIndex i;
+ CFMutableArrayRef message;
+ CFIndex n = CFArrayGetCount(myInstance->userInterfaces);
+ CFURLRef url = NULL;
+
+ if (myInstance->userNotification != NULL) {
+ CFMutableArrayRef save = NULL;
+
+ if (n > 0) {
+ CFRetain(myInstance->userInterfaces);
+ save = myInstance->userInterfaces;
+ }
+ notify_remove(myInstance, TRUE);
+ myInstance->userInterfaces = save;
+ if (n == 0) {
+ return;
+ }
+ }
+
+ dict = CFDictionaryCreateMutable(NULL,
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
+ // set localization URL
+ bundle = CFBundleGetBundleWithIdentifier(MY_BUNDLE_ID);
+ if (bundle != NULL) {
+ url = CFBundleCopyBundleURL(bundle);
+ }
+ if (url != NULL) {
+ // set URL
+ CFDictionarySetValue(dict, kCFUserNotificationLocalizationURLKey, url);
+ CFRelease(url);
+ } else {
+ SCLog(TRUE, LOG_NOTICE, CFSTR("SCMonitor: can't find bundle"));
+ goto done;
+ }
+
+ // set icon URL
+ url = CFURLCreateFromFileSystemRepresentation(NULL,
+ (const UInt8 *)MY_ICON_PATH,
+ strlen(MY_ICON_PATH),
+ FALSE);
+ if (url != NULL) {
+ CFDictionarySetValue(dict, kCFUserNotificationIconURLKey, url);
+ CFRelease(url);
+ }
+
+ // header
+ CFDictionarySetValue(dict,
+ kCFUserNotificationAlertHeaderKey,
+ (n == 1) ? CFSTR("HEADER_1") : CFSTR("HEADER_N"));
+
+ // message
+ message = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+ CFArrayAppendValue(message,
+ (n == 1) ? CFSTR("MESSAGE_S1") : CFSTR("MESSAGE_SN"));
+ for (i = 0; i < n; i++) {
+ SCNetworkInterfaceRef interface;
+ CFStringRef name;
+
+ interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, i);
+ name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+ if (n == 1) {
+ CFArrayAppendValue(message, name);
+ } else {
+ CFStringRef str;
+
+ str = CFStringCreateWithFormat(NULL, NULL, CFSTR("\r\t%@"), name);
+ CFArrayAppendValue(message, str);
+ CFRelease(str);
+ }
+ }
+ CFArrayAppendValue(message,
+ (n == 1) ? CFSTR("MESSAGE_E1") : CFSTR("MESSAGE_EN"));
+ CFDictionarySetValue(dict, kCFUserNotificationAlertMessageKey, message);
+ CFRelease(message);
+
+ // button titles
+ CFDictionaryAddValue(dict, kCFUserNotificationDefaultButtonTitleKey, CFSTR("OPEN_NP"));
+ CFDictionaryAddValue(dict, kCFUserNotificationAlternateButtonTitleKey, CFSTR("CANCEL"));
+
+ // create and post notification
+ myInstance->userNotification = CFUserNotificationCreate(NULL,
+ 0,
+ kCFUserNotificationNoteAlertLevel,
+ &error,
+ dict);
+ if (myInstance->userNotification == NULL) {
+ SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: CFUserNotificationCreate() failed, %d"), error);
+ goto done;
+ }
+
+ // establish callback
+ myInstance->userRls = CFUserNotificationCreateRunLoopSource(NULL,
+ myInstance->userNotification,
+ notify_reply,
+ 0);
+ if (myInstance->userRls == NULL) {
+ SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: CFUserNotificationCreateRunLoopSource() failed"));
+ CFRelease(myInstance->userNotification);
+ myInstance->userNotification = NULL;
+ goto done;
+ }
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), myInstance->userRls, kCFRunLoopDefaultMode);
+
+ // add instance for notification
+ if (notify_to_instance == NULL) {
+ notify_to_instance = CFDictionaryCreateMutable(NULL,
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ NULL); // no retain/release/... for values
+ }
+ CFDictionarySetValue(notify_to_instance, myInstance->userNotification, myInstance);
+
+ done :
+
+ if (dict != NULL) CFRelease(dict);
+ return;
+}
+
+
+static void
+updateInterfaceList(SCDynamicStoreRef store, CFArrayRef changes, void * arg)
+{
+ CFIndex i;
+ CFArrayRef interfaces;
+ MyType *myInstance = (MyType *)arg;
+ CFIndex n;
+ SCPreferencesRef prefs;
+ CFMutableSetRef previouslyKnown = NULL;
+ SCNetworkSetRef set = NULL;
+
+ prefs = SCPreferencesCreate(NULL, CFSTR("SCMonitor"), NULL);
+ if (prefs == NULL) {
+ return;
+ }
+
+ set = SCNetworkSetCopyCurrent(prefs);
+ if (set == NULL) {
+ set = SCNetworkSetCreate(prefs);
+ if (set == NULL) {
+ goto done;
+ }
+ }
+
+ previouslyKnown = CFSetCreateMutableCopy(NULL, 0, myInstance->knownInterfaces);
+
+ interfaces = SCNetworkInterfaceCopyAll();
+ if (interfaces != NULL) {
+
+ n = CFArrayGetCount(interfaces);
+ for (i = 0; i < n; i++) {
+ CFStringRef bsdName;
+ SCNetworkInterfaceRef interface;
+ Boolean ok;
+
+ interface = CFArrayGetValueAtIndex(interfaces, i);
+ bsdName = SCNetworkInterfaceGetBSDName(interface);
+ if (bsdName == NULL) {
+ // if no BSD name
+ continue;
+ }
+
+ CFSetRemoveValue(previouslyKnown, bsdName);
+
+ if (CFSetContainsValue(myInstance->knownInterfaces, bsdName)) {
+ // if known interface
+ continue;
+ }
+
+ CFSetAddValue(myInstance->knownInterfaces, bsdName);
+
+ ok = SCNetworkSetEstablishDefaultInterfaceConfiguration(set, interface);
+ if (ok) {
+ // this is a *new* interface
+ if (myInstance->userInterfaces == NULL) {
+ myInstance->userInterfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+ }
+ CFArrayAppendValue(myInstance->userInterfaces, interface);
+ }
+ }
+
+ CFRelease(interfaces);
+ }
+
+ n = CFSetGetCount(previouslyKnown);
+ if (n > 0) {
+ const void * names_q[32];
+ const void ** names = names_q;
+
+ if (n > (CFIndex)(sizeof(names_q) / sizeof(CFTypeRef)))
+ names = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0);
+ CFSetGetValues(previouslyKnown, names);
+ for (i = 0; i < n; i++) {
+ if (myInstance->userInterfaces != NULL) {
+ CFIndex j;
+
+ j = CFArrayGetCount(myInstance->userInterfaces);
+ while (--j >= 0) {
+ CFStringRef bsdName;
+ SCNetworkInterfaceRef interface;
+
+ interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, j);
+ bsdName = SCNetworkInterfaceGetBSDName(interface);
+ if (CFEqual(bsdName, names[i])) {
+ // if we have previously posted a notification
+ // for this no-longer-present interface
+ CFArrayRemoveValueAtIndex(myInstance->userInterfaces, j);
+ }
+ }
+ }
+
+ CFSetRemoveValue(myInstance->knownInterfaces, names[i]);
+ }
+ if (names != names_q) CFAllocatorDeallocate(NULL, names);
+ }
+
+ done :
+
+ // post notification
+ if (myInstance->userInterfaces != NULL) {
+ notify_add(myInstance);
+ }
+
+ if (set != NULL) CFRelease(set);
+ CFRelease(prefs);
+ return;
+}
+
+
+static void
+watcher_remove(MyType *myInstance)
+{
+ if (myInstance->monitorRls != NULL) {
+ CFRunLoopSourceInvalidate(myInstance->monitorRls);
+ CFRelease(myInstance->monitorRls);
+ myInstance->monitorRls = NULL;
+ }
+
+ if (myInstance->knownInterfaces != NULL) {
+ CFRelease(myInstance->knownInterfaces);
+ myInstance->knownInterfaces = NULL;
+ }
+
+ return;
+}
+
+
+static void
+watcher_add(MyType *myInstance)
+{
+ SCDynamicStoreContext context = { 0, (void *)myInstance, NULL, NULL, NULL };
+ CFDictionaryRef dict;
+ CFStringRef key;
+ CFArrayRef keys;
+ SCDynamicStoreRef store;
+
+ store = SCDynamicStoreCreate(NULL, CFSTR("SCMonitor"), updateInterfaceList, &context);
+ if (store == NULL) {
+ SCLog(TRUE, LOG_ERR,
+ CFSTR("SCMonitor: SCDynamicStoreCreate() failed: %s"),
+ SCErrorString(SCError()));
+ return;
+ }
+
+ key = SCDynamicStoreKeyCreateNetworkInterface(NULL, kSCDynamicStoreDomainState);
+
+ // watch for changes to the list of network interfaces
+ keys = CFArrayCreate(NULL, (const void **)&key, 1, &kCFTypeArrayCallBacks);
+ SCDynamicStoreSetNotificationKeys(store, NULL, keys);
+ CFRelease(keys);
+ myInstance->monitorRls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
+ CFRunLoopAddSource(CFRunLoopGetCurrent(),
+ myInstance->monitorRls,
+ kCFRunLoopDefaultMode);
+
+ // initialize the list of known interfaces
+ myInstance->knownInterfaces = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+ dict = SCDynamicStoreCopyValue(store, key);
+ if (dict != NULL) {
+ if (isA_CFDictionary(dict)) {
+ CFIndex i;
+ CFArrayRef interfaces;
+ CFIndex n;
+
+ interfaces = CFDictionaryGetValue(dict, kSCPropNetInterfaces);
+ n = isA_CFArray(interfaces) ? CFArrayGetCount(interfaces) : 0;
+ for (i = 0; i < n; i++) {
+ CFStringRef bsdName;
+
+ bsdName = CFArrayGetValueAtIndex(interfaces, i);
+ if (isA_CFString(bsdName)) {
+ CFSetAddValue(myInstance->knownInterfaces, bsdName);
+ }
+ }
+ }
+
+ CFRelease(dict);
+ }
+
+ CFRelease(key);
+ CFRelease(store);
+ return;
+}
+
+
+#pragma mark -
+#pragma mark UserEventAgent stubs
+
+
+static HRESULT
+myQueryInterface(void *myInstance, REFIID iid, LPVOID *ppv)
+{
+ CFUUIDRef interfaceID = CFUUIDCreateFromUUIDBytes(NULL, iid);
+
+ // Test the requested ID against the valid interfaces.
+ if (CFEqual(interfaceID, kUserEventAgentInterfaceID)) {
+ ((MyType *) myInstance)->_UserEventAgentInterface->AddRef(myInstance);
+ *ppv = myInstance;
+ CFRelease(interfaceID);
+ return S_OK;
+ }
+
+ if (CFEqual(interfaceID, IUnknownUUID)) {
+ ((MyType *) myInstance)->_UserEventAgentInterface->AddRef(myInstance);
+ *ppv = myInstance;
+ CFRelease(interfaceID);
+ return S_OK;
+ }
+
+ // Requested interface unknown, bail with error.
+ *ppv = NULL;
+ CFRelease(interfaceID);
+ return E_NOINTERFACE;
+}
+
+
+static ULONG
+myAddRef(void *myInstance)
+{
+ ((MyType *) myInstance)->_refCount++;
+ return ((MyType *) myInstance)->_refCount;
+}
+
+
+static ULONG
+myRelease(void *myInstance)
+{
+ ((MyType *) myInstance)->_refCount--;
+ if (((MyType *) myInstance)->_refCount == 0) {
+ CFUUIDRef factoryID = ((MyType *) myInstance)->_factoryID;
+
+ if (factoryID != NULL) {
+ CFPlugInRemoveInstanceForFactory(factoryID);
+ CFRelease(factoryID);
+
+ watcher_remove((MyType *)myInstance);
+ notify_remove((MyType *)myInstance, TRUE);
+ }
+ free(myInstance);
+ return 0;
+ }
+
+ return ((MyType *) myInstance)->_refCount;
+}
+
+
+static void
+myInstall(void *myInstance)
+{
+ watcher_add((MyType *)myInstance);
+ return;
+}
+
+
+static UserEventAgentInterfaceStruct UserEventAgentInterfaceFtbl = {
+ NULL, // Required padding for COM
+ myQueryInterface, // These three are the required COM functions
+ myAddRef,
+ myRelease,
+ myInstall // Interface implementation
+};
+
+
+void *
+UserEventAgentFactory(CFAllocatorRef allocator, CFUUIDRef typeID)
+{
+ MyType *newOne = NULL;
+
+ if (CFEqual(typeID, kUserEventAgentTypeID)) {
+ newOne = (MyType *)malloc(sizeof(MyType));
+ bzero(newOne, sizeof(*newOne));
+ newOne->_UserEventAgentInterface = &UserEventAgentInterfaceFtbl;
+ newOne->_factoryID = (CFUUIDRef)CFRetain(kUserEventAgentFactoryID);
+ CFPlugInAddInstanceForFactory(kUserEventAgentFactoryID);
+ newOne->_refCount = 1;
+ }
+
+ return newOne;
+}
+
+
+#ifdef MAIN
+int
+main(int argc, char **argv)
+{
+ MyType *newOne = (MyType *)malloc(sizeof(MyType));
+
+ _sc_log = FALSE;
+ _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+ bzero(newOne, sizeof(*newOne));
+ myInstall(newOne);
+ CFRunLoopRun();
+ exit(0);
+ return (0);
+}
+#endif // MAIN
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<key>CFBundleExecutable</key>
<string>SystemConfiguration</string>
<key>CFBundleGetInfoString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleIdentifier</key>
<string>com.apple.SystemConfiguration</string>
<key>CFBundleInfoDictionaryVersion</key>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.9.0</string>
+ <string>1.9.1</string>
</dict>
</plist>
// prefs
SCPreferencesRef prefs;
+ // name
+ CFStringRef name;
+
} SCNetworkServicePrivate, *SCNetworkServicePrivateRef;
Boolean
SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set);
+/*!
+ @function SCNetworkSetEstablishDefaultInterfaceConfiguration
+ @discussion Updates a network set by adding services for
+ the specified network interface if is not currently
+ represented.
+ If the provided set contains one (or more) services, new
+ services will only be added for interfaces that are not
+ represented in *any* set.
+ Otherwise, new services will be added for interfaces that
+ are not represented in the provided set.
+ The new services are established with "default" configuration
+ options.
+ @param set The network set.
+ @param interface The network interface.
+ @result TRUE if the configuration was updated; FALSE if no
+ changes were required or if an error was encountered.
+ */
+Boolean
+SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set,
+ SCNetworkInterfaceRef interface);
__END_DECLS
interfacePrivate->localized_arg2 = port_name;
}
}
+ } else if (CFEqual(provider, CFSTR("IOUSBDevice"))) {
+ CFTypeRef val;
+
+ // check if a "Product Name" has been provided
+ val = IORegistryEntrySearchCFProperty(interface,
+ kIOServicePlane,
+ CFSTR(kIOPropertyProductNameKey),
+ NULL,
+ kIORegistryIterateRecursively | kIORegistryIterateParents);
+ if (val != NULL) {
+ CFStringRef productName;
+
+ productName = IOCopyCFStringValue(val);
+ CFRelease(val);
+
+ if (productName != NULL) {
+ if (CFStringGetLength(productName) > 0) {
+ // if we have a [somewhat reasonable?] product name
+ if (interfacePrivate->name != NULL) {
+ CFRelease(interfacePrivate->name);
+ }
+ interfacePrivate->name = CFRetain(productName);
+ if (interfacePrivate->localized_name != NULL) {
+ CFRelease(interfacePrivate->localized_name);
+ }
+ interfacePrivate->localized_name = copy_interface_string(bundle, productName, TRUE);
+ }
+
+ CFRelease(productName);
+ }
+ } else {
+ interfacePrivate->localized_key = CFSTR("usb-ether");
+ interfacePrivate->localized_arg1 = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOBSDNameKey));
+ }
}
CFRelease(provider);
}
if (interfacePrivate->localized_name != NULL) {
CFRelease(interfacePrivate->localized_name);
}
- interfacePrivate->localized_name = CFRetain(productName);
+ interfacePrivate->localized_name = copy_interface_string(bundle, productName, TRUE);
// if not provided, also check if the product name
// matches a CCL script
CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkService %p [%p]> {"), cf, allocator);
CFStringAppendFormat(result, NULL, CFSTR("id = %@"), servicePrivate->serviceID);
CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), servicePrivate->prefs);
+ if (servicePrivate->name != NULL) {
+ CFStringAppendFormat(result, NULL, CFSTR(", name = %@"), servicePrivate->name);
+ }
CFStringAppendFormat(result, NULL, CFSTR("}"));
return result;
/* release resources */
CFRelease(servicePrivate->serviceID);
- if (servicePrivate->interface != NULL) CFRelease(servicePrivate->interface);
+ if (servicePrivate->interface != NULL) CFRelease(servicePrivate->interface);
CFRelease(servicePrivate->prefs);
+ if (servicePrivate->name != NULL) CFRelease(servicePrivate->name);
return;
}
servicePrivate->prefs = CFRetain(prefs);
servicePrivate->serviceID = CFStringCreateCopy(NULL, serviceID);
servicePrivate->interface = (interface != NULL) ? CFRetain(interface) : NULL;
+ servicePrivate->name = NULL;
return servicePrivate;
}
// update template for v.92 modems
if ((overrides == NULL) &&
CFDictionaryGetValueIfPresent(config,
- kSCPropNetModemConnectionScript,
+ kSCPropNetModemConnectionScript,
(const void **)&script) &&
CFEqual(script, CFSTR("v.34 Personality")) &&
_SCNetworkInterfaceIsModemV92(interface)) {
return NULL;
}
+ if (servicePrivate->name != NULL) {
+ return servicePrivate->name;
+ }
+
path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL, // allocator
servicePrivate->serviceID, // service
NULL); // entity
if (isA_CFDictionary(entity)) {
name = CFDictionaryGetValue(entity, kSCPropUserDefinedName);
- name = isA_CFString(name);
+ if (isA_CFString(name)) {
+ servicePrivate->name = CFRetain(name);
+ }
}
interface = SCNetworkServiceGetInterface(service);
}
if (interface != NULL) {
- if (name != NULL) {
- CFStringRef interface_name;
+ CFStringRef interface_name;
+ CFStringRef suffix = NULL;
+ if (servicePrivate->name != NULL) {
interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface);
- if ((interface_name != NULL) && CFEqual(name, interface_name)) {
- // if service name matches the [non-]localized
- // interface name
- name = NULL;
+ if (interface_name != NULL) {
+ if (CFEqual(name, interface_name)) {
+ // if service name matches the [non-]localized
+ // interface name
+ CFRelease(servicePrivate->name);
+ servicePrivate->name = NULL;
+ } else if (CFStringHasPrefix(name, interface_name)) {
+ CFIndex prefixLen = CFStringGetLength(interface_name);
+ CFIndex suffixLen = CFStringGetLength(name);
+
+ suffix = CFStringCreateWithSubstring(NULL,
+ name,
+ CFRangeMake(prefixLen, suffixLen - prefixLen));
+ CFRelease(servicePrivate->name);
+ servicePrivate->name = NULL;
+ }
}
}
- if (name == NULL) {
- name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+ if (servicePrivate->name == NULL) {
+ interface_name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+ if (interface_name != NULL) {
+ if (suffix != NULL) {
+ servicePrivate->name = CFStringCreateWithFormat(NULL,
+ NULL,
+ CFSTR("%@%@"),
+ interface_name,
+ suffix);
+ } else {
+ servicePrivate->name = CFRetain(interface_name);
+ }
+ }
}
+ if (suffix != NULL) CFRelease(suffix);
}
- return name;
+ return servicePrivate->name;
}
CFDictionaryRef entity;
Boolean ok = FALSE;
CFStringRef path;
+ CFStringRef saveName = NULL;
SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service;
if (!isA_SCNetworkService(service)) {
return FALSE;
}
- if ((name != NULL) && !isA_CFString(name)) {
- _SCErrorSet(kSCStatusInvalidArgument);
- return FALSE;
+ if (name != NULL) {
+ if (!isA_CFString(name)) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+ saveName = CFRetain(name);
}
if (name != NULL) {
CFStringRef interface_name;
interface_name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
- if ((interface_name != NULL) && CFEqual(name, interface_name)) {
- // if service name matches the localized interface name
- // then store the non-localized name.
- interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface);
- if (interface_name != NULL) {
- name = interface_name;
+ if (interface_name != NULL) {
+ if (CFEqual(name, interface_name)) {
+ // if service name matches the localized interface name
+ // then store the non-localized name.
+ interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface);
+ if (interface_name != NULL) {
+ CFRelease(saveName);
+ saveName = CFRetain(interface_name);
+ }
+ } else if (CFStringHasPrefix(name, interface_name)) {
+ CFIndex prefixLen = CFStringGetLength(interface_name);
+ CFStringRef suffix;
+ CFIndex suffixLen = CFStringGetLength(name);
+
+ // if service name matches the localized interface name plus
+ // a few extra characters) then store the non-localized name with
+ // the same suffix.
+ suffix = CFStringCreateWithSubstring(NULL,
+ name,
+ CFRangeMake(prefixLen, suffixLen - prefixLen));
+ interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface);
+ if (interface_name != NULL) {
+ CFRelease(saveName);
+ saveName = CFStringCreateWithFormat(NULL,
+ NULL,
+ CFSTR("%@%@"),
+ interface_name,
+ suffix);
+ }
+ CFRelease(suffix);
}
}
}
* the "name" is not unique.
*/
CFRelease(sets);
+ if (saveName != NULL) CFRelease(saveName);
_SCErrorSet(kSCStatusKeyExists);
return FALSE;
}
CFMutableDictionaryRef newEntity;
newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
- if (name != NULL) {
- CFDictionarySetValue(newEntity, kSCPropUserDefinedName, name);
+ if (saveName != NULL) {
+ CFDictionarySetValue(newEntity, kSCPropUserDefinedName, saveName);
} else {
CFDictionaryRemoveValue(newEntity, kSCPropUserDefinedName);
}
CFRelease(newEntity);
}
CFRelease(path);
+ if (saveName != NULL) CFRelease(saveName);
+
+ if (servicePrivate->name != NULL) CFRelease(servicePrivate->name);
+ if (name != NULL) CFRetain(name);
+ servicePrivate->name = name;
return ok;
}
}
if (setPrivate->name != NULL) {
- return setPrivate->name;;
+ return setPrivate->name;
}
path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
}
-Boolean
-SCNetworkSetEstablishDefaultConfiguration(SCNetworkSetRef set)
+static CFStringRef
+next_service_name(SCNetworkServiceRef service)
+{
+ CFArrayRef components;
+ CFIndex n;
+ CFStringRef name;
+ CFMutableArrayRef newComponents;
+ SInt32 suffix = 2;
+
+ name = SCNetworkServiceGetName(service);
+ if (name == NULL) {
+ return NULL;
+ }
+
+ components = CFStringCreateArrayBySeparatingStrings(NULL, name, CFSTR(" "));
+ if (components != NULL) {
+ newComponents = CFArrayCreateMutableCopy(NULL, 0, components);
+ CFRelease(components);
+ } else {
+ newComponents = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+ CFArrayAppendValue(newComponents, name);
+ }
+
+ n = CFArrayGetCount(newComponents);
+ if (n > 1) {
+ CFStringRef str;
+
+ str = CFArrayGetValueAtIndex(newComponents, n - 1);
+ suffix = CFStringGetIntValue(str);
+ if (suffix++ > 0) {
+ CFArrayRemoveValueAtIndex(newComponents, n - 1);
+ } else {
+ suffix = 2;
+ }
+ }
+
+ name = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), suffix);
+ CFArrayAppendValue(newComponents, name);
+ CFRelease(name);
+
+ name = CFStringCreateByCombiningStrings(NULL, newComponents, CFSTR(" "));
+ CFRelease(newComponents);
+
+ return name;
+}
+
+
+static Boolean
+__SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CFArrayRef interfaces)
{
CFIndex i;
- CFArrayRef interfaces;
CFIndex n;
Boolean ok = TRUE;
CFArrayRef services;
- Boolean setUpdated = FALSE;
SCNetworkSetPrivateRef setPrivate = (SCNetworkSetPrivateRef)set;
-
- if (!isA_SCNetworkSet(set)) {
- _SCErrorSet(kSCStatusInvalidArgument);
- return FALSE;
- }
+ Boolean updated = FALSE;
// first, assume that we only want to add new services
// for those interfaces that are not represented in the
services = SCNetworkServiceCopyAll(setPrivate->prefs);
}
- interfaces = SCNetworkInterfaceCopyAll();
n = (interfaces != NULL) ? CFArrayGetCount(interfaces) : 0;
for (i = 0; i < n; i++) {
SCNetworkInterfaceRef interface;
goto nextInterface;
}
- ok = SCNetworkSetAddService(set, service);
- if (!ok) {
- SCLog(TRUE, LOG_DEBUG,
- CFSTR("could not add service for \"%@\": %s\n"),
- SCNetworkInterfaceGetLocalizedDisplayName(interface),
- SCErrorString(SCError()));
- SCNetworkServiceRemove(service);
- CFRelease(service);
- goto nextInterface;
+ while (TRUE) {
+ CFStringRef newName;
+
+ ok = SCNetworkSetAddService(set, service);
+ if (ok) {
+ break;
+ }
+
+ if (SCError() != kSCStatusKeyExists) {
+ SCLog(TRUE, LOG_DEBUG,
+ CFSTR("could not add service for \"%@\": %s\n"),
+ SCNetworkInterfaceGetLocalizedDisplayName(interface),
+ SCErrorString(SCError()));
+ SCNetworkServiceRemove(service);
+ CFRelease(service);
+ goto nextInterface;
+ }
+
+ // we have two interfaces with the same service
+ // name, acquire a new, hopefully unique, name
+
+ newName = next_service_name(service);
+ if (newName == NULL) {
+ SCLog(TRUE, LOG_DEBUG,
+ CFSTR("could not set unique name for \"%@\": %s\n"),
+ SCNetworkInterfaceGetLocalizedDisplayName(interface),
+ SCErrorString(SCError()));
+ SCNetworkServiceRemove(service);
+ CFRelease(service);
+ goto nextInterface;
+ }
+
+ ok = SCNetworkServiceSetName(service, newName);
+ CFRelease(newName);
+ if (ok) {
+ continue;
+ }
+
+ if (SCError() != kSCStatusKeyExists) {
+ SCLog(TRUE, LOG_DEBUG,
+ CFSTR("could not set unique name for \"%@\": %s\n"),
+ SCNetworkInterfaceGetLocalizedDisplayName(interface),
+ SCErrorString(SCError()));
+ SCNetworkServiceRemove(service);
+ CFRelease(service);
+ goto nextInterface;
+ }
}
CFRelease(service);
- setUpdated = TRUE;
+ updated = TRUE;
} else {
add_supported_interfaces(interface_list, interface);
}
}
CFRelease(interface_list);
}
- if (interfaces != NULL) CFRelease(interfaces);
if (services != NULL) CFRelease(services);
- if (ok && !setUpdated) {
+ if (ok && !updated) {
// if no changes were made
_SCErrorSet(kSCStatusOK);
}
- return setUpdated;
+ return updated;
+}
+
+
+Boolean
+SCNetworkSetEstablishDefaultConfiguration(SCNetworkSetRef set)
+{
+ CFArrayRef interfaces;
+ Boolean updated;
+
+ if (!isA_SCNetworkSet(set)) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+
+ interfaces = SCNetworkInterfaceCopyAll();
+ updated = __SCNetworkSetEstablishDefaultConfigurationForInterfaces(set, interfaces);
+ if (interfaces != NULL) CFRelease(interfaces);
+
+ return updated;
+}
+
+
+Boolean
+SCNetworkSetEstablishDefaultInterfaceConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface)
+{
+ CFMutableArrayRef interfaces;
+ Boolean updated;
+
+ if (!isA_SCNetworkSet(set)) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+
+ if (!isA_SCNetworkInterface(interface)) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+
+ interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+ CFArrayAppendValue(interfaces, interface);
+ updated = __SCNetworkSetEstablishDefaultConfigurationForInterfaces(set, interfaces);
+ CFRelease(interfaces);
+
+ return updated;
}
char buf[32];
SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs;
int sc_status = kSCStatusFailed;
- struct stat statbuf;
+ struct stat statBuf;
+ struct stat statBuf2;
if (prefs == NULL) {
/* sorry, you must provide a session */
retry :
- prefsPrivate->lockFD = open(prefsPrivate->lockPath, O_WRONLY|O_CREAT, 0644);
+ prefsPrivate->lockFD = open(prefsPrivate->lockPath,
+ wait ? O_WRONLY|O_CREAT|O_EXLOCK
+ : O_WRONLY|O_CREAT|O_EXLOCK|O_NONBLOCK,
+ 0644);
if (prefsPrivate->lockFD == -1) {
- if (errno == EROFS) {
- goto locked;
- }
-
- if ((errno == ENOENT) &&
- ((prefsPrivate->prefsID == NULL) || !CFStringHasPrefix(prefsPrivate->prefsID, CFSTR("/")))) {
- int ret;
-
- // create parent (/Library/Preferences/SystemConfiguration)
- ret = createParentDirectory(prefsPrivate->lockPath);
- if (ret == 0) {
- SCLog(TRUE, LOG_NOTICE,
- CFSTR("created directory for \"%s\""),
- prefsPrivate->newPath ? prefsPrivate->newPath : prefsPrivate->path);
- goto retry;
- } else if (errno == EROFS) {
- goto locked;
- }
- }
-
- sc_status = errno;
- SCLog(TRUE, LOG_ERR,
- CFSTR("SCPreferencesLock open() failed: %s"),
- strerror(errno));
- goto error;
- }
-
- if (flock(prefsPrivate->lockFD, wait ? LOCK_EX : LOCK_EX|LOCK_NB) == -1) {
switch (errno) {
+ case ENOENT :
+ if ((prefsPrivate->prefsID == NULL) ||
+ !CFStringHasPrefix(prefsPrivate->prefsID, CFSTR("/"))) {
+ int ret;
+
+ // create parent (/Library/Preferences/SystemConfiguration)
+ ret = createParentDirectory(prefsPrivate->lockPath);
+ if (ret == 0) {
+ SCLog(TRUE, LOG_NOTICE,
+ CFSTR("created directory for \"%s\""),
+ prefsPrivate->newPath ? prefsPrivate->newPath : prefsPrivate->path);
+ goto retry;
+ } else if (errno == EROFS) {
+ goto locked;
+ }
+ }
+ break;
+ case EROFS :
+ // if read-only filesystem
+ goto locked;
case EWOULDBLOCK :
// if already locked (and we are not blocking)
sc_status = kSCStatusPrefsBusy;
- break;
+ goto error;
default :
- sc_status = errno;
- SCLog(TRUE, LOG_ERR,
- CFSTR("SCPreferencesLock flock() failed: %s"),
- strerror(errno));
break;
}
+ sc_status = errno;
+ SCLog(TRUE, LOG_ERR,
+ CFSTR("SCPreferencesLock open() failed: %s"),
+ strerror(errno));
goto error;
}
- if (stat(prefsPrivate->lockPath, &statbuf) == -1) {
- // if the lock file was unlinked
+ if ((stat(prefsPrivate->lockPath, &statBuf) == -1) ||
+ (fstat(prefsPrivate->lockFD, &statBuf2) == -1) ||
+ (statBuf.st_dev != statBuf2.st_dev) ||
+ (statBuf.st_ino != statBuf2.st_ino)) {
+ // if the lock file was unlinked or re-created
close(prefsPrivate->lockFD);
prefsPrivate->lockFD = -1;
goto retry;
if (prefsPrivate->accessed) {
CFDataRef currentSignature;
Boolean match;
- struct stat statBuf;
/*
* the preferences have been accessed since the
Boolean ok;
SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs;
uint32_t status = kSCStatusOK;
- CFDataRef reply = NULL;
// start helper
prefsPrivate->helper = _SCHelperOpen(prefsPrivate->authorizationData);
}
// have the helper "open" the prefs
- status = kSCStatusOK;
- reply = NULL;
ok = _SCHelperExec(prefsPrivate->helper,
SCHELPER_MSG_PREFS_OPEN,
data,
}
// have the helper "access" the prefs
- status = kSCStatusOK;
- reply = NULL;
ok = _SCHelperExec(prefsPrivate->helper,
SCHELPER_MSG_PREFS_ACCESS,
NULL,
}
+static void
+__SCPreferencesSynchronize_helper(SCPreferencesRef prefs)
+{
+ Boolean ok;
+ SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs;
+ uint32_t status = kSCStatusOK;
+
+ if (prefsPrivate->helper == -1) {
+ // if no helper
+ return;
+ }
+
+ // have the helper "synchronize" the prefs
+ ok = _SCHelperExec(prefsPrivate->helper,
+ SCHELPER_MSG_PREFS_SYNCHRONIZE,
+ NULL,
+ &status,
+ NULL);
+ if (!ok) {
+ // close helper
+ if (prefsPrivate->helper != -1) {
+ _SCHelperClose(prefsPrivate->helper);
+ prefsPrivate->helper = -1;
+ }
+ }
+
+ return;
+}
+
+
void
SCPreferencesSynchronize(SCPreferencesRef prefs)
{
return;
}
+ if (prefsPrivate->authorizationData != NULL) {
+ __SCPreferencesSynchronize_helper(prefs);
+ }
+
if (prefsPrivate->prefs != NULL) {
CFRelease(prefsPrivate->prefs);
prefsPrivate->prefs = NULL;
/*
- * Copyright (c) 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2005-2007 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
SCHELPER_MSG_PREFS_APPLY,
SCHELPER_MSG_PREFS_UNLOCK,
SCHELPER_MSG_PREFS_CLOSE,
+ SCHELPER_MSG_PREFS_SYNCHRONIZE,
// SCNetworkConfiguration
SCHELPER_MSG_INTERFACE_REFRESH = 200,
/*
- * Copyright (c) 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2005-2007 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
if (CFDataGetLength(data) == sizeof(extForm.bytes)) {
OSStatus err;
- memcpy(extForm.bytes, CFDataGetBytePtr(data), sizeof(extForm.bytes));
+ bcopy(CFDataGetBytePtr(data), extForm.bytes, sizeof(extForm.bytes));
err = AuthorizationCreateFromExternalForm(&extForm, &authorization);
if (err != errAuthorizationSuccess) {
SCLog(TRUE, LOG_ERR,
*status = SCError();
}
- SCPreferencesSynchronize(prefs);
return TRUE;
}
*status = SCError();
}
- SCPreferencesSynchronize(prefs);
return TRUE;
}
}
+/*
+ * SYNCHRONIZE
+ * (in) data = N/A
+ * (out) status = kSCStatusOK
+ * (out) reply = N/A
+ */
+static Boolean
+do_prefs_Synchronize(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+ if (prefs == NULL) {
+ return FALSE;
+ }
+
+ SCPreferencesSynchronize(prefs);
+ *status = kSCStatusOK;
+ return TRUE;
+}
+
+
static Boolean
hasAuthorization()
{
{ SCHELPER_MSG_PREFS_APPLY, "PREFS apply", TRUE, do_prefs_Apply , NULL },
{ SCHELPER_MSG_PREFS_UNLOCK, "PREFS unlock", FALSE, do_prefs_Unlock , NULL },
{ SCHELPER_MSG_PREFS_CLOSE, "PREFS close", FALSE, do_prefs_Close , NULL },
+ { SCHELPER_MSG_PREFS_SYNCHRONIZE, "PREFS synchronize", FALSE, do_prefs_Synchronize , NULL },
{ SCHELPER_MSG_INTERFACE_REFRESH, "INTERFACE refresh", TRUE, do_interface_refresh , NULL },
1558480607550D470046C2E9 /* PBXTargetDependency */,
1558480807550D470046C2E9 /* PBXTargetDependency */,
1558480A07550D470046C2E9 /* PBXTargetDependency */,
+ 150ECB3C0D0079280065E94D /* PBXTargetDependency */,
);
name = configd_executables;
productName = configd_executables;
15DAF2DC08466D4900D1B2BD /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; };
15DAF2DF08466D4900D1B2BD /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; };
15DAF2E108466D4900D1B2BD /* SCHelper_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */; };
+ 15E517680CCFBCD0008FFE82 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
+ 15FC130B0CCEA59E0013872C /* monitor.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FC130A0CCEA59E0013872C /* monitor.c */; };
+ 15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+ 15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */; };
+ 15FEE81F0CD03E75001312F9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15FEE8180CD03CBB001312F9 /* Localizable.strings */; };
F95B8A430B03E07A00993BA3 /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; };
F95B8A460B03E09300993BA3 /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; };
F95B8A470B03E09300993BA3 /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
+ 150ECB3B0D0079280065E94D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 151F5D990CCE98E50093AC3B /* SCMonitor */;
+ remoteInfo = SCMonitor;
+ };
1520A385084681350010B584 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
1514D76D05C08A5F00757DC9 /* config_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config_types.h; path = SystemConfiguration.fproj/config_types.h; sourceTree = SOURCE_ROOT; };
151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCPreferencesPathKey.h; path = SystemConfiguration.fproj/SCPreferencesPathKey.h; sourceTree = SOURCE_ROOT; };
151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCPreferencesPathKey.c; path = SystemConfiguration.fproj/SCPreferencesPathKey.c; sourceTree = SOURCE_ROOT; };
+ 151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SCMonitor.plugin; sourceTree = BUILT_PRODUCTS_DIR; };
151F63EC09328A3C0096DCC9 /* genSCPreferences */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = genSCPreferences; sourceTree = BUILT_PRODUCTS_DIR; };
1520A3DE0846B2DC0010B584 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
1521FC5C060F296A003B28F5 /* dnsinfo_create.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_create.c; path = dnsinfo/dnsinfo_create.c; sourceTree = SOURCE_ROOT; };
15DC346C0711D49400A3311C /* net_service.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net_service.h; sourceTree = "<group>"; };
15DC346D0711D49400A3311C /* net_set.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net_set.c; sourceTree = "<group>"; };
15DC346E0711D49400A3311C /* net_set.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net_set.h; sourceTree = "<group>"; };
+ 15FC12F20CCEA4F00013872C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = SCMonitor/Info.plist; sourceTree = "<group>"; };
+ 15FC130A0CCEA59E0013872C /* monitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = monitor.c; path = SCMonitor/monitor.c; sourceTree = "<group>"; };
15FCAACF05FD0EBF00CB79E6 /* shared_dns_info_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = shared_dns_info_types.h; path = dnsinfo/shared_dns_info_types.h; sourceTree = SOURCE_ROOT; };
15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = shared_dns_info.defs; path = dnsinfo/shared_dns_info.defs; sourceTree = "<group>"; };
15FD71090754D628001CC321 /* Kicker.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Kicker.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
15FD73970754DE49001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
15FD73EE0754DE62001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
15FD743E0754DE7A001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+ 15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
+ 15FEE8160CD03CA3001312F9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = SCMonitor/English.lproj/Localizable.strings; sourceTree = "<group>"; };
23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pppcontroller_types.h; path = /usr/local/include/ppp/pppcontroller_types.h; sourceTree = "<absolute>"; };
23C1E2B8062DD45900835B54 /* pppcontroller.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = pppcontroller.defs; path = SystemConfiguration.fproj/pppcontroller.defs; sourceTree = "<group>"; };
23C1E2BE062DD5DB00835B54 /* pppcontroller.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pppcontroller.h; path = configd.build/SystemConfiguration.framework.build/DerivedSources/pppcontroller.h; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 151F5D980CCE98E50093AC3B /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */,
+ 15E517680CCFBCD0008FFE82 /* SystemConfiguration.framework in Frameworks */,
+ 15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
1547001B08455B98006787CE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
name = "Initial Preferences";
sourceTree = "<group>";
};
+ 151F5DA80CCE995D0093AC3B /* SCMonitor */ = {
+ isa = PBXGroup;
+ children = (
+ 15FC130A0CCEA59E0013872C /* monitor.c */,
+ 15FC12F20CCEA4F00013872C /* Info.plist */,
+ 15FEE8180CD03CBB001312F9 /* Localizable.strings */,
+ );
+ name = SCMonitor;
+ sourceTree = "<group>";
+ };
1547002E084561B4006787CE /* SCHelper */ = {
isa = PBXGroup;
children = (
1582B36B05FD1A4D009C2750 /* DNSConfiguration */,
15CB690705C0722A0099E85F /* SystemConfiguration */,
1547002E084561B4006787CE /* SCHelper */,
+ 151F5DA80CCE995D0093AC3B /* SCMonitor */,
15CB69C205C0722B0099E85F /* configd */,
15CB6A2205C0722B0099E85F /* scselect */,
15CB6A3705C0722B0099E85F /* scutil */,
15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */,
15DAD5EE075913CE0084A6ED /* libdnsinfo.a */,
1547001D08455B98006787CE /* SCHelper */,
+ 151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */,
158ADCA60754ECC800124717 /* configd, scutil, scselect */,
158ADBFD0754ECB100124717 /* Plugins */,
151F63EC09328A3C0096DCC9 /* genSCPreferences */,
isa = PBXGroup;
children = (
158AD9F80754EA2F00124717 /* AppleTalk.framework */,
+ 15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */,
15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */,
1543636A0752D03C00A8EC6C /* IOKit.framework */,
1520A3DE0846B2DC0010B584 /* Security.framework */,
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ 151F5D990CCE98E50093AC3B /* SCMonitor */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 151F5D9F0CCE98E60093AC3B /* Build configuration list for PBXNativeTarget "SCMonitor" */;
+ buildPhases = (
+ 151F5D960CCE98E50093AC3B /* Resources */,
+ 151F5D970CCE98E50093AC3B /* Sources */,
+ 151F5D980CCE98E50093AC3B /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = SCMonitor;
+ productName = SCMonitor;
+ productReference = 151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */;
+ productType = "com.apple.product-type.bundle";
+ };
151F63DA09328A3C0096DCC9 /* Schema */ = {
isa = PBXNativeTarget;
buildConfigurationList = 151F63DC09328A3C0096DCC9 /* Build configuration list for PBXNativeTarget "Schema" */;
151F63DA09328A3C0096DCC9 /* Schema */,
15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */,
1547001808455B98006787CE /* SCHelper */,
+ 151F5D990CCE98E50093AC3B /* SCMonitor */,
159D549F07529FFF004F8947 /* configd */,
1558481207550EC10046C2E9 /* scselect */,
155847430754FDCD0046C2E9 /* scutil */,
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
+ 151F5D960CCE98E50093AC3B /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15FEE81F0CD03E75001312F9 /* Localizable.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
15828AE30753B5F900AD4710 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
+ 151F5D970CCE98E50093AC3B /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15FC130B0CCEA59E0013872C /* monitor.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
1547001A08455B98006787CE /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
+ 150ECB3C0D0079280065E94D /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 151F5D990CCE98E50093AC3B /* SCMonitor */;
+ targetProxy = 150ECB3B0D0079280065E94D /* PBXContainerItemProxy */;
+ };
1520A386084681350010B584 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1547001808455B98006787CE /* SCHelper */;
name = Localizable.strings;
sourceTree = "<group>";
};
+ 15FEE8180CD03CBB001312F9 /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 15FEE8160CD03CA3001312F9 /* English */,
+ );
+ name = Localizable.strings;
+ sourceTree = "<group>";
+ };
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
+ 151F5D9C0CCE98E60093AC3B /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist";
+ INSTALL_MODE_FLAG = "a-w,a+rX";
+ INSTALL_PATH = /System/Library/UserEventPlugins;
+ PRODUCT_NAME = SCMonitor;
+ WRAPPER_EXTENSION = plugin;
+ ZERO_LINK = YES;
+ };
+ name = Development;
+ };
+ 151F5D9D0CCE98E60093AC3B /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_MODEL_TUNING = G5;
+ INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist";
+ INSTALL_MODE_FLAG = "a-w,a+rX";
+ INSTALL_PATH = /System/Library/UserEventPlugins;
+ PRODUCT_NAME = SCMonitor;
+ WRAPPER_EXTENSION = plugin;
+ ZERO_LINK = NO;
+ };
+ name = Deployment;
+ };
+ 151F5D9E0CCE98E60093AC3B /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist";
+ INSTALL_MODE_FLAG = "a-w,a+rX";
+ INSTALL_PATH = /System/Library/UserEventPlugins;
+ PRODUCT_NAME = SCMonitor;
+ VALID_ARCHS = "i386 ppc";
+ WRAPPER_EXTENSION = plugin;
+ ZERO_LINK = YES;
+ };
+ name = Default;
+ };
151F63DD09328A3C0096DCC9 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
buildSettings = {
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 204;
+ DYLIB_CURRENT_VERSION = 210;
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 = 204;
+ DYLIB_CURRENT_VERSION = 210;
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 = 204;
+ DYLIB_CURRENT_VERSION = 210;
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 = 204;
+ DYLIB_CURRENT_VERSION = 210;
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 = 204;
+ DYLIB_CURRENT_VERSION = 210;
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 = 204;
+ DYLIB_CURRENT_VERSION = 210;
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 = 204;
+ CURRENT_PROJECT_VERSION = 210;
DEAD_CODE_STRIPPING = YES;
INSTALL_GROUP = wheel;
INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
156EB6400905594A00EEF749 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 204;
+ CURRENT_PROJECT_VERSION = 210;
DEAD_CODE_STRIPPING = YES;
INSTALL_GROUP = wheel;
INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
156EB6410905594A00EEF749 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 204;
+ CURRENT_PROJECT_VERSION = 210;
DEAD_CODE_STRIPPING = YES;
INSTALL_GROUP = wheel;
INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 151F5D9F0CCE98E60093AC3B /* Build configuration list for PBXNativeTarget "SCMonitor" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 151F5D9C0CCE98E60093AC3B /* Development */,
+ 151F5D9D0CCE98E60093AC3B /* Deployment */,
+ 151F5D9E0CCE98E60093AC3B /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
151F63DC09328A3C0096DCC9 /* Build configuration list for PBXNativeTarget "Schema" */ = {
isa = XCConfigurationList;
buildConfigurations = (
{ "close", 0, 1, do_prefs_close, 2, 1,
" close [!] : close current \"preference\" session" },
+ { "synchronize",0, 1, do_prefs_synchronize, 2, 0,
+ " synchronize : synchronize a \"preferences\" session" },
+
{ "list", 0, 1, do_prefs_list, 4, 0,
" list [path] : list preference paths" },
}
+__private_extern__
+void
+do_prefs_synchronize(int argc, char **argv)
+{
+ SCPreferencesSynchronize(prefs);
+ return;
+}
+
+
static CFComparisonResult
sort_paths(const void *p1, const void *p2, void *context) {
CFStringRef path1 = (CFStringRef)p1;
/*
- * Copyright (c) 2003, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003, 2005-2007 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
void do_prefs_commit (int argc, char **argv);
void do_prefs_apply (int argc, char **argv);
void do_prefs_close (int argc, char **argv);
+void do_prefs_synchronize (int argc, char **argv);
void do_prefs_list (int argc, char **argv);
void do_prefs_get (int argc, char **argv);