]> git.saurik.com Git - apple/configd.git/commitdiff
configd-204.tar.gz mac-os-x-105 mac-os-x-1051 v204
authorApple <opensource@apple.com>
Tue, 30 Oct 2007 03:37:15 +0000 (03:37 +0000)
committerApple <opensource@apple.com>
Tue, 30 Oct 2007 03:37:15 +0000 (03:37 +0000)
219 files changed:
Plugins/ATconfig/Info.plist
Plugins/ATconfig/atconfig.c
Plugins/ATconfig/cfManager.c
Plugins/ATconfig/cfManager.h
Plugins/IPMonitor/Info.plist
Plugins/IPMonitor/Resolvers.plist
Plugins/IPMonitor/dns-configuration.c
Plugins/IPMonitor/dns-configuration.h [new file with mode: 0644]
Plugins/IPMonitor/ip_plugin.c
Plugins/IPMonitor/set-hostname.c
Plugins/IPMonitor/set-hostname.h [new file with mode: 0644]
Plugins/IPMonitor/smb-configuration.c [new file with mode: 0644]
Plugins/IPMonitor/smb-configuration.h [new file with mode: 0644]
Plugins/InterfaceNamer/Info.plist
Plugins/InterfaceNamer/ifnamer.c
Plugins/KernelEventMonitor/Info.plist
Plugins/KernelEventMonitor/ev_appletalk.c
Plugins/KernelEventMonitor/ev_appletalk.h
Plugins/KernelEventMonitor/ev_dlil.c
Plugins/KernelEventMonitor/ev_dlil.h
Plugins/KernelEventMonitor/ev_ipv4.c
Plugins/KernelEventMonitor/ev_ipv4.h
Plugins/KernelEventMonitor/ev_ipv6.c
Plugins/KernelEventMonitor/ev_ipv6.h
Plugins/KernelEventMonitor/eventmon.c
Plugins/KernelEventMonitor/eventmon.h
Plugins/Kicker/Info.plist
Plugins/Kicker/Kicker.xml
Plugins/Kicker/enable-network
Plugins/Kicker/kicker.c
Plugins/LinkConfiguration/Info.plist
Plugins/LinkConfiguration/linkconfig.c
Plugins/NetworkIdentification/Info.plist [new file with mode: 0644]
Plugins/NetworkIdentification/Makefile [new file with mode: 0644]
Plugins/NetworkIdentification/NetworkIdentification.c [new file with mode: 0644]
Plugins/PreferencesMonitor/Info.plist
Plugins/PreferencesMonitor/prefsmon.c
Plugins/common/cache.c
Plugins/common/cache.h
SystemConfiguration.fproj/BondConfiguration.c
SystemConfiguration.fproj/BondConfiguration.h
SystemConfiguration.fproj/BondConfigurationPrivate.h
SystemConfiguration.fproj/DHCP.c
SystemConfiguration.fproj/DHCPClientPreferences.h
SystemConfiguration.fproj/DeviceOnHold.c
SystemConfiguration.fproj/DeviceOnHold.h
SystemConfiguration.fproj/English.lproj/Localizable.strings [new file with mode: 0644]
SystemConfiguration.fproj/English.lproj/NetworkInterface.strings
SystemConfiguration.fproj/Info.plist
SystemConfiguration.fproj/LinkConfiguration.c
SystemConfiguration.fproj/LinkConfiguration.h
SystemConfiguration.fproj/Makefile
SystemConfiguration.fproj/NetworkConfiguration.plist
SystemConfiguration.fproj/SCD.c
SystemConfiguration.fproj/SCDAdd.c
SystemConfiguration.fproj/SCDHostName.c
SystemConfiguration.fproj/SCDKeys.c
SystemConfiguration.fproj/SCDLock.c
SystemConfiguration.fproj/SCDNotifierAdd.c
SystemConfiguration.fproj/SCDNotifierCancel.c
SystemConfiguration.fproj/SCDNotifierInformViaCallback.c
SystemConfiguration.fproj/SCDNotifierInformViaFD.c
SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c
SystemConfiguration.fproj/SCDNotifierInformViaSignal.c
SystemConfiguration.fproj/SCDNotifierRemove.c
SystemConfiguration.fproj/SCDNotifierSetKeys.c
SystemConfiguration.fproj/SCDNotifierWait.c
SystemConfiguration.fproj/SCDNotify.c
SystemConfiguration.fproj/SCDOpen.c
SystemConfiguration.fproj/SCDPlugin.c
SystemConfiguration.fproj/SCDPlugin.h
SystemConfiguration.fproj/SCDPrivate.c
SystemConfiguration.fproj/SCDRemove.c
SystemConfiguration.fproj/SCDSet.c
SystemConfiguration.fproj/SCDSnapshot.c
SystemConfiguration.fproj/SCDTouch.c
SystemConfiguration.fproj/SCDUnlock.c
SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h
SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h
SystemConfiguration.fproj/SCDynamicStoreInternal.h
SystemConfiguration.fproj/SCDynamicStoreKey.h
SystemConfiguration.fproj/SCDynamicStorePrivate.h
SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h
SystemConfiguration.fproj/SCLocation.c
SystemConfiguration.fproj/SCNetwork.c
SystemConfiguration.fproj/SCNetwork.h
SystemConfiguration.fproj/SCNetworkConfiguration.h
SystemConfiguration.fproj/SCNetworkConfigurationInternal.c
SystemConfiguration.fproj/SCNetworkConfigurationInternal.h
SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h [new file with mode: 0644]
SystemConfiguration.fproj/SCNetworkConnection.c
SystemConfiguration.fproj/SCNetworkConnection.h
SystemConfiguration.fproj/SCNetworkConnectionPrivate.c [new file with mode: 0644]
SystemConfiguration.fproj/SCNetworkConnectionPrivate.h [new file with mode: 0644]
SystemConfiguration.fproj/SCNetworkInterface.c
SystemConfiguration.fproj/SCNetworkProtocol.c
SystemConfiguration.fproj/SCNetworkReachability.c
SystemConfiguration.fproj/SCNetworkService.c
SystemConfiguration.fproj/SCNetworkSet.c
SystemConfiguration.fproj/SCNetworkSignature.c [new file with mode: 0644]
SystemConfiguration.fproj/SCNetworkSignature.h [new file with mode: 0644]
SystemConfiguration.fproj/SCNetworkSignaturePrivate.h [new file with mode: 0644]
SystemConfiguration.fproj/SCP.c
SystemConfiguration.fproj/SCPAdd.c
SystemConfiguration.fproj/SCPApply.c
SystemConfiguration.fproj/SCPCommit.c
SystemConfiguration.fproj/SCPGet.c
SystemConfiguration.fproj/SCPList.c
SystemConfiguration.fproj/SCPLock.c
SystemConfiguration.fproj/SCPOpen.c
SystemConfiguration.fproj/SCPPath.c
SystemConfiguration.fproj/SCPRemove.c
SystemConfiguration.fproj/SCPSet.c
SystemConfiguration.fproj/SCPUnlock.c
SystemConfiguration.fproj/SCPreferences.h
SystemConfiguration.fproj/SCPreferencesInternal.h
SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c [new file with mode: 0644]
SystemConfiguration.fproj/SCPreferencesKeychainPrivate.h [new file with mode: 0644]
SystemConfiguration.fproj/SCPreferencesPath.h
SystemConfiguration.fproj/SCPreferencesPathKey.c
SystemConfiguration.fproj/SCPreferencesPrivate.h
SystemConfiguration.fproj/SCPreferencesSetSpecific.h
SystemConfiguration.fproj/SCPrivate.h
SystemConfiguration.fproj/SCProxies.c
SystemConfiguration.fproj/SCSchemaDefinitions.c
SystemConfiguration.fproj/SCSchemaDefinitions.h
SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h [new file with mode: 0644]
SystemConfiguration.fproj/SCValidation.h
SystemConfiguration.fproj/SystemConfiguration.h
SystemConfiguration.fproj/VLANConfiguration.c
SystemConfiguration.fproj/VLANConfiguration.h
SystemConfiguration.fproj/VLANConfigurationPrivate.h [deleted file]
SystemConfiguration.fproj/config.defs
SystemConfiguration.fproj/config_types.h
SystemConfiguration.fproj/dy_framework.c
SystemConfiguration.fproj/dy_framework.h
SystemConfiguration.fproj/genSCPreferences.c
SystemConfiguration.fproj/helper/SCHelper_client.c [new file with mode: 0644]
SystemConfiguration.fproj/helper/SCHelper_client.h [new file with mode: 0644]
SystemConfiguration.fproj/helper/SCHelper_server.c [new file with mode: 0644]
SystemConfiguration.fproj/helper/helper_comm.c [new file with mode: 0644]
SystemConfiguration.fproj/helper/helper_comm.h [new file with mode: 0644]
SystemConfiguration.fproj/moh.c
SystemConfiguration.fproj/moh.h
SystemConfiguration.fproj/moh_msg.h
configd.tproj/_SCD.c
configd.tproj/_SCD.h
configd.tproj/_configadd.c
configd.tproj/_configclose.c
configd.tproj/_configget.c
configd.tproj/_configlist.c
configd.tproj/_configlock.c
configd.tproj/_confignotify.c
configd.tproj/_configopen.c
configd.tproj/_configremove.c
configd.tproj/_configset.c
configd.tproj/_configtouch.c
configd.tproj/_configunlock.c
configd.tproj/_notifyadd.c
configd.tproj/_notifycancel.c
configd.tproj/_notifychanges.c
configd.tproj/_notifyremove.c
configd.tproj/_notifyviafd.c
configd.tproj/_notifyviaport.c
configd.tproj/_notifyviasignal.c
configd.tproj/_snapshot.c
configd.tproj/com.apple.configd.plist [new file with mode: 0644]
configd.tproj/configd.8
configd.tproj/configd.h
configd.tproj/configd.m
configd.tproj/configd.plist [deleted file]
configd.tproj/configd_server.c
configd.tproj/configd_server.h
configd.tproj/notify_server.h
configd.tproj/pattern.c
configd.tproj/pattern.h
configd.tproj/plugin_support.c
configd.tproj/plugin_support.h
configd.tproj/session.c
configd.tproj/session.h
configd.xcode/project.pbxproj [deleted file]
configd.xcodeproj/project.pbxproj [new file with mode: 0644]
dnsinfo/dnsinfo.h
dnsinfo/dnsinfo_copy.c
dnsinfo/dnsinfo_create.c
dnsinfo/dnsinfo_create.h
dnsinfo/dnsinfo_private.c
dnsinfo/dnsinfo_private.h
dnsinfo/dnsinfo_server.c
dnsinfo/dnsinfo_server.h
dnsinfo/shared_dns_info.defs
dnsinfo/shared_dns_info_types.h
get-mobility-info
preferences.xml
scselect.tproj/scselect.8
scselect.tproj/scselect.c
scutil.tproj/cache.c
scutil.tproj/cache.h
scutil.tproj/commands.c
scutil.tproj/commands.h
scutil.tproj/dictionary.c
scutil.tproj/dictionary.h
scutil.tproj/net.c
scutil.tproj/net.h
scutil.tproj/net_interface.c
scutil.tproj/net_protocol.c
scutil.tproj/net_service.c
scutil.tproj/net_service.h
scutil.tproj/net_set.c
scutil.tproj/notifications.c
scutil.tproj/notifications.h
scutil.tproj/prefs.c
scutil.tproj/prefs.h
scutil.tproj/scutil.8
scutil.tproj/scutil.c
scutil.tproj/scutil.h
scutil.tproj/session.h
scutil.tproj/tests.c
scutil.tproj/tests.h

index 9891c5f7aa8d95df786d4b5ada0f46770fd72048..44bafb217b9a2bc0b3e93787acafc4803052711e 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>0.0.1d1</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>0.0.1d1</string>
+       <key>Builtin</key>
+       <true/>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
index 973fd6f3fe5747d09dd11d06f724429efd03107b..9f0d405cfd35fca74be0e47d7e9b06d2f0c52dcc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <unistd.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
+#include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
+#include <sys/stat.h>
 #include <sys/utsname.h>
 #include <sys/wait.h>
 #include <sys/utsname.h>
 #include <sys/wait.h>
+#include <dlfcn.h>
 #include <net/if.h>
 #include <netat/appletalk.h>
 #include <netat/at_var.h>
 #include <net/if.h>
 #include <netat/appletalk.h>
 #include <netat/at_var.h>
@@ -76,8 +79,60 @@ static CFMutableDictionaryRef        curStartup      = NULL;
 static Boolean                 _verbose        = FALSE;
 
 
 static Boolean                 _verbose        = FALSE;
 
 
-static void    stopAppleTalk (CFRunLoopTimerRef timer, void *info);
+#define        RETRY_DELAY     2.0     // seconds
+#define        RETRY_LIMIT     5       // # of startup/shutdown attempts
+
 static void    startAppleTalk(CFRunLoopTimerRef timer, void *info);
 static void    startAppleTalk(CFRunLoopTimerRef timer, void *info);
+static void    stopAppleTalk (CFRunLoopTimerRef timer, void *info);
+
+
+static void *
+__loadAppleTalk(void) {
+       static void *image = NULL;
+       if (NULL == image) {
+               const char      *framework              = "/System/Library/Frameworks/AppleTalk.framework/Versions/A/AppleTalk";
+               struct stat     statbuf;
+               const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
+               char            path[MAXPATHLEN];
+
+               strlcpy(path, framework, sizeof(path));
+               if (suffix) strlcat(path, suffix, sizeof(path));
+               if (0 <= stat(path, &statbuf)) {
+                       image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
+               } else {
+                       image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
+               }
+       }
+       return (void *)image;
+}
+
+
+static int
+_at_setdefaultaddr(char *ifName, struct at_addr *init_address)
+{
+       #undef at_setdefaultaddr
+       static typeof (at_setdefaultaddr) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadAppleTalk();
+               if (image) dyfunc = dlsym(image, "at_setdefaultaddr");
+       }
+       return dyfunc ? dyfunc(ifName, init_address) : -1;
+}
+#define at_setdefaultaddr _at_setdefaultaddr
+
+
+static int
+_at_setdefaultzone(char *ifName, at_nvestr_t *zone)
+{
+       #undef at_setdefaultzone
+       static typeof (at_setdefaultzone) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadAppleTalk();
+               if (image) dyfunc = dlsym(image, "at_setdefaultzone");
+       }
+       return dyfunc ? dyfunc(ifName, zone) : -1;
+}
+#define at_setdefaultzone _at_setdefaultzone
 
 
 static void
 
 
 static void
@@ -92,7 +147,7 @@ updateDefaults(const void *key, const void *val, void *context)
 
        if (!CFDictionaryGetValueIfPresent(curDefaults, ifName, (const void **)&oldDict) ||
            !CFEqual(oldDict, newDict)) {
 
        if (!CFDictionaryGetValueIfPresent(curDefaults, ifName, (const void **)&oldDict) ||
            !CFEqual(oldDict, newDict)) {
-               char            ifr_name[IFNAMSIZ+1];
+               char            ifr_name[IFNAMSIZ + 1];
 
                bzero(&ifr_name, sizeof(ifr_name));
                if (!_SC_cfstring_to_cstring(ifName, ifr_name, sizeof(ifr_name), kCFStringEncodingASCII)) {
 
                bzero(&ifr_name, sizeof(ifr_name));
                if (!_SC_cfstring_to_cstring(ifName, ifr_name, sizeof(ifr_name), kCFStringEncodingASCII)) {
@@ -1194,7 +1249,8 @@ stopComplete(pid_t pid, int status, struct rusage *rusage, void *context)
                }
        }
 
                }
        }
 
-       SCLog(TRUE, LOG_ERR,
+       SCLog(TRUE,
+             (execRetry > 1) ? LOG_NOTICE : LOG_ERR,
              CFSTR("AppleTalk shutdown failed, status = %d%s"),
              WEXITSTATUS(status),
              (execRetry > 1) ? " (retrying)" : "");
              CFSTR("AppleTalk shutdown failed, status = %d%s"),
              WEXITSTATUS(status),
              (execRetry > 1) ? " (retrying)" : "");
@@ -1205,7 +1261,7 @@ stopComplete(pid_t pid, int status, struct rusage *rusage, void *context)
                CFRunLoopTimerRef       timer;
 
                timer = CFRunLoopTimerCreate(NULL,
                CFRunLoopTimerRef       timer;
 
                timer = CFRunLoopTimerCreate(NULL,
-                                            CFAbsoluteTimeGetCurrent() + 1.0,
+                                            CFAbsoluteTimeGetCurrent() + RETRY_DELAY,
                                             0.0,
                                             0,
                                             0,
                                             0.0,
                                             0,
                                             0,
@@ -1245,7 +1301,7 @@ stopAppleTalk(CFRunLoopTimerRef timer, void *info)
                                            argv);                      // argv
 
        if (!timer) {
                                            argv);                      // argv
 
        if (!timer) {
-               execRetry = 5;  // initialize retry count
+               execRetry = RETRY_LIMIT;        // initialize retry count
        }
 
        return;
        }
 
        return;
@@ -1277,7 +1333,8 @@ startComplete(pid_t pid, int status, struct rusage *rusage, void *context)
                }
        }
 
                }
        }
 
-       SCLog(TRUE, LOG_ERR,
+       SCLog(TRUE,
+             (execRetry > 1) ? LOG_NOTICE : LOG_ERR,
              CFSTR("AppleTalk startup failed, status = %d%s"),
              WEXITSTATUS(status),
              (execRetry > 1) ? " (retrying)" : "");
              CFSTR("AppleTalk startup failed, status = %d%s"),
              WEXITSTATUS(status),
              (execRetry > 1) ? " (retrying)" : "");
@@ -1288,7 +1345,7 @@ startComplete(pid_t pid, int status, struct rusage *rusage, void *context)
                CFRunLoopTimerRef       timer;
 
                timer = CFRunLoopTimerCreate(NULL,
                CFRunLoopTimerRef       timer;
 
                timer = CFRunLoopTimerCreate(NULL,
-                                            CFAbsoluteTimeGetCurrent() + 1.0,
+                                            CFAbsoluteTimeGetCurrent() + RETRY_DELAY,
                                             0.0,
                                             0,
                                             0,
                                             0.0,
                                             0,
                                             0,
@@ -1373,7 +1430,7 @@ startAppleTalk(CFRunLoopTimerRef timer, void *info)
                                            argv);                      // argv
 
        if (!timer) {
                                            argv);                      // argv
 
        if (!timer) {
-               execRetry = 5;  // initialize retry count
+               execRetry = RETRY_LIMIT;        // initialize retry count
        }
 
     done :
        }
 
     done :
@@ -1476,7 +1533,7 @@ load_ATconfig(CFBundleRef bundle, Boolean bundleVerbose)
                                     CFSTR("AppleTalk Configuraton plug-in"),
                                     atConfigChangedCallback,
                                     NULL);
                                     CFSTR("AppleTalk Configuraton plug-in"),
                                     atConfigChangedCallback,
                                     NULL);
-       if (!store) {
+       if (store == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCreate() failed: %s"), SCErrorString(SCError()));
                goto error;
        }
                SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCreate() failed: %s"), SCErrorString(SCError()));
                goto error;
        }
index 73bcd59b9abb40a7b2d1937ed3faa90403a4de90..72196cdd4faca21cb7fb91bb52b0aa83be99b9eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -53,10 +53,10 @@ configRead(const char *path)
        CFArrayRef              config  = NULL;
 
        fd = open(path, O_RDONLY, 0644);
        CFArrayRef              config  = NULL;
 
        fd = open(path, O_RDONLY, 0644);
-       if (fd < 0) {
+       if (fd == -1) {
                goto done;
        }
                goto done;
        }
-       if (fstat(fd, &statBuf) < 0) {
+       if (fstat(fd, &statBuf) == -1) {
                goto done;
        }
        if ((statBuf.st_mode & S_IFMT) != S_IFREG) {
                goto done;
        }
        if ((statBuf.st_mode & S_IFMT) != S_IFREG) {
@@ -78,7 +78,7 @@ configRead(const char *path)
 
     done:
 
 
     done:
 
-       if (fd >= 0) {
+       if (fd != -1) {
                close(fd);
        }
        if (config == NULL) {
                close(fd);
        }
        if (config == NULL) {
@@ -107,11 +107,11 @@ configWrite(const char *path, CFArrayRef config)
        int             len;
 
        str  = CFStringCreateByCombiningStrings(NULL, config, CFSTR("\n"));
        int             len;
 
        str  = CFStringCreateByCombiningStrings(NULL, config, CFSTR("\n"));
-       data = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingMacRoman, '.');
+       data = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingMacRoman, (UInt8)'.');
        CFRelease(str);
 
        fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
        CFRelease(str);
 
        fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-       if (fd < 0) {
+       if (fd == -1) {
                goto done;
        }
 
                goto done;
        }
 
@@ -122,7 +122,7 @@ configWrite(const char *path, CFArrayRef config)
 
     done:
 
 
     done:
 
-       if (fd >= 0)
+       if (fd != -1)
                close(fd);
        CFRelease(data);
        return;
                close(fd);
        CFRelease(data);
        return;
index 373c371b97f94b1499c8bee3103ded5778657e31..6c28c2c9ec1d5f450660e8fcf814abd8ee9aa0b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index cf30d3992f4fd11901a8b8093f21921e1684716b..deba33254e55cfcada12a591eeb89a1d35da070b 100644 (file)
@@ -15,7 +15,7 @@
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
@@ -27,5 +27,7 @@
        </array>
        <key>Builtin</key>
        <true/>
        </array>
        <key>Builtin</key>
        <true/>
+       <key>pdns_timeout</key>
+       <integer>5</integer>
 </dict>
 </plist>
 </dict>
 </plist>
index c59cf4d2cf4d9e4b445db4338dba71398243cf0d..f7fcd96747881baaf58887befec85a4b1765a73c 100644 (file)
@@ -4,21 +4,17 @@
 <array>
        <dict>
                <key>Options</key>
 <array>
        <dict>
                <key>Options</key>
-               <string>attempts:4</string>
-               <key>ServerAddresses</key>
-               <array>
-                       <string>224.0.0.251</string>
-                       <string>ff02::fb</string>
-               </array>
-               <key>ServerPort</key>
-               <integer>5353</integer>
+               <string>mdns</string>
                <key>ServerTimeout</key>
                <integer>2</integer>
                <key>SupplementalMatchDomains</key>
                <array>
                        <string>local</string>
                        <string>254.169.in-addr.arpa</string>
                <key>ServerTimeout</key>
                <integer>2</integer>
                <key>SupplementalMatchDomains</key>
                <array>
                        <string>local</string>
                        <string>254.169.in-addr.arpa</string>
-                       <string>0.8.e.f.ip6.arpa</string>
+                       <string>8.e.f.ip6.arpa</string>
+                       <string>9.e.f.ip6.arpa</string>
+                       <string>a.e.f.ip6.arpa</string>
+                       <string>b.e.f.ip6.arpa</string>
                </array>
        </dict>
 </array>
                </array>
        </dict>
 </array>
index d8ed3045607997fa6bf66c10a25aa8ea698dc042..8db803818b1b3de9094ef38d3885404a3412504e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <dnsinfo.h>
 #include <dnsinfo_create.h>
 
 #include <dnsinfo.h>
 #include <dnsinfo_create.h>
 
+#include <dns_sd.h>
+#ifndef        kDNSServiceCompPrivateDNS
+#define        kDNSServiceCompPrivateDNS       "PrivateDNS"
+#endif
 
 /* pre-defined (supplemental) resolver configurations */
 
 /* pre-defined (supplemental) resolver configurations */
-static  CFArrayRef      S_predefined  = NULL;
+static  CFArrayRef      S_predefined   = NULL;
+
+/* private DNS resolver configurations */
+static CFNumberRef     S_pdns_timeout  = NULL;
+
+
+static void
+add_resolver(CFMutableArrayRef supplemental, CFMutableDictionaryRef resolver)
+{
+       CFIndex         i;
+       CFIndex         n_supplemental;
+       CFNumberRef     order;
+       uint32_t        order_val       = 0;
+
+       order = CFDictionaryGetValue(resolver, kSCPropNetDNSSearchOrder);
+       if (!isA_CFNumber(order) ||
+           !CFNumberGetValue(order, kCFNumberIntType, &order_val)) {
+               order     = NULL;
+               order_val = 0;
+       }
+
+       n_supplemental = CFArrayGetCount(supplemental);
+       for (i = 0; i < n_supplemental; i++) {
+               CFDictionaryRef         supplemental_resolver;
+
+               supplemental_resolver = CFArrayGetValueAtIndex(supplemental, i);
+               if (CFEqual(resolver, supplemental_resolver)) {
+                       // a real duplicate
+                       return;
+               }
+
+               if (order != NULL) {
+                       CFMutableDictionaryRef  compare;
+                       Boolean                 match;
+
+                       compare = CFDictionaryCreateMutableCopy(NULL, 0, supplemental_resolver);
+                       CFDictionarySetValue(compare, kSCPropNetDNSSearchOrder, order);
+                       match = CFEqual(resolver, compare);
+                       CFRelease(compare);
+                       if (match) {
+                               CFNumberRef     supplemental_order;
+                               uint32_t        supplemental_order_val  = 0;
+
+                               // if only the search order's are different
+                               supplemental_order = CFDictionaryGetValue(supplemental_resolver, kSCPropNetDNSSearchOrder);
+                               if (!isA_CFNumber(supplemental_order) ||
+                                   !CFNumberGetValue(supplemental_order, kCFNumberIntType, &supplemental_order_val)) {
+                                       supplemental_order_val = 0;
+                               }
+
+                               if (order_val < supplemental_order_val ) {
+                                       // if we should prefer this match resolver, else just skip it
+                                       CFArraySetValueAtIndex(supplemental, i, resolver);
+                               }
+
+                               return;
+                       }
+               }
+       }
+
+       order = CFNumberCreate(NULL, kCFNumberIntType, &n_supplemental);
+       CFDictionarySetValue(resolver, CFSTR("*ORDER*"), order);
+       CFRelease(order);
+
+       CFArrayAppendValue(supplemental, resolver);
+       return;
+}
 
 
 static void
 
 
 static void
@@ -62,7 +132,6 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
        CFIndex         n_domains;
        CFArrayRef      orders;
 
        CFIndex         n_domains;
        CFArrayRef      orders;
 
-
        domains = CFDictionaryGetValue(dns, kSCPropNetDNSSupplementalMatchDomains);
        n_domains = isA_CFArray(domains) ? CFArrayGetCount(domains) : 0;
        if (n_domains == 0) {
        domains = CFDictionaryGetValue(dns, kSCPropNetDNSSupplementalMatchDomains);
        n_domains = isA_CFArray(domains) ? CFArrayGetCount(domains) : 0;
        if (n_domains == 0) {
@@ -81,12 +150,9 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
         * the match domains and add each to the supplemental list.
         */
        for (i = 0; i < n_domains; i++) {
         * the match domains and add each to the supplemental list.
         */
        for (i = 0; i < n_domains; i++) {
-               CFIndex                 j;
                CFStringRef             match_domain;
                CFNumberRef             match_order;
                CFStringRef             match_domain;
                CFNumberRef             match_order;
-               uint32_t                match_order_val = 0;
                CFMutableDictionaryRef  match_resolver;
                CFMutableDictionaryRef  match_resolver;
-               CFIndex                 n_supplemental;
 
                match_domain = CFArrayGetValueAtIndex(domains, i);
                if (!isA_CFString(match_domain)) {
 
                match_domain = CFArrayGetValueAtIndex(domains, i);
                if (!isA_CFString(match_domain)) {
@@ -96,10 +162,21 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
                match_order = (orders != NULL) ? CFArrayGetValueAtIndex(orders, i) : NULL;
 
                match_resolver = CFDictionaryCreateMutableCopy(NULL, 0, dns);
                match_order = (orders != NULL) ? CFArrayGetValueAtIndex(orders, i) : NULL;
 
                match_resolver = CFDictionaryCreateMutableCopy(NULL, 0, dns);
+
+               // remove keys we don't want in a supplemental resolver
                CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSupplementalMatchDomains);
                CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSupplementalMatchOrders);
                CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSearchDomains);
                CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSupplementalMatchDomains);
                CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSupplementalMatchOrders);
                CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSearchDomains);
-               CFDictionarySetValue(match_resolver, kSCPropNetDNSDomainName, match_domain);
+               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSortList);
+
+               // set supplemental resolver "domain"
+               if (CFStringGetLength(match_domain) > 0) {
+                       CFDictionarySetValue(match_resolver, kSCPropNetDNSDomainName, match_domain);
+               } else {
+                       CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSDomainName);
+               }
+
+               // set supplemental resolver "search_order"
                if (isA_CFNumber(match_order)) {
                        CFDictionarySetValue(match_resolver, kSCPropNetDNSSearchOrder, match_order);
                } else if (!CFDictionaryContainsKey(match_resolver, kSCPropNetDNSSearchOrder)) {
                if (isA_CFNumber(match_order)) {
                        CFDictionarySetValue(match_resolver, kSCPropNetDNSSearchOrder, match_order);
                } else if (!CFDictionaryContainsKey(match_resolver, kSCPropNetDNSSearchOrder)) {
@@ -111,61 +188,8 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
 
                        defaultOrder++;         // if multiple domains, maintain ordering
                }
 
                        defaultOrder++;         // if multiple domains, maintain ordering
                }
-
-               match_order = CFDictionaryGetValue(match_resolver, kSCPropNetDNSSearchOrder);
-               if (!isA_CFNumber(match_order) ||
-                   !CFNumberGetValue(match_order, kCFNumberIntType, &match_order_val)) {
-                       match_order     = NULL;
-                       match_order_val = 0;
-               }
-
-               n_supplemental = CFArrayGetCount(supplemental);
-               for (j = 0; j < n_supplemental; j++) {
-                       CFMutableDictionaryRef  compare;
-                       Boolean                 match;
-                       CFDictionaryRef         supplemental_resolver;
-
-                       supplemental_resolver = CFArrayGetValueAtIndex(supplemental, j);
-                       if (CFEqual(match_resolver, supplemental_resolver)) {
-                               // a real duplicate
-                               CFRelease(match_resolver);
-                               match_resolver = NULL;
-                               break;
-                       }
-
-                       compare = CFDictionaryCreateMutableCopy(NULL, 0, supplemental_resolver);
-                       if (match_order != NULL) {
-                               CFDictionarySetValue(compare, kSCPropNetDNSSearchOrder, match_order);
-                       }
-                       match = CFEqual(match_resolver, compare);
-                       CFRelease(compare);
-
-                       if (match) {
-                               CFNumberRef     supplemental_order;
-                               uint32_t        supplemental_order_val  = 0;
-
-                               // if only the search order's are different
-                               supplemental_order = CFDictionaryGetValue(supplemental_resolver, kSCPropNetDNSSearchOrder);
-                               if (!isA_CFNumber(supplemental_order) ||
-                                   !CFNumberGetValue(supplemental_order, kCFNumberIntType, &supplemental_order_val)) {
-                                       supplemental_order_val = 0;
-                               }
-
-                               if (match_order_val < supplemental_order_val ) {
-                                       // if we should prefer this match resolver, else just skip it
-                                       CFArraySetValueAtIndex(supplemental, j, match_resolver);
-                               }
-
-                               CFRelease(match_resolver);
-                               match_resolver = NULL;
-                               break;
-                       }
-               }
-
-               if (match_resolver != NULL) {
-                       CFArrayAppendValue(supplemental, match_resolver);
-                       CFRelease(match_resolver);
-               }
+               add_resolver(supplemental, match_resolver);
+               CFRelease(match_resolver);
        }
 
        return;
        }
 
        return;
@@ -192,9 +216,9 @@ add_predefined_resolvers(CFMutableArrayRef supplemental)
                        continue;
                }
 
                        continue;
                }
 
-               defaultOrder = DEFAULT_SEARCH_ORDER +
-                              (DEFAULT_SEARCH_ORDER / 2) +
-                              ((DEFAULT_SEARCH_ORDER / 1000) * i);
+               defaultOrder = DEFAULT_SEARCH_ORDER
+                              + (DEFAULT_SEARCH_ORDER / 2)
+                              ((DEFAULT_SEARCH_ORDER / 1000) * i);
                add_supplemental(supplemental, dns, defaultOrder);
        }
 
                add_supplemental(supplemental, dns, defaultOrder);
        }
 
@@ -243,9 +267,9 @@ add_supplemental_resolvers(CFMutableArrayRef supplemental, CFDictionaryRef servi
                        continue;
                }
 
                        continue;
                }
 
-               defaultOrder = DEFAULT_SEARCH_ORDER -
-                              (DEFAULT_SEARCH_ORDER / 2) +
-                              ((DEFAULT_SEARCH_ORDER / 1000) * i);
+               defaultOrder = DEFAULT_SEARCH_ORDER
+                              - (DEFAULT_SEARCH_ORDER / 2)
+                              ((DEFAULT_SEARCH_ORDER / 1000) * i);
                if ((n_order > 0) &&
                    !CFArrayContainsValue(service_order, CFRangeMake(0, n_order), keys[i])) {
                        // push out services not specified in service order
                if ((n_order > 0) &&
                    !CFArrayContainsValue(service_order, CFRangeMake(0, n_order), keys[i])) {
                        // push out services not specified in service order
@@ -264,28 +288,85 @@ add_supplemental_resolvers(CFMutableArrayRef supplemental, CFDictionaryRef servi
 }
 
 
 }
 
 
+static void
+add_private_resolvers(CFMutableArrayRef supplemental, CFArrayRef privateResolvers)
+{
+       CFIndex i;
+       CFIndex n;
+
+       n = isA_CFArray(privateResolvers) ? CFArrayGetCount(privateResolvers) : 0;
+       for (i = 0; i < n; i++) {
+               uint32_t                defaultOrder;
+               CFStringRef             domain;
+               CFNumberRef             num;
+               CFMutableDictionaryRef  resolver;
+
+               domain = CFArrayGetValueAtIndex(privateResolvers, i);
+               if (!isA_CFString(domain) || (CFStringGetLength(domain) == 0)) {
+                       continue;
+               }
+
+               defaultOrder = DEFAULT_SEARCH_ORDER
+                              - (DEFAULT_SEARCH_ORDER / 4)
+                              + ((DEFAULT_SEARCH_ORDER / 1000) * i);
+
+               resolver = CFDictionaryCreateMutable(NULL,
+                                                    0,
+                                                    &kCFTypeDictionaryKeyCallBacks,
+                                                    &kCFTypeDictionaryValueCallBacks);
+               CFDictionarySetValue(resolver, kSCPropNetDNSDomainName, domain);
+               CFDictionarySetValue(resolver, kSCPropNetDNSOptions, CFSTR("pdns"));
+               num = CFNumberCreate(NULL, kCFNumberIntType, &defaultOrder);
+               CFDictionarySetValue(resolver, kSCPropNetDNSSearchOrder, num);
+               CFRelease(num);
+               if (S_pdns_timeout != NULL) {
+                       CFDictionarySetValue(resolver, kSCPropNetDNSServerTimeout, S_pdns_timeout);
+               }
+               add_resolver(supplemental, resolver);
+               CFRelease(resolver);
+       }
+
+       return;
+}
+
+
 static CFComparisonResult
 compareBySearchOrder(const void *val1, const void *val2, void *context)
 {
        CFDictionaryRef dns1    = (CFDictionaryRef)val1;
        CFDictionaryRef dns2    = (CFDictionaryRef)val2;
 static CFComparisonResult
 compareBySearchOrder(const void *val1, const void *val2, void *context)
 {
        CFDictionaryRef dns1    = (CFDictionaryRef)val1;
        CFDictionaryRef dns2    = (CFDictionaryRef)val2;
-       CFNumberRef     num;
+       CFNumberRef     num1;
+       CFNumberRef     num2;
        uint32_t        order1  = DEFAULT_SEARCH_ORDER;
        uint32_t        order2  = DEFAULT_SEARCH_ORDER;
 
        uint32_t        order1  = DEFAULT_SEARCH_ORDER;
        uint32_t        order2  = DEFAULT_SEARCH_ORDER;
 
-       num = CFDictionaryGetValue(dns1, kSCPropNetDNSSearchOrder);
-       if (!isA_CFNumber(num) ||
-           !CFNumberGetValue(num, kCFNumberIntType, &order1)) {
+       num1 = CFDictionaryGetValue(dns1, kSCPropNetDNSSearchOrder);
+       if (!isA_CFNumber(num1) ||
+           !CFNumberGetValue(num1, kCFNumberIntType, &order1)) {
                order1 = DEFAULT_SEARCH_ORDER;
        }
 
                order1 = DEFAULT_SEARCH_ORDER;
        }
 
-       num = CFDictionaryGetValue(dns2, kSCPropNetDNSSearchOrder);
-       if (!isA_CFNumber(num) ||
-           !CFNumberGetValue(num, kCFNumberIntType, &order2)) {
+       num2 = CFDictionaryGetValue(dns2, kSCPropNetDNSSearchOrder);
+       if (!isA_CFNumber(num2) ||
+           !CFNumberGetValue(num2, kCFNumberIntType, &order2)) {
                order2 = DEFAULT_SEARCH_ORDER;
        }
 
        if (order1 == order2) {
                order2 = DEFAULT_SEARCH_ORDER;
        }
 
        if (order1 == order2) {
+               // if same "SearchOrder", retain original orderring for configurations
+               if (CFDictionaryGetValueIfPresent(dns1, CFSTR("*ORDER*"), (const void **)&num1) &&
+                   CFDictionaryGetValueIfPresent(dns2, CFSTR("*ORDER*"), (const void **)&num2) &&
+                   isA_CFNumber(num1) &&
+                   isA_CFNumber(num2) &&
+                   CFNumberGetValue(num1, kCFNumberIntType, &order1) &&
+                   CFNumberGetValue(num2, kCFNumberIntType, &order2)) {
+                       if (order1 == order2) {
+                               return kCFCompareEqualTo;
+                       } else {
+                               return (order1 < order2) ? kCFCompareLessThan : kCFCompareGreaterThan;
+                       }
+               }
+
                return kCFCompareEqualTo;
        }
 
                return kCFCompareEqualTo;
        }
 
@@ -297,32 +378,37 @@ static CFStringRef
 trimDomain(CFStringRef domain)
 {
        CFIndex length;
 trimDomain(CFStringRef domain)
 {
        CFIndex length;
-       CFRange range;
-       Boolean trimmed = FALSE;
 
        if (!isA_CFString(domain)) {
                return NULL;
        }
 
 
        if (!isA_CFString(domain)) {
                return NULL;
        }
 
-       // remove trailing dots
+       // remove any leading/trailing dots
        length = CFStringGetLength(domain);
        length = CFStringGetLength(domain);
-       while (CFStringFindWithOptions(domain,
-                                      CFSTR("."),
-                                      CFRangeMake(0, length),
-                                      kCFCompareAnchored|kCFCompareBackwards,
-                                      &range)) {
-               trimmed = TRUE;
-               length = range.location;
+       if ((length > 0) &&
+           (CFStringFindWithOptions(domain,
+                                    CFSTR("."),
+                                    CFRangeMake(0, 1),
+                                    kCFCompareAnchored,
+                                    NULL) ||
+            CFStringFindWithOptions(domain,
+                                    CFSTR("."),
+                                    CFRangeMake(0, length),
+                                    kCFCompareAnchored|kCFCompareBackwards,
+                                    NULL))) {
+               CFMutableStringRef      trimmed;
+
+               trimmed = CFStringCreateMutableCopy(NULL, 0, domain);
+               CFStringTrim(trimmed, CFSTR("."));
+               domain = (CFStringRef)trimmed;
+               length = CFStringGetLength(domain);
+       } else {
+               CFRetain(domain);
        }
 
        if (length == 0) {
        }
 
        if (length == 0) {
-               return NULL;
-       }
-
-       if (trimmed) {
-               domain = CFStringCreateWithSubstring(NULL, domain, CFRangeMake(0, length));
-       } else {
-               CFRetain(domain);
+               CFRelease(domain);
+               domain = NULL;
        }
 
        return domain;
        }
 
        return domain;
@@ -426,11 +512,18 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
                CFDictionaryRef dns;
                CFIndex         domainIndex;
                CFNumberRef     num;
                CFDictionaryRef dns;
                CFIndex         domainIndex;
                CFNumberRef     num;
+               CFStringRef     options;
                CFStringRef     supplementalDomain;
                uint32_t        supplementalOrder;
 
                dns = CFArrayGetValueAtIndex(mySupplemental, i);
 
                CFStringRef     supplementalDomain;
                uint32_t        supplementalOrder;
 
                dns = CFArrayGetValueAtIndex(mySupplemental, i);
 
+               options = CFDictionaryGetValue(dns, kSCPropNetDNSOptions);
+               if (isA_CFString(options) && CFEqual(options, CFSTR("pdns"))) {
+                       // don't add private resolver domains to the search list
+                       continue;
+               }
+
                supplementalDomain = CFDictionaryGetValue(dns, kSCPropNetDNSDomainName);
                supplementalDomain = trimDomain(supplementalDomain);
                if (supplementalDomain == NULL) {
                supplementalDomain = CFDictionaryGetValue(dns, kSCPropNetDNSDomainName);
                supplementalDomain = trimDomain(supplementalDomain);
                if (supplementalDomain == NULL) {
@@ -505,7 +598,7 @@ create_resolver(CFDictionaryRef dns)
 
        // process domain
        str = CFDictionaryGetValue(dns, kSCPropNetDNSDomainName);
 
        // process domain
        str = CFDictionaryGetValue(dns, kSCPropNetDNSDomainName);
-       if (isA_CFString(str)) {
+       if (isA_CFString(str) && (CFStringGetLength(str) > 0)) {
                char    domain[NS_MAXDNAME];
 
                if (_SC_cfstring_to_cstring(str, domain, sizeof(domain), kCFStringEncodingUTF8) != NULL) {
                char    domain[NS_MAXDNAME];
 
                if (_SC_cfstring_to_cstring(str, domain, sizeof(domain), kCFStringEncodingUTF8) != NULL) {
@@ -522,7 +615,7 @@ create_resolver(CFDictionaryRef dns)
                // add "search" domains
                for (i = 0; i < n; i++) {
                        str = CFArrayGetValueAtIndex(list, i);
                // add "search" domains
                for (i = 0; i < n; i++) {
                        str = CFArrayGetValueAtIndex(list, i);
-                       if (isA_CFString(str)) {
+                       if (isA_CFString(str) && (CFStringGetLength(str) > 0)) {
                                char    search[NS_MAXDNAME];
 
                                if (_SC_cfstring_to_cstring(str, search, sizeof(search), kCFStringEncodingUTF8) != NULL) {
                                char    search[NS_MAXDNAME];
 
                                if (_SC_cfstring_to_cstring(str, search, sizeof(search), kCFStringEncodingUTF8) != NULL) {
@@ -629,7 +722,8 @@ __private_extern__
 void
 dns_configuration_set(CFDictionaryRef   defaultResolver,
                      CFDictionaryRef   services,
 void
 dns_configuration_set(CFDictionaryRef   defaultResolver,
                      CFDictionaryRef   services,
-                     CFArrayRef        serviceOrder)
+                     CFArrayRef        serviceOrder,
+                     CFArrayRef        privateResolvers)
 {
        CFIndex                 i;
        CFMutableDictionaryRef  myDefault;
 {
        CFIndex                 i;
        CFMutableDictionaryRef  myDefault;
@@ -690,7 +784,7 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
                CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSearchDomains);
                CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSupplementalMatchDomains);
                CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSupplementalMatchOrders);
                CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSearchDomains);
                CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSupplementalMatchDomains);
                CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSupplementalMatchOrders);
-               CFArrayAppendValue(supplemental, mySupplemental);
+               add_resolver(supplemental, mySupplemental);
                CFRelease(mySupplemental);
        }
 
                CFRelease(mySupplemental);
        }
 
@@ -698,6 +792,10 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
 
        add_supplemental_resolvers(supplemental, services, serviceOrder);
 
 
        add_supplemental_resolvers(supplemental, services, serviceOrder);
 
+       // collect (and add) any "private" resolver configurations
+
+       add_private_resolvers(supplemental, privateResolvers);
+
        // update the "search" list
 
        update_search_domains(&myDefault, supplemental);
        // update the "search" list
 
        update_search_domains(&myDefault, supplemental);
@@ -755,7 +853,7 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
                 * if no default or supplemental resolvers
                 */
                if (!_dns_configuration_store(NULL)) {
                 * if no default or supplemental resolvers
                 */
                if (!_dns_configuration_store(NULL)) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("set_dns_configuration: could not store configuration"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("dns_configuration_set: could not store configuration"));
                }
        } else {
                dns_create_config_t     _config;
                }
        } else {
                dns_create_config_t     _config;
@@ -788,7 +886,7 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
                // save configuration
 
                if (!_dns_configuration_store(&_config)) {
                // save configuration
 
                if (!_dns_configuration_store(&_config)) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("set_dns_configuration() failed: could not store configuration"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("dns_configuration_set: could not store configuration"));
                }
 
                _dns_configuration_free(&_config);
                }
 
                _dns_configuration_free(&_config);
@@ -845,7 +943,135 @@ __private_extern__
 void
 dns_configuration_init(CFBundleRef bundle)
 {
 void
 dns_configuration_init(CFBundleRef bundle)
 {
+       CFDictionaryRef dict;
+
+       dict = CFBundleGetInfoDictionary(bundle);
+       if (isA_CFDictionary(dict)) {
+               S_pdns_timeout = CFDictionaryGetValue(dict, CFSTR("pdns_timeout"));
+               S_pdns_timeout = isA_CFNumber(S_pdns_timeout);
+       }
+
        load_predefined_resolvers(bundle);
        return;
 }
 
        load_predefined_resolvers(bundle);
        return;
 }
 
+
+#ifdef MAIN
+#undef MAIN
+
+static void
+split(const void * key, const void * value, void * context)
+{
+       CFArrayRef              components;
+       CFStringRef             entity_id;
+       CFStringRef             service_id;
+       CFMutableDictionaryRef  state_dict;
+
+       components = CFStringCreateArrayBySeparatingStrings(NULL, (CFStringRef)key, CFSTR("/"));
+       service_id = CFArrayGetValueAtIndex(components, 3);
+       entity_id  = CFArrayGetValueAtIndex(components, 4);
+       state_dict = CFDictionaryCreateMutable(NULL,
+                                              0,
+                                              &kCFTypeDictionaryKeyCallBacks,
+                                              &kCFTypeDictionaryValueCallBacks);
+       CFDictionarySetValue(state_dict, entity_id, (CFDictionaryRef)value);
+       CFDictionarySetValue((CFMutableDictionaryRef)context, service_id, state_dict);
+       CFRelease(state_dict);
+       CFRelease(components);
+
+       return;
+}
+
+int
+main(int argc, char **argv)
+{
+       CFDictionaryRef         entities;
+       CFStringRef             key;
+       CFStringRef             pattern;
+       CFMutableArrayRef       patterns;
+       CFStringRef             primary         = NULL;
+       CFDictionaryRef         primaryDNS      = NULL;
+       CFArrayRef              private_resolvers;
+       CFArrayRef              service_order   = NULL;
+       CFMutableDictionaryRef  service_state_dict;
+       CFDictionaryRef         setup_global_ipv4;
+       CFDictionaryRef         state_global_ipv4;
+       SCDynamicStoreRef       store;
+
+       _sc_log     = FALSE;
+       _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("TEST"), NULL, NULL);
+
+       // get DNS entities
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetDNS);
+       patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       entities = SCDynamicStoreCopyMultiple(store, NULL, patterns);
+       CFRelease(patterns);
+
+       service_state_dict = CFDictionaryCreateMutable(NULL,
+                                                      0,
+                                                      &kCFTypeDictionaryKeyCallBacks,
+                                                      &kCFTypeDictionaryValueCallBacks);
+       CFDictionaryApplyFunction(entities, split, service_state_dict);
+       CFRelease(entities);
+
+       // get primary service ID
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetIPv4);
+       state_global_ipv4 = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+       if (state_global_ipv4 != NULL) {
+               primary = CFDictionaryGetValue(state_global_ipv4, kSCDynamicStorePropNetPrimaryService);
+               if (primary != NULL) {
+                       CFDictionaryRef service_dict;
+
+                       // get DNS configuration for primary service
+                       service_dict = CFDictionaryGetValue(service_state_dict, primary);
+                       if (service_dict != NULL) {
+                               primaryDNS = CFDictionaryGetValue(service_dict, kSCEntNetDNS);
+                       }
+               }
+       }
+
+       // get serviceOrder
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainSetup,
+                                                        kSCEntNetIPv4);
+       setup_global_ipv4 = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+       if (setup_global_ipv4 != NULL) {
+               service_order = CFDictionaryGetValue(setup_global_ipv4, kSCPropNetServiceOrder);
+       }
+
+       // get private resolvers
+       key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"),
+                                     kSCDynamicStoreDomainState,
+                                     kSCCompNetwork,
+                                     CFSTR(kDNSServiceCompPrivateDNS));
+       private_resolvers = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+
+       // update DNS configuration
+       dns_configuration_init(CFBundleGetMainBundle());
+       dns_configuration_set(primaryDNS, service_state_dict, service_order, private_resolvers);
+
+       // cleanup
+       if (setup_global_ipv4 != NULL)  CFRelease(setup_global_ipv4);
+       if (state_global_ipv4 != NULL)  CFRelease(state_global_ipv4);
+       if (private_resolvers != NULL)  CFRelease(private_resolvers);
+       CFRelease(service_state_dict);
+       CFRelease(store);
+
+       /* not reached */
+       exit(0);
+       return 0;
+}
+#endif
+
diff --git a/Plugins/IPMonitor/dns-configuration.h b/Plugins/IPMonitor/dns-configuration.h
new file mode 100644 (file)
index 0000000..7c45f53
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2006 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@
+ */
+
+#ifndef _DNS_CONFIGURATION_H
+#define _DNS_CONFIGURATION_H
+
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+__BEGIN_DECLS
+
+void   dns_configuration_init          (CFBundleRef            bundle);
+
+void   dns_configuration_set           (CFDictionaryRef        defaultResolver,
+                                        CFDictionaryRef        services,
+                                        CFArrayRef             serviceOrder,
+                                        CFArrayRef             privateResolvers);
+
+__END_DECLS
+
+#endif /* _DNS_CONFIGURATION_H */
+
index daa906522d75186060545c19527d14a9f502ad89..4999309d7c3cbd3c263a4304815c551fb4230bbb 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2007 Apple Inc.  All Rights Reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -30,7 +30,7 @@
 /*
  * Modification History
  *
 /*
  * Modification History
  *
- * July 19, 2000       Dieter Siegmund (dieter@apple.com)
+ * July 19, 2000       Dieter Siegmund (dieter@apple.com)
  * - initial revision
  *
  * November 15, 2000   Dieter Siegmund (dieter@apple.com)
  * - initial revision
  *
  * November 15, 2000   Dieter Siegmund (dieter@apple.com)
@@ -60,6 +60,9 @@
  *
  * March 22, 2004      Allan Nathanson (ajn@apple.com)
  * - create expanded DNS configuration
  *
  * March 22, 2004      Allan Nathanson (ajn@apple.com)
  * - create expanded DNS configuration
+ *
+ * June 20, 2006       Allan Nathanson (ajn@apple.com)
+ * - add SMB configuration
  */
 
 #include <stdlib.h>
  */
 
 #include <stdlib.h>
 #include <arpa/inet.h>
 #include <sys/sysctl.h>
 #include <limits.h>
 #include <arpa/inet.h>
 #include <sys/sysctl.h>
 #include <limits.h>
+#include <notify.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>     /* for SCLog() */
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>     /* for SCLog() */
-
 #include <dnsinfo.h>
 
 #include <dnsinfo.h>
 
-void load_hostname(Boolean verbose);
-void dns_configuration_init(CFBundleRef bundle);
-void dns_configuration_set(CFDictionaryRef      defaultResolver,
-                          CFDictionaryRef      services,
-                          CFArrayRef           serviceOrder);
+#include <dns_sd.h>
+#ifndef        kDNSServiceCompPrivateDNS
+#define        kDNSServiceCompPrivateDNS       "PrivateDNS"
+#endif
+
+#include "set-hostname.h"
+#include "dns-configuration.h"
+#include "smb-configuration.h"
 
 #define IP_FORMAT      "%d.%d.%d.%d"
 #define IP_CH(ip)      ((u_char *)(ip))
 #define IP_LIST(ip)    IP_CH(ip)[0],IP_CH(ip)[1],IP_CH(ip)[2],IP_CH(ip)[3]
 
 /* debug output on/off */
 
 #define IP_FORMAT      "%d.%d.%d.%d"
 #define IP_CH(ip)      ((u_char *)(ip))
 #define IP_LIST(ip)    IP_CH(ip)[0],IP_CH(ip)[1],IP_CH(ip)[2],IP_CH(ip)[3]
 
 /* debug output on/off */
-static boolean_t               S_IPMonitor_debug = FALSE;
+static boolean_t               S_IPMonitor_debug = FALSE;
 
 /* are we netbooted?  If so, don't touch the default route */
 static boolean_t               S_netboot = FALSE;
 
 
 /* are we netbooted?  If so, don't touch the default route */
 static boolean_t               S_netboot = FALSE;
 
-/* notification key indicating dns configuration has been changed */
-static CFStringRef             S_notify_dnsinfo = NULL;
-
 /* dictionary to hold per-service state: key is the serviceID */
 static CFMutableDictionaryRef  S_service_state_dict = NULL;
 
 /* if set, a PPP interface overrides the primary */
 /* dictionary to hold per-service state: key is the serviceID */
 static CFMutableDictionaryRef  S_service_state_dict = NULL;
 
 /* if set, a PPP interface overrides the primary */
-static boolean_t               S_ppp_override_primary = TRUE;
+static boolean_t               S_ppp_override_primary = FALSE;
 
 /* the current primary serviceID's */
 static CFStringRef             S_primary_ipv4 = NULL;
 static CFStringRef             S_primary_ipv6 = NULL;
 static CFStringRef             S_primary_dns = NULL;
 static CFStringRef             S_primary_proxies = NULL;
 
 /* the current primary serviceID's */
 static CFStringRef             S_primary_ipv4 = NULL;
 static CFStringRef             S_primary_ipv6 = NULL;
 static CFStringRef             S_primary_dns = NULL;
 static CFStringRef             S_primary_proxies = NULL;
+static CFStringRef             S_primary_smb = NULL;
 
 static CFStringRef             S_state_global_ipv4 = NULL;
 static CFStringRef             S_state_global_ipv6 = NULL;
 static CFStringRef             S_state_global_dns = NULL;
 
 static CFStringRef             S_state_global_ipv4 = NULL;
 static CFStringRef             S_state_global_ipv6 = NULL;
 static CFStringRef             S_state_global_dns = NULL;
-static CFStringRef             S_state_global_netinfo = NULL;
 static CFStringRef             S_state_global_proxies = NULL;
 static CFStringRef             S_state_global_proxies = NULL;
+static CFStringRef             S_state_global_smb = NULL;
 static CFStringRef             S_state_service_prefix = NULL;
 static CFStringRef             S_setup_global_ipv4 = NULL;
 static CFStringRef             S_state_service_prefix = NULL;
 static CFStringRef             S_setup_global_ipv4 = NULL;
-static CFStringRef             S_setup_global_netinfo = NULL;
 static CFStringRef             S_setup_global_proxies = NULL;
 static CFStringRef             S_setup_global_proxies = NULL;
+static CFStringRef             S_setup_global_smb = NULL;
 static CFStringRef             S_setup_service_prefix = NULL;
 
 static CFStringRef             S_setup_service_prefix = NULL;
 
+static CFStringRef             S_private_resolvers = NULL;
+
 static struct in_addr          S_router_subnet = { 0 };
 static struct in_addr          S_router_subnet_mask = { 0 };
 
 static struct in_addr          S_router_subnet = { 0 };
 static struct in_addr          S_router_subnet_mask = { 0 };
 
@@ -135,8 +141,7 @@ static const struct in6_addr        S_ip6_zeros = IN6ADDR_ANY_INIT;
 #define kRouterNeedsLocalIP    CFSTR("com.apple.IPMonitor.RouterNeedsLocalIP")
 #define kRouterIsDirect                CFSTR("com.apple.IPMonitor.IsDirect")
 
 #define kRouterNeedsLocalIP    CFSTR("com.apple.IPMonitor.RouterNeedsLocalIP")
 #define kRouterIsDirect                CFSTR("com.apple.IPMonitor.IsDirect")
 
-#define VAR_RUN_RESOLV_CONF            "/var/run/resolv.conf"
-#define VAR_RUN_NICONFIG_LOCAL_XML     "/var/run/niconfig_local.xml"
+#define VAR_RUN_RESOLV_CONF    "/var/run/resolv.conf"
 
 #ifndef KERN_NETBOOT
 #define KERN_NETBOOT           40      /* int: are we netbooted? 1=yes,0=no */
 
 #ifndef KERN_NETBOOT
 #define KERN_NETBOOT           40      /* int: are we netbooted? 1=yes,0=no */
@@ -148,11 +153,11 @@ static const struct in6_addr      S_ip6_zeros = IN6ADDR_ANY_INIT;
  **/
 #define ENTITY_TYPES_COUNT     5
 enum {
  **/
 #define ENTITY_TYPES_COUNT     5
 enum {
-    kEntityTypeIPv4    = 0,
-    kEntityTypeIPv6    = 1,
-    kEntityTypeDNS     = 2,
-    kEntityTypeNetInfo         = 3,
-    kEntityTypeProxies         = 4,
+    kEntityTypeIPv4    = 0,
+    kEntityTypeIPv6    = 1,
+    kEntityTypeDNS     = 2,
+    kEntityTypeProxies = 3,
+    kEntityTypeSMB     = 4,
 };
 typedef uint32_t       EntityType;
 
 };
 typedef uint32_t       EntityType;
 
@@ -167,8 +172,8 @@ typedef GetEntityChangesFunc * GetEntityChangesFuncRef;
 static GetEntityChangesFunc get_ipv4_changes;
 static GetEntityChangesFunc get_ipv6_changes;
 static GetEntityChangesFunc get_dns_changes;
 static GetEntityChangesFunc get_ipv4_changes;
 static GetEntityChangesFunc get_ipv6_changes;
 static GetEntityChangesFunc get_dns_changes;
-static GetEntityChangesFunc get_netinfo_changes;
 static GetEntityChangesFunc get_proxies_changes;
 static GetEntityChangesFunc get_proxies_changes;
+static GetEntityChangesFunc get_smb_changes;
 
 static void
 my_CFRelease(void * t);
 
 static void
 my_CFRelease(void * t);
@@ -179,12 +184,12 @@ my_CFArrayAppendUniqueValue(CFMutableArrayRef arr, CFTypeRef new);
 static void
 my_CFArrayRemoveValue(CFMutableArrayRef arr, CFStringRef key);
 
 static void
 my_CFArrayRemoveValue(CFMutableArrayRef arr, CFStringRef key);
 
-static GetEntityChangesFuncRef entityChangeFunc[ENTITY_TYPES_COUNT] = {
-    get_ipv4_changes,  /* 0 */
-    get_ipv6_changes,  /* 1 */
-    get_dns_changes,   /* 2 */
-    get_netinfo_changes,/* 3 */
-    get_proxies_changes,/* 4 */
+static const GetEntityChangesFuncRef entityChangeFunc[ENTITY_TYPES_COUNT] = {
+    get_ipv4_changes,  /* 0 */
+    get_ipv6_changes,  /* 1 */
+    get_dns_changes,   /* 2 */
+    get_proxies_changes,/* 3 */
+    get_smb_changes,   /* 4 */
 };
 
 /**
 };
 
 /**
@@ -247,6 +252,7 @@ keyChangeListApplyToStore(keyChangeListRef keys, SCDynamicStoreRef session)
     CFArrayRef         notify = keys->notify;
     CFArrayRef         remove = keys->remove;
     CFDictionaryRef    set = keys->set;
     CFArrayRef         notify = keys->notify;
     CFArrayRef         remove = keys->remove;
     CFDictionaryRef    set = keys->set;
+    int                        status;
 
     if (CFArrayGetCount(notify) == 0) {
        notify = NULL;
 
     if (CFArrayGetCount(notify) == 0) {
        notify = NULL;
@@ -272,6 +278,15 @@ keyChangeListApplyToStore(keyChangeListRef keys, SCDynamicStoreRef session)
        }
     }
     (void)SCDynamicStoreSetMultiple(session, set, remove, notify);
        }
     }
     (void)SCDynamicStoreSetMultiple(session, set, remove, notify);
+
+    status = notify_post("com.apple.system.config.network_change");
+    if (status == NOTIFY_STATUS_OK) {
+           SCLog(TRUE, LOG_INFO, CFSTR("network configuration changed."));
+    } else {
+       SCLog(TRUE, LOG_INFO,
+             CFSTR("IPMonitor: notify_post() failed: error=%ld"), status);
+    }
+
     return;
 }
 
     return;
 }
 
@@ -336,18 +351,6 @@ my_CFDictionaryGetDictionary(CFDictionaryRef dict, CFStringRef key)
     return (isA_CFDictionary(CFDictionaryGetValue(dict, key)));
 }
 
     return (isA_CFDictionary(CFDictionaryGetValue(dict, key)));
 }
 
-static CFDictionaryRef
-my_SCDCopy(SCDynamicStoreRef session, CFStringRef key)
-{
-    CFDictionaryRef    dict;
-
-    dict = SCDynamicStoreCopyValue(session, key);
-    if (isA_CFDictionary(dict) == NULL) {
-       my_CFRelease(&dict);
-    }
-    return dict;
-}
-
 static boolean_t
 cfstring_to_ipvx(int family, CFStringRef str, void * addr, int addr_size)
 {
 static boolean_t
 cfstring_to_ipvx(int family, CFStringRef str, void * addr, int addr_size)
 {
@@ -428,159 +431,6 @@ parse_component(CFStringRef key, CFStringRef prefix)
     return (comp);
 }
 
     return (comp);
 }
 
-static void
-append_netinfo_arrays(CFDictionaryRef dict, CFMutableArrayRef ni_addrs,
-                     CFMutableArrayRef ni_tags)
-{
-    CFArrayRef         addrs;
-    CFArrayRef         tags;
-
-    if (isA_CFDictionary(dict) == NULL)
-       return;
-
-    addrs = isA_CFArray(CFDictionaryGetValue(dict, kSCPropNetNetInfoServerAddresses));
-    tags  = isA_CFArray(CFDictionaryGetValue(dict, kSCPropNetNetInfoServerTags));
-    if (addrs && tags) {
-       CFIndex         addrs_count = CFArrayGetCount(addrs);
-       CFIndex         tags_count = CFArrayGetCount(tags);
-
-       if (addrs_count > 0) {
-           if (addrs_count == tags_count) {
-               CFArrayAppendArray(ni_addrs, addrs,
-                                  CFRangeMake(0, addrs_count));
-               CFArrayAppendArray(ni_tags, tags,
-                                  CFRangeMake(0, tags_count));
-           }
-
-       }
-
-    }
-    return;
-}
-
-static void
-append_netinfo_broadcast_addresses(CFDictionaryRef netinfo_dict,
-                                  CFDictionaryRef ipv4_dict,
-                                  CFMutableArrayRef ni_addrs,
-                                  CFMutableArrayRef ni_tags)
-{
-    CFArrayRef         addrs;
-    CFIndex            addrs_count;
-    CFIndex            i;
-    CFArrayRef         masks;
-    CFIndex            masks_count;
-    CFStringRef                tag;
-
-    tag = CFDictionaryGetValue(netinfo_dict,
-                              kSCPropNetNetInfoBroadcastServerTag);
-    tag = isA_CFString(tag);
-    if (tag == NULL) {
-       tag = kSCValNetNetInfoDefaultServerTag;
-    }
-    addrs = isA_CFArray(CFDictionaryGetValue(ipv4_dict,
-                                            kSCPropNetIPv4Addresses));
-    masks = isA_CFArray(CFDictionaryGetValue(ipv4_dict,
-                                            kSCPropNetIPv4SubnetMasks));
-    if (addrs == NULL || masks == NULL) {
-       return;
-    }
-    masks_count = CFArrayGetCount(masks);
-    addrs_count = CFArrayGetCount(addrs);
-    if (addrs_count != masks_count) {
-       return;
-    }
-
-    for (i = 0; i < addrs_count; i++) {
-       struct in_addr  addr;
-       CFStringRef     broadcast = NULL;
-       struct in_addr  mask;
-
-       if (cfstring_to_ip(CFArrayGetValueAtIndex(addrs, i), &addr)
-           && cfstring_to_ip(CFArrayGetValueAtIndex(masks, i), &mask)) {
-           struct in_addr              b;
-
-           b.s_addr = htonl(ntohl(addr.s_addr) | ~ntohl(mask.s_addr));
-           broadcast = CFStringCreateWithFormat(NULL, NULL,
-                                                CFSTR(IP_FORMAT),
-                                                IP_LIST(&b));
-           CFArrayAppendValue(ni_addrs, broadcast);
-           CFArrayAppendValue(ni_tags, tag);
-           my_CFRelease(&broadcast);
-       }
-    }
-    return;
-}
-
-static CFDictionaryRef
-make_netinfo_dict(CFDictionaryRef state_dict,
-                 CFDictionaryRef setup_dict,
-                 CFDictionaryRef ipv4_dict)
-{
-    boolean_t                  has_manual = FALSE;
-    boolean_t                  has_broadcast = FALSE;
-    boolean_t                  has_dhcp = FALSE;
-    CFIndex                    i;
-    CFArrayRef                 m = NULL;
-    CFIndex                    n;
-    CFMutableArrayRef          ni_addrs = NULL;
-    CFMutableDictionaryRef     ni_dict = NULL;
-    CFMutableArrayRef          ni_tags = NULL;
-
-    if (setup_dict == NULL || ipv4_dict == NULL) {
-       goto netinfo_done;
-    }
-    m = isA_CFArray(CFDictionaryGetValue(setup_dict,
-                                        kSCPropNetNetInfoBindingMethods));
-    if (m == NULL) {
-       goto netinfo_done;
-    }
-    ni_addrs = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-    ni_tags = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
-    /* find out which are configured */
-    n = CFArrayGetCount(m);
-    for (i = 0; i < n; i++) {
-       CFStringRef method = CFArrayGetValueAtIndex(m, i);
-
-       if (CFEqual(method,
-                   kSCValNetNetInfoBindingMethodsManual)) {
-           has_manual = TRUE;
-       }
-       else if (CFEqual(method,
-                        kSCValNetNetInfoBindingMethodsDHCP)) {
-           has_dhcp = TRUE;
-       }
-       else if (CFEqual(method,
-                        kSCValNetNetInfoBindingMethodsBroadcast)) {
-           has_broadcast = TRUE;
-       }
-    }
-    if (has_dhcp && state_dict != NULL) {
-       append_netinfo_arrays(state_dict, ni_addrs, ni_tags);
-    }
-    if (has_manual) {
-       append_netinfo_arrays(setup_dict, ni_addrs, ni_tags);
-    }
-    if (has_broadcast) {
-       append_netinfo_broadcast_addresses(setup_dict, ipv4_dict,
-                                          ni_addrs, ni_tags);
-    }
-    if (CFArrayGetCount(ni_addrs) == 0) {
-       goto netinfo_done;
-    }
-    ni_dict = CFDictionaryCreateMutable(NULL, 0,
-                                       &kCFTypeDictionaryKeyCallBacks,
-                                       &kCFTypeDictionaryValueCallBacks);
-    CFDictionarySetValue(ni_dict, kSCPropNetNetInfoServerAddresses,
-                        ni_addrs);
-    CFDictionarySetValue(ni_dict, kSCPropNetNetInfoServerTags,
-                        ni_tags);
- netinfo_done:
-    my_CFRelease(&ni_addrs);
-    my_CFRelease(&ni_tags);
-    return (ni_dict);
-}
-
 static CFMutableDictionaryRef
 service_dict_copy(CFStringRef serviceID)
 {
 static CFMutableDictionaryRef
 service_dict_copy(CFStringRef serviceID)
 {
@@ -653,6 +503,121 @@ service_dict_get(CFStringRef serviceID, CFStringRef entity)
     return (CFDictionaryGetValue(service_dict, entity));
 }
 
     return (CFDictionaryGetValue(service_dict, entity));
 }
 
+#define        ALLOW_EMTPY_STRING      1<<0
+
+static CFTypeRef
+sanitize_prop(CFTypeRef val, uint32_t flags)
+{
+    if (val != NULL) {
+       if (isA_CFString(val)) {
+           CFMutableStringRef  str;
+
+           str = CFStringCreateMutableCopy(NULL, 0, (CFStringRef)val);
+           CFStringTrimWhitespace(str);
+           if (!(flags & ALLOW_EMTPY_STRING) && (CFStringGetLength(str) == 0)) {
+               CFRelease(str);
+               str = NULL;
+           }
+           val = str;
+       } else {
+           CFRetain(val);
+       }
+    }
+
+    return val;
+}
+
+static void
+merge_array_prop(CFMutableDictionaryRef        dict,
+                CFStringRef            key,
+                CFDictionaryRef        state_dict,
+                CFDictionaryRef        setup_dict,
+                uint32_t               flags,
+                Boolean                append)
+{
+    CFMutableArrayRef  merge_prop;
+    CFArrayRef         setup_prop = NULL;
+    CFArrayRef         state_prop = NULL;
+
+    if (setup_dict != NULL) {
+       setup_prop = isA_CFArray(CFDictionaryGetValue(setup_dict, key));
+    }
+    if (state_dict != NULL) {
+       state_prop = isA_CFArray(CFDictionaryGetValue(state_dict, key));
+    }
+
+    if ((setup_prop == NULL) && (state_prop == NULL)) {
+       return;
+    }
+
+    merge_prop = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    if (setup_prop != NULL) {
+       CFIndex i;
+       CFIndex n;
+
+       n = CFArrayGetCount(setup_prop);
+       for (i = 0; i < n; i++) {
+           CFTypeRef   val;
+
+           val = CFArrayGetValueAtIndex(setup_prop, i);
+           val = sanitize_prop(val, flags);
+           if (val != NULL) {
+               CFArrayAppendValue(merge_prop, val);
+               CFRelease(val);
+           }
+       }
+    }
+    if (state_prop != NULL) {
+       CFIndex i;
+       CFIndex n;
+       CFRange setup_range     = CFRangeMake(0, CFArrayGetCount(merge_prop));
+
+       n = CFArrayGetCount(state_prop);
+       for (i = 0; i < n; i++) {
+           CFTypeRef   val;
+
+           val = CFArrayGetValueAtIndex(state_prop, i);
+           val = sanitize_prop(val, flags);
+           if (val != NULL) {
+               if (append || !CFArrayContainsValue(merge_prop, setup_range, val)) {
+                   CFArrayAppendValue(merge_prop, val);
+               }
+               CFRelease(val);
+           }
+       }
+    }
+    if (CFArrayGetCount(merge_prop) > 0) {
+       CFDictionarySetValue(dict, key, merge_prop);
+    }
+    CFRelease(merge_prop);
+    return;
+}
+
+static void
+pick_prop(CFMutableDictionaryRef       dict,
+         CFStringRef                   key,
+         CFDictionaryRef               state_dict,
+         CFDictionaryRef               setup_dict,
+         uint32_t                      flags)
+{
+       CFTypeRef       val     = NULL;
+
+       if (setup_dict != NULL) {
+           val = CFDictionaryGetValue(setup_dict, key);
+           val = sanitize_prop(val, flags);
+       }
+       if (val == NULL && state_dict != NULL) {
+           val = CFDictionaryGetValue(state_dict, key);
+           val = sanitize_prop(val, flags);
+       }
+       if (val != NULL) {
+           CFDictionarySetValue(dict, key, val);
+           CFRelease(val);
+       }
+
+       return;
+}
+
 /**
  ** GetEntityChangesFunc functions
  **/
 /**
  ** GetEntityChangesFunc functions
  **/
@@ -726,7 +691,7 @@ get_ipv4_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                     != subnet_addr(router_ip, mask).s_addr) {
                /* router is not on the same subnet */
                CFDictionarySetValue(dict, kRouterNeedsLocalIP,
                     != subnet_addr(router_ip, mask).s_addr) {
                /* router is not on the same subnet */
                CFDictionarySetValue(dict, kRouterNeedsLocalIP,
-                                    CFArrayGetValueAtIndex(addrs, 0));
+                                    kCFBooleanTrue);
            }
        }
     }
            }
        }
     }
@@ -800,56 +765,6 @@ dns_has_supplemental(CFStringRef serviceID)
     return CFDictionaryContainsKey(dns_dict, kSCPropNetDNSSupplementalMatchDomains);
 }
 
     return CFDictionaryContainsKey(dns_dict, kSCPropNetDNSSupplementalMatchDomains);
 }
 
-static void
-merge_dns_prop(CFMutableDictionaryRef dict, CFStringRef key,
-                CFDictionaryRef state_dict, CFDictionaryRef setup_dict,
-                Boolean append)
-{
-    CFArrayRef         setup_prop = NULL;
-    CFArrayRef         state_prop = NULL;
-
-    if (setup_dict != NULL) {
-       setup_prop = isA_CFArray(CFDictionaryGetValue(setup_dict, key));
-    }
-    if (state_dict != NULL) {
-       state_prop = isA_CFArray(CFDictionaryGetValue(state_dict, key));
-    }
-    if ((setup_prop != NULL) && (state_prop != NULL)) {
-       CFMutableArrayRef       merge_prop;
-
-       /* create a new list by merging the setup and state lists */
-       merge_prop = CFArrayCreateMutableCopy(NULL, 0, setup_prop);
-       if (append) {
-           CFRange state_range = CFRangeMake(0, CFArrayGetCount(state_prop));
-
-           CFArrayAppendArray(merge_prop, state_prop, state_range);
-       } else {
-           CFIndex     i;
-           CFIndex     n;
-           CFRange     setup_range = CFRangeMake(0, CFArrayGetCount(setup_prop));
-
-           n = CFArrayGetCount(state_prop);
-           for (i = 0; i < n; i++) {
-               CFTypeRef   val;
-
-               val = CFArrayGetValueAtIndex(state_prop, i);
-               if (!CFArrayContainsValue(setup_prop, setup_range, val)) {
-                   CFArrayAppendValue(merge_prop, val);
-               }
-           }
-       }
-       CFDictionarySetValue(dict, key, merge_prop);
-       my_CFRelease(&merge_prop);
-    }
-    else if (setup_prop != NULL) {
-       CFDictionarySetValue(dict, key, setup_prop);
-    }
-    else if (state_prop != NULL) {
-       CFDictionarySetValue(dict, key, state_prop);
-    }
-    return;
-}
-
 static boolean_t
 get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                CFDictionaryRef setup_dict, CFDictionaryRef info)
 static boolean_t
 get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                CFDictionaryRef setup_dict, CFDictionaryRef info)
@@ -859,32 +774,32 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
     int                                i;
     struct {
        CFStringRef     key;
     int                                i;
     struct {
        CFStringRef     key;
+       uint32_t        flags;
        Boolean         append;
     } merge_list[] = {
        Boolean         append;
     } merge_list[] = {
-       { kSCPropNetDNSSearchDomains, FALSE },
-       { kSCPropNetDNSServerAddresses, FALSE },
-       { kSCPropNetDNSSortList, FALSE },
-       { kSCPropNetDNSSupplementalMatchDomains, TRUE },
-       { kSCPropNetDNSSupplementalMatchOrders, TRUE },
-       { NULL, FALSE }
+       { kSCPropNetDNSSearchDomains,                   0,                      FALSE },
+       { kSCPropNetDNSServerAddresses,                 0,                      FALSE },
+       { kSCPropNetDNSSortList,                        0,                      FALSE },
+       { kSCPropNetDNSSupplementalMatchDomains,        ALLOW_EMTPY_STRING,     TRUE  },
+       { kSCPropNetDNSSupplementalMatchOrders,         0,                      TRUE  },
     };
     CFMutableDictionaryRef      new_dict = NULL;
     };
     CFMutableDictionaryRef      new_dict = NULL;
-    CFStringRef                        pick_list[] = {
+    CFStringRef                pick_list[] = {
        kSCPropNetDNSDomainName,
        kSCPropNetDNSOptions,
        kSCPropNetDNSSearchOrder,
        kSCPropNetDNSServerPort,
        kSCPropNetDNSServerTimeout,
        kSCPropNetDNSDomainName,
        kSCPropNetDNSOptions,
        kSCPropNetDNSSearchOrder,
        kSCPropNetDNSServerPort,
        kSCPropNetDNSServerTimeout,
-       NULL
     };
 
     };
 
-    if (state_dict == NULL && setup_dict == NULL) {
+    if ((state_dict == NULL) && (setup_dict == NULL)) {
        /* there is no DNS */
        goto done;
     }
        /* there is no DNS */
        goto done;
     }
-    if (service_dict_get(serviceID, kSCEntNetIPv4) == NULL
-       && service_dict_get(serviceID, kSCEntNetIPv6) == NULL) {
-       /* no point in remembering the DNS */
+
+    if ((service_dict_get(serviceID, kSCEntNetIPv4) == NULL) &&
+       (service_dict_get(serviceID, kSCEntNetIPv6) == NULL)) {
+       /* there is no IPv4 nor IPv6 */
        goto done;
     }
 
        goto done;
     }
 
@@ -893,26 +808,22 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
 
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
 
-    for (i = 0; merge_list[i].key != NULL; i++) {
-       merge_dns_prop(new_dict,
+    for (i = 0; i < sizeof(merge_list)/sizeof(merge_list[0]); i++) {
+       merge_array_prop(new_dict,
                         merge_list[i].key,
                         state_dict,
                         setup_dict,
                         merge_list[i].key,
                         state_dict,
                         setup_dict,
+                        merge_list[i].flags,
                         merge_list[i].append);
     }
                         merge_list[i].append);
     }
-    for (i = 0; pick_list[i]; i++) {
-       CFTypeRef       val = NULL;
-
-       if (setup_dict != NULL) {
-           val = CFDictionaryGetValue(setup_dict, pick_list[i]);
-       }
-       if (val == NULL && state_dict != NULL) {
-           val = CFDictionaryGetValue(state_dict, pick_list[i]);
-       }
-       if (val != NULL) {
-           CFDictionarySetValue(new_dict, pick_list[i], val);
-       }
+    for (i = 0; i < sizeof(pick_list)/sizeof(pick_list[0]); i++) {
+       pick_prop(new_dict,
+                 pick_list[i],
+                 state_dict,
+                 setup_dict,
+                 0);
     }
     }
+
     if (CFDictionaryGetCount(new_dict) == 0) {
        my_CFRelease(&new_dict);
        goto done;
     if (CFDictionaryGetCount(new_dict) == 0) {
        my_CFRelease(&new_dict);
        goto done;
@@ -945,42 +856,79 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
 }
 
 static boolean_t
 }
 
 static boolean_t
-get_netinfo_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
+get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                    CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
     boolean_t                  changed = FALSE;
                    CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
     boolean_t                  changed = FALSE;
-    CFDictionaryRef            global_dict;
-    CFDictionaryRef            ipv4_dict;
     CFDictionaryRef            new_dict = NULL;
 
     CFDictionaryRef            new_dict = NULL;
 
-    global_dict = my_CFDictionaryGetDictionary(info, S_setup_global_netinfo);
-    ipv4_dict = service_dict_get(serviceID, kSCEntNetIPv4);
-    new_dict = make_netinfo_dict(state_dict, global_dict, ipv4_dict);
-    changed = service_dict_set(serviceID, kSCEntNetNetInfo, new_dict);
-    my_CFRelease(&new_dict);
+    if ((service_dict_get(serviceID, kSCEntNetIPv4) == NULL) &&
+       (service_dict_get(serviceID, kSCEntNetIPv6) == NULL)) {
+       /* there is no IPv4 nor IPv6 */
+       goto done;
+    }
+    if (setup_dict != NULL) {
+       new_dict = setup_dict;
+    }
+    else {
+       new_dict = state_dict;
+    }
+ done:
+    changed = service_dict_set(serviceID, kSCEntNetProxies, new_dict);
     return (changed);
 }
 
 static boolean_t
     return (changed);
 }
 
 static boolean_t
-get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
-                   CFDictionaryRef setup_dict, CFDictionaryRef info)
+get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
+               CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
     boolean_t                  changed = FALSE;
 {
     boolean_t                  changed = FALSE;
-    CFDictionaryRef            new_dict = NULL;
+    int                                i;
+    CFMutableDictionaryRef      new_dict = NULL;
+    CFStringRef                        pick_list[] = {
+       kSCPropNetSMBNetBIOSName,
+       kSCPropNetSMBNetBIOSNodeType,
+       kSCPropNetSMBNetBIOSScope,
+       kSCPropNetSMBWorkgroup,
+    };
 
 
-    if (service_dict_get(serviceID, kSCEntNetIPv4) == NULL
-       && service_dict_get(serviceID, kSCEntNetIPv6) == NULL) {
-       /* no point in remembering the Proxies */
+    if (service_dict_get(serviceID, kSCEntNetIPv4) == NULL) {
+       /* there is no IPv4 */
        goto done;
     }
        goto done;
     }
-    if (setup_dict != NULL) {
-       new_dict = setup_dict;
+
+    if (state_dict == NULL && setup_dict == NULL) {
+       /* there is no SMB */
+       goto done;
     }
     }
-    else {
-       new_dict = state_dict;
+
+    // merge SMB configuration
+    new_dict = CFDictionaryCreateMutable(NULL, 0,
+                                        &kCFTypeDictionaryKeyCallBacks,
+                                        &kCFTypeDictionaryValueCallBacks);
+
+    merge_array_prop(new_dict,
+                    kSCPropNetSMBWINSAddresses,
+                    state_dict,
+                    setup_dict,
+                    0,
+                    FALSE);
+    for (i = 0; i < sizeof(pick_list)/sizeof(pick_list[0]); i++) {
+       pick_prop(new_dict,
+                 pick_list[i],
+                 state_dict,
+                 setup_dict,
+                 0);
     }
     }
+
+    if (CFDictionaryGetCount(new_dict) == 0) {
+       my_CFRelease(&new_dict);
+       goto done;
+    }
+
  done:
  done:
-    changed = service_dict_set(serviceID, kSCEntNetProxies, new_dict);
+    changed = service_dict_set(serviceID, kSCEntNetSMB, new_dict);
+    my_CFRelease(&new_dict);
     return (changed);
 }
 
     return (changed);
 }
 
@@ -1014,9 +962,10 @@ services_info_copy(SCDynamicStoreRef session, CFArrayRef service_list)
     count = CFArrayGetCount(service_list);
     get_keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
     count = CFArrayGetCount(service_list);
     get_keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
-    CFArrayAppendValue(get_keys, S_setup_global_netinfo);
-    CFArrayAppendValue(get_keys, S_setup_global_proxies);
     CFArrayAppendValue(get_keys, S_setup_global_ipv4);
     CFArrayAppendValue(get_keys, S_setup_global_ipv4);
+    CFArrayAppendValue(get_keys, S_setup_global_proxies);
+    CFArrayAppendValue(get_keys, S_setup_global_smb);
+    CFArrayAppendValue(get_keys, S_private_resolvers);
 
     for (s = 0; s < count; s++) {
        CFStringRef     serviceID = CFArrayGetValueAtIndex(service_list, s);
 
     for (s = 0; s < count; s++) {
        CFStringRef     serviceID = CFArrayGetValueAtIndex(service_list, s);
@@ -1065,29 +1014,31 @@ get_service_state_entity(CFDictionaryRef service_info, CFStringRef serviceID,
     return (state_dict);
 }
 
     return (state_dict);
 }
 
-static int                     rtm_seq = 0;
+static int                     rtm_seq = 0;
 
 static boolean_t
 ipv4_route(int cmd, struct in_addr gateway, struct in_addr netaddr,
 
 static boolean_t
 ipv4_route(int cmd, struct in_addr gateway, struct in_addr netaddr,
-          struct in_addr netmask, char * ifname, boolean_t is_direct)
+          struct in_addr netmask, char * ifname, struct in_addr ifa,
+          boolean_t is_direct)
 {
     boolean_t                  default_route = (netaddr.s_addr == 0);
 {
     boolean_t                  default_route = (netaddr.s_addr == 0);
-    int                        len;
+    int                                len;
     boolean_t                  ret = TRUE;
     struct {
        struct rt_msghdr        hdr;
        struct sockaddr_in      dst;
        struct sockaddr_in      gway;
        struct sockaddr_in      mask;
     boolean_t                  ret = TRUE;
     struct {
        struct rt_msghdr        hdr;
        struct sockaddr_in      dst;
        struct sockaddr_in      gway;
        struct sockaddr_in      mask;
-       struct sockaddr_dl      link;
-    }                          rtmsg;
-    int                        sockfd = -1;
+       struct sockaddr_dl      ifp;
+       struct sockaddr_in      ifa;
+    }                          rtmsg;
+    int                                sockfd = -1;
 
     if (default_route && S_netboot) {
        return (TRUE);
     }
 
 
     if (default_route && S_netboot) {
        return (TRUE);
     }
 
-    if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
+    if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
        SCLog(TRUE, LOG_INFO,
              CFSTR("IPMonitor: ipv4_route: open routing socket failed, %s"),
              strerror(errno));
        SCLog(TRUE, LOG_INFO,
              CFSTR("IPMonitor: ipv4_route: open routing socket failed, %s"),
              strerror(errno));
@@ -1123,18 +1074,23 @@ ipv4_route(int cmd, struct in_addr gateway, struct in_addr netaddr,
 
     len = sizeof(rtmsg);
     if (ifname) {
 
     len = sizeof(rtmsg);
     if (ifname) {
-       rtmsg.link.sdl_len = sizeof(rtmsg.link);
-       rtmsg.link.sdl_family = AF_LINK;
-       rtmsg.link.sdl_nlen = strlen(ifname);
-       rtmsg.hdr.rtm_addrs |= RTA_IFP;
-       bcopy(ifname, rtmsg.link.sdl_data, rtmsg.link.sdl_nlen);
+       rtmsg.hdr.rtm_addrs |= RTA_IFP | RTA_IFA;
+       /* copy the interface name */
+       rtmsg.ifp.sdl_len = sizeof(rtmsg.ifp);
+       rtmsg.ifp.sdl_family = AF_LINK;
+       rtmsg.ifp.sdl_nlen = strlen(ifname);
+       bcopy(ifname, rtmsg.ifp.sdl_data, rtmsg.ifp.sdl_nlen);
+       /* and the interface address */
+       rtmsg.ifa.sin_len = sizeof(rtmsg.ifa);
+       rtmsg.ifa.sin_family = AF_INET;
+       rtmsg.ifa.sin_addr = ifa;
     }
     else {
     }
     else {
-       /* no link information */
-       len -= sizeof(rtmsg.link);
+       /* no ifp/ifa information */
+       len -= sizeof(rtmsg.ifp) + sizeof(rtmsg.ifa);
     }
     rtmsg.hdr.rtm_msglen = len;
     }
     rtmsg.hdr.rtm_msglen = len;
-    if (write(sockfd, &rtmsg, len) < 0) {
+    if (write(sockfd, &rtmsg, len) == -1) {
        if ((cmd == RTM_ADD) && (errno == EEXIST)) {
            /* no sense complaining about a route that already exists */
        }
        if ((cmd == RTM_ADD) && (errno == EEXIST)) {
            /* no sense complaining about a route that already exists */
        }
@@ -1158,16 +1114,16 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr,
           struct in6_addr netmask, char * ifname, boolean_t is_direct)
 {
     boolean_t                  default_route;
           struct in6_addr netmask, char * ifname, boolean_t is_direct)
 {
     boolean_t                  default_route;
-    int                        len;
+    int                                len;
     boolean_t                  ret = TRUE;
     struct {
        struct rt_msghdr        hdr;
        struct sockaddr_in6     dst;
        struct sockaddr_in6     gway;
        struct sockaddr_in6     mask;
     boolean_t                  ret = TRUE;
     struct {
        struct rt_msghdr        hdr;
        struct sockaddr_in6     dst;
        struct sockaddr_in6     gway;
        struct sockaddr_in6     mask;
-       struct sockaddr_dl      link;
-    }                          rtmsg;
-    int                        sockfd = -1;
+       struct sockaddr_dl      ifp;
+    }                          rtmsg;
+    int                                sockfd = -1;
     struct in6_addr            zeroes = IN6ADDR_ANY_INIT;
 
     default_route = (bcmp(&zeroes, &netaddr, sizeof(netaddr)) == 0);
     struct in6_addr            zeroes = IN6ADDR_ANY_INIT;
 
     default_route = (bcmp(&zeroes, &netaddr, sizeof(netaddr)) == 0);
@@ -1178,7 +1134,7 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr,
        /* add the scope id to the link local address */
        gateway.__u6_addr.__u6_addr16[1] = (uint16_t)htons(index);
     }
        /* add the scope id to the link local address */
        gateway.__u6_addr.__u6_addr16[1] = (uint16_t)htons(index);
     }
-    if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
+    if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
        SCLog(TRUE, LOG_INFO,
              CFSTR("IPMonitor ipv6_route: open routing socket failed, %s"),
              strerror(errno));
        SCLog(TRUE, LOG_INFO,
              CFSTR("IPMonitor ipv6_route: open routing socket failed, %s"),
              strerror(errno));
@@ -1213,18 +1169,18 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr,
 
     len = sizeof(rtmsg);
     if (ifname) {
 
     len = sizeof(rtmsg);
     if (ifname) {
-       rtmsg.link.sdl_len = sizeof(rtmsg.link);
-       rtmsg.link.sdl_family = AF_LINK;
-       rtmsg.link.sdl_nlen = strlen(ifname);
+       rtmsg.ifp.sdl_len = sizeof(rtmsg.ifp);
+       rtmsg.ifp.sdl_family = AF_LINK;
+       rtmsg.ifp.sdl_nlen = strlen(ifname);
        rtmsg.hdr.rtm_addrs |= RTA_IFP;
        rtmsg.hdr.rtm_addrs |= RTA_IFP;
-       bcopy(ifname, rtmsg.link.sdl_data, rtmsg.link.sdl_nlen);
+       bcopy(ifname, rtmsg.ifp.sdl_data, rtmsg.ifp.sdl_nlen);
     }
     else {
     }
     else {
-       /* no link information */
-       len -= sizeof(rtmsg.link);
+       /* no ifp information */
+       len -= sizeof(rtmsg.ifp);
     }
     rtmsg.hdr.rtm_msglen = len;
     }
     rtmsg.hdr.rtm_msglen = len;
-    if (write(sockfd, &rtmsg, len) < 0) {
+    if (write(sockfd, &rtmsg, len) == -1) {
        if ((cmd == RTM_ADD) && (errno == EEXIST)) {
            /* no sense complaining about a route that already exists */
        }
        if ((cmd == RTM_ADD) && (errno == EEXIST)) {
            /* no sense complaining about a route that already exists */
        }
@@ -1253,7 +1209,8 @@ ipv4_subnet_route_add(struct in_addr local_ip,
                    IP_FORMAT " -netmask %s interface %s"),
              IP_LIST(&subnet), inet_ntoa(mask), ifname);
     }
                    IP_FORMAT " -netmask %s interface %s"),
              IP_LIST(&subnet), inet_ntoa(mask), ifname);
     }
-    return (ipv4_route(RTM_ADD, local_ip, subnet, mask, ifname, FALSE));
+    return (ipv4_route(RTM_ADD, local_ip, subnet, mask, ifname, local_ip,
+                      FALSE));
 }
 
 static boolean_t
 }
 
 static boolean_t
@@ -1265,7 +1222,8 @@ ipv4_subnet_route_delete(struct in_addr subnet, struct in_addr mask)
                    IP_FORMAT " %s"),
              IP_LIST(&subnet), inet_ntoa(mask));
     }
                    IP_FORMAT " %s"),
              IP_LIST(&subnet), inet_ntoa(mask));
     }
-    return (ipv4_route(RTM_DELETE, S_ip_zeros, subnet, mask, NULL, FALSE));
+    return (ipv4_route(RTM_DELETE, S_ip_zeros, subnet, mask, NULL,
+                      S_ip_zeros, FALSE));
 }
 
 
 }
 
 
@@ -1275,12 +1233,13 @@ ipv4_default_route_delete(void)
     if (S_IPMonitor_debug) {
        SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: IPv4 route delete default"));
     }
     if (S_IPMonitor_debug) {
        SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: IPv4 route delete default"));
     }
-    return (ipv4_route(RTM_DELETE, S_ip_zeros, S_ip_zeros, S_ip_zeros, NULL, FALSE));
+    return (ipv4_route(RTM_DELETE, S_ip_zeros, S_ip_zeros, S_ip_zeros, NULL,
+                      S_ip_zeros, FALSE));
 }
 
 static boolean_t
 ipv4_default_route_add(struct in_addr router, char * ifname,
 }
 
 static boolean_t
 ipv4_default_route_add(struct in_addr router, char * ifname,
-                      boolean_t is_direct)
+                      struct in_addr local_ip, boolean_t is_direct)
 {
     if (S_IPMonitor_debug) {
        SCLog(TRUE, LOG_INFO,
 {
     if (S_IPMonitor_debug) {
        SCLog(TRUE, LOG_INFO,
@@ -1288,12 +1247,13 @@ ipv4_default_route_add(struct in_addr router, char * ifname,
                    " %s interface %s direct %d"),
              inet_ntoa(router), ifname, is_direct);
     }
                    " %s interface %s direct %d"),
              inet_ntoa(router), ifname, is_direct);
     }
-    return (ipv4_route(RTM_ADD, router, S_ip_zeros, S_ip_zeros, ifname, is_direct));
+    return (ipv4_route(RTM_ADD, router, S_ip_zeros, S_ip_zeros, ifname,
+                      local_ip, is_direct));
 }
 
 static boolean_t
 ipv4_default_route_change(struct in_addr router, char * ifname,
 }
 
 static boolean_t
 ipv4_default_route_change(struct in_addr router, char * ifname,
-                         boolean_t is_direct)
+                         struct in_addr local_ip, boolean_t is_direct)
 {
     if (S_IPMonitor_debug) {
        SCLog(TRUE, LOG_INFO,
 {
     if (S_IPMonitor_debug) {
        SCLog(TRUE, LOG_INFO,
@@ -1302,7 +1262,7 @@ ipv4_default_route_change(struct in_addr router, char * ifname,
              inet_ntoa(router), ifname, is_direct);
     }
     return (ipv4_route(RTM_CHANGE, router, S_ip_zeros, S_ip_zeros, ifname,
              inet_ntoa(router), ifname, is_direct);
     }
     return (ipv4_route(RTM_CHANGE, router, S_ip_zeros, S_ip_zeros, ifname,
-                      is_direct));
+                      local_ip, is_direct));
 }
 
 static boolean_t
 }
 
 static boolean_t
@@ -1340,7 +1300,8 @@ multicast_route_delete()
     struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) };
     struct in_addr netmask = { htonl(IN_CLASSD_NET) };
 
     struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) };
     struct in_addr netmask = { htonl(IN_CLASSD_NET) };
 
-    return (ipv4_route(RTM_DELETE, gateway, netaddr, netmask, "lo0", FALSE));
+    return (ipv4_route(RTM_DELETE, gateway, netaddr, netmask, "lo0",
+                      gateway, FALSE));
 }
 
 static boolean_t
 }
 
 static boolean_t
@@ -1350,11 +1311,13 @@ multicast_route_add()
     struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) };
     struct in_addr netmask = { htonl(IN_CLASSD_NET) };
 
     struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) };
     struct in_addr netmask = { htonl(IN_CLASSD_NET) };
 
-    return (ipv4_route(RTM_ADD, gateway, netaddr, netmask, "lo0", FALSE));
+    return (ipv4_route(RTM_ADD, gateway, netaddr, netmask, "lo0",
+                      gateway, FALSE));
 }
 
 static void
 }
 
 static void
-set_ipv4_router(struct in_addr * router, char * ifname, boolean_t is_direct)
+set_ipv4_router(struct in_addr * router, char * ifname,
+               struct in_addr * local_ip, boolean_t is_direct)
 {
     if (S_router_subnet.s_addr != 0) {
        ipv4_subnet_route_delete(S_router_subnet, S_router_subnet_mask);
 {
     if (S_router_subnet.s_addr != 0) {
        ipv4_subnet_route_delete(S_router_subnet, S_router_subnet_mask);
@@ -1363,7 +1326,10 @@ set_ipv4_router(struct in_addr * router, char * ifname, boolean_t is_direct)
     /* assign the new default route, ensure local multicast route available */
     (void)ipv4_default_route_delete();
     if (router != NULL) {
     /* assign the new default route, ensure local multicast route available */
     (void)ipv4_default_route_delete();
     if (router != NULL) {
-       (void)ipv4_default_route_add(*router, ifname, is_direct);
+       (void)ipv4_default_route_add(*router, ifname,
+                                    (local_ip != NULL)
+                                    ? *local_ip : S_ip_zeros,
+                                    is_direct);
        (void)multicast_route_delete();
     }
     else {
        (void)multicast_route_delete();
     }
     else {
@@ -1390,19 +1356,6 @@ empty_dns()
     (void)unlink(VAR_RUN_RESOLV_CONF);
 }
 
     (void)unlink(VAR_RUN_RESOLV_CONF);
 }
 
-static void
-empty_netinfo(SCDynamicStoreRef session)
-{
-    int fd = open(VAR_RUN_NICONFIG_LOCAL_XML "-",
-                 O_CREAT|O_TRUNC|O_WRONLY, 0644);
-    if (fd >= 0) {
-       close(fd);
-       rename(VAR_RUN_NICONFIG_LOCAL_XML "-", VAR_RUN_NICONFIG_LOCAL_XML);
-    }
-
-    return;
-}
-
 static void
 set_dns(CFArrayRef val_search_domains,
        CFStringRef val_domain_name,
 static void
 set_dns(CFArrayRef val_search_domains,
        CFStringRef val_domain_name,
@@ -1466,31 +1419,10 @@ set_dns(CFArrayRef val_search_domains,
     return;
 }
 
     return;
 }
 
-static void
-set_netinfo(CFDictionaryRef dict)
-{
-    int fd = open(VAR_RUN_NICONFIG_LOCAL_XML "-",
-                 O_CREAT|O_TRUNC|O_WRONLY, 0644);
-    if (fd >= 0) {
-       /* publish new netinfo config */
-       CFDataRef       contents;
-       contents = CFPropertyListCreateXMLData(NULL, dict);
-       if (contents) {
-           CFIndex     len = CFDataGetLength(contents);
-
-           write(fd, CFDataGetBytePtr(contents), len);
-           CFRelease(contents);
-       }
-       close(fd);
-       rename(VAR_RUN_NICONFIG_LOCAL_XML "-", VAR_RUN_NICONFIG_LOCAL_XML);
-    }
-    return;
-}
-
 static boolean_t
 router_is_our_ipv6_address(CFStringRef router, CFArrayRef addr_list)
 {
 static boolean_t
 router_is_our_ipv6_address(CFStringRef router, CFArrayRef addr_list)
 {
-    CFIndex            i;
+    CFIndex            i;
     CFIndex            n = CFArrayGetCount(addr_list);
     struct in6_addr    r;
 
     CFIndex            n = CFArrayGetCount(addr_list);
     struct in6_addr    r;
 
@@ -1507,13 +1439,14 @@ router_is_our_ipv6_address(CFStringRef router, CFArrayRef addr_list)
 }
 
 static void
 }
 
 static void
-update_ipv4(SCDynamicStoreRef session, CFDictionaryRef service_info,
-           CFStringRef primary, keyChangeListRef keys)
+update_ipv4(CFDictionaryRef    service_info,
+           CFStringRef         primary,
+           keyChangeListRef    keys)
 {
     CFDictionaryRef    ipv4_dict = NULL;
 
     if (primary != NULL) {
 {
     CFDictionaryRef    ipv4_dict = NULL;
 
     if (primary != NULL) {
-       CFDictionaryRef         service_dict;
+       CFDictionaryRef service_dict;
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
@@ -1521,18 +1454,25 @@ update_ipv4(SCDynamicStoreRef session, CFDictionaryRef service_info,
        }
     }
     if (ipv4_dict != NULL) {
        }
     }
     if (ipv4_dict != NULL) {
-       CFMutableDictionaryRef  dict = NULL;
+       CFMutableDictionaryRef  dict = NULL;
        CFStringRef             if_name = NULL;
        char                    ifn[IFNAMSIZ + 1] = { '\0' };
        char *                  ifn_p = NULL;
        boolean_t               is_direct = FALSE;
        struct in_addr          local_ip = { 0 };
        CFStringRef             if_name = NULL;
        char                    ifn[IFNAMSIZ + 1] = { '\0' };
        char *                  ifn_p = NULL;
        boolean_t               is_direct = FALSE;
        struct in_addr          local_ip = { 0 };
-       CFStringRef             val_router = NULL;
+       CFStringRef             local_ip_cf;
+       CFArrayRef              local_ip_list;
+       boolean_t               needs_local_ip = FALSE;
        struct in_addr          router = { 0 };
        struct in_addr          router = { 0 };
+       CFStringRef             val_router = NULL;
 
        dict = CFDictionaryCreateMutable(NULL, 0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
 
        dict = CFDictionaryCreateMutable(NULL, 0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
+       local_ip_list = CFDictionaryGetValue(ipv4_dict,
+                                            kSCPropNetIPv4Addresses);
+       local_ip_cf = CFArrayGetValueAtIndex(local_ip_list, 0);
+       cfstring_to_ip(local_ip_cf, &local_ip);
        val_router = CFDictionaryGetValue(ipv4_dict, kSCPropNetIPv4Router);
        if (val_router != NULL) {
            cfstring_to_ip(val_router, &router);
        val_router = CFDictionaryGetValue(ipv4_dict, kSCPropNetIPv4Router);
        if (val_router != NULL) {
            cfstring_to_ip(val_router, &router);
@@ -1540,24 +1480,13 @@ update_ipv4(SCDynamicStoreRef session, CFDictionaryRef service_info,
            if (CFDictionaryContainsKey(ipv4_dict, kRouterIsDirect)) {
                is_direct = TRUE;
            }
            if (CFDictionaryContainsKey(ipv4_dict, kRouterIsDirect)) {
                is_direct = TRUE;
            }
-           else {
-               CFStringRef             local_ip_str;
-
-               local_ip_str = CFDictionaryGetValue(ipv4_dict,
-                                                   kRouterNeedsLocalIP);
-               if (local_ip_str != NULL) {
-                   cfstring_to_ip(local_ip_str, &local_ip);
-               }
+           else if (CFDictionaryContainsKey(ipv4_dict, kRouterNeedsLocalIP)) {
+               needs_local_ip = TRUE;
            }
        }
        else {
            }
        }
        else {
-           CFArrayRef          addrs;
-
-           addrs = CFDictionaryGetValue(ipv4_dict,
-                                        kSCPropNetIPv4Addresses);
-           val_router = CFArrayGetValueAtIndex(addrs, 0);
-           cfstring_to_ip(val_router, &router);
            is_direct = TRUE;
            is_direct = TRUE;
+           router = local_ip;
        }
        if_name = CFDictionaryGetValue(ipv4_dict, kSCPropInterfaceName);
        if (if_name) {
        }
        if_name = CFDictionaryGetValue(ipv4_dict, kSCPropInterfaceName);
        if (if_name) {
@@ -1575,35 +1504,36 @@ update_ipv4(SCDynamicStoreRef session, CFDictionaryRef service_info,
        CFRelease(dict);
 
        /* route add default ... */
        CFRelease(dict);
 
        /* route add default ... */
-       if (local_ip.s_addr != 0) {
+       if (needs_local_ip) {
            struct in_addr      m;
 
            m.s_addr = htonl(INADDR_BROADCAST);
            ipv4_subnet_route_add(local_ip, router, m, ifn_p);
            struct in_addr      m;
 
            m.s_addr = htonl(INADDR_BROADCAST);
            ipv4_subnet_route_add(local_ip, router, m, ifn_p);
-           set_ipv4_router(&local_ip, ifn_p, FALSE);
-           ipv4_default_route_change(router, ifn_p, FALSE);
+           set_ipv4_router(&local_ip, ifn_p, &local_ip, FALSE);
+           ipv4_default_route_change(router, ifn_p, local_ip, FALSE);
            S_router_subnet = router;
            S_router_subnet_mask = m;
        }
        else {
            S_router_subnet = router;
            S_router_subnet_mask = m;
        }
        else {
-           set_ipv4_router(&router, ifn_p, is_direct);
+           set_ipv4_router(&router, ifn_p, &local_ip, is_direct);
        }
     }
     else {
        keyChangeListRemoveValue(keys, S_state_global_ipv4);
        }
     }
     else {
        keyChangeListRemoveValue(keys, S_state_global_ipv4);
-       set_ipv4_router(NULL, NULL, FALSE);
+       set_ipv4_router(NULL, NULL, NULL, FALSE);
     }
     return;
 }
 
 static void
     }
     return;
 }
 
 static void
-update_ipv6(SCDynamicStoreRef session, CFDictionaryRef service_info,
-           CFStringRef primary, keyChangeListRef keys)
+update_ipv6(CFDictionaryRef    service_info,
+           CFStringRef         primary,
+           keyChangeListRef    keys)
 {
     CFDictionaryRef    ipv6_dict = NULL;
 
     if (primary != NULL) {
 {
     CFDictionaryRef    ipv6_dict = NULL;
 
     if (primary != NULL) {
-       CFDictionaryRef         service_dict;
+       CFDictionaryRef service_dict;
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
@@ -1611,8 +1541,8 @@ update_ipv6(SCDynamicStoreRef session, CFDictionaryRef service_info,
        }
     }
     if (ipv6_dict != NULL) {
        }
     }
     if (ipv6_dict != NULL) {
-       CFArrayRef              addrs;
-       CFMutableDictionaryRef  dict = NULL;
+       CFArrayRef              addrs;
+       CFMutableDictionaryRef  dict = NULL;
        CFStringRef             if_name = NULL;
        char                    ifn[IFNAMSIZ + 1] = { '\0' };
        char *                  ifn_p = NULL;
        CFStringRef             if_name = NULL;
        char                    ifn[IFNAMSIZ + 1] = { '\0' };
        char *                  ifn_p = NULL;
@@ -1665,13 +1595,14 @@ update_ipv6(SCDynamicStoreRef session, CFDictionaryRef service_info,
 }
 
 static void
 }
 
 static void
-update_dns(SCDynamicStoreRef session, CFDictionaryRef service_info,
-          CFStringRef primary, keyChangeListRef keys)
+update_dns(CFDictionaryRef     service_info,
+          CFStringRef          primary,
+          keyChangeListRef     keys)
 {
 {
-    CFDictionaryRef            dict = NULL;
+    CFDictionaryRef    dict = NULL;
 
     if (primary != NULL) {
 
     if (primary != NULL) {
-       CFDictionaryRef         service_dict;
+       CFDictionaryRef service_dict;
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
@@ -1693,92 +1624,86 @@ update_dns(SCDynamicStoreRef session, CFDictionaryRef service_info,
 }
 
 static void
 }
 
 static void
-update_dnsinfo(CFStringRef primary, CFArrayRef service_order, keyChangeListRef keys)
+update_dnsinfo(CFDictionaryRef service_info,
+              CFStringRef      primary,
+              keyChangeListRef keys,
+              CFArrayRef       service_order)
 {
 {
-    CFDictionaryRef            dict = NULL;
+    CFArrayRef privateResolvers;
+
+    privateResolvers = CFDictionaryGetValue(service_info, S_private_resolvers);
 
     if (primary == NULL) {
 
     if (primary == NULL) {
-       dns_configuration_set(NULL, NULL, NULL);
+       dns_configuration_set(NULL, NULL, NULL, privateResolvers);
     } else {
     } else {
-       CFDictionaryRef         service_dict;
+       CFDictionaryRef dict            = NULL;
+       CFDictionaryRef service_dict;
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
            dict = CFDictionaryGetValue(service_dict, kSCEntNetDNS);
        }
 
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
            dict = CFDictionaryGetValue(service_dict, kSCEntNetDNS);
        }
 
-       dns_configuration_set(dict, S_service_state_dict, service_order);
+       dns_configuration_set(dict, S_service_state_dict, service_order, privateResolvers);
     }
     }
-    keyChangeListNotifyKey(keys, S_notify_dnsinfo);
+    keyChangeListNotifyKey(keys, S_state_global_dns);
     return;
 }
 
 static void
     return;
 }
 
 static void
-update_netinfo(SCDynamicStoreRef session, CFDictionaryRef service_info,
-              CFStringRef primary, keyChangeListRef keys)
+update_proxies(CFDictionaryRef service_info,
+              CFStringRef      primary,
+              keyChangeListRef keys)
 {
     CFDictionaryRef    dict = NULL;
 
     if (primary != NULL) {
 {
     CFDictionaryRef    dict = NULL;
 
     if (primary != NULL) {
-       CFDictionaryRef         ipv4_dict = NULL;
-       CFDictionaryRef         service_dict;
-       CFDictionaryRef         setup_dict;
-       CFStringRef             state_key;
-       CFDictionaryRef         state_dict;
+       CFDictionaryRef service_dict;
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
-           ipv4_dict = CFDictionaryGetValue(service_dict, kSCEntNetIPv4);
-       }
-       state_key = state_service_key(primary, kSCEntNetNetInfo);
-       state_dict = my_CFDictionaryGetDictionary(service_info, state_key);
-       if (state_dict != NULL) {
-           CFRetain(state_dict);
-       }
-       else {
-           state_dict = my_SCDCopy(session, state_key);
+           dict = CFDictionaryGetValue(service_dict, kSCEntNetProxies);
+           if (dict == NULL) {
+               dict = my_CFDictionaryGetDictionary(service_info,
+                                                   S_setup_global_proxies);
+           }
        }
        }
-       setup_dict = my_CFDictionaryGetDictionary(service_info,
-                                                 S_setup_global_netinfo);
-       dict = make_netinfo_dict(state_dict, setup_dict, ipv4_dict);
-       my_CFRelease(&state_key);
-       my_CFRelease(&state_dict);
     }
     if (dict == NULL) {
     }
     if (dict == NULL) {
-       empty_netinfo(session);
-       keyChangeListRemoveValue(keys, S_state_global_netinfo);
+       keyChangeListRemoveValue(keys, S_state_global_proxies);
     }
     else {
     }
     else {
-       set_netinfo(dict);
-       keyChangeListSetValue(keys, S_state_global_netinfo, dict);
-       my_CFRelease(&dict);
+       keyChangeListSetValue(keys, S_state_global_proxies, dict);
     }
     return;
 }
 
 static void
     }
     return;
 }
 
 static void
-update_proxies(SCDynamicStoreRef session, CFDictionaryRef service_info,
-              CFStringRef primary, keyChangeListRef keys)
+update_smb(CFDictionaryRef     service_info,
+          CFStringRef          primary,
+          keyChangeListRef     keys)
 {
 {
-    CFDictionaryRef            dict = NULL;
+    CFDictionaryRef    dict    = NULL;
 
     if (primary != NULL) {
 
     if (primary != NULL) {
-       CFDictionaryRef                 service_dict;
+       CFDictionaryRef service_dict;
+
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
-           dict = CFDictionaryGetValue(service_dict, kSCEntNetProxies);
+           dict = CFDictionaryGetValue(service_dict, kSCEntNetSMB);
            if (dict == NULL) {
                dict = my_CFDictionaryGetDictionary(service_info,
            if (dict == NULL) {
                dict = my_CFDictionaryGetDictionary(service_info,
-                                                   S_setup_global_proxies);
+                                                   S_setup_global_smb);
            }
        }
     }
     if (dict == NULL) {
            }
        }
     }
     if (dict == NULL) {
-       keyChangeListRemoveValue(keys, S_state_global_proxies);
+       keyChangeListRemoveValue(keys, S_state_global_smb);
     }
     else {
     }
     else {
-       keyChangeListSetValue(keys, S_state_global_proxies, dict);
+       keyChangeListSetValue(keys, S_state_global_smb, dict);
     }
     }
+
     return;
 }
 
     return;
 }
 
@@ -1786,7 +1711,7 @@ static unsigned int
 get_service_rank(CFStringRef proto_key, CFArrayRef order, CFStringRef serviceID)
 {
     CFDictionaryRef    d;
 get_service_rank(CFStringRef proto_key, CFArrayRef order, CFStringRef serviceID)
 {
     CFDictionaryRef    d;
-    CFIndex            i;
+    CFIndex            i;
     CFDictionaryRef    proto_dict;
 
     if (serviceID == NULL) {
     CFDictionaryRef    proto_dict;
 
     if (serviceID == NULL) {
@@ -1800,7 +1725,7 @@ get_service_rank(CFStringRef proto_key, CFArrayRef order, CFStringRef serviceID)
     proto_dict = CFDictionaryGetValue(d, proto_key);
     if (proto_dict) {
        CFStringRef     if_name;
     proto_dict = CFDictionaryGetValue(d, proto_key);
     if (proto_dict) {
        CFStringRef     if_name;
-       CFNumberRef     override = NULL;
+       CFNumberRef     override = NULL;
 
        if_name = CFDictionaryGetValue(proto_dict, kSCPropInterfaceName);
        if (S_ppp_override_primary == TRUE
 
        if_name = CFDictionaryGetValue(proto_dict, kSCPropInterfaceName);
        if (S_ppp_override_primary == TRUE
@@ -1876,7 +1801,7 @@ static void
 elect_protocol(const void * key, const void * value, void * context)
 {
     struct election_state *    elect_p = (struct election_state *)context;
 elect_protocol(const void * key, const void * value, void * context)
 {
     struct election_state *    elect_p = (struct election_state *)context;
-    CFDictionaryRef            proto_dict = NULL;
+    CFDictionaryRef            proto_dict = NULL;
     CFStringRef                        router;
     boolean_t                  router_valid = FALSE;
     CFStringRef                        serviceID = (CFStringRef)key;
     CFStringRef                        router;
     boolean_t                  router_valid = FALSE;
     CFStringRef                        serviceID = (CFStringRef)key;
@@ -1954,14 +1879,15 @@ service_changed(CFDictionaryRef services_info, CFStringRef serviceID)
 static CFArrayRef
 service_order_get(CFDictionaryRef services_info)
 {
 static CFArrayRef
 service_order_get(CFDictionaryRef services_info)
 {
-    CFArrayRef                 order = NULL;
-    CFNumberRef                        ppp_override = NULL;
-    int                                ppp_val = TRUE;
-    CFDictionaryRef            ipv4_dict = NULL;
+    CFArrayRef         order = NULL;
+    CFDictionaryRef    ipv4_dict;
 
     ipv4_dict = my_CFDictionaryGetDictionary(services_info,
                                             S_setup_global_ipv4);
     if (ipv4_dict != NULL) {
 
     ipv4_dict = my_CFDictionaryGetDictionary(services_info,
                                             S_setup_global_ipv4);
     if (ipv4_dict != NULL) {
+       CFNumberRef     ppp_override;
+       int             ppp_val = 0;
+
        order = CFDictionaryGetValue(ipv4_dict, kSCPropNetServiceOrder);
        order = isA_CFArray(order);
 
        order = CFDictionaryGetValue(ipv4_dict, kSCPropNetServiceOrder);
        order = isA_CFArray(order);
 
@@ -1975,7 +1901,7 @@ service_order_get(CFDictionaryRef services_info)
        S_ppp_override_primary = (ppp_val != 0) ? TRUE : FALSE;
     }
     else {
        S_ppp_override_primary = (ppp_val != 0) ? TRUE : FALSE;
     }
     else {
-       S_ppp_override_primary = TRUE;
+       S_ppp_override_primary = FALSE;
     }
     return (order);
 }
     }
     return (order);
 }
@@ -2055,16 +1981,19 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
            global_ipv4_changed = TRUE;
            global_ipv6_changed = TRUE;
        }
            global_ipv4_changed = TRUE;
            global_ipv6_changed = TRUE;
        }
-       else if (CFEqual(change, S_setup_global_netinfo)) {
-           if (S_primary_ipv4 != NULL) {
-               my_CFArrayAppendUniqueValue(service_changes, S_primary_ipv4);
-           }
-       }
        else if (CFEqual(change, S_setup_global_proxies)) {
            if (S_primary_proxies != NULL) {
                my_CFArrayAppendUniqueValue(service_changes, S_primary_proxies);
            }
        }
        else if (CFEqual(change, S_setup_global_proxies)) {
            if (S_primary_proxies != NULL) {
                my_CFArrayAppendUniqueValue(service_changes, S_primary_proxies);
            }
        }
+       else if (CFEqual(change, S_setup_global_smb)) {
+           if (S_primary_smb != NULL) {
+               my_CFArrayAppendUniqueValue(service_changes, S_primary_smb);
+           }
+       }
+       else if (CFEqual(change, S_private_resolvers)) {
+           dnsinfo_changed = TRUE;
+       }
        else if (CFStringHasPrefix(change, S_state_service_prefix)) {
            CFStringRef serviceID = parse_component(change,
                                                    S_state_service_prefix);
        else if (CFStringHasPrefix(change, S_state_service_prefix)) {
            CFStringRef serviceID = parse_component(change,
                                                    S_state_service_prefix);
@@ -2102,25 +2031,22 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
 
        if (S_primary_ipv4 != NULL && CFEqual(S_primary_ipv4, serviceID)) {
            if ((changes & (1 << kEntityTypeIPv4)) != 0) {
 
        if (S_primary_ipv4 != NULL && CFEqual(S_primary_ipv4, serviceID)) {
            if ((changes & (1 << kEntityTypeIPv4)) != 0) {
-               update_ipv4(session, services_info, serviceID, &keys);
+               update_ipv4(services_info, serviceID, &keys);
                global_ipv4_changed = TRUE;
            }
                global_ipv4_changed = TRUE;
            }
-           if ((changes & (1 << kEntityTypeNetInfo)) != 0) {
-               update_netinfo(session, services_info, serviceID, &keys);
-           }
        }
        else if ((changes & (1 << kEntityTypeIPv4)) != 0) {
            global_ipv4_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeIPv6)) != 0) {
            if (S_primary_ipv6 != NULL && CFEqual(S_primary_ipv6, serviceID)) {
        }
        else if ((changes & (1 << kEntityTypeIPv4)) != 0) {
            global_ipv4_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeIPv6)) != 0) {
            if (S_primary_ipv6 != NULL && CFEqual(S_primary_ipv6, serviceID)) {
-               update_ipv6(session, services_info, serviceID, &keys);
+               update_ipv6(services_info, serviceID, &keys);
            }
            global_ipv6_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeDNS)) != 0) {
            if (S_primary_dns != NULL && CFEqual(S_primary_dns, serviceID)) {
            }
            global_ipv6_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeDNS)) != 0) {
            if (S_primary_dns != NULL && CFEqual(S_primary_dns, serviceID)) {
-               update_dns(session, services_info, serviceID, &keys);
+               update_dns(services_info, serviceID, &keys);
                dnsinfo_changed = TRUE;
            }
            else if (wasSupplemental || dns_has_supplemental(serviceID)) {
                dnsinfo_changed = TRUE;
            }
            else if (wasSupplemental || dns_has_supplemental(serviceID)) {
@@ -2129,7 +2055,12 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
        }
        if ((changes & (1 << kEntityTypeProxies)) != 0) {
            if (S_primary_proxies != NULL && CFEqual(S_primary_proxies, serviceID)) {
        }
        if ((changes & (1 << kEntityTypeProxies)) != 0) {
            if (S_primary_proxies != NULL && CFEqual(S_primary_proxies, serviceID)) {
-               update_proxies(session, services_info, serviceID, &keys);
+               update_proxies(services_info, serviceID, &keys);
+           }
+       }
+       if ((changes & (1 << kEntityTypeSMB)) != 0) {
+           if (S_primary_smb != NULL && CFEqual(S_primary_smb, serviceID)) {
+               update_smb(services_info, serviceID, &keys);
            }
        }
     }
            }
        }
     }
@@ -2142,8 +2073,7 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
        new_primary = elect_new_primary(service_order,
                                        kSCEntNetIPv4, kSCPropNetIPv4Router);
        if (set_new_primary(&S_primary_ipv4, new_primary, "IPv4")) {
        new_primary = elect_new_primary(service_order,
                                        kSCEntNetIPv4, kSCPropNetIPv4Router);
        if (set_new_primary(&S_primary_ipv4, new_primary, "IPv4")) {
-           update_ipv4(session, services_info, S_primary_ipv4, &keys);
-           update_netinfo(session, services_info, S_primary_ipv4, &keys);
+           update_ipv4(services_info, S_primary_ipv4, &keys);
        }
        my_CFRelease(&new_primary);
     }
        }
        my_CFRelease(&new_primary);
     }
@@ -2155,13 +2085,14 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
        new_primary = elect_new_primary(service_order,
                                        kSCEntNetIPv6, kSCPropNetIPv6Router);
        if (set_new_primary(&S_primary_ipv6, new_primary, "IPv6")) {
        new_primary = elect_new_primary(service_order,
                                        kSCEntNetIPv6, kSCPropNetIPv6Router);
        if (set_new_primary(&S_primary_ipv6, new_primary, "IPv6")) {
-           update_ipv6(session, services_info, S_primary_ipv6, &keys);
+           update_ipv6(services_info, S_primary_ipv6, &keys);
        }
        my_CFRelease(&new_primary);
     }
     if (global_ipv4_changed || global_ipv6_changed) {
        CFStringRef     new_primary_dns;
        CFStringRef     new_primary_proxies;
        }
        my_CFRelease(&new_primary);
     }
     if (global_ipv4_changed || global_ipv6_changed) {
        CFStringRef     new_primary_dns;
        CFStringRef     new_primary_proxies;
+       CFStringRef     new_primary_smb;
 
        if (S_primary_ipv4 != NULL && S_primary_ipv6 != NULL) {
            /* decide between IPv4 and IPv6 */
 
        if (S_primary_ipv4 != NULL && S_primary_ipv6 != NULL) {
            /* decide between IPv4 and IPv6 */
@@ -2183,28 +2114,46 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
            else {
                new_primary_proxies = S_primary_ipv6;
            }
            else {
                new_primary_proxies = S_primary_ipv6;
            }
+           if (rank_service_entity(service_order, S_primary_ipv4,
+                                   kSCEntNetIPv4, kSCEntNetSMB)
+               <= rank_service_entity(service_order, S_primary_ipv6,
+                                      kSCEntNetIPv6, kSCEntNetSMB)) {
+               new_primary_smb = S_primary_ipv4;
+           }
+           else {
+               new_primary_smb = S_primary_ipv6;
+           }
 
        }
        else if (S_primary_ipv6 != NULL) {
 
        }
        else if (S_primary_ipv6 != NULL) {
-           new_primary_dns = new_primary_proxies = S_primary_ipv6;
+           new_primary_dns     = S_primary_ipv6;
+           new_primary_proxies = S_primary_ipv6;
+           new_primary_smb     = S_primary_ipv6;
        }
        else if (S_primary_ipv4 != NULL) {
        }
        else if (S_primary_ipv4 != NULL) {
-           new_primary_dns = new_primary_proxies = S_primary_ipv4;
+           new_primary_dns     = S_primary_ipv4;
+           new_primary_proxies = S_primary_ipv4;
+           new_primary_smb     = S_primary_ipv4;
        }
        else {
        }
        else {
-           new_primary_dns = new_primary_proxies = NULL;
+           new_primary_dns     = NULL;
+           new_primary_proxies = NULL;
+           new_primary_smb     = NULL;
        }
 
        if (set_new_primary(&S_primary_dns, new_primary_dns, "DNS")) {
        }
 
        if (set_new_primary(&S_primary_dns, new_primary_dns, "DNS")) {
-           update_dns(session, services_info, S_primary_dns, &keys);
+           update_dns(services_info, S_primary_dns, &keys);
            dnsinfo_changed = TRUE;
        }
        if (set_new_primary(&S_primary_proxies, new_primary_proxies, "Proxies")) {
            dnsinfo_changed = TRUE;
        }
        if (set_new_primary(&S_primary_proxies, new_primary_proxies, "Proxies")) {
-           update_proxies(session, services_info, S_primary_proxies, &keys);
+           update_proxies(services_info, S_primary_proxies, &keys);
+       }
+       if (set_new_primary(&S_primary_smb, new_primary_smb, "SMB")) {
+           update_smb(services_info, S_primary_smb, &keys);
        }
     }
     if (dnsinfo_changed) {
        }
     }
     if (dnsinfo_changed) {
-       update_dnsinfo(S_primary_dns, service_order, &keys);
+       update_dnsinfo(services_info, S_primary_dns, &keys, service_order);
     }
     my_CFRelease(&service_changes);
     my_CFRelease(&services_info);
     }
     my_CFRelease(&service_changes);
     my_CFRelease(&services_info);
@@ -2216,11 +2165,11 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
 static void
 initEntityNames(void)
 {
 static void
 initEntityNames(void)
 {
-    entityTypeNames[0] = kSCEntNetIPv4;        /* 0 */
-    entityTypeNames[1] = kSCEntNetIPv6;        /* 1 */
-    entityTypeNames[2] = kSCEntNetDNS;         /* 2 */
-    entityTypeNames[3] = kSCEntNetNetInfo;     /* 3 */
-    entityTypeNames[4] = kSCEntNetProxies;     /* 4 */
+    entityTypeNames[0] = kSCEntNetIPv4;                /* 0 */
+    entityTypeNames[1] = kSCEntNetIPv6;                /* 1 */
+    entityTypeNames[2] = kSCEntNetDNS;         /* 2 */
+    entityTypeNames[3] = kSCEntNetProxies;     /* 3 */
+    entityTypeNames[4] = kSCEntNetSMB;         /* 4 */
     return;
 }
 
     return;
 }
 
@@ -2258,26 +2207,26 @@ ip_plugin_init()
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainState,
                                                     kSCEntNetDNS);
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainState,
                                                     kSCEntNetDNS);
-    S_state_global_netinfo
-       = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
-                                                    kSCDynamicStoreDomainState,
-                                                    kSCEntNetNetInfo);
     S_state_global_proxies
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainState,
                                                     kSCEntNetProxies);
     S_state_global_proxies
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainState,
                                                     kSCEntNetProxies);
+    S_state_global_smb
+       = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                    kSCDynamicStoreDomainState,
+                                                    kSCEntNetSMB);
     S_setup_global_ipv4
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetIPv4);
     S_setup_global_ipv4
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetIPv4);
-    S_setup_global_netinfo
-       = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
-                                                    kSCDynamicStoreDomainSetup,
-                                                    kSCEntNetNetInfo);
     S_setup_global_proxies
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetProxies);
     S_setup_global_proxies
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetProxies);
+    S_setup_global_smb
+       = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                    kSCDynamicStoreDomainSetup,
+                                                    kSCEntNetSMB);
     S_state_service_prefix
        = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@/"),
                                  kSCDynamicStoreDomainState,
     S_state_service_prefix
        = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@/"),
                                  kSCDynamicStoreDomainState,
@@ -2293,12 +2242,6 @@ ip_plugin_init()
                                    &kCFTypeDictionaryKeyCallBacks,
                                    &kCFTypeDictionaryValueCallBacks);
 
                                    &kCFTypeDictionaryKeyCallBacks,
                                    &kCFTypeDictionaryValueCallBacks);
 
-    key = CFStringCreateWithCString(NULL,
-                                   dns_configuration_notify_key(),
-                                   kCFStringEncodingASCII);
-    S_notify_dnsinfo = CFStringCreateWithFormat(NULL, NULL, CFSTR("Notify:%@"), key);
-    CFRelease(key);
-
     keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
     patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
     keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
     patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
@@ -2312,9 +2255,6 @@ ip_plugin_init()
        CFRelease(key);
     }
 
        CFRelease(key);
     }
 
-    /* add notifier for setup global netinfo */
-    CFArrayAppendValue(keys, S_setup_global_netinfo);
-
     /* add notifier for ServiceOrder/PPPOverridePrimary changes for IPv4 */
     key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
     /* add notifier for ServiceOrder/PPPOverridePrimary changes for IPv4 */
     key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
@@ -2322,6 +2262,13 @@ ip_plugin_init()
     CFArrayAppendValue(keys, key);
     CFRelease(key);
 
     CFArrayAppendValue(keys, key);
     CFRelease(key);
 
+    /* add notifier for Private DNS configuration */
+    S_private_resolvers = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"),
+                                                 kSCDynamicStoreDomainState,
+                                                 kSCCompNetwork,
+                                                 CFSTR(kDNSServiceCompPrivateDNS));
+    CFArrayAppendValue(keys, S_private_resolvers);
+
     if (!SCDynamicStoreSetNotificationKeys(session, keys, patterns)) {
        SCLog(TRUE, LOG_ERR,
              CFSTR("IPMonitor ip_plugin_init "
     if (!SCDynamicStoreSetNotificationKeys(session, keys, patterns)) {
        SCLog(TRUE, LOG_ERR,
              CFSTR("IPMonitor ip_plugin_init "
@@ -2343,13 +2290,12 @@ ip_plugin_init()
     CFRelease(rls);
 
     /* initialize dns configuration */
     CFRelease(rls);
 
     /* initialize dns configuration */
-    dns_configuration_set(NULL, NULL, NULL);
+    dns_configuration_set(NULL, NULL, NULL, NULL);
     empty_dns();
     (void)SCDynamicStoreRemoveValue(session, S_state_global_dns);
 
     empty_dns();
     (void)SCDynamicStoreRemoveValue(session, S_state_global_dns);
 
-    /* initialize netinfo state */
-    empty_netinfo(session);
-    (void)SCDynamicStoreRemoveValue(session, S_state_global_netinfo);
+    /* initialize SMB configuration */
+    (void)SCDynamicStoreRemoveValue(session, S_state_global_smb);
 
   done:
     my_CFRelease(&keys);
 
   done:
     my_CFRelease(&keys);
@@ -2363,7 +2309,7 @@ void
 prime_IPMonitor()
 {
     /* initialize multicast route */
 prime_IPMonitor()
 {
     /* initialize multicast route */
-    set_ipv4_router(NULL, NULL, FALSE);
+    set_ipv4_router(NULL, NULL, NULL, FALSE);
 }
 
 __private_extern__
 }
 
 __private_extern__
@@ -2378,6 +2324,7 @@ load_IPMonitor(CFBundleRef bundle, Boolean bundleVerbose)
     ip_plugin_init();
 
     load_hostname(S_IPMonitor_debug);
     ip_plugin_init();
 
     load_hostname(S_IPMonitor_debug);
+    load_smb_configuration(S_IPMonitor_debug);
 
     return;
 }
 
     return;
 }
index 4bf0c8cf55c6e746bd900ee28d1f8c37dfc6a54d..ec381adadaa0cc2b32e5ffee9f782c44758fe693 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -37,7 +37,7 @@
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h>
 #include <SystemConfiguration/SCValidation.h>
-#include <SystemConfiguration/SCPrivate.h>     // for SCLog(), SCPrint()
+#include <SystemConfiguration/SCPrivate.h>
 
 #include <notify.h>
 
 
 #include <notify.h>
 
@@ -55,134 +55,10 @@ static Boolean                     _verbose        = FALSE;
 
 /* SPI (from SCNetworkReachability.c) */
 Boolean
 
 /* SPI (from SCNetworkReachability.c) */
 Boolean
-_SC_checkResolverReachability(SCDynamicStoreRef         *storeP,
-                             SCNetworkConnectionFlags  *flags,
-                             Boolean                   *haveDNS,
-                             const char *              nodename);
-
-
-/*
- * checkResolverReachabilityByAddress()
- *
- * Given an IP address, determine whether a reverse DNS query can be issued
- * using the current network configuration.
- */
-static Boolean
-checkResolverReachabilityByAddress(SCDynamicStoreRef store, struct sockaddr *sa)
-{
-       SCNetworkConnectionFlags        flags;
-       Boolean                         haveDNS;
-       int                             i;
-       Boolean                         ok              = FALSE;
-       char                            ptr_name[128];
-
-       /*
-        * Ideally, we would have an API that given a local IP
-        * address would return the DNS server(s) that would field
-        * a given PTR query.  Fortunately, we do have an SPI which
-        * which will provide this information given a "name" so we
-        * take the address, convert it into the inverse query name,
-        * and find out which servers should be consulted.
-        */
-
-       switch (sa->sa_family) {
-               case AF_INET : {
-                       union {
-                               in_addr_t       s_addr;
-                               unsigned char   b[4];
-                       } rev;
-                       struct sockaddr_in      *sin    = (struct sockaddr_in *)sa;
-
-                       /*
-                        * build "PTR" query name
-                        *   NNN.NNN.NNN.NNN.in-addr.arpa.
-                        */
-                       rev.s_addr = sin->sin_addr.s_addr;
-                       (void) snprintf(ptr_name, sizeof(ptr_name), "%u.%u.%u.%u.in-addr.arpa.",
-                                       rev.b[3],
-                                       rev.b[2],
-                                       rev.b[1],
-                                       rev.b[0]);
-
-                       break;
-               }
-
-               case AF_INET6 : {
-                       int                     s       = 0;
-                       struct sockaddr_in6     *sin6   = (struct sockaddr_in6 *)sa;
-                       int                     x       = sizeof(ptr_name);
-                       int                     n;
-
-#define        USE_NIBBLE_QUERY
-#ifdef USE_NIBBLE_QUERY
-                       /*
-                        * build IPv6 "nibble" PTR query name (RFC 1886, RFC 3152)
-                        *   N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.ip6.arpa.
-                        */
-                       for (i = sizeof(sin6->sin6_addr) - 1; i >= 0; i--) {
-                               n = snprintf(&ptr_name[s], x, "%x.%x.",
-                                            ( sin6->sin6_addr.s6_addr[i]       & 0xf),
-                                            ((sin6->sin6_addr.s6_addr[i] >> 4) & 0xf));
-                               if ((n == -1) || (n >= x)) {
-                                       goto done;
-                               }
-
-                               s += n;
-                               x -= n;
-                       }
-
-                       n = snprintf(&ptr_name[s], x, "ip6.arpa.");
-                       if ((n == -1) || (n >= x)) {
-                               goto done;
-                       }
-#else  /* USE_NIBBLE_QUERY */
-                       /*
-                        * build IPv6 "bit-string" PTR query name (RFC 2673)
-                        *   \[xNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN].ip6.arpa.
-                        */
-                       n = snprintf(&ptr_name[0], x, "\\[x");
-                       if ((n == -1) || (n >= x)) {
-                               goto done;
-                       }
-
-                       s += n;
-                       x -= n;
-                       for (i = 0; i < 16; i++) {
-                               n = snprintf(&ptr_name[s], x, "%2.2x", sin6->sin6_addr.s6_addr[i]);
-                               if ((n == -1) || (n >= x)) {
-                                       goto done;
-                               }
-
-                               s += n;
-                               x -= n;
-                       }
-
-                       n = snprintf(&ptr_name[s], x, "].ip6.arpa.");
-                       if ((n == -1) || (n >= x)) {
-                               goto done;
-                       }
-#endif /* USE_NIBBLE_QUERY */
-
-                       break;
-               }
-
-               default :
-                       goto done;
-       }
-
-       ok = _SC_checkResolverReachability(&store, &flags, &haveDNS, ptr_name);
-       if (ok) {
-               if (!(flags & kSCNetworkFlagsReachable) ||
-                       (flags & kSCNetworkFlagsConnectionRequired)) {
-                       // if not reachable *OR* connection required
-                       ok = FALSE;
-               }
-       }
-
-    done :
-
-       return ok;
-}
+_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef       *storeP,
+                                      SCNetworkConnectionFlags *flags,
+                                      Boolean                  *haveDNS,
+                                      struct sockaddr          *sa);
 
 
 #define        HOSTNAME_NOTIFY_KEY     "com.apple.system.hostname"
 
 
 #define        HOSTNAME_NOTIFY_KEY     "com.apple.system.hostname"
@@ -348,11 +224,6 @@ copy_static_name()
 }
 
 
 }
 
 
-#ifndef        kSCPropNetHostName
-#define        kSCPropNetHostName      CFSTR("HostName")
-#endif
-
-
 static CFStringRef
 copy_prefs_hostname(SCDynamicStoreRef store)
 {
 static CFStringRef
 copy_prefs_hostname(SCDynamicStoreRef store)
 {
@@ -370,7 +241,7 @@ copy_prefs_hostname(SCDynamicStoreRef store)
                goto done;
        }
 
                goto done;
        }
 
-       name = isA_CFString(CFDictionaryGetValue(dict, kSCPropNetHostName));
+       name = isA_CFString(CFDictionaryGetValue(dict, kSCPropSystemHostName));
        if (name == NULL) {
                goto done;
        }
        if (name == NULL) {
                goto done;
        }
@@ -379,7 +250,7 @@ copy_prefs_hostname(SCDynamicStoreRef store)
     done :
 
        if (dict != NULL)       CFRelease(dict);
     done :
 
        if (dict != NULL)       CFRelease(dict);
-       
+
        return name;
 }
 
        return name;
 }
 
@@ -497,14 +368,19 @@ reverseDNSComplete(int32_t status, char *host, char *serv, void *context)
                         */
                        if (host != NULL) {
                                hostname = CFStringCreateWithCString(NULL, host, kCFStringEncodingUTF8);
                         */
                        if (host != NULL) {
                                hostname = CFStringCreateWithCString(NULL, host, kCFStringEncodingUTF8);
-                               SCLog(TRUE, LOG_INFO, CFSTR("hostname (reverse DNS query) = %@"), hostname);
-                               set_hostname(hostname);
-                               CFRelease(hostname);
-                               goto done;
+                               if (hostname != NULL) {
+                                       SCLog(TRUE, LOG_INFO, CFSTR("hostname (reverse DNS query) = %@"), hostname);
+                                       set_hostname(hostname);
+                                       CFRelease(hostname);
+                                       goto done;
+                               }
                        }
                        break;
 
                case EAI_NONAME :
                        }
                        break;
 
                case EAI_NONAME :
+#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
+               case EAI_NODATA:
+#endif
                        /*
                         * if no name available
                         */
                        /*
                         * if no name available
                         */
@@ -568,14 +444,28 @@ getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, voi
 }
 
 
 }
 
 
+static CFStringRef
+replyMPCopyDescription(const void *info)
+{
+       SCDynamicStoreRef       store   = (SCDynamicStoreRef)info;
+
+       return CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("<getnameinfo_async_start reply MP> {store = %p}"),
+                                       store);
+}
+
+
 static void
 start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 {
 static void
 start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 {
-       char                    addr[64];
-       Boolean                 ok;
-       struct sockaddr         *sa;
-       struct sockaddr_in      sin;
-       struct sockaddr_in6     sin6;
+       char                            addr[64];
+       SCNetworkConnectionFlags        flags;
+       Boolean                         haveDNS;
+       Boolean                         ok;
+       struct sockaddr                 *sa;
+       struct sockaddr_in              sin;
+       struct sockaddr_in6             sin6;
 
        if (_SC_cfstring_to_cstring(address, addr, sizeof(addr), kCFStringEncodingASCII) == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("could not convert [primary] address"));
 
        if (_SC_cfstring_to_cstring(address, addr, sizeof(addr), kCFStringEncodingASCII) == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("could not convert [primary] address"));
@@ -603,7 +493,7 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 
                p = strchr(addr, '%');
                if (p != NULL) {
 
                p = strchr(addr, '%');
                if (p != NULL) {
-                       sin6.sin6_scope_id = if_nametoindex(p+1);
+                       sin6.sin6_scope_id = if_nametoindex(p + 1);
                }
 
                sa = (struct sockaddr *)&sin6;
                }
 
                sa = (struct sockaddr *)&sin6;
@@ -611,9 +501,23 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
                goto done;
        }
 
                goto done;
        }
 
-       ok = checkResolverReachabilityByAddress(store, sa);
+
+       ok = _SC_checkResolverReachabilityByAddress(&store, &flags, &haveDNS, sa);
+       if (ok) {
+               if (!(flags & kSCNetworkFlagsReachable) ||
+                       (flags & kSCNetworkFlagsConnectionRequired)) {
+                       // if not reachable *OR* connection required
+                       ok = FALSE;
+               }
+       }
+
        if (ok) {
        if (ok) {
-               CFMachPortContext       context = { 0, (void *)store, CFRetain, CFRelease, CFCopyDescription };
+               CFMachPortContext       context = { 0
+                                                 , (void *)store
+                                                 , CFRetain
+                                                 , CFRelease
+                                                 , replyMPCopyDescription
+                                                 };
                mach_port_t             port;
                int32_t                 error;
 
                mach_port_t             port;
                int32_t                 error;
 
@@ -622,7 +526,7 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
                error = getnameinfo_async_start(&port,
                                                sa,
                                                sa->sa_len,
                error = getnameinfo_async_start(&port,
                                                sa,
                                                sa->sa_len,
-                                               0,              // flags
+                                               NI_NAMEREQD,    // flags
                                                reverseDNSComplete,
                                                NULL);
                if (error != 0) {
                                                reverseDNSComplete,
                                                NULL);
                if (error != 0) {
@@ -656,7 +560,7 @@ update_hostname(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
 
        if (dnsPort != NULL) {
                /* cancel the outstanding DNS query */
 
        if (dnsPort != NULL) {
                /* cancel the outstanding DNS query */
-               lu_async_call_cancel(CFMachPortGetPort(dnsPort));
+               getnameinfo_async_cancel(CFMachPortGetPort(dnsPort));
                CFRunLoopSourceInvalidate(dnsRLS);
                CFRelease(dnsRLS);
                dnsRLS = NULL;
                CFRunLoopSourceInvalidate(dnsRLS);
                CFRelease(dnsRLS);
                dnsRLS = NULL;
diff --git a/Plugins/IPMonitor/set-hostname.h b/Plugins/IPMonitor/set-hostname.h
new file mode 100644 (file)
index 0000000..109779d
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2006 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@
+ */
+
+#ifndef _SET_HOSTNAME_H
+#define _SET_HOSTNAME_H
+
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+__BEGIN_DECLS
+
+void   load_hostname           (Boolean        verbose);
+
+__END_DECLS
+
+#endif /* _SET_HOSTNAME_H */
diff --git a/Plugins/IPMonitor/smb-configuration.c b/Plugins/IPMonitor/smb-configuration.c
new file mode 100644 (file)
index 0000000..ef120a0
--- /dev/null
@@ -0,0 +1,943 @@
+/*
+ * Copyright (c) 2006, 2007 Apple 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
+ *
+ * June 26, 2006       Allan Nathanson <ajn@apple.com>
+ * - initial revision
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb_async.h>
+#include <notify.h>
+#include <smb_server_prefs.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreFoundation/CFStringDefaultEncoding.h>    // for __CFStringGetInstallationEncodingAndRegion()
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCValidation.h>
+#include <SystemConfiguration/SCPrivate.h>             // for SCLog(), SCPrint()
+
+#define        SMB_STARTUP_DELAY       60.0
+#define        SMB_DEBOUNCE_DELAY      5.0
+
+/* SPI (from SCNetworkReachability.c) */
+Boolean
+_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef       *storeP,
+                                      SCNetworkConnectionFlags *flags,
+                                      Boolean                  *haveDNS,
+                                      struct sockaddr          *sa);
+
+
+static SCDynamicStoreRef       store           = NULL;
+static CFRunLoopSourceRef      rls             = NULL;
+
+static Boolean                 dnsActive       = FALSE;
+static CFMachPortRef           dnsPort         = NULL;
+static CFRunLoopSourceRef      dnsRLS          = NULL;
+static struct timeval          dnsQueryStart;
+
+static CFRunLoopTimerRef       timer           = NULL;
+
+static Boolean                 _verbose        = FALSE;
+
+
+static CFAbsoluteTime
+boottime(void)
+{
+       static CFAbsoluteTime   bt      = 0;
+
+       if (bt == 0) {
+               int             mib[2]  = { CTL_KERN, KERN_BOOTTIME };
+               struct timeval  tv;
+               size_t          tv_len  = sizeof(tv);
+
+               if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &tv, &tv_len, NULL, 0) == -1) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("sysctl() CTL_KERN/KERN_BOOTTIME failed: %s"), strerror(errno));
+                       return kCFAbsoluteTimeIntervalSince1970;
+               }
+
+               // Note: we need to convert from Unix time to CF time.
+               bt = (CFTimeInterval)tv.tv_sec - kCFAbsoluteTimeIntervalSince1970;
+               bt += (1.0E-6 * (CFTimeInterval)tv.tv_usec);
+       }
+
+       return bt;
+}
+
+
+static CFStringRef
+copy_default_name(void)
+{
+       CFStringRef             address;
+       SCNetworkInterfaceRef   interface;
+       CFMutableStringRef      name    = NULL;
+
+       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, CFSTR("en0"),
+                                                        kIncludeNoVirtualInterfaces);
+       if (interface == NULL) {
+               goto done;
+       }
+
+       address = SCNetworkInterfaceGetHardwareAddressString(interface);
+       if (address == NULL) {
+               goto done;
+       }
+
+       name = CFStringCreateMutableCopy(NULL, 0, address);
+       CFStringFindAndReplace(name,
+                              CFSTR(":"),
+                              CFSTR(""),
+                              CFRangeMake(0, CFStringGetLength(name)),
+                              0);
+       CFStringInsert(name, 0, CFSTR("MAC"));
+       CFStringUppercase(name, NULL);
+
+    done :
+
+       if (interface != NULL) CFRelease(interface);
+       return name;
+}
+
+
+static CFDictionaryRef
+smb_copy_global_configuration(SCDynamicStoreRef store)
+{
+       CFDictionaryRef dict;
+       CFStringRef     key;
+
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetSMB);
+       dict = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+
+       if (dict != NULL) {
+               if (isA_CFDictionary(dict)) {
+                       return dict;
+               }
+
+               CFRelease(dict);
+       }
+
+       dict = CFDictionaryCreate(NULL,                 // allocator
+                                 NULL,                 // keys
+                                 NULL,                 // values
+                                 0,                    // numValues
+                                 &kCFTypeDictionaryKeyCallBacks,
+                                 &kCFTypeDictionaryValueCallBacks);
+       return dict;
+}
+
+
+static void
+update_pref(SCPreferencesRef prefs, CFStringRef key, CFTypeRef newVal, Boolean *changed)
+{
+       CFTypeRef       curVal;
+
+       curVal = SCPreferencesGetValue(prefs, key);
+       if (!_SC_CFEqual(curVal, newVal)) {
+               if (newVal != NULL) {
+                       SCPreferencesSetValue(prefs, key, newVal);
+               } else {
+                       SCPreferencesRemoveValue(prefs, key);
+               }
+
+               *changed = TRUE;
+       }
+
+       return;
+}
+
+
+static void
+smb_set_configuration(SCDynamicStoreRef store, CFDictionaryRef dict)
+{
+       CFArrayRef              array;
+       Boolean                 changed         = FALSE;
+       UInt32                  dosCodepage     = 0;
+       CFStringEncoding        dosEncoding     = 0;
+       CFStringEncoding        macEncoding     = kCFStringEncodingMacRoman;
+       uint32_t                macRegion       = 0;
+       Boolean                 ok;
+       SCPreferencesRef        prefs;
+       CFStringRef             str;
+
+       prefs = SCPreferencesCreate(NULL, CFSTR("smb-configuration"), CFSTR(kSMBPreferencesAppID));
+       if (prefs == NULL) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("smb_set_configuration: SCPreferencesCreate() failed: %s"),
+                     SCErrorString(SCError()));
+               return;
+       }
+
+       ok = SCPreferencesLock(prefs, TRUE);
+       if (!ok) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("smb_set_configuration: SCPreferencesLock() failed: %s"),
+                     SCErrorString(SCError()));
+               goto done;
+       }
+
+       // Server description
+       str = SCDynamicStoreCopyComputerName(store, &macEncoding);
+       update_pref(prefs, CFSTR(kSMBPrefServerDescription), str, &changed);
+
+       // DOS code page
+       if (str != NULL) {
+               if (macEncoding == kCFStringEncodingMacRoman) {
+                       CFStringRef     key;
+                       CFDictionaryRef dict;
+
+                       // get region
+                       key = SCDynamicStoreKeyCreateComputerName(NULL);
+                       dict = SCDynamicStoreCopyValue(store, key);
+                       CFRelease(key);
+                       if (dict != NULL) {
+                               if (isA_CFDictionary(dict)) {
+                                       CFNumberRef     num;
+                                       SInt32          val;
+
+                                       num = CFDictionaryGetValue(dict, kSCPropSystemComputerNameRegion);
+                                       if (isA_CFNumber(num) &&
+                                           CFNumberGetValue(num, kCFNumberSInt32Type, &val)) {
+                                               macRegion = (uint32_t)val;
+                                       }
+                               }
+
+                               CFRelease(dict);
+                       }
+               }
+
+               CFRelease(str);
+       } else {
+               // Important: must have root acccess (eUID==0) to access the config file!
+               __CFStringGetInstallationEncodingAndRegion((uint32_t *)&macEncoding, &macRegion);
+       }
+       _SC_dos_encoding_and_codepage(macEncoding, macRegion, &dosEncoding, &dosCodepage);
+       str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), dosCodepage);
+       update_pref(prefs, CFSTR(kSMBPrefDOSCodePage), str, &changed);
+       CFRelease(str);
+
+       // NetBIOS name
+       str = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSName);
+       str = isA_CFString(str);
+       update_pref(prefs, CFSTR(kSMBPrefNetBIOSName), str, &changed);
+
+       // NetBIOS node type
+       str = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSNodeType);
+       str = isA_CFString(str);
+       if (str != NULL) {
+               if (CFEqual(str, kSCValNetSMBNetBIOSNodeTypeBroadcast)) {
+                       // B-node
+                       str = CFSTR(kSMBPrefNetBIOSNodeBroadcast);
+               } else if (CFEqual(str, kSCValNetSMBNetBIOSNodeTypePeer)) {
+                       // P-node
+                       str = CFSTR(kSMBPrefNetBIOSNodePeer);
+               } else if (CFEqual(str, kSCValNetSMBNetBIOSNodeTypeMixed)) {
+                       // M-node
+                       str = CFSTR(kSMBPrefNetBIOSNodeMixed);
+               } else if (CFEqual(str, kSCValNetSMBNetBIOSNodeTypeHybrid)) {
+                       // H-node
+                       str = CFSTR(kSMBPrefNetBIOSNodeHybrid);
+               } else {
+                       str = NULL;
+               }
+       }
+       update_pref(prefs, CFSTR(kSMBPrefNetBIOSNodeType), str, &changed);
+
+       // NetBIOS scope
+       str = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSScope);
+       str = isA_CFString(str);
+       update_pref(prefs, CFSTR(kSMBPrefNetBIOSScope), str, &changed);
+
+       // WINS addresses
+       array = CFDictionaryGetValue(dict, kSCPropNetSMBWINSAddresses);
+       array = isA_CFArray(array);
+       update_pref(prefs, CFSTR(kSMBPrefWINSServerAddressList), array, &changed);
+
+       // Workgroup (or domain)
+       str = CFDictionaryGetValue(dict, kSCPropNetSMBWorkgroup);
+       str = isA_CFString(str);
+       update_pref(prefs, CFSTR(kSMBPrefWorkgroup), str, &changed);
+
+       if (changed) {
+               ok = SCPreferencesCommitChanges(prefs);
+               if (!ok) {
+                       SCLog((SCError() != EROFS), LOG_ERR,
+                             CFSTR("smb_set_configuration: SCPreferencesCommitChanges() failed: %s"),
+                             SCErrorString(SCError()));
+                       goto done;
+               }
+
+               ok = SCPreferencesApplyChanges(prefs);
+               if (!ok) {
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("smb_set_configuration: SCPreferencesApplyChanges() failed: %s"),
+                             SCErrorString(SCError()));
+                       goto done;
+               }
+       }
+
+    done :
+
+       (void) SCPreferencesUnlock(prefs);
+       CFRelease(prefs);
+       return;
+}
+
+
+static CFStringRef
+copy_primary_service(SCDynamicStoreRef store)
+{
+       CFDictionaryRef dict;
+       CFStringRef     key;
+       CFStringRef     serviceID       = NULL;
+
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetIPv4);
+       dict = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+
+       if (dict != NULL) {
+               if (isA_CFDictionary(dict)) {
+                       serviceID = CFDictionaryGetValue(dict, kSCDynamicStorePropNetPrimaryService);
+                       if (isA_CFString(serviceID)) {
+                               CFRetain(serviceID);
+                       } else {
+                               serviceID = NULL;
+                       }
+               }
+               CFRelease(dict);
+       }
+
+       return serviceID;
+}
+
+
+static CFStringRef
+copy_primary_ip(SCDynamicStoreRef store, CFStringRef serviceID)
+{
+       CFStringRef     address = NULL;
+       CFDictionaryRef dict;
+       CFStringRef     key;
+
+       key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                         kSCDynamicStoreDomainState,
+                                                         serviceID,
+                                                         kSCEntNetIPv4);
+       dict = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+
+       if (dict != NULL) {
+               if (isA_CFDictionary(dict)) {
+                       CFArrayRef      addresses;
+
+                       addresses = CFDictionaryGetValue(dict, kSCPropNetIPv4Addresses);
+                       if (isA_CFArray(addresses) && (CFArrayGetCount(addresses) > 0)) {
+                               address = CFArrayGetValueAtIndex(addresses, 0);
+                               if (isA_CFString(address)) {
+                                       CFRetain(address);
+                               } else {
+                                       address = NULL;
+                               }
+                       }
+               }
+               CFRelease(dict);
+       }
+
+       return address;
+}
+
+
+static void
+reverseDNSComplete(int32_t status, char *host, char *serv, void *context)
+{
+       CFDictionaryRef         dict;
+       struct timeval          dnsQueryComplete;
+       struct timeval          dnsQueryElapsed;
+       CFStringRef             name;
+       SCDynamicStoreRef       store   = (SCDynamicStoreRef)context;
+
+       (void) gettimeofday(&dnsQueryComplete, NULL);
+       timersub(&dnsQueryComplete, &dnsQueryStart, &dnsQueryElapsed);
+       SCLog(_verbose, LOG_INFO,
+             CFSTR("async DNS complete%s (query time = %d.%3.3d)"),
+             ((status == 0) && (host != NULL)) ? "" : ", host not found",
+             dnsQueryElapsed.tv_sec,
+             dnsQueryElapsed.tv_usec / 1000);
+
+       // get network configuration
+       dict = smb_copy_global_configuration(store);
+
+       // use NetBIOS name from network configuration (if available)
+       name = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSName);
+       if ((name != NULL) && _SC_CFStringIsValidNetBIOSName(name)) {
+               SCLog(TRUE, LOG_INFO, CFSTR("NetBIOS name (network configuration) = %@"), name);
+               goto set;
+       }
+
+       // use reverse DNS name, if available
+       switch (status) {
+               case 0 :
+                       /*
+                        * if [reverse] DNS query was successful
+                        */
+                       if (host != NULL) {
+                               char    *dot;
+
+                               dot = strchr(host, '.');
+                               name = CFStringCreateWithBytes(NULL,
+                                                              (UInt8 *)host,
+                                                              (dot != NULL) ? dot - host : strlen(host),
+                                                              kCFStringEncodingUTF8,
+                                                              FALSE);
+                               if (name != NULL) {
+                                       if (_SC_CFStringIsValidNetBIOSName(name)) {
+                                               CFMutableDictionaryRef  newDict;
+
+                                               SCLog(TRUE, LOG_INFO, CFSTR("NetBIOS name (reverse DNS query) = %@"), name);
+                                               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+                                               CFDictionarySetValue(newDict, kSCPropNetSMBNetBIOSName, name);
+                                               CFRelease(dict);
+                                               dict = newDict;
+                                               CFRelease(name);
+                                               goto set;
+                                       }
+
+                                       CFRelease(name);
+                               }
+                       }
+                       break;
+
+               case EAI_NONAME :
+#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
+               case EAI_NODATA:
+#endif
+                       /*
+                        * if no name available
+                        */
+                       break;
+
+               default :
+                       /*
+                        * Hmmmm...
+                        */
+                       SCLog(TRUE, LOG_ERR, CFSTR("getnameinfo() failed: %s"), gai_strerror(status));
+       }
+
+       // try local (multicast DNS) name, if available
+       name = SCDynamicStoreCopyLocalHostName(store);
+       if (name != NULL) {
+               if (_SC_CFStringIsValidNetBIOSName(name)) {
+                       CFMutableDictionaryRef  newDict;
+
+                       SCLog(TRUE, LOG_INFO, CFSTR("NetBIOS name (multicast DNS) = %@"), name);
+                       newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+                       CFDictionarySetValue(newDict, kSCPropNetSMBNetBIOSName, name);
+                       CFRelease(dict);
+                       dict = newDict;
+                       CFRelease(name);
+                       goto set;
+               }
+               CFRelease(name);
+       }
+
+       // use "default" name
+       name = copy_default_name();
+       if (name != NULL) {
+               CFMutableDictionaryRef  newDict;
+
+               SCLog(TRUE, LOG_INFO, CFSTR("NetBIOS name (default) = %@"), name);
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               CFDictionarySetValue(newDict, kSCPropNetSMBNetBIOSName, name);
+               CFRelease(dict);
+               dict = newDict;
+               CFRelease(name);
+       }
+
+    set :
+
+       // update SMB configuration
+       smb_set_configuration(store, dict);
+
+       if (host != NULL)       free(host);
+       if (dict != NULL)       CFRelease(dict);
+       if (serv != NULL)       free(serv);
+       dnsActive = FALSE;
+       return;
+}
+
+
+static void
+getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info)
+{
+       int32_t status;
+
+       status = getnameinfo_async_handle_reply(msg);
+       if ((status == 0) && dnsActive) {
+               // if request has been re-queued
+               return;
+       }
+
+       if (port == dnsPort) {
+               CFRunLoopSourceInvalidate(dnsRLS);
+               CFRelease(dnsRLS);
+               dnsRLS = NULL;
+               CFRelease(dnsPort);
+               dnsPort = NULL;
+       }
+
+       return;
+}
+
+
+static CFStringRef
+replyMPCopyDescription(const void *info)
+{
+       SCDynamicStoreRef       store   = (SCDynamicStoreRef)info;
+
+       return CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("<getnameinfo_async_start reply MP> {store = %p}"),
+                                       store);
+}
+
+
+static Boolean
+start_dns_query(SCDynamicStoreRef store, CFStringRef address)
+{
+       char                            addr[64];
+       SCNetworkConnectionFlags        flags;
+       Boolean                         haveDNS;
+       Boolean                         ok      = FALSE;
+       struct sockaddr                 *sa;
+       struct sockaddr_in              sin;
+       struct sockaddr_in6             sin6;
+
+       if (_SC_cfstring_to_cstring(address, addr, sizeof(addr), kCFStringEncodingASCII) == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("could not convert [primary] address"));
+               return FALSE;
+       }
+
+       bzero(&sin, sizeof(sin));
+       sin.sin_len    = sizeof(sin);
+       sin.sin_family = AF_INET;
+
+       bzero(&sin6, sizeof(sin6));
+       sin6.sin6_len    = sizeof(sin6);
+       sin6.sin6_family = AF_INET6;
+
+       if (inet_aton(addr, &sin.sin_addr) == 1) {
+               /*
+                * if IPv4 address
+                */
+               sa = (struct sockaddr *)&sin;
+       } else if (inet_pton(AF_INET6, addr, &sin6.sin6_addr) == 1) {
+               /*
+                * if IPv6 address
+                */
+               char    *p;
+
+               p = strchr(addr, '%');
+               if (p != NULL) {
+                       sin6.sin6_scope_id = if_nametoindex(p + 1);
+               }
+
+               sa = (struct sockaddr *)&sin6;
+       } else {
+               goto done;
+       }
+
+       ok = _SC_checkResolverReachabilityByAddress(&store, &flags, &haveDNS, sa);
+       if (ok) {
+               if (!(flags & kSCNetworkFlagsReachable) ||
+                   (flags & kSCNetworkFlagsConnectionRequired)) {
+                       // if not reachable *OR* connection required
+                       ok = FALSE;
+               }
+       }
+
+       if (ok) {
+               CFMachPortContext       context = { 0
+                                                 , (void *)store
+                                                 , CFRetain
+                                                 , CFRelease
+                                                 , replyMPCopyDescription
+                                                 };
+               mach_port_t             port;
+               int32_t                 error;
+
+               (void) gettimeofday(&dnsQueryStart, NULL);
+
+               error = getnameinfo_async_start(&port,
+                                               sa,
+                                               sa->sa_len,
+                                               NI_NAMEREQD,    // flags
+                                               reverseDNSComplete,
+                                               (void *)store);
+               if (error != 0) {
+                       ok = FALSE;
+                       goto done;
+               }
+
+               dnsActive = TRUE;
+               dnsPort = CFMachPortCreateWithPort(NULL,
+                                                  port,
+                                                  getnameinfo_async_handleCFReply,
+                                                  &context,
+                                                  NULL);
+               dnsRLS = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
+               CFRunLoopAddSource(CFRunLoopGetCurrent(), dnsRLS, kCFRunLoopDefaultMode);
+       }
+
+    done :
+
+       return ok;
+}
+
+
+static void
+smb_update_configuration(__unused CFRunLoopTimerRef _timer, void *info)
+{
+       CFStringRef             address         = NULL;
+       CFDictionaryRef         dict;
+       CFStringRef             name;
+       CFStringRef             serviceID       = NULL;
+       SCDynamicStoreRef       store           = (SCDynamicStoreRef)info;
+
+       // get network configuration
+       dict = smb_copy_global_configuration(store);
+
+       // use NetBIOS name from network configuration (if available)
+       name = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSName);
+       if ((name != NULL) && _SC_CFStringIsValidNetBIOSName(name)) {
+               SCLog(TRUE, LOG_INFO, CFSTR("NetBIOS name (network configuration) = %@"), name);
+               goto set;
+       }
+
+       // get primary service ID
+       serviceID = copy_primary_service(store);
+       if (serviceID == NULL) {
+               // if no primary service
+               goto mDNS;
+       }
+
+       // get DNS name associated with primary IP, if available
+       address = copy_primary_ip(store, serviceID);
+       if (address != NULL) {
+               Boolean ok;
+
+               // start reverse DNS query using primary IP address
+               ok = start_dns_query(store, address);
+               if (ok) {
+                       // if query started
+                       goto done;
+               }
+       }
+
+    mDNS :
+
+       // get local (multicast DNS) name, if available
+
+       name = SCDynamicStoreCopyLocalHostName(store);
+       if (name != NULL) {
+               if (_SC_CFStringIsValidNetBIOSName(name)) {
+                       CFMutableDictionaryRef  newDict;
+
+                       SCLog(TRUE, LOG_INFO, CFSTR("NetBIOS name (multicast DNS) = %@"), name);
+                       newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+                       CFDictionarySetValue(newDict, kSCPropNetSMBNetBIOSName, name);
+                       CFRelease(dict);
+                       dict = newDict;
+                       CFRelease(name);
+                       goto set;
+               }
+               CFRelease(name);
+       }
+
+       // get "default" name
+       name = copy_default_name();
+       if (name != NULL) {
+               CFMutableDictionaryRef  newDict;
+
+               SCLog(TRUE, LOG_INFO, CFSTR("NetBIOS name (default) = %@"), name);
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               CFDictionarySetValue(newDict, kSCPropNetSMBNetBIOSName, name);
+               CFRelease(dict);
+               dict = newDict;
+               CFRelease(name);
+       }
+
+    set :
+
+       // update SMB configuration
+       smb_set_configuration(store, dict);
+
+    done :
+
+       if (address != NULL)    CFRelease(address);
+       if (dict != NULL)       CFRelease(dict);
+       if (serviceID != NULL)  CFRelease(serviceID);
+
+       if (timer != NULL) {
+               CFRunLoopTimerInvalidate(timer);
+               CFRelease(timer);
+               timer = NULL;
+       }
+
+       return;
+}
+
+
+static void
+configuration_changed(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
+{
+       CFRunLoopTimerContext   context = { 0, (void *)store, CFRetain, CFRelease, NULL };
+       CFAbsoluteTime          time_boot;
+       CFAbsoluteTime          time_now ;
+
+       // if active, cancel any in-progress attempt to resolve the primary IP address
+       if (dnsPort != NULL) {
+               /* cancel the outstanding DNS query */
+               getnameinfo_async_cancel(CFMachPortGetPort(dnsPort));
+               CFRunLoopSourceInvalidate(dnsRLS);
+               CFRelease(dnsRLS);
+               dnsRLS = NULL;
+               CFRelease(dnsPort);
+               dnsPort = NULL;
+       }
+
+       // if active, cancel any queued configuration change
+       if (timer != NULL) {
+               CFRunLoopTimerInvalidate(timer);
+               CFRelease(timer);
+               timer = NULL;
+       }
+
+       // queue configuration change
+       time_boot = boottime() + SMB_STARTUP_DELAY;
+       time_now  = CFAbsoluteTimeGetCurrent() + SMB_DEBOUNCE_DELAY;
+
+       timer = CFRunLoopTimerCreate(NULL,
+                                    time_now > time_boot ? time_now : time_boot,
+                                    0,
+                                    0,
+                                    0,
+                                    smb_update_configuration,
+                                    &context);
+       CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopDefaultMode);
+
+       return;
+}
+
+
+__private_extern__
+void
+load_smb_configuration(Boolean verbose)
+{
+       CFStringRef             key;
+       CFMutableArrayRef       keys            = NULL;
+       CFMutableArrayRef       patterns        = NULL;
+
+       if (verbose) {
+               _verbose = TRUE;
+       }
+
+       /* initialize a few globals */
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("smb-configuration"), configuration_changed, NULL);
+       if (store == NULL) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCDynamicStoreCreate() failed: %s"),
+                     SCErrorString(SCError()));
+               goto error;
+       }
+
+       /* establish notification keys and patterns */
+
+       keys     = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       /* ...watch for primary service / interface changes */
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetIPv4);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       /* ...watch for DNS configuration changes */
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetDNS);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       /* ...watch for SMB configuration changes */
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetSMB);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       /* ...watch for ComputerName changes */
+       key = SCDynamicStoreKeyCreateComputerName(NULL);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       /* ...watch for local (multicast DNS) hostname changes */
+       key = SCDynamicStoreKeyCreateHostNames(NULL);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       /* register the keys/patterns */
+       if (!SCDynamicStoreSetNotificationKeys(store, keys, patterns)) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s"),
+                     SCErrorString(SCError()));
+               goto error;
+       }
+
+       rls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
+       if (!rls) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCDynamicStoreCreateRunLoopSource() failed: %s"),
+                     SCErrorString(SCError()));
+               goto error;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+
+       CFRelease(keys);
+       CFRelease(patterns);
+       return;
+
+    error :
+
+       if (keys != NULL)       CFRelease(keys);
+       if (patterns != NULL)   CFRelease(patterns);
+       if (store != NULL)      CFRelease(store);
+       return;
+}
+
+
+#ifdef MAIN
+int
+main(int argc, char **argv)
+{
+
+#ifdef DEBUG
+       CFStringRef             address;
+       CFStringRef             name;
+       CFStringRef             serviceID;
+       SCDynamicStoreRef       store;
+
+       _sc_log = FALSE;
+       if ((argc > 1) && (strcmp(argv[1], "-d") == 0)) {
+               _sc_verbose = TRUE;
+               argv++;
+               argc--;
+       }
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("smb-configuration"), NULL, NULL);
+       if (store == NULL) {
+               SCPrint(TRUE, stdout,
+                       CFSTR("SCDynamicStoreCreate() failed: %s\n"),
+                       SCErrorString(SCError()));
+               exit(1);
+       }
+
+       // get "default" name
+       name = copy_default_name();
+       if (name != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("default name = %@\n"), name);
+               CFRelease(name);
+       }
+
+       // get primary service
+       serviceID = copy_primary_service(store);
+       if (serviceID != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("primary service ID = %@\n"), serviceID);
+       } else {
+               SCPrint(TRUE, stdout, CFSTR("No primary service\n"));
+               goto done;
+       }
+
+       if ((argc == (2+1)) && (argv[1][0] == 's')) {
+               if (serviceID != NULL)  CFRelease(serviceID);
+               serviceID = CFStringCreateWithCString(NULL, argv[2], kCFStringEncodingUTF8);
+               SCPrint(TRUE, stdout, CFSTR("alternate service ID = %@\n"), serviceID);
+       }
+
+       // get primary IP address
+       address = copy_primary_ip(store, serviceID);
+       CFRelease(serviceID);
+       if (address != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("primary address = %@\n"), address);
+
+               if ((argc == (2+1)) && (argv[1][0] == 'a')) {
+                       if (address != NULL)    CFRelease(address);
+                       address = CFStringCreateWithCString(NULL, argv[2], kCFStringEncodingUTF8);
+                       SCPrint(TRUE, stdout, CFSTR("alternate primary address = %@\n"), address);
+               }
+
+               // start reverse DNS query using primary IP address
+               (void) start_dns_query(store, address);
+               CFRelease(address);
+       }
+
+    done :
+
+       smb_update_configuration(NULL, store);
+
+       CFRelease(store);
+
+       CFRunLoopRun();
+
+#else  /* DEBUG */
+
+       _sc_log     = FALSE;
+       _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+       load_smb_configuration((argc > 1) ? TRUE : FALSE);
+       CFRunLoopRun();
+       /* not reached */
+
+#endif /* DEBUG */
+
+       exit(0);
+       return 0;
+}
+#endif /* MAIN */
diff --git a/Plugins/IPMonitor/smb-configuration.h b/Plugins/IPMonitor/smb-configuration.h
new file mode 100644 (file)
index 0000000..46ece86
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006 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@
+ */
+
+#ifndef _SMB_CONFIGURATION_H
+#define _SMB_CONFIGURATION_H
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+void   load_smb_configuration          (Boolean        verbose);
+
+__END_DECLS
+
+#endif /* _SMB_CONFIGURATION_H */
index 510d8a8a4cd76eb8cd381ff22047a06a76e3f6b1..a0de58f8e9670db5382d471e3012ddd42bdfc3bf 100644 (file)
@@ -15,7 +15,7 @@
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
index a0a96207dd89bf3870ae24fd6f9d4d77f1142fba..6d94985b9c68a821c02e83945e748745633db3ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 /*
  * Modification History
  *
 /*
  * Modification History
  *
+ * November 6, 2006            Allan Nathanson <ajn@apple.com>
+ *                             Dan Markarian <markarian@apple.com>
+ *                             Dieter Siegmund <dieter@apple.com>
+ * - updated code to name interfaces quicker (without need for
+ *   calling IOKitWaitQuiet).
+ *
  * October 3, 2003             Allan Nathanson <ajn@apple.com>
  * - sort new interfaces by IOKit path (rather than MAC address) to
  *   help facilitate a more predictable interface-->name mapping for
  * October 3, 2003             Allan Nathanson <ajn@apple.com>
  * - sort new interfaces by IOKit path (rather than MAC address) to
  *   help facilitate a more predictable interface-->name mapping for
@@ -56,6 +62,7 @@
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <mach/mach.h>
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <mach/mach.h>
+#include <net/ethernet.h>
 #include <net/if_types.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <net/if_types.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPrivate.h>     // for SCLog(), SCPrint()
 #include <SystemConfiguration/SCValidation.h>
 
 #include <SystemConfiguration/SCPrivate.h>     // for SCLog(), SCPrint()
 #include <SystemConfiguration/SCValidation.h>
 
-#include <SystemConfiguration/BondConfiguration.h>
-#include <SystemConfiguration/BondConfigurationPrivate.h>
-
-#include <SystemConfiguration/VLANConfiguration.h>
-#include <SystemConfiguration/VLANConfigurationPrivate.h>
-
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOBSD.h>
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOBSD.h>
+#include <IOKit/IOMessage.h>
 #include <IOKit/network/IONetworkController.h>
 #include <IOKit/network/IONetworkInterface.h>
 
 #include <IOKit/network/IONetworkController.h>
 #include <IOKit/network/IONetworkInterface.h>
 
 #define        kIOBuiltin                      "IOBuiltin"
 #endif
 
 #define        kIOBuiltin                      "IOBuiltin"
 #endif
 
-#ifndef        kIOLocation
-#define        kIOLocation                     "IOLocation"
-#endif
-
 #define kIONetworkStackUserCommand     "IONetworkStackUserCommand"
 #define kIONetworkStackUserCommand     "IONetworkStackUserCommand"
-#define kIORegisterOne                 1
+#define kRegisterInterface             1
+
+#define        kSCNetworkInterfaceType         "SCNetworkInterfaceType"
+#define        kSCNetworkInterfaceActive       "Active"
 
 #define MY_PLUGIN_NAME                 "InterfaceNamer"
 
 #define MY_PLUGIN_NAME                 "InterfaceNamer"
+#define        MY_PLUGIN_ID                    CFSTR("com.apple.SystemConfiguration." MY_PLUGIN_NAME)
 
 
-static boolean_t                       S_debug = FALSE;
-static CFMutableArrayRef               S_dblist = NULL;
-static io_connect_t                    S_connect = MACH_PORT_NULL;
-static io_iterator_t                   S_iter = MACH_PORT_NULL;
-static IONotificationPortRef           S_notify = NULL;
+#define WAIT_QUIET_TIMEOUT_KEY         "WaitQuietTimeout"
+#define WAIT_QUIET_TIMEOUT_DEFAULT     60.0
 
 
-static void
-writeInterfaceList(CFArrayRef ilist);
+/*
+ * S_connect
+ *   "IONetworkStack" connect object used to "name" an interface.
+ */
+static io_connect_t            S_connect               = MACH_PORT_NULL;
 
 
-static void
-displayInterface(CFDictionaryRef if_dict);
+/*
+ * S_dblist
+ *   An array of CFDictionary's representing the interfaces
+ *   that have been identified and [need to be] named.
+ */
+static CFMutableArrayRef       S_dblist                = NULL;
 
 
-static CFDictionaryRef
-lookupIOKitPath(CFStringRef if_path);
+/*
+ * S_debug
+ *   A boolean that enables additional logging.
+ */
+static boolean_t               S_debug                 = FALSE;
+
+/*
+ * S_iflist
+ *   An array of SCNetworkInterface's representing the
+ *   interfaces that have been identified.
+ */
+static CFMutableArrayRef       S_iflist                = NULL;
+
+/*
+ * S_iter
+ *   IOServiceAddMatchingNotification object used to watch for
+ *   new network interfaces.
+ */
+static io_iterator_t           S_iter                  = MACH_PORT_NULL;
+
+/*
+ * S_notify
+ *   notification object for receiving IOKit notifications of
+ *   new devices or state changes.
+ */
+static IONotificationPortRef   S_notify                = NULL;
+
+/* S_prev_active_list
+ *   An array of CFDictionary's representing the previously
+ *   named interfaces.
+ */
+static CFMutableArrayRef       S_prev_active_list      = NULL;
+
+/*
+ * S_quiet
+ *   IOServiceAddInterestNotification object used to watch for
+ *   IOKit matching to quiesce.
+ */
+static io_object_t             S_quiet                 = MACH_PORT_NULL;
+
+/*
+ * S_stack
+ *   IOServiceAddMatchingNotification object used to watch for
+ *   the availability of the "IONetworkStack" object.
+ */
+static io_iterator_t           S_stack                 = MACH_PORT_NULL;
 
 
-static __inline__ CFComparisonResult
-compareMacAddress(CFDataRef addr1, CFDataRef addr2)
+/*
+ * S_state
+ *   A dictionary containing Information about each network
+ *   interface.  For now, the key is the BSD name and the
+ *   value is a CFNumber noting how long (in milliseconds)
+ *   it took for the interface to be recognized/named.
+ */
+static CFMutableDictionaryRef  S_state                 = NULL;
+
+/*
+ * S_timer
+ *   CFRunLoopTimer tracking how long we are willing to wait
+ *   for IOKit matching to quiesce (IOKitWaitQuiet).
+ */
+static CFRunLoopTimerRef       S_timer                 = NULL;
+
+/*
+ * Virtual network interface configuration
+ *   S_prefs : SCPreferences to configuration
+ *   S_bonds : most recently actived Bond configuration
+ *   S_vlans : most recently actived VLAN configuration
+ */
+static SCPreferencesRef                S_prefs                 = NULL;
+static CFArrayRef              S_bonds                 = NULL;
+static CFArrayRef              S_vlans                 = NULL;
+
+static void
+addTimestamp(CFMutableDictionaryRef dict, CFStringRef key)
 {
 {
-    int len1;
-    int len2;
-    int clen;
-    int res;
-
-    len1 = CFDataGetLength(addr1);
-    len2 = CFDataGetLength(addr2);
-
-    if (len1 == len2) {
-       if (len1 == 0)
-           return (kCFCompareEqualTo);
-       return (memcmp(CFDataGetBytePtr(addr1),
-                      CFDataGetBytePtr(addr2),
-                      len1));
-    }
-    clen = len1;
-    if (len2 < clen)
-       clen = len2;
-    res = memcmp(CFDataGetBytePtr(addr1),
-                CFDataGetBytePtr(addr2),
-                clen);
-    if (res == 0) {
-       return (len1 - len2);
-    }
-    return (res);
+    CFAbsoluteTime     now;
+    CFNumberRef                val;
+
+    now = CFAbsoluteTimeGetCurrent();
+    val = CFNumberCreate(NULL, kCFNumberDoubleType, &now);
+    CFDictionaryAddValue(dict, key, val);
+    CFRelease(val);
+    return;
 }
 
 static CFComparisonResult
 }
 
 static CFComparisonResult
@@ -158,249 +217,16 @@ if_unit_compare(const void *val1, const void *val2, void *context)
     return (CFNumberCompare(unit1, unit2, NULL));
 }
 
     return (CFNumberCompare(unit1, unit2, NULL));
 }
 
-static CFArrayRef
-split_path(CFStringRef path)
-{
-       CFArrayRef              components;
-       CFMutableStringRef      nPath;
-
-       // turn '@'s into '/'s
-       nPath = CFStringCreateMutableCopy(NULL, 0, path);
-       (void) CFStringFindAndReplace(nPath,
-                                     CFSTR("@"),
-                                     CFSTR("/"),
-                                     CFRangeMake(0, CFStringGetLength(nPath)),
-                                     0);
-
-       // split path into components to be compared
-       components = CFStringCreateArrayBySeparatingStrings(NULL, nPath, CFSTR("/"));
-       CFRelease(nPath);
-
-       return components;
-}
-
-
-static CFComparisonResult
-if_path_compare(const void *val1, const void *val2, void *context)
-{
-    CFBooleanRef       builtin;
-    Boolean            builtin_val1    = FALSE;
-    Boolean            builtin_val2    = FALSE;
-    CFArrayRef         elements1       = NULL;
-    CFArrayRef         elements2       = NULL;
-    CFIndex            i;
-    CFIndex            n;
-    CFIndex            n1              = 0;
-    CFIndex            n2              = 0;
-    CFStringRef                path;
-    CFComparisonResult res;
-    CFNumberRef                type1;
-    CFNumberRef                type2;
-
-    /* sort by interface type */
-
-    type1 = CFDictionaryGetValue((CFDictionaryRef)val1, CFSTR(kIOInterfaceType));
-    type2 = CFDictionaryGetValue((CFDictionaryRef)val2, CFSTR(kIOInterfaceType));
-    res = CFNumberCompare(type1, type2, NULL);
-    if (res != kCFCompareEqualTo) {
-       return (res);
-    }
-
-    /* built-in interfaces sort first */
-    builtin = CFDictionaryGetValue((CFDictionaryRef)val1, CFSTR(kIOBuiltin));
-    if (isA_CFBoolean(builtin) != NULL) {
-       builtin_val1 = CFBooleanGetValue(builtin);
-    }
-    builtin = CFDictionaryGetValue((CFDictionaryRef)val2, CFSTR(kIOBuiltin));
-    if (isA_CFBoolean(builtin) != NULL) {
-       builtin_val2 = CFBooleanGetValue(builtin);
-    }
-    if (builtin_val1 != builtin_val2) {
-       if (builtin_val1) {
-           res = kCFCompareLessThan;
-       } else {
-           res = kCFCompareGreaterThan;
-       }
-       return (res);
-    }
-
-    /* ... and then sort built-in interfaces by "location" */
-    if (builtin_val1) {
-       CFStringRef     location1;
-       CFStringRef     location2;
-
-       location1 = CFDictionaryGetValue((CFDictionaryRef)val1, CFSTR(kIOLocation));
-       location2 = CFDictionaryGetValue((CFDictionaryRef)val2, CFSTR(kIOLocation));
-       if (location1 != location2) {
-           if (isA_CFString(location1)) {
-               if (isA_CFString(location2)) {
-                   res = CFStringCompare(location1, location2, 0);
-               } else {
-                   res = kCFCompareLessThan;
-               }
-           } else {
-               res = kCFCompareGreaterThan;
-           }
-
-           if (res != kCFCompareEqualTo) {
-               return (res);
-           }
-       }
-    }
-
-    /* ... and then sort by IOPathMatch */
-
-    path = CFDictionaryGetValue((CFDictionaryRef)val1, CFSTR(kIOPathMatchKey));
-    if (isA_CFString(path)) {
-       elements1 = split_path(path);
-       n1 = CFArrayGetCount(elements1);
-    } else {
-       goto done;
-    }
-
-    path = CFDictionaryGetValue((CFDictionaryRef)val2, CFSTR(kIOPathMatchKey));
-    if (isA_CFString(path)) {
-       elements2 = split_path(path);
-       n2 = CFArrayGetCount(elements2);
-    } else {
-       goto done;
-    }
-
-    n = (n1 <= n2) ? n1 : n2;
-    for (i = 0; i < n; i++) {
-       CFStringRef     e1;
-       CFStringRef     e2;
-       char            *end;
-       quad_t          q1;
-       quad_t          q2;
-       char            *str;
-       Boolean         isNum;
-
-       e1 = CFArrayGetValueAtIndex(elements1, i);
-       e2 = CFArrayGetValueAtIndex(elements2, i);
-
-       str = _SC_cfstring_to_cstring(e1, NULL, 0, kCFStringEncodingASCII);
-       errno = 0;
-       q1 = strtoq(str, &end, 16);
-       isNum = ((*str != '\0') && (*end == '\0') && (errno == 0));
-       CFAllocatorDeallocate(NULL, str);
-
-       if (isNum) {
-           // if e1 is a valid numeric string
-           str = _SC_cfstring_to_cstring(e2, NULL, 0, kCFStringEncodingASCII);
-           errno = 0;
-           q2 = strtoq(str, &end, 16);
-           isNum = ((*str != '\0') && (*end == '\0') && (errno == 0));
-           CFAllocatorDeallocate(NULL, str);
-
-           if (isNum) {
-               // if e2 is also a valid numeric string
-
-               if (q1 == q2) {
-                   res = kCFCompareEqualTo;
-                   continue;
-               } else if (q1 < q2) {
-                   res = kCFCompareLessThan;
-               } else {
-                   res = kCFCompareGreaterThan;
-               }
-               break;
-           }
-       }
-
-       res = CFStringCompare(e1, e2, 0);
-       if (res != kCFCompareEqualTo) {
-           break;
-       }
-    }
-
-    if (res == kCFCompareEqualTo) {
-       if (n1 < n2) {
-           res = kCFCompareLessThan;
-       } else if (n1 < n2) {
-           res = kCFCompareGreaterThan;
-       }
-    }
-
- done :
-    if ( elements1 ) CFRelease( elements1 );
-    if ( elements2 ) CFRelease( elements2 );
-
-    return res;
-}
-
-static boolean_t
-addCFStringProperty( CFMutableDictionaryRef dict,
-                    const char *           key,
-                    const char *           string )
-{
-    boolean_t    ret = false;
-    CFStringRef  valObj, keyObj;
-
-    if ( (string == 0) || (key == 0) || (dict == 0) )
-       return false;
-
-    keyObj = CFStringCreateWithCString(NULL,
-                                      key,
-                                      kCFStringEncodingASCII );
-
-    valObj = CFStringCreateWithCString(NULL,
-                                      string,
-                                      kCFStringEncodingASCII );
-
-    if (valObj && keyObj) {
-       CFDictionarySetValue( dict, keyObj, valObj );
-       ret = true;
-    }
-
-    if ( keyObj ) CFRelease( keyObj );
-    if ( valObj ) CFRelease( valObj );
-
-    return ret;
-}
-
-static boolean_t
-addCFNumberProperty( CFMutableDictionaryRef dict,
-                    const char *           key,
-                    unsigned int           number )
-{
-    boolean_t    ret = false;
-    CFNumberRef  numObj;
-    CFStringRef  keyObj;
-
-    if ( (key == 0) || (dict == 0) )
-       return false;
-
-    numObj = CFNumberCreate(NULL,
-                           kCFNumberLongType,
-                           &number);
-
-    keyObj = CFStringCreateWithCString(NULL,
-                                      key,
-                                      kCFStringEncodingASCII );
-
-    if ( numObj && keyObj )
-       {
-           CFDictionarySetValue( dict, keyObj, numObj );
-           ret = true;
-       }
-
-    if ( numObj ) CFRelease( numObj );
-    if ( keyObj ) CFRelease( keyObj );
-
-    return ret;
-}
-
 static void *
 read_file(char * filename, size_t * data_length)
 {
 static void *
 read_file(char * filename, size_t * data_length)
 {
-    void *             data = NULL;
-    size_t             len = 0;
-    int                        fd = -1;
+    void *             data    = NULL;
+    size_t             len     = 0;
+    int                        fd      = -1;
     struct stat                sb;
 
     *data_length = 0;
     struct stat                sb;
 
     *data_length = 0;
-    if (stat(filename, &sb) < 0)
+    if (stat(filename, &sb) == -1)
        goto done;
     len = sb.st_size;
     if (len == 0)
        goto done;
     len = sb.st_size;
     if (len == 0)
@@ -411,17 +237,18 @@ read_file(char * filename, size_t * data_length)
        goto done;
 
     fd = open(filename, O_RDONLY);
        goto done;
 
     fd = open(filename, O_RDONLY);
-    if (fd < 0)
+    if (fd == -1)
        goto done;
 
     if (read(fd, data, len) != len) {
        goto done;
 
     if (read(fd, data, len) != len) {
-       SCLog(TRUE, LOG_INFO,
+       SCLog(TRUE, LOG_ERR,
              CFSTR(MY_PLUGIN_NAME ": read %s failed, %s"),
              filename, strerror(errno));
        goto done;
     }
              CFSTR(MY_PLUGIN_NAME ": read %s failed, %s"),
              filename, strerror(errno));
        goto done;
     }
+
  done:
  done:
-    if (fd >= 0)
+    if (fd != -1)
        close(fd);
     if (data) {
        *data_length = len;
        close(fd);
     if (data) {
        *data_length = len;
@@ -434,9 +261,9 @@ readPropertyList(char * filename)
 {
     void *             buf;
     size_t             bufsize;
 {
     void *             buf;
     size_t             bufsize;
-    CFDataRef          data = NULL;
-    CFPropertyListRef  plist = NULL;
-    CFStringRef                errorString = NULL;
+    CFDataRef          data            = NULL;
+    CFPropertyListRef  plist           = NULL;
+    CFStringRef                errorString     = NULL;
 
     buf = read_file(filename, &bufsize);
     if (buf == NULL) {
 
     buf = read_file(filename, &bufsize);
     if (buf == NULL) {
@@ -451,9 +278,9 @@ readPropertyList(char * filename)
                                            kCFPropertyListMutableContainers,
                                            &errorString);
     if (plist == NULL) {
                                            kCFPropertyListMutableContainers,
                                            &errorString);
     if (plist == NULL) {
-       if (errorString) {
-           SCLog(TRUE, LOG_INFO,
-                 CFSTR(MY_PLUGIN_NAME ":%@"),
+       if (errorString != NULL) {
+           SCLog(TRUE, LOG_ERR,
+                 CFSTR(MY_PLUGIN_NAME ": %@"),
                  errorString);
            CFRelease(errorString);
        }
                  errorString);
            CFRelease(errorString);
        }
@@ -466,173 +293,314 @@ readPropertyList(char * filename)
     return (plist);
 }
 
     return (plist);
 }
 
-#define        IFNAMER_ID                      CFSTR("com.apple.SystemConfiguration.InterfaceNamer")
 #define        INTERFACES                      CFSTR("Interfaces")
 #define        NETWORK_INTERFACES_PREFS        CFSTR("NetworkInterfaces.plist")
 #define        OLD_NETWORK_INTERFACES_FILE     "/var/db/NetworkInterfaces.xml"
 
 #define        INTERFACES                      CFSTR("Interfaces")
 #define        NETWORK_INTERFACES_PREFS        CFSTR("NetworkInterfaces.plist")
 #define        OLD_NETWORK_INTERFACES_FILE     "/var/db/NetworkInterfaces.xml"
 
+static void
+writeInterfaceList(CFArrayRef if_list)
+{
+    CFArrayRef         cur_list;
+    SCPreferencesRef   prefs;
+
+    if (isA_CFArray(if_list) == NULL) {
+       return;
+    }
+
+    prefs = SCPreferencesCreate(NULL, MY_PLUGIN_ID, NETWORK_INTERFACES_PREFS);
+    if (prefs == NULL) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": SCPreferencesCreate failed, %s"),
+             SCErrorString(SCError()));
+       return;
+    }
+
+    cur_list = SCPreferencesGetValue(prefs, INTERFACES);
+    if (_SC_CFEqual(cur_list, if_list)) {
+       goto done;
+    }
+
+    if (!SCPreferencesSetValue(prefs, INTERFACES, if_list)) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": SCPreferencesSetValue failed, %s"),
+             SCErrorString(SCError()));
+       goto done;
+    }
+
+    if (!SCPreferencesCommitChanges(prefs)) {
+       SCLog((SCError() != EROFS), LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": SCPreferencesCommitChanges failed, %s"),
+             SCErrorString(SCError()));
+       goto done;
+    }
+
+done:
+
+    CFRelease(prefs);
+    return;
+}
+
 static CFMutableArrayRef
 readInterfaceList()
 {
 static CFMutableArrayRef
 readInterfaceList()
 {
-    CFArrayRef         ilist;
+    CFArrayRef         if_list;
     CFMutableArrayRef  plist = NULL;
     SCPreferencesRef   prefs = NULL;
 
     CFMutableArrayRef  plist = NULL;
     SCPreferencesRef   prefs = NULL;
 
-    prefs = SCPreferencesCreate(NULL, IFNAMER_ID, NETWORK_INTERFACES_PREFS);
+    prefs = SCPreferencesCreate(NULL, MY_PLUGIN_ID, NETWORK_INTERFACES_PREFS);
     if (!prefs) {
     if (!prefs) {
-       SCLog(TRUE, LOG_INFO,
+       SCLog(TRUE, LOG_ERR,
              CFSTR(MY_PLUGIN_NAME ": SCPreferencesCreate failed, %s"),
              SCErrorString(SCError()));
        return (NULL);
     }
 
              CFSTR(MY_PLUGIN_NAME ": SCPreferencesCreate failed, %s"),
              SCErrorString(SCError()));
        return (NULL);
     }
 
-    ilist = SCPreferencesGetValue(prefs, INTERFACES);
-    if (isA_CFArray(ilist)) {
-       plist = CFArrayCreateMutableCopy(NULL, 0, ilist);
-    } else {
-       plist = (CFMutableArrayRef)readPropertyList(OLD_NETWORK_INTERFACES_FILE);
-       if (plist == NULL) {
+    if_list = SCPreferencesGetValue(prefs, INTERFACES);
+    if (!isA_CFArray(if_list)) {
+       if_list = (CFArrayRef)readPropertyList(OLD_NETWORK_INTERFACES_FILE);
+       if (if_list == NULL) {
            goto done;
        }
            goto done;
        }
-       if (isA_CFArray(plist) == NULL) {
-           CFRelease(plist);
+       if (!isA_CFArray(if_list)) {
+           CFRelease(if_list);
+           if_list = NULL;
            goto done;
        }
            goto done;
        }
-       writeInterfaceList(plist);
+       writeInterfaceList(if_list);
        (void)unlink(OLD_NETWORK_INTERFACES_FILE);
     }
 
   done:
        (void)unlink(OLD_NETWORK_INTERFACES_FILE);
     }
 
   done:
+    if (if_list != NULL) {
+       CFIndex i;
+       CFIndex n       = CFArrayGetCount(if_list);
+
+       plist = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       for (i = 0; i < n; i++) {
+           CFDictionaryRef     dict;
+
+           dict = CFArrayGetValueAtIndex(if_list, i);
+           if (isA_CFDictionary(dict) &&
+               CFDictionaryContainsKey(dict, CFSTR(kIOInterfaceType)) &&
+               CFDictionaryContainsKey(dict, CFSTR(kIOInterfaceUnit)) &&
+               CFDictionaryContainsKey(dict, CFSTR(kIOMACAddress))) {
+                   CFArrayAppendValue(plist, dict);
+           }
+       }
+    }
     if (prefs) {
        CFRelease(prefs);
     }
     return (plist);
 }
 
     if (prefs) {
        CFRelease(prefs);
     }
     return (plist);
 }
 
-static void
-writeInterfaceList(CFArrayRef ilist)
+static CFMutableArrayRef
+previouslyActiveInterfaces()
 {
 {
-    SCPreferencesRef   prefs;
+    CFMutableArrayRef  active;
+    CFIndex            i;
+    CFIndex            n;
 
 
-    if (isA_CFArray(ilist) == NULL) {
-       return;
+    if (S_dblist == NULL) {
+       return NULL;
     }
 
     }
 
-    prefs = SCPreferencesCreate(NULL, IFNAMER_ID, NETWORK_INTERFACES_PREFS);
-    if (prefs == NULL) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME ": SCPreferencesCreate failed, %s"),
-             SCErrorString(SCError()));
-       return;
-    }
+    active = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
 
-    if (!SCPreferencesSetValue(prefs, INTERFACES, ilist)) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME ": SCPreferencesSetValue failed, %s"),
-             SCErrorString(SCError()));
-       goto done;
+    n = CFArrayGetCount(S_dblist);
+    for (i = 0; i < n; i++) {
+       CFDictionaryRef if_dict;
+
+       if_dict = CFArrayGetValueAtIndex(S_dblist, i);
+       if (CFDictionaryContainsKey(if_dict, CFSTR(kSCNetworkInterfaceActive))) {
+           CFMutableDictionaryRef      new_dict;
+
+           new_dict = CFDictionaryCreateMutableCopy(NULL, 0, if_dict);
+           CFDictionaryRemoveValue(new_dict, CFSTR(kSCNetworkInterfaceActive));
+           CFArraySetValueAtIndex(S_dblist, i, new_dict);
+           CFArrayAppendValue(active, new_dict);
+           CFRelease(new_dict);
+       }
     }
 
     }
 
-    if (!SCPreferencesCommitChanges(prefs)) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME ": SCPreferencesCommitChanges failed, %s"),
-             SCErrorString(SCError()));
-       goto done;
+    return active;
+}
+
+static void
+updateStore(void)
+{
+    CFStringRef                key;
+    SCDynamicStoreRef  store;
+
+    store = SCDynamicStoreCreate(NULL, CFSTR(MY_PLUGIN_NAME), NULL, NULL);
+    if (store == NULL) {
+       return;
     }
 
     }
 
-done:
+    key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@" MY_PLUGIN_NAME),
+                                 kSCDynamicStoreDomainPlugin);
+    (void)SCDynamicStoreSetValue(store, key, S_state);
+    CFRelease(key);
+    CFRelease(store);
 
 
-    CFRelease(prefs);
     return;
 }
 
 static void
     return;
 }
 
 static void
-updateBondConfiguration(void)
+updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef            prefs,
+                                          SCPreferencesNotification   notificationType,
+                                          void                         *info)
 {
 {
-    BondPreferencesRef prefs;
+    CFArrayRef interfaces;
 
 
-    prefs = BondPreferencesCreate(NULL);
-    if (prefs == NULL) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME ": BondPreferencesCreate failed, %s"),
-             SCErrorString(SCError()));
+    if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) {
        return;
     }
 
        return;
     }
 
-    if (!_BondPreferencesUpdateConfiguration(prefs)) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME ": _BondPreferencesUpdateConfiguration failed, %s"),
+    if (prefs == NULL) {
+       // if a new interface has been "named"
+       prefs = S_prefs;
+       if (S_bonds != NULL) {
+           CFRelease(S_bonds);
+           S_bonds = NULL;
+       }
+       if (S_vlans != NULL) {
+           CFRelease(S_vlans);
+           S_vlans = NULL;
+       }
+    }
+
+    // update Bond configuration
+
+    interfaces = SCBondInterfaceCopyAll(prefs);
+    if ((S_bonds == NULL) && (interfaces == NULL)) {
+       // if no change
+       goto vlan;
+    }
+    if ((S_bonds != NULL) && (interfaces != NULL) && CFEqual(S_bonds, interfaces)) {
+       // if no change
+       CFRelease(interfaces);
+       goto vlan;
+    }
+    if (S_bonds != NULL) CFRelease(S_bonds);
+    S_bonds = interfaces;
+
+    if (!_SCBondInterfaceUpdateConfiguration(prefs)) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": _SCBondInterfaceUpdateConfiguration failed, %s"),
              SCErrorString(SCError()));
              SCErrorString(SCError()));
+    }
+
+  vlan :
+
+    // update VLAN configuration
+
+    interfaces = SCVLANInterfaceCopyAll(prefs);
+    if ((S_vlans == NULL) && (interfaces == NULL)) {
+       // if no change
        goto done;
     }
        goto done;
     }
+    if ((S_vlans != NULL) && (interfaces != NULL) && CFEqual(S_vlans, interfaces)) {
+       // if no change
+       CFRelease(interfaces);
+       goto done;
+    }
+    if (S_vlans != NULL) CFRelease(S_vlans);
+    S_vlans = interfaces;
 
 
-done:
+    if (!_SCVLANInterfaceUpdateConfiguration(prefs)) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": _SCVLANInterfaceUpdateConfiguration failed, %s"),
+             SCErrorString(SCError()));
+    }
 
 
-    CFRelease(prefs);
+  done :
+
+    // we are finished with current prefs, wait for changes
+
+    SCPreferencesSynchronize(prefs);
     return;
 }
 
     return;
 }
 
-static void
-updateVLANConfiguration(void)
+static CFDictionaryRef
+createInterfaceDict(SCNetworkInterfaceRef interface)
 {
 {
-    VLANPreferencesRef prefs;
+    CFMutableDictionaryRef     new_if;
+    CFTypeRef                  val;
 
 
-    prefs = VLANPreferencesCreate(NULL);
-    if (prefs == NULL) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME ": VLANPreferencesCreate failed, %s"),
-             SCErrorString(SCError()));
-       return;
+    new_if = CFDictionaryCreateMutable(NULL,
+                                      0,
+                                      &kCFTypeDictionaryKeyCallBacks,
+                                      &kCFTypeDictionaryValueCallBacks);
+
+    val = _SCNetworkInterfaceGetIOPath(interface);
+    if (val != NULL) {
+       CFDictionarySetValue(new_if, CFSTR(kIOPathMatchKey), val);
     }
 
     }
 
-    if (!_VLANPreferencesUpdateConfiguration(prefs)) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME ": _VLANPreferencesUpdateConfiguration failed, %s"),
-             SCErrorString(SCError()));
-       goto done;
+    val = _SCNetworkInterfaceGetIOInterfaceType(interface);
+    if (val != NULL) {
+       CFDictionarySetValue(new_if, CFSTR(kIOInterfaceType), val);
     }
 
     }
 
-done:
+    val = _SCNetworkInterfaceGetIOInterfaceUnit(interface);
+    if (val != NULL) {
+       CFDictionarySetValue(new_if, CFSTR(kIOInterfaceUnit), val);
+    }
 
 
-    CFRelease(prefs);
-    return;
-}
+    val = _SCNetworkInterfaceGetHardwareAddress(interface);
+    if (val != NULL) {
+       CFDictionarySetValue(new_if, CFSTR(kIOMACAddress), val);
+    }
+
+    val = SCNetworkInterfaceGetBSDName(interface);
+    if (val != NULL) {
+       CFDictionarySetValue(new_if, CFSTR(kIOBSDNameKey), val);
+    }
+
+    val = SCNetworkInterfaceGetInterfaceType(interface);
+    if (val != NULL) {
+       CFDictionarySetValue(new_if, CFSTR(kSCNetworkInterfaceType), val);
+    }
 
 
-#define INDEX_BAD      (-1)
+    CFDictionarySetValue(new_if,
+                        CFSTR(kIOBuiltin),
+                        _SCNetworkInterfaceIsBuiltin(interface) ? kCFBooleanTrue : kCFBooleanFalse);
+
+    CFDictionarySetValue(new_if, CFSTR(kSCNetworkInterfaceActive), kCFBooleanTrue);
+
+    return new_if;
+}
 
 static CFDictionaryRef
 
 static CFDictionaryRef
-lookupInterfaceByType(CFArrayRef list, CFDictionaryRef if_dict, int * where)
+lookupInterfaceByAddress(CFArrayRef db_list, SCNetworkInterfaceRef interface, CFIndex * where)
 {
     CFDataRef  addr;
     CFIndex    i;
     CFIndex    n;
     CFNumberRef        type;
 
 {
     CFDataRef  addr;
     CFIndex    i;
     CFIndex    n;
     CFNumberRef        type;
 
-    if (where) {
-       *where = INDEX_BAD;
-    }
-    if (list == NULL) {
+    if (db_list == NULL) {
        return (NULL);
     }
        return (NULL);
     }
-    addr = CFDictionaryGetValue(if_dict, CFSTR(kIOMACAddress));
-    type = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceType));
+    type = _SCNetworkInterfaceGetIOInterfaceType(interface);
+    addr = _SCNetworkInterfaceGetHardwareAddress(interface);
     if (type == NULL || addr == NULL) {
        return (NULL);
     }
 
     if (type == NULL || addr == NULL) {
        return (NULL);
     }
 
-    n = CFArrayGetCount(list);
+    n = CFArrayGetCount(db_list);
     for (i = 0; i < n; i++) {
     for (i = 0; i < n; i++) {
-       CFDictionaryRef dict = CFArrayGetValueAtIndex(list, i);
        CFDataRef       a;
        CFDataRef       a;
+       CFDictionaryRef dict = CFArrayGetValueAtIndex(db_list, i);
        CFNumberRef     t;
 
        CFNumberRef     t;
 
-       a = CFDictionaryGetValue(dict, CFSTR(kIOMACAddress));
        t = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceType));
        t = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceType));
-       if (a == NULL || t == NULL)
+       a = CFDictionaryGetValue(dict, CFSTR(kIOMACAddress));
+       if (t == NULL || a == NULL)
            continue;
 
            continue;
 
-       if (CFNumberCompare(type, t, NULL) == kCFCompareEqualTo
-           && compareMacAddress(addr, a) == kCFCompareEqualTo) {
+       if (CFEqual(type, t) && CFEqual(addr, a)) {
            if (where) {
                *where = i;
            }
            if (where) {
                *where = i;
            }
@@ -643,28 +611,25 @@ lookupInterfaceByType(CFArrayRef list, CFDictionaryRef if_dict, int * where)
 }
 
 static CFDictionaryRef
 }
 
 static CFDictionaryRef
-lookupInterfaceByUnit(CFArrayRef list, CFDictionaryRef if_dict, int * where)
+lookupInterfaceByUnit(CFArrayRef db_list, SCNetworkInterfaceRef interface, CFIndex * where)
 {
     CFIndex    i;
     CFIndex    n;
     CFNumberRef        type;
     CFNumberRef        unit;
 
 {
     CFIndex    i;
     CFIndex    n;
     CFNumberRef        type;
     CFNumberRef        unit;
 
-    if (where) {
-       *where = INDEX_BAD;
-    }
-    if (list == NULL) {
+    if (db_list == NULL) {
        return (NULL);
     }
        return (NULL);
     }
-    type = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceType));
-    unit = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceUnit));
+    type = _SCNetworkInterfaceGetIOInterfaceType(interface);
+    unit = _SCNetworkInterfaceGetIOInterfaceUnit(interface);
     if (type == NULL || unit == NULL) {
        return (NULL);
     }
 
     if (type == NULL || unit == NULL) {
        return (NULL);
     }
 
-    n = CFArrayGetCount(list);
+    n = CFArrayGetCount(db_list);
     for (i = 0; i < n; i++) {
     for (i = 0; i < n; i++) {
-       CFDictionaryRef dict = CFArrayGetValueAtIndex(list, i);
+       CFDictionaryRef dict = CFArrayGetValueAtIndex(db_list, i);
        CFNumberRef     t;
        CFNumberRef     u;
 
        CFNumberRef     t;
        CFNumberRef     u;
 
@@ -674,8 +639,7 @@ lookupInterfaceByUnit(CFArrayRef list, CFDictionaryRef if_dict, int * where)
            continue;
        }
 
            continue;
        }
 
-       if (CFNumberCompare(type, t, NULL) == kCFCompareEqualTo
-           && CFNumberCompare(unit, u, NULL) == kCFCompareEqualTo) {
+       if (CFEqual(type, t) && CFEqual(unit, u)) {
            if (where)
                *where = i;
            return (dict);
            if (where)
                *where = i;
            return (dict);
@@ -684,55 +648,24 @@ lookupInterfaceByUnit(CFArrayRef list, CFDictionaryRef if_dict, int * where)
     return (NULL);
 }
 
     return (NULL);
 }
 
-#define kAirPortDriverPath     CFSTR("AirPort")
-#define kIO80211InterfacePath  CFSTR("IO80211Interface")
-#define APPLE_WIRELESS_80211   CFSTR("AppleWireless80211")
-
-static __inline__ boolean_t
-pathIsAirPort(CFStringRef path)
+static CFDictionaryRef
+lookupAirPortInterface(CFArrayRef db_list, CFIndex * where)
 {
 {
-    CFRange r;
-
-    r = CFStringFind(path, kIO80211InterfacePath, 0);
-    if (r.location != kCFNotFound) {
-       return (TRUE);
-    }
+    CFIndex    i;
+    CFIndex    n;
 
 
-    r = CFStringFind(path, kAirPortDriverPath, 0);
-    if (r.location != kCFNotFound) {
-       return (TRUE);
+    if (db_list == NULL) {
+       return (NULL);
     }
     }
+    n = CFArrayGetCount(db_list);
+    for (i = 0; i < n; i++) {
+       CFDictionaryRef dict;
+       CFStringRef     if_type;
 
 
-    r = CFStringFind(path, APPLE_WIRELESS_80211, 0);
-    if (r.location != kCFNotFound) {
-       return (TRUE);
-    }
-
-    return (FALSE);
-}
-
-static CFDictionaryRef
-lookupAirPortInterface(CFArrayRef list, int * where)
-{
-    CFIndex    i;
-    CFIndex    n;
-
-    if (where) {
-       *where = INDEX_BAD;
-    }
-    if (list == NULL) {
-       return (NULL);
-    }
-    n = CFArrayGetCount(list);
-    for (i = 0; i < n; i++) {
-       CFDictionaryRef dict = CFArrayGetValueAtIndex(list, i);
-       CFStringRef     path;
-
-       path = CFDictionaryGetValue(dict, CFSTR(kIOPathMatchKey));
-       if (path == NULL) {
-           continue;
-       }
-       if (pathIsAirPort(path) == TRUE) {
+       dict = CFArrayGetValueAtIndex(db_list, i);
+       if_type = CFDictionaryGetValue(dict, CFSTR(kSCNetworkInterfaceType));
+       if ((if_type != NULL) &&
+           CFEqual(if_type, kSCNetworkInterfaceTypeIEEE80211)) {
            if (where)
                *where = i;
            return (dict);
            if (where)
                *where = i;
            return (dict);
@@ -742,54 +675,70 @@ lookupAirPortInterface(CFArrayRef list, int * where)
 }
 
 static void
 }
 
 static void
-insertInterface(CFMutableArrayRef list, CFDictionaryRef if_dict)
+insertInterface(CFMutableArrayRef db_list, SCNetworkInterfaceRef interface)
 {
     CFIndex            i;
 {
     CFIndex            i;
+    CFDictionaryRef    if_dict;
+    CFStringRef                if_name;
     CFNumberRef                if_type;
     CFNumberRef                if_unit;
     CFNumberRef                if_type;
     CFNumberRef                if_unit;
-    CFIndex            n       = CFArrayGetCount(list);
+    CFIndex            n       = CFArrayGetCount(db_list);
     CFComparisonResult res;
 
     CFComparisonResult res;
 
-    if_type = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceType));
-    if_unit = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceUnit));
+    if_name = SCNetworkInterfaceGetBSDName(interface);
+    if (if_name != NULL) {
+       addTimestamp(S_state, if_name);
+    }
+
+    if_dict = createInterfaceDict(interface);
+    if_type = _SCNetworkInterfaceGetIOInterfaceType(interface);
+    if_unit = _SCNetworkInterfaceGetIOInterfaceUnit(interface);
+    if ((if_type == NULL) || (if_unit == NULL)) {
+       CFRelease(if_dict);
+       return;
+    }
+
     for (i = 0; i < n; i++) {
     for (i = 0; i < n; i++) {
-       CFDictionaryRef dict = CFArrayGetValueAtIndex(list, i);
-       CFNumberRef     type;
-       CFNumberRef     unit;
+       CFNumberRef     db_type;
+       CFNumberRef     db_unit;
+       CFDictionaryRef dict    = CFArrayGetValueAtIndex(db_list, i);
 
 
-       type = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceType));
-       unit = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceUnit));
-       res = CFNumberCompare(if_type, type, NULL);
+       db_type = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceType));
+       db_unit = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceUnit));
+       res = CFNumberCompare(if_type, db_type, NULL);
        if (res == kCFCompareLessThan
            || (res == kCFCompareEqualTo
        if (res == kCFCompareLessThan
            || (res == kCFCompareEqualTo
-               && (CFNumberCompare(if_unit, unit, NULL)
+               && (CFNumberCompare(if_unit, db_unit, NULL)
                    == kCFCompareLessThan))) {
                    == kCFCompareLessThan))) {
-           CFArrayInsertValueAtIndex(list, i, if_dict);
+           CFArrayInsertValueAtIndex(db_list, i, if_dict);
+           CFRelease(if_dict);
            return;
        }
     }
            return;
        }
     }
+
     CFArrayAppendValue(S_dblist, if_dict);
     CFArrayAppendValue(S_dblist, if_dict);
+    CFRelease(if_dict);
     return;
 }
 
 static void
     return;
 }
 
 static void
-replaceInterface(CFDictionaryRef if_dict)
+replaceInterface(SCNetworkInterfaceRef interface)
 {
 {
-    int where;
+    CFIndex where;
 
     if (S_dblist == NULL) {
        S_dblist = CFArrayCreateMutable(NULL, 0,
                                        &kCFTypeArrayCallBacks);
     }
 
     if (S_dblist == NULL) {
        S_dblist = CFArrayCreateMutable(NULL, 0,
                                        &kCFTypeArrayCallBacks);
     }
-    /* remove any dict that has our type/addr */
-    if (lookupInterfaceByType(S_dblist, if_dict, &where) != NULL) {
+    // remove any dict that has our type/addr
+    if (lookupInterfaceByAddress(S_dblist, interface, &where) != NULL) {
        CFArrayRemoveValueAtIndex(S_dblist, where);
     }
        CFArrayRemoveValueAtIndex(S_dblist, where);
     }
-    /* remove any dict that has the same type/unit */
-    if (lookupInterfaceByUnit(S_dblist, if_dict, &where) != NULL) {
+    // remove any dict that has the same type/unit
+    if (lookupInterfaceByUnit(S_dblist, interface, &where) != NULL) {
        CFArrayRemoveValueAtIndex(S_dblist, where);
     }
        CFArrayRemoveValueAtIndex(S_dblist, where);
     }
-    insertInterface(S_dblist, if_dict);
+    insertInterface(S_dblist, interface);
     return;
 }
 
     return;
 }
 
@@ -798,19 +747,21 @@ getHighestUnitForType(CFNumberRef if_type)
 {
     int                i;
     CFIndex            n;
 {
     int                i;
     CFIndex            n;
-    CFNumberRef                ret_unit = NULL;
+    CFNumberRef                ret_unit        = NULL;
 
 
-    if (S_dblist == NULL)
+    if (S_dblist == NULL) {
        return (NULL);
        return (NULL);
+    }
 
     n = CFArrayGetCount(S_dblist);
     for (i = 0; i < n; i++) {
        CFDictionaryRef dict = CFArrayGetValueAtIndex(S_dblist, i);
        CFNumberRef     type;
 
     n = CFArrayGetCount(S_dblist);
     for (i = 0; i < n; i++) {
        CFDictionaryRef dict = CFArrayGetValueAtIndex(S_dblist, i);
        CFNumberRef     type;
-       CFNumberRef     unit;
 
        type = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceType));
        if (CFEqual(type, if_type)) {
 
        type = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceType));
        if (CFEqual(type, if_type)) {
+           CFNumberRef unit;
+
            unit = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceUnit));
            if (ret_unit == NULL
                || (CFNumberCompare(unit, ret_unit, NULL)
            unit = CFDictionaryGetValue(dict, CFSTR(kIOInterfaceUnit));
            if (ret_unit == NULL
                || (CFNumberCompare(unit, ret_unit, NULL)
@@ -819,254 +770,51 @@ getHighestUnitForType(CFNumberRef if_type)
            }
        }
     }
            }
        }
     }
+
     return (ret_unit);
 }
 
     return (ret_unit);
 }
 
-//------------------------------------------------------------------------
-// Register a single interface with the given service path to the
-// data link layer (BSD), using the specified unit number.
-
+/*
+ * Function: registerInterface
+ * Purpose:
+ *   Register a single interface with the given service path to the
+ *   data link layer (BSD), using the specified unit number.
+ */
 static kern_return_t
 static kern_return_t
-registerInterface(io_connect_t connect,
-                 CFStringRef path,
-                 CFNumberRef unit)
+registerInterface(io_connect_t connect,
+                 CFStringRef   path,
+                 CFNumberRef   unit)
 {
 {
+    static const int           command = kRegisterInterface;
     CFMutableDictionaryRef     dict;
     CFMutableDictionaryRef     dict;
-    kern_return_t              kr = kIOReturnNoMemory;
+    kern_return_t              kr;
+    CFNumberRef                        num;
 
     dict = CFDictionaryCreateMutable(NULL, 0,
                                     &kCFTypeDictionaryKeyCallBacks,
                                     &kCFTypeDictionaryValueCallBacks);
 
     dict = CFDictionaryCreateMutable(NULL, 0,
                                     &kCFTypeDictionaryKeyCallBacks,
                                     &kCFTypeDictionaryValueCallBacks);
-    if (dict == NULL
-       || addCFNumberProperty(dict, kIONetworkStackUserCommand,
-                              kIORegisterOne) == FALSE)
-       ;
-    else {
-       CFDictionarySetValue(dict, CFSTR(kIOPathMatchKey), path);
-       CFDictionarySetValue(dict, CFSTR(kIOInterfaceUnit), unit);
-       kr = IOConnectSetCFProperties(connect, dict);
-    }
-    if (dict) CFRelease( dict );
+    num = CFNumberCreate(NULL, kCFNumberIntType, &command);
+    CFDictionarySetValue(dict, CFSTR(kIONetworkStackUserCommand), num);
+    CFRelease(num);
+    CFDictionarySetValue(dict, CFSTR(kIOPathMatchKey), path);
+    CFDictionarySetValue(dict, CFSTR(kIOInterfaceUnit), unit);
+    kr = IOConnectSetCFProperties(connect, dict);
+    CFRelease(dict);
     return kr;
 }
 
     return kr;
 }
 
-/*
- * Note: this function blocks all other plug-ins until it completes
- */
-static void
-waitForQuiet(mach_port_t masterPort)
-{
-    mach_timespec_t t;
-    kern_return_t   wait_ret;
-
-    t.tv_sec  = 4;
-    t.tv_nsec = 0;
-
-    // kIOReturnTimeout if the wait timed out.
-    // kIOReturnSuccess on success.
-    wait_ret = IOKitWaitQuiet(masterPort, &t);
-    return;
-}
-
-/*
- * Function: createNetworkStackObject
- * Purpose:
- *   Get a reference to the single IONetworkStack object instance in
- *   the kernel. Naming requests must be sent to this object, which is
- *   attached as a client to all network interface objects in the system.
- * Note:
- *   Call IOObjectRelease on the returned object.
- */
-static io_object_t
-createNetworkStackObject(mach_port_t masterPort)
-{
-    io_iterator_t      iter = MACH_PORT_NULL;
-    kern_return_t      kr;
-    io_object_t                stack = MACH_PORT_NULL;
-
-    kr = IOServiceGetMatchingServices(masterPort,
-                                     IOServiceMatching("IONetworkStack"),
-                                     &iter);
-    if (iter != MACH_PORT_NULL) {
-       if (kr == KERN_SUCCESS) {
-           stack = IOIteratorNext(iter);
-       }
-       IOObjectRelease(iter);
-    }
-    return stack;
-}
-
-static void
-printMacAddress(CFDataRef data)
-{
-    int                i;
-    CFIndex    n = CFDataGetLength(data);
-
-    for (i = 0; i < n; i++) {
-       if (i != 0) SCPrint(TRUE, stdout, CFSTR(":"));
-       SCPrint(TRUE, stdout, CFSTR("%02x"), CFDataGetBytePtr(data)[i]);
-    }
-    return;
-}
-
-/*
- * Function: getMacAddress
- *
- * Purpose:
- *   Given an interface object if_obj, return its associated mac address.
- *   The mac address is stored in the parent, the network controller object.
- *
- * Returns:
- *   The CFDataRef containing the bytes of the mac address.
- */
-static CFDataRef
-getMacAddress(io_object_t if_obj)
-{
-    CFMutableDictionaryRef     dict = NULL;
-    CFDataRef                  data = NULL;
-    kern_return_t              kr;
-    io_object_t                        parent_obj = MACH_PORT_NULL;
-
-    /* get the parent node */
-    kr = IORegistryEntryGetParentEntry(if_obj, kIOServicePlane, &parent_obj);
-    if (kr != KERN_SUCCESS) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME
-                   ": IORegistryEntryGetParentEntry returned 0x%x"),
-             kr);
-       goto failed;
-    }
-
-    /* get the dictionary associated with the node */
-    kr = IORegistryEntryCreateCFProperties(parent_obj,
-                                          &dict,
-                                          NULL,
-                                          kNilOptions );
-    if (kr != KERN_SUCCESS) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME
-                   ": IORegistryEntryCreateCFProperties returned 0x%x"),
-             kr);
-       goto failed;
-    }
-    data = CFDictionaryGetValue(dict, CFSTR(kIOMACAddress));
-    if (data) {
-       CFRetain(data);
-    }
-
- failed:
-    if (dict)
-       CFRelease(dict);
-    if (parent_obj)
-       IOObjectRelease(parent_obj);
-    return (data);
-}
-
-static CFDictionaryRef
-getInterface(io_object_t if_obj)
-{
-    CFBooleanRef                       builtin;
-    kern_return_t                      kr;
-    CFDataRef                          mac_address = NULL;
-    CFStringRef                                location;
-    CFMutableDictionaryRef             new_if = NULL;
-    io_string_t                                path;
-    CFMutableDictionaryRef             reginfo_if = NULL;
-    CFDictionaryRef                    ret_dict = NULL;
-    CFStringRef                                string;
-    CFNumberRef                                type;
-    CFNumberRef                                unit;
-
-    kr = IORegistryEntryGetPath(if_obj, kIOServicePlane, path);
-    if (kr != KERN_SUCCESS) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME
-                   ": IORegistryEntryGetPath returned 0x%x"),
-             kr);
-       goto failed;
-    }
-    kr = IORegistryEntryCreateCFProperties(if_obj,
-                                          &reginfo_if,
-                                          NULL,
-                                          kNilOptions);
-    if (kr != KERN_SUCCESS) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME
-                   ": IORegistryEntryCreateCFProperties returned 0x%x"),
-             kr);
-       goto failed;
-    }
-    type = isA_CFNumber(CFDictionaryGetValue(reginfo_if,
-                                            CFSTR(kIOInterfaceType)));
-    if (type == NULL) {
-       goto failed;
-    }
-    mac_address = getMacAddress(if_obj);
-    if (mac_address == NULL) {
-       goto failed;
-    }
-    builtin = isA_CFBoolean(CFDictionaryGetValue(reginfo_if,
-                                                CFSTR(kIOBuiltin)));
-    if ((builtin == NULL) || !CFBooleanGetValue(builtin)) {
-       builtin = isA_CFBoolean(CFDictionaryGetValue(reginfo_if,
-                                                CFSTR(kIOPrimaryInterface)));
-    }
-    location = isA_CFString(CFDictionaryGetValue(reginfo_if,
-                                                CFSTR(kIOLocation)));
-
-    new_if = CFDictionaryCreateMutable(NULL, 0,
-                                      &kCFTypeDictionaryKeyCallBacks,
-                                      &kCFTypeDictionaryValueCallBacks);
-    if (new_if == NULL) {
-       goto failed;
-    }
-    CFDictionarySetValue(new_if, CFSTR(kIOInterfaceType), type);
-    CFDictionarySetValue(new_if, CFSTR(kIOMACAddress), mac_address);
-    if (builtin) {
-       CFDictionarySetValue(new_if, CFSTR(kIOBuiltin), builtin);
-    }
-    if (location) {
-       CFDictionarySetValue(new_if, CFSTR(kIOLocation), location);
-    }
-    addCFStringProperty(new_if, kIOPathMatchKey, path);
-
-    unit = isA_CFNumber(CFDictionaryGetValue(reginfo_if,
-                                            CFSTR(kIOInterfaceUnit)));
-    if (unit) {
-       CFDictionarySetValue(new_if, CFSTR(kIOInterfaceUnit), unit);
-    }
-    string = isA_CFString(CFDictionaryGetValue(reginfo_if, CFSTR(kIOBSDNameKey)));
-    if (string) {
-       CFDictionarySetValue(new_if, CFSTR(kIOBSDNameKey), string);
-    }
-    ret_dict = new_if;
-    new_if = NULL;
-
- failed:
-    if (new_if) {
-       CFRelease(new_if);
-    }
-    if (reginfo_if) {
-       CFRelease(reginfo_if);
-    }
-    if (mac_address) {
-       CFRelease(mac_address);
-    }
-    return (ret_dict);
-}
-
-static CFDictionaryRef
+static SCNetworkInterfaceRef
 lookupIOKitPath(CFStringRef if_path)
 {
 lookupIOKitPath(CFStringRef if_path)
 {
-    CFDictionaryRef            dict = NULL;
-    io_registry_entry_t                entry = MACH_PORT_NULL;
+    io_registry_entry_t                entry           = MACH_PORT_NULL;
+    SCNetworkInterfaceRef      interface       = NULL;
     kern_return_t              kr;
     kern_return_t              kr;
-    mach_port_t                        masterPort = MACH_PORT_NULL;
+    mach_port_t                        masterPort      = MACH_PORT_NULL;
     io_string_t                        path;
 
     kr = IOMasterPort(bootstrap_port, &masterPort);
     if (kr != KERN_SUCCESS) {
     io_string_t                        path;
 
     kr = IOMasterPort(bootstrap_port, &masterPort);
     if (kr != KERN_SUCCESS) {
-       SCLog(TRUE, LOG_INFO,
+       SCLog(TRUE, LOG_ERR,
              CFSTR(MY_PLUGIN_NAME ": IOMasterPort returned 0x%x\n"),
              kr);
        goto error;
              CFSTR(MY_PLUGIN_NAME ": IOMasterPort returned 0x%x\n"),
              kr);
        goto error;
@@ -1074,12 +822,13 @@ lookupIOKitPath(CFStringRef if_path)
     _SC_cfstring_to_cstring(if_path, path, sizeof(path), kCFStringEncodingASCII);
     entry = IORegistryEntryFromPath(masterPort, path);
     if (entry == MACH_PORT_NULL) {
     _SC_cfstring_to_cstring(if_path, path, sizeof(path), kCFStringEncodingASCII);
     entry = IORegistryEntryFromPath(masterPort, path);
     if (entry == MACH_PORT_NULL) {
-       SCLog(TRUE, LOG_INFO,
+       SCLog(TRUE, LOG_ERR,
              CFSTR(MY_PLUGIN_NAME ": IORegistryEntryFromPath(%@) failed"),
              if_path);
        goto error;
     }
              CFSTR(MY_PLUGIN_NAME ": IORegistryEntryFromPath(%@) failed"),
              if_path);
        goto error;
     }
-    dict = getInterface(entry);
+
+    interface = _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(entry);
 
  error:
     if (masterPort != MACH_PORT_NULL) {
 
  error:
     if (masterPort != MACH_PORT_NULL) {
@@ -1088,324 +837,935 @@ lookupIOKitPath(CFStringRef if_path)
     if (entry != MACH_PORT_NULL) {
        IOObjectRelease(entry);
     }
     if (entry != MACH_PORT_NULL) {
        IOObjectRelease(entry);
     }
-    return (dict);
+    return (interface);
 
 }
 
 static void
 
 }
 
 static void
-displayInterface(CFDictionaryRef if_dict)
+displayInterface(SCNetworkInterfaceRef interface)
 {
 {
+    CFStringRef                addr;
     CFStringRef                name;
     CFNumberRef                type;
     CFNumberRef                unit;
 
     CFStringRef                name;
     CFNumberRef                type;
     CFNumberRef                unit;
 
-    name = CFDictionaryGetValue(if_dict, CFSTR(kIOBSDNameKey));
-    if (name) {
-       SCPrint(TRUE, stdout, CFSTR("BSD Name: %@\n"), name);
-    }
-
-    unit = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceUnit));
-    if (unit) {
-       SCPrint(TRUE, stdout, CFSTR("Unit: %@\n"), unit);
-    }
-
-    type = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceType));
-    SCPrint(TRUE, stdout, CFSTR("Type: %@\n"), type);
-
-    SCPrint(TRUE, stdout, CFSTR("MAC address: "));
-    printMacAddress(CFDictionaryGetValue(if_dict, CFSTR(kIOMACAddress)));
-    SCPrint(TRUE, stdout, CFSTR("\n"));
+    name = SCNetworkInterfaceGetBSDName(interface);
+    unit = _SCNetworkInterfaceGetIOInterfaceUnit(interface);
+    type = _SCNetworkInterfaceGetIOInterfaceType(interface);
+    addr = SCNetworkInterfaceGetHardwareAddressString(interface);
+
+    SCLog(TRUE, LOG_INFO,
+         CFSTR(MY_PLUGIN_NAME ":   %s%@%sType: %@, %s%@%sMAC address: %@"),
+         (name != NULL) ? "BSD Name: " : "",
+         (name != NULL) ? name : CFSTR(""),
+         (name != NULL) ? ", " : "",
+         type,
+         (unit != NULL) ? "Unit: " : "",
+         (unit != NULL) ? (CFTypeRef)unit : (CFTypeRef)CFSTR(""),
+         (unit != NULL) ? ", " : "",
+         addr);
 }
 
 }
 
-static void
-sort_interfaces_by_unit(CFMutableArrayRef if_list)
+static int
+builtinCount(CFArrayRef if_list, CFIndex last, CFNumberRef if_type)
 {
 {
-    int                count = CFArrayGetCount(if_list);
-    CFRange    range = CFRangeMake(0, count);
+    CFIndex    i;
+    int                n       = 0;
 
 
-    if (count < 2)
-       return;
-    CFArraySortValues(if_list, range, if_unit_compare, NULL);
-    return;
+    for (i = 0; i < last; i++) {
+       SCNetworkInterfaceRef   builtin_if;
+       CFNumberRef             builtin_type;
+
+       builtin_if   = CFArrayGetValueAtIndex(if_list, i);
+       builtin_type = _SCNetworkInterfaceGetIOInterfaceType(builtin_if);
+       if (CFEqual(if_type, builtin_type)) {
+           if (_SCNetworkInterfaceIsBuiltin(builtin_if)) {
+               n++;    // if built-in interface
+           }
+       }
+    }
+
+    return n;
 }
 
 }
 
-static void
-sort_interfaces_by_path(CFMutableArrayRef if_list)
+static __inline__ boolean_t
+isQuiet(void)
 {
 {
-    int                count = CFArrayGetCount(if_list);
-    CFRange    range = CFRangeMake(0, count);
-
-    if (count < 2)
-       return;
-    CFArraySortValues(if_list, range, if_path_compare, NULL);
-    return;
+    return (S_quiet == MACH_PORT_NULL);
 }
 
 static void
 }
 
 static void
-name_interfaces(CFArrayRef if_list)
+nameInterfaces(CFMutableArrayRef if_list)
 {
     CFIndex    i;
 {
     CFIndex    i;
-    CFIndex    n = CFArrayGetCount(if_list);
-    CFIndex    i_builtin = 0;
-    CFIndex    n_builtin = 0;
-
-    if (S_debug)
-       SCPrint(TRUE, stdout, CFSTR("\n"));
-
-    for (i = 0; i < n; i++) {
-       CFBooleanRef    builtin;
-       CFDictionaryRef if_dict;
-
-       if_dict = CFArrayGetValueAtIndex(if_list, i);
-       builtin = CFDictionaryGetValue(if_dict, CFSTR(kIOBuiltin));
-       if (builtin && CFBooleanGetValue(builtin)) {
-           n_builtin++;        // reserve unit number for built-in interface
-       }
-    }
+    CFIndex    n       = CFArrayGetCount(if_list);
 
     for (i = 0; i < n; i++) {
 
     for (i = 0; i < n; i++) {
-       CFDictionaryRef if_dict;
-       CFNumberRef     type;
-       CFNumberRef     unit;
-
-       if (S_debug) {
-           if (i != 0)
-               SCPrint(TRUE, stdout, CFSTR("\n"));
-       }
-
-       if_dict = CFArrayGetValueAtIndex(if_list, i);
-       unit = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceUnit));
-       type = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceType));
-       if (unit) {
+       SCNetworkInterfaceRef   interface;
+       CFStringRef             path;
+       CFNumberRef             type;
+       CFNumberRef             unit;
+       CFIndex                 where;
+
+       interface = CFArrayGetValueAtIndex(if_list, i);
+       path = _SCNetworkInterfaceGetIOPath(interface);
+       type = _SCNetworkInterfaceGetIOInterfaceType(interface);
+       unit = _SCNetworkInterfaceGetIOInterfaceUnit(interface);
+
+       if (unit != NULL) {
            if (S_debug) {
            if (S_debug) {
-               SCPrint(TRUE, stdout, CFSTR("Interface already has a unit number\n"));
-               displayInterface(if_dict);
+               CFStringRef     if_name;
+
+               if_name = SCNetworkInterfaceGetBSDName(interface);
+               if ((if_name == NULL) || !CFDictionaryContainsKey(S_state, if_name)) {
+                       SCLog(TRUE, LOG_INFO,
+                             CFSTR(MY_PLUGIN_NAME ": Interface already has a unit number"));
+                       displayInterface(interface);
+               }
            }
            }
-           replaceInterface(if_dict);
-       }
-       else {
-           CFDictionaryRef             dbdict = NULL;
-           kern_return_t               kr = KERN_SUCCESS;
-           CFStringRef                 path;
-           CFNumberRef                 unit = NULL;
-
-           path = CFDictionaryGetValue(if_dict, CFSTR(kIOPathMatchKey));
-           dbdict = lookupInterfaceByType(S_dblist, if_dict, NULL);
-           if (dbdict == NULL
-               && pathIsAirPort(path) == TRUE) {
-               dbdict = lookupAirPortInterface(S_dblist, NULL);
+
+           // update the list of interfaces that were previously named
+           if ((S_prev_active_list != NULL)
+               && lookupInterfaceByAddress(S_prev_active_list, interface, &where) != NULL) {
+               CFArrayRemoveValueAtIndex(S_prev_active_list, where);
            }
            }
+       } else {
+           CFDictionaryRef     dbdict;
+           kern_return_t       kr;
+
+           dbdict = lookupInterfaceByAddress(S_dblist, interface, NULL);
            if (dbdict != NULL) {
            if (dbdict != NULL) {
-               unit = CFDictionaryGetValue(dbdict,
-                                           CFSTR(kIOInterfaceUnit));
+               unit = CFDictionaryGetValue(dbdict, CFSTR(kIOInterfaceUnit));
                CFRetain(unit);
                CFRetain(unit);
-           }
-           else {
-               int             if_type;
-               boolean_t       is_builtin = FALSE;
-               int             next_unit = 0;
-
-               CFNumberGetValue(type,
-                                kCFNumberIntType, &if_type);
-               if (if_type == IFT_ETHER) { /* ethernet */
-                   CFBooleanRef        builtin;
-
-                   builtin = CFDictionaryGetValue(if_dict,
-                                                  CFSTR(kIOBuiltin));
-                   if (builtin && CFBooleanGetValue(builtin)) {
-                       is_builtin = TRUE;
-                       next_unit = i_builtin++;
-                   }
-                   else {
-#if defined(__ppc__)
-                       /* skip over slots reserved for built-in ethernet interface(s) */
-                       next_unit = n_builtin;
-#endif
+
+               SCLog(S_debug, LOG_INFO,
+                     CFSTR(MY_PLUGIN_NAME ": Interface assigned unit %@ (from database)"),
+                     unit);
+           } else {
+               CFStringRef     if_type;
+
+               if_type = SCNetworkInterfaceGetInterfaceType(interface);
+               if ((if_type != NULL) &&
+                   CFEqual(if_type, kSCNetworkInterfaceTypeIEEE80211)) {
+                   dbdict = lookupAirPortInterface(S_dblist, NULL);
+                   if (dbdict != NULL) {
+                       unit = CFDictionaryGetValue(dbdict, CFSTR(kIOInterfaceUnit));
+                       CFRetain(unit);
+
+                       SCLog(S_debug, LOG_INFO,
+                             CFSTR(MY_PLUGIN_NAME ": Interface assigned unit %@ (updating database)"),
+                             unit);
                    }
                }
                    }
                }
-               if (is_builtin == FALSE) {
+           }
+
+           if ((dbdict != NULL) && (S_prev_active_list != NULL)) {
+               // update the list of interfaces that were previously named
+               where = CFArrayGetFirstIndexOfValue(S_prev_active_list,
+                                                   CFRangeMake(0, CFArrayGetCount(S_prev_active_list)),
+                                                   dbdict);
+               if (where != kCFNotFound) {
+                   CFArrayRemoveValueAtIndex(S_prev_active_list, where);
+               }
+           }
+
+           if (dbdict == NULL) {
+               boolean_t       is_builtin;
+               int             next_unit       = 0;
+
+               if (!isQuiet()) {
+                   // if new interface, wait until quiet before naming
+                   addTimestamp(S_state, path);
+                   continue;
+               }
+
+               is_builtin = _SCNetworkInterfaceIsBuiltin(interface);
+               next_unit = 0;
+               if (is_builtin) {
+                   // built-in interface, use the reserved slots
+                   next_unit = builtinCount(if_list, i, type);
+               } else {
+                   // not built-in, skip over the reserved slots
+                   next_unit = builtinCount(if_list, n, type);
+
                    unit = getHighestUnitForType(type);
                    unit = getHighestUnitForType(type);
-                   if (unit) {
+                   if (unit != NULL) {
                        int     high_unit;
 
                        int     high_unit;
 
-                       CFNumberGetValue(unit,
-                                        kCFNumberIntType, &high_unit);
+                       CFNumberGetValue(unit, kCFNumberIntType, &high_unit);
                        if (high_unit >= next_unit) {
                            next_unit = high_unit + 1;
                        }
                    }
                }
                        if (high_unit >= next_unit) {
                            next_unit = high_unit + 1;
                        }
                    }
                }
-               unit = CFNumberCreate(NULL,
-                                     kCFNumberIntType, &next_unit);
-           }
-           if (S_debug) {
-               SCPrint(TRUE, stdout, CFSTR("Interface assigned unit %@ %s\n"), unit,
-                       dbdict ? "(from database)" : "(next available)");
+               unit = CFNumberCreate(NULL, kCFNumberIntType, &next_unit);
+
+               SCLog(S_debug, LOG_INFO,
+                     CFSTR(MY_PLUGIN_NAME ": Interface assigned unit %@ (%s)"),
+                     unit,
+                     is_builtin ? "built-in" : "next available");
            }
            }
+
            kr = registerInterface(S_connect, path, unit);
            if (kr != KERN_SUCCESS) {
            kr = registerInterface(S_connect, path, unit);
            if (kr != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_INFO,
-                     CFSTR(MY_PLUGIN_NAME
-                           ": failed to name the interface 0x%x"),
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR(MY_PLUGIN_NAME ": failed to name the interface, kr=0x%x"),
                      kr);
                if (S_debug) {
                      kr);
                if (S_debug) {
-                   displayInterface(if_dict);
+                   displayInterface(interface);
                }
                }
-           }
-           else {
-               CFDictionaryRef new_dict;
+           } else {
+               SCNetworkInterfaceRef   new_interface;
 
 
-               path = CFDictionaryGetValue(if_dict,
-                                           CFSTR(kIOPathMatchKey));
-               new_dict = lookupIOKitPath(path);
-               if (new_dict != NULL) {
-                   CFNumberRef         new_unit;
+               new_interface = lookupIOKitPath(path);
+               if (new_interface != NULL) {
+                   CFNumberRef new_unit;
 
 
-                   new_unit = CFDictionaryGetValue(new_dict,
-                                                   CFSTR(kIOInterfaceUnit));
+                   new_unit = _SCNetworkInterfaceGetIOInterfaceUnit(new_interface);
                    if (CFEqual(unit, new_unit) == FALSE) {
                    if (CFEqual(unit, new_unit) == FALSE) {
-                       SCLog(TRUE, LOG_INFO,
+                       SCLog(S_debug, LOG_INFO,
                              CFSTR(MY_PLUGIN_NAME
                                    ": interface type %@ assigned "
                                    "unit %@ instead of %@"),
                              type, new_unit, unit);
                    }
                    if (S_debug) {
                              CFSTR(MY_PLUGIN_NAME
                                    ": interface type %@ assigned "
                                    "unit %@ instead of %@"),
                              type, new_unit, unit);
                    }
                    if (S_debug) {
-                       displayInterface(new_dict);
+                       displayInterface(new_interface);
                    }
                    }
-                   replaceInterface(new_dict);
-                   CFRelease(new_dict);
+
+                   // update if_list (with the interface name & unit)
+                   CFArraySetValueAtIndex(if_list, i, new_interface);
+                   CFRelease(new_interface);
+                   interface = new_interface;  // if_list holds the reference
                }
            }
                }
            }
+
            CFRelease(unit);
        }
            CFRelease(unit);
        }
+
+       // update db
+       replaceInterface(interface);
     }
     }
-    writeInterfaceList(S_dblist);
     return;
 }
 
 static void
     return;
 }
 
 static void
-interfaceArrivalCallback( void * refcon, io_iterator_t iter )
+updateInterfaces()
 {
 {
-    CFMutableArrayRef  if_list = NULL;
-    io_object_t        obj;
+    if (S_connect == MACH_PORT_NULL) {
+       // if we don't have the "IONetworkStack" connect object
+       return;
+    }
 
 
+    if (S_iflist != NULL) {
+       CFIndex n;
 
 
-    while ((obj = IOIteratorNext(iter))) {
-       CFDictionaryRef dict;
+       n = CFArrayGetCount(S_iflist);
+       if (n > 1) {
+           CFArraySortValues(S_iflist, CFRangeMake(0, n), _SCNetworkInterfaceCompare, NULL);
+       }
+       nameInterfaces(S_iflist);
+    }
+
+    if (isQuiet()) {
+       /*
+        * The registry [matching] has quiesced so let's
+        * - save the DB with the interfaces that have been named
+        * - update the VLAN/BOND configuration
+        * - tell everyone that we've finished (at least for now)
+        * - log those interfaces which are no longer present
+        *   in the HW config (or have yet to show up).
+        */
+       writeInterfaceList(S_dblist);
+       updateVirtualNetworkInterfaceConfiguration(NULL, kSCPreferencesNotificationApply, NULL);
+       updateStore();
+
+       if (S_iflist != NULL) {
+           CFRelease(S_iflist);
+           S_iflist = NULL;
+       }
+
+       if (S_prev_active_list != NULL) {
+           if (S_debug) {
+               CFIndex i;
+               CFIndex n;
 
 
-       dict = getInterface(obj);
-       if (dict) {
-           if (if_list == NULL) {
-               if_list = CFArrayCreateMutable(NULL, 0,
-                                              &kCFTypeArrayCallBacks);
+               n = CFArrayGetCount(S_prev_active_list);
+               SCLog(TRUE, LOG_INFO,
+                     CFSTR(MY_PLUGIN_NAME ": Interface%s not [yet] active"),
+                     (n > 0) ? "s" : "");
+               for (i = 0; i < n; i++) {
+                   CFDictionaryRef     if_dict;
+                   CFStringRef         name;
+                   CFNumberRef         type;
+                   CFNumberRef         unit;
+
+                   if_dict = CFArrayGetValueAtIndex(S_prev_active_list, i);
+                   name = CFDictionaryGetValue(if_dict, CFSTR(kIOBSDNameKey));
+                   type = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceType));
+                   unit = CFDictionaryGetValue(if_dict, CFSTR(kIOInterfaceUnit));
+                   SCLog(TRUE, LOG_INFO,
+                         CFSTR(MY_PLUGIN_NAME ":   %s%@%sType: %@, Unit: %@"),
+                         (name != NULL) ? "BSD Name: " : "",
+                         (name != NULL) ? name : CFSTR(""),
+                         (name != NULL) ? ", " : "",
+                         type,
+                         unit);
+               }
            }
            }
-           if (if_list)
-               CFArrayAppendValue(if_list, dict);
-           CFRelease(dict);
+           CFRelease(S_prev_active_list);
+           S_prev_active_list = NULL;
        }
        }
-       IOObjectRelease(obj);
+    } else {
+       if ((S_prev_active_list != NULL) && (CFArrayGetCount(S_prev_active_list) == 0)) {
+           /*
+            * if we've named all of the interfaces that
+            * were used during the previous boot.
+            */
+           addTimestamp(S_state, CFSTR("*RELEASE*"));
+           SCLog(S_debug, LOG_INFO,
+                 CFSTR(MY_PLUGIN_NAME ": last boot interfaces have been named"));
+           updateStore();
+           CFRelease(S_prev_active_list);
+           S_prev_active_list = NULL;
+       }
+    }
+
+    return;
+}
+
+static CFComparisonResult
+compareMacAddress(const void *val1, const void *val2, void *context)
+{
+    CFDataRef          mac1    = (CFDataRef)val1;
+    CFDataRef          mac2    = (CFDataRef)val2;
+    CFIndex            n1;
+    CFIndex            n2;
+    CFComparisonResult res;
+
+    n1 = CFDataGetLength(mac1);
+    n2 = CFDataGetLength(mac2);
+    if (n1 < n2) {
+       res = kCFCompareLessThan;
+     } else if (n2 > n1) {
+       res = kCFCompareGreaterThan;
+     } else {
+       res = bcmp(CFDataGetBytePtr(mac1), CFDataGetBytePtr(mac2), n1);
+     }
+
+     return res;
+}
+
+static void
+updatePlatformUUID()
+{
+    CFDataRef          addr;
+    CFMutableArrayRef  addrs   = NULL;
+    CFStringRef                guid;
+    CFIndex            i;
+    CFIndex            n;
+    io_registry_entry_t        platform;
+
+    platform = IORegistryEntryFromPath(kIOMasterPortDefault, kIODeviceTreePlane ":/");
+    if (platform == MACH_PORT_NULL) {
+       return;
+    }
+
+    guid = IORegistryEntryCreateCFProperty(platform, CFSTR(kIOPlatformUUIDKey), NULL, 0);
+    if (guid != NULL) {
+       // if GUID already defined
+       goto done;
     }
     }
-    if (if_list) {
-       sort_interfaces_by_path(if_list);
-       name_interfaces(if_list);
-       updateBondConfiguration();
-       updateVLANConfiguration();
-       CFRelease(if_list);
+
+    addrs = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    n = (S_dblist != NULL) ? CFArrayGetCount(S_dblist) : 0;
+    for (i = 0; i < n; i++) {
+       CFBooleanRef    builtin;
+       CFDictionaryRef dict;
+       CFStringRef     type;
+
+       dict = CFArrayGetValueAtIndex(S_dblist, i);
+       type = CFDictionaryGetValue(dict, CFSTR(kSCNetworkInterfaceType));
+       if (!isA_CFString(type) || !CFEqual(type, kSCNetworkInterfaceTypeEthernet)) {
+           continue;
+       }
+       builtin = CFDictionaryGetValue(dict, CFSTR(kIOBuiltin));
+       if (!isA_CFBoolean(builtin) || !CFBooleanGetValue(builtin)) {
+           continue;
+       }
+       addr = CFDictionaryGetValue(dict, CFSTR(kIOMACAddress));
+       if (!isA_CFData(addr) || (CFDataGetLength(addr) != ETHER_ADDR_LEN)) {
+           continue;
+       }
+       CFArrayAppendValue(addrs, addr);
+    }
+
+    if (CFArrayGetCount(addrs) == 0) {
+       // if no ethernet interfaces, look for wireless
+       for (i = 0; i < n; i++) {
+           CFDictionaryRef     dict;
+           CFStringRef         type;
+
+           dict = CFArrayGetValueAtIndex(S_dblist, i);
+           type = CFDictionaryGetValue(dict, CFSTR(kSCNetworkInterfaceType));
+           if (!isA_CFString(type) || !CFEqual(type, kSCNetworkInterfaceTypeIEEE80211)) {
+               continue;
+           }
+           addr = CFDictionaryGetValue(dict, CFSTR(kIOMACAddress));
+           if (!isA_CFData(addr) || (CFDataGetLength(addr) != ETHER_ADDR_LEN)) {
+               continue;
+           }
+           CFArrayAppendValue(addrs, addr);
+       }
+    }
+
+    n = CFArrayGetCount(addrs);
+    switch (n) {
+       case 0 :
+           SCLog(TRUE, LOG_ERR,
+                 CFSTR(MY_PLUGIN_NAME ": no network interfaces, could not update platform UUID"));
+           break;
+       default :
+           // sort by MAC address
+           CFArraySortValues(addrs, CFRangeMake(0, n), compareMacAddress, NULL);
+
+           // fall through
+       case 1 : {
+           CFUUIDBytes         bytes   = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
+                                           0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+           kern_return_t       kr;
+           CFUUIDRef           uuid;
+
+           // set GUID
+           addr = CFArrayGetValueAtIndex(addrs, 0);
+           bcopy(CFDataGetBytePtr(addr),
+                 (void *)&bytes + sizeof(bytes) - ETHER_ADDR_LEN,
+                 ETHER_ADDR_LEN);
+           uuid = CFUUIDCreateFromUUIDBytes(NULL, bytes);
+           guid = CFUUIDCreateString(NULL, uuid);
+           CFRelease(uuid);
+
+           SCLog(TRUE, LOG_INFO,
+                 CFSTR(MY_PLUGIN_NAME ": setting platform UUID = %@"),
+                 guid);
+           kr = IORegistryEntrySetCFProperty(platform, CFSTR(kIOPlatformUUIDKey), guid);
+           if (kr != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR(MY_PLUGIN_NAME ": IORegistryEntrySetCFProperty(platform UUID) failed, kr=0x%x"),
+                     kr);
+           }
+
+           addTimestamp(S_state, CFSTR("*PLATFORM-UUID*"));
+           updateStore();
+           break;
+       }
     }
     }
+
+  done :
+
+    if (addrs != NULL) CFRelease(addrs);
+    if (platform != MACH_PORT_NULL) IOObjectRelease(platform);
+    if (guid != NULL) CFRelease(guid);
     return;
 }
 
     return;
 }
 
+static void
+interfaceArrivalCallback(void *refcon, io_iterator_t iter)
+{
+    io_object_t        obj;
 
 
-__private_extern__
-void
-load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
+    while ((obj = IOIteratorNext(iter)) != MACH_PORT_NULL) {
+       SCNetworkInterfaceRef   interface;
+
+       interface = _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(obj);
+       if (interface != NULL) {
+           if (S_iflist == NULL) {
+               S_iflist = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+           }
+           CFArrayAppendValue(S_iflist, interface);
+           CFRelease(interface);
+       }
+       IOObjectRelease(obj);
+    }
+
+    updateInterfaces();
+    return;
+}
+
+/*
+ * Function: stackCallback
+ * Purpose:
+ *   Get a reference to the single IONetworkStack object instance in
+ *   the kernel. Naming requests must be sent to this object, which is
+ *   attached as a client to all network interface objects in the system.
+ * Note:
+ *   Call IOObjectRelease on the returned object.
+ */
+static void
+stackCallback(void *refcon, io_iterator_t iter)
 {
     kern_return_t      kr;
 {
     kern_return_t      kr;
-    mach_port_t                masterPort = MACH_PORT_NULL;
-    io_object_t                stack = MACH_PORT_NULL;
+    io_object_t                stack;
 
 
-    if (bundleVerbose) {
-       S_debug++;
+    stack = IOIteratorNext(iter);
+    if (stack == MACH_PORT_NULL) {
+       goto error;
     }
 
     }
 
-    kr = IOMasterPort(bootstrap_port, &masterPort);
+    kr = IOServiceOpen(stack, mach_task_self(), 0, &S_connect);
     if (kr != KERN_SUCCESS) {
     if (kr != KERN_SUCCESS) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME ": IOMasterPort returned 0x%x"),
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": IOServiceOpen returned 0x%x"),
              kr);
        goto error;
     }
 
              kr);
        goto error;
     }
 
-    /* synchronize with any drivers that might be loading at boot time */
-    waitForQuiet(masterPort);
+    addTimestamp(S_state, CFSTR("*STACK*"));
+    SCLog(S_debug, LOG_INFO,
+         CFSTR(MY_PLUGIN_NAME ": IONetworkStack found"));
 
 
-    stack = createNetworkStackObject(masterPort);
-    if (stack == MACH_PORT_NULL) {
-       SCLog(TRUE, LOG_INFO,
+    if (S_stack != MACH_PORT_NULL) {
+       IOObjectRelease(S_stack);
+       S_stack = MACH_PORT_NULL;
+    }
+
+    updateInterfaces();
+
+ error:
+    if (stack != MACH_PORT_NULL) {
+       IOObjectRelease(stack);
+    }
+
+    return;
+}
+
+static void
+quietCallback(void             *refcon,
+             io_service_t      service,
+             natural_t         messageType,
+             void              *messageArgument)
+{
+    if (messageArgument != NULL) {
+       // if not yet quiet
+       return;
+    }
+
+    if (messageType == kIOMessageServiceBusyStateChange) {
+       addTimestamp(S_state, CFSTR("*QUIET*"));
+       SCLog(S_debug, LOG_INFO,
+             CFSTR(MY_PLUGIN_NAME ": IOKit quiet"));
+    }
+
+    if (S_connect == MACH_PORT_NULL) {
+       SCLog(TRUE, LOG_ERR,
              CFSTR(MY_PLUGIN_NAME ": No network stack object"));
              CFSTR(MY_PLUGIN_NAME ": No network stack object"));
-       goto error;
+       return;
     }
     }
-    kr = IOServiceOpen(stack, mach_task_self(), 0, &S_connect);
-    if (kr != KERN_SUCCESS) {
-       SCPrint(TRUE, stdout, CFSTR(MY_PLUGIN_NAME ": IOServiceOpen returned 0x%x\n"), kr);
-       goto error;
+
+    if (S_quiet != MACH_PORT_NULL) {
+       IOObjectRelease(S_quiet);
+       S_quiet = MACH_PORT_NULL;
+    }
+
+    if (S_timer != NULL) {
+       CFRunLoopTimerInvalidate(S_timer);
+       CFRelease(S_timer);
+       S_timer = NULL;
+    }
+
+    // grab (and name) any additional interfaces.
+    interfaceArrivalCallback((void *)S_notify, S_iter);
+
+    updatePlatformUUID();
+
+    return;
+}
+
+static void
+iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, int *count)
+{
+    kern_return_t      kr  = kIOReturnSuccess;;
+    io_object_t                obj;
+
+    while ((kr == kIOReturnSuccess) &&
+          ((obj = IOIteratorNext(iterator)) != MACH_PORT_NULL)) {
+       uint32_t                busy;
+       io_name_t               location;
+       io_name_t               name;
+       CFMutableArrayRef       newNodes;
+       CFMutableStringRef      str     = NULL;
+
+       if (nodes == NULL) {
+           newNodes = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       } else {
+           newNodes = CFArrayCreateMutableCopy(NULL, 0, nodes);
+       }
+
+       kr = IORegistryEntryGetName(obj, name);
+       if (kr != kIOReturnSuccess) {
+           SCLog(TRUE, LOG_ERR,
+                 CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryEntryGetName returned 0x%x"),
+                 kr);
+           goto next;
+       }
+
+       str = CFStringCreateMutable(NULL, 0);
+       CFStringAppendCString(str, name, kCFStringEncodingUTF8);
+
+       kr = IORegistryEntryGetLocationInPlane(obj, kIOServicePlane, location);
+       switch (kr) {
+           case kIOReturnSuccess :
+               CFStringAppendCString(str, "@", kCFStringEncodingUTF8);
+               CFStringAppendCString(str, location, kCFStringEncodingUTF8);
+               break;
+           case kIOReturnNotFound :
+               break;
+           default :
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryEntryGetLocationInPlane returned 0x%x"),
+                     kr);
+               goto next;
+               break;
+       }
+
+       CFArrayAppendValue(newNodes, str);
+       CFRelease(str);
+
+       kr = IOServiceGetBusyState(obj, &busy);
+       if (kr != kIOReturnSuccess) {
+           SCLog(TRUE, LOG_ERR,
+                 CFSTR(MY_PLUGIN_NAME ": reportBusy IOServiceGetBusyState returned 0x%x"),
+                 kr);
+           goto next;
+       }
+
+       if (busy != 0) {
+           CFStringRef path;
+
+           if ((*count)++ == 0) {
+               SCLog(TRUE, LOG_WARNING, CFSTR(MY_PLUGIN_NAME ": Busy services :"));
+           }
+
+           path = CFStringCreateByCombiningStrings(NULL, newNodes, CFSTR("/"));
+           SCLog(TRUE, LOG_WARNING, CFSTR(MY_PLUGIN_NAME ":   %@ [%d]"), path, busy);
+           CFRelease(path);
+       }
+
+       kr = IORegistryIteratorEnterEntry(iterator);
+       if (kr != kIOReturnSuccess) {
+           SCLog(TRUE, LOG_ERR,
+                 CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryIteratorEnterEntry returned 0x%x"),
+                 kr);
+           goto next;
+       }
+
+       iterateRegistryBusy(iterator, newNodes, count);
+
+       kr = IORegistryIteratorExitEntry(iterator);
+       if (kr != kIOReturnSuccess) {
+           SCLog(TRUE, LOG_ERR,
+                 CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryIteratorExitEntry returned 0x%x"),
+                 kr);
+       }
+
+      next :
+
+       CFRelease(newNodes);
+       IOObjectRelease(obj);
+    }
+
+    return;
+}
+
+static void
+reportBusy()
+{
+    int                        count           = 0;
+    io_iterator_t      iterator        = MACH_PORT_NULL;
+    kern_return_t      kr;
+
+    kr = IORegistryCreateIterator(kIOMasterPortDefault,
+                                 kIOServicePlane,
+                                 0,
+                                 &iterator);
+    if (kr != kIOReturnSuccess) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryCreateIterator returned 0x%x"),
+             kr);
+       return;
+    }
+
+    iterateRegistryBusy(iterator, NULL, &count);
+    SCLog((count == 0), LOG_WARNING,
+         CFSTR(MY_PLUGIN_NAME ":   w/no busy services"));
+    IOObjectRelease(iterator);
+    return;
+}
+
+static void
+timerCallback(CFRunLoopTimerRef        timer, void *info)
+{
+    /*
+     * We've been waiting for IOKit to quiesce and it just
+     * hasn't happenned.  Time to just move on!
+     */
+    addTimestamp(S_state, CFSTR("*TIMEOUT*"));
+    SCLog(TRUE, LOG_ERR,
+         CFSTR(MY_PLUGIN_NAME ": timed out waiting for IOKit to quiesce"));
+
+    reportBusy();
+    quietCallback((void *)S_notify, MACH_PORT_NULL, 0, NULL);
+    return;
+}
+
+static Boolean
+setup_IOKit(CFBundleRef bundle)
+{
+    uint32_t           busy;
+    CFDictionaryRef    dict;
+    kern_return_t      kr;
+    mach_port_t                masterPort      = MACH_PORT_NULL;
+    Boolean            ok              = FALSE;
+    io_object_t                root            = MACH_PORT_NULL;
+    double             timeout         = WAIT_QUIET_TIMEOUT_DEFAULT;
+
+    // read DB of previously named network interfaces
+    S_dblist = readInterfaceList();
+    if (S_dblist != NULL) {
+       CFIndex n;
+
+       n = CFArrayGetCount(S_dblist);
+       if (n > 1) {
+           CFArraySortValues(S_dblist, CFRangeMake(0, n), if_unit_compare, NULL);
+       }
     }
 
     }
 
+    // get interfaces that were named during the last boot
+    S_prev_active_list = previouslyActiveInterfaces();
+
+    // track how long we've waited to see each interface.
+    S_state = CFDictionaryCreateMutable(NULL,
+                                       0,
+                                       &kCFTypeDictionaryKeyCallBacks,
+                                       &kCFTypeDictionaryValueCallBacks);
+    addTimestamp(S_state, CFSTR("*START*"));
+
     // Creates and returns a notification object for receiving IOKit
     // notifications of new devices or state changes.
     // Creates and returns a notification object for receiving IOKit
     // notifications of new devices or state changes.
+    kr = IOMasterPort(bootstrap_port, &masterPort);
+    if (kr != KERN_SUCCESS) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": IOMasterPort returned 0x%x"),
+             kr);
+       goto done;
+    }
 
     S_notify = IONotificationPortCreate(masterPort);
     if (S_notify == NULL) {
 
     S_notify = IONotificationPortCreate(masterPort);
     if (S_notify == NULL) {
-       SCLog(TRUE, LOG_INFO,
+       SCLog(TRUE, LOG_ERR,
              CFSTR(MY_PLUGIN_NAME ": IONotificationPortCreate failed"));
              CFSTR(MY_PLUGIN_NAME ": IONotificationPortCreate failed"));
-       goto error;
+       goto done;
+    }
+
+    // watch IOKit matching activity
+    root = IORegistryEntryFromPath(masterPort, kIOServicePlane ":/");
+    if (root == MACH_PORT_NULL) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": IORegistryEntryFromPath failed"));
+       goto done;
+    }
+
+    kr = IOServiceAddInterestNotification(S_notify,
+                                         root,
+                                         kIOBusyInterest,
+                                         &quietCallback,
+                                         (void *)S_notify,     // refCon
+                                         &S_quiet);            // notification
+    if (kr != KERN_SUCCESS) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": IOServiceAddInterestNotification returned 0x%x"),
+             kr);
+       goto done;
+    }
+
+    kr = IOServiceGetBusyState(root, &busy);
+    if (kr != KERN_SUCCESS) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": IOServiceGetBusyState returned 0x%x"),
+             kr);
+       goto done;
     }
     }
+
+    // add a timer so we don't wait forever for IOKit to quiesce
+    dict = CFBundleGetInfoDictionary(bundle);
+    if (isA_CFDictionary(dict)) {
+       CFNumberRef     num;
+
+       num = CFDictionaryGetValue(dict, CFSTR(WAIT_QUIET_TIMEOUT_KEY));
+       if (num != NULL) {
+           if (!isA_CFNumber(num) ||
+               !CFNumberGetValue(num, kCFNumberDoubleType, &timeout) ||
+               (timeout <= 0.0)) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR(MY_PLUGIN_NAME ": " WAIT_QUIET_TIMEOUT_KEY " value error"));
+               timeout = WAIT_QUIET_TIMEOUT_DEFAULT;
+           }
+       }
+    }
+    S_timer = CFRunLoopTimerCreate(NULL,
+                                  CFAbsoluteTimeGetCurrent() + timeout,
+                                  0,
+                                  0,
+                                  0,
+                                  timerCallback,
+                                  NULL);
+    if (S_timer == NULL) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": CFRunLoopTimerCreate failed"));
+       goto done;
+    }
+
+    CFRunLoopAddTimer(CFRunLoopGetCurrent(), S_timer, kCFRunLoopDefaultMode);
+
+    // watch for the introduction of the IONetworkStack
+    kr = IOServiceAddMatchingNotification(S_notify,
+                                         kIOFirstMatchNotification,
+                                         IOServiceMatching("IONetworkStack"),
+                                         &stackCallback,
+                                         (void *)S_notify,     // refCon
+                                         &S_stack);            // notification
+    if (kr != KERN_SUCCESS) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": IOServiceAddMatchingNotification returned 0x%x"),
+             kr);
+       goto done;
+    }
+
+    // check and see if the stack is already available and arm the
+    // notification for its introduction.
+    stackCallback((void *)S_notify, S_stack);
+
+    // watch for the introduction of new network interfaces
     kr = IOServiceAddMatchingNotification(S_notify,
                                          kIOFirstMatchNotification,
                                          IOServiceMatching("IONetworkInterface"),
                                          &interfaceArrivalCallback,
     kr = IOServiceAddMatchingNotification(S_notify,
                                          kIOFirstMatchNotification,
                                          IOServiceMatching("IONetworkInterface"),
                                          &interfaceArrivalCallback,
-                                         (void *) S_notify, /* refCon */
-                                         &S_iter );         /* notification */
-
+                                         (void *)S_notify,     // refCon
+                                         &S_iter);             // notification
     if (kr != KERN_SUCCESS) {
     if (kr != KERN_SUCCESS) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR(MY_PLUGIN_NAME
-                   ": IOServiceAddMatchingNotification returned 0x%x"),
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": IOServiceAddMatchingNotification returned 0x%x"),
              kr);
              kr);
-       goto error;
+       goto done;
     }
 
     }
 
-    S_dblist = readInterfaceList();
-    if (S_dblist) {
-       sort_interfaces_by_unit(S_dblist);
-    }
-    // Get the current list of matches and arms the notification for
+    // Get the current list of matches and arm the notification for
     // future interface arrivals.
     // future interface arrivals.
+    interfaceArrivalCallback((void *)S_notify, S_iter);
 
 
-    interfaceArrivalCallback((void *) S_notify, S_iter);
+    // Check if IOKit has already quiesced.
+    quietCallback((void *)S_notify,
+                 MACH_PORT_NULL,
+                 kIOMessageServiceBusyStateChange,
+                 (void *)busy);
 
     CFRunLoopAddSource(CFRunLoopGetCurrent(),
                       IONotificationPortGetRunLoopSource(S_notify),
                       kCFRunLoopDefaultMode);
 
     CFRunLoopAddSource(CFRunLoopGetCurrent(),
                       IONotificationPortGetRunLoopSource(S_notify),
                       kCFRunLoopDefaultMode);
-    if (stack != MACH_PORT_NULL) {
-       IOObjectRelease(stack);
+
+#ifdef WAIT_PREVIOUS_BOOT_INTERFACES_OR_QUIET
+    /*
+     * Start the wheels turning until we've named all of
+     * the interfaces that were used during the previous
+     * boot, until IOKit [matching] has quiesced, or
+     * until we've waited long enough.
+     */
+    CFRunLoopAddTimer(CFRunLoopGetCurrent(), S_timer, MY_PLUGIN_ID);
+    CFRunLoopAddSource(CFRunLoopGetCurrent(),
+                      IONotificationPortGetRunLoopSource(S_notify),
+                      MY_PLUGIN_ID);
+    while (S_prev_active_list != NULL) {
+       int     rlStatus;
+
+       rlStatus = CFRunLoopRunInMode(MY_PLUGIN_ID, 1.0e10, TRUE);
+    }
+#endif /* WAIT_PREVIOUS_BOOT_INTERFACES_OR_QUIET */
+
+    ok = TRUE;
+
+ done:
+    if (root != MACH_PORT_NULL) {
+       IOObjectRelease(root);
     }
     if (masterPort != MACH_PORT_NULL) {
        mach_port_deallocate(mach_task_self(), masterPort);
     }
     }
     if (masterPort != MACH_PORT_NULL) {
        mach_port_deallocate(mach_task_self(), masterPort);
     }
-    return;
- error:
-    if (stack != MACH_PORT_NULL) {
-       IOObjectRelease(stack);
+
+    return ok;
+}
+
+static Boolean
+setup_Virtual(CFBundleRef bundle)
+{
+    // open a SCPreferences session
+    S_prefs = SCPreferencesCreate(NULL, CFSTR(MY_PLUGIN_NAME), NULL);
+    if (S_prefs == NULL) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": SCPreferencesCreate() failed: %s"),
+             SCErrorString(SCError()));
+       return FALSE;
     }
     }
-    if (masterPort != MACH_PORT_NULL) {
-       mach_port_deallocate(mach_task_self(), masterPort);
+
+    // register for change notifications.
+    if (!SCPreferencesSetCallback(S_prefs, updateVirtualNetworkInterfaceConfiguration, NULL)) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": SCPreferencesSetCallBack() failed: %s"),
+             SCErrorString(SCError()));
+       CFRelease(S_prefs);
+       return FALSE;
+    }
+
+    // schedule
+    if (!SCPreferencesScheduleWithRunLoop(S_prefs, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": SCPreferencesScheduleWithRunLoop() failed: %s"),
+             SCErrorString(SCError()));
+       CFRelease(S_prefs);
+       return FALSE;
+    }
+
+    return TRUE;
+}
+
+__private_extern__
+void
+load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
+{
+    if (bundleVerbose) {
+       S_debug = TRUE;
+    }
+
+    // setup virtual network interface monitoring
+    if (!setup_Virtual(bundle)) {
+       goto error;
+    }
+
+    // setup [IOKit] network interface monitoring
+    if (!setup_IOKit(bundle)) {
+       goto error;
     }
     }
+
+    return;
+
+  error :
     if (S_connect != MACH_PORT_NULL) {
        IOServiceClose(S_connect);
        S_connect = MACH_PORT_NULL;
     }
     if (S_connect != MACH_PORT_NULL) {
        IOServiceClose(S_connect);
        S_connect = MACH_PORT_NULL;
     }
+    if (S_dblist != NULL) {
+       CFRelease(S_dblist);
+       S_dblist = NULL;
+    }
     if (S_iter != MACH_PORT_NULL) {
        IOObjectRelease(S_iter);
        S_iter = MACH_PORT_NULL;
     if (S_iter != MACH_PORT_NULL) {
        IOObjectRelease(S_iter);
        S_iter = MACH_PORT_NULL;
@@ -1413,6 +1773,24 @@ load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
     if (S_notify != MACH_PORT_NULL) {
        IONotificationPortDestroy(S_notify);
     }
     if (S_notify != MACH_PORT_NULL) {
        IONotificationPortDestroy(S_notify);
     }
+    if (S_quiet != MACH_PORT_NULL) {
+       IOObjectRelease(S_quiet);
+       S_quiet = MACH_PORT_NULL;
+    }
+    if (S_stack != MACH_PORT_NULL) {
+       IOObjectRelease(S_stack);
+       S_stack = MACH_PORT_NULL;
+    }
+    if (S_state != NULL) {
+       CFRelease(S_state);
+       S_state = NULL;
+    }
+    if (S_timer != NULL) {
+       CFRunLoopTimerInvalidate(S_timer);
+       CFRelease(S_timer);
+       S_timer = NULL;
+    }
+
     return;
 }
 
     return;
 }
 
@@ -1422,11 +1800,47 @@ load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
 int
 main(int argc, char ** argv)
 {
 int
 main(int argc, char ** argv)
 {
-    load_InterfaceNamer(CFBundleGetMainBundle(),
-        (argc > 1) ? TRUE : FALSE);
+    _sc_log     = FALSE;
+    _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+    load_InterfaceNamer(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE);
     CFRunLoopRun();
     /* not reached */
     exit(0);
     return 0;
 }
 #endif /* MAIN */
     CFRunLoopRun();
     /* not reached */
     exit(0);
     return 0;
 }
 #endif /* MAIN */
+
+#ifdef TEST_PLATFORM_UUID
+int
+main(int argc, char ** argv)
+{
+    CFArrayRef interfaces;
+
+    _sc_log     = FALSE;
+    _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+    S_dblist = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    interfaces = SCNetworkInterfaceCopyAll();
+    if (interfaces != NULL) {
+       CFIndex i;
+       CFIndex n;
+
+       n = CFArrayGetCount(interfaces);
+       for (i = 0; i < n; i++) {
+           CFDictionaryRef             dict;
+           SCNetworkInterfaceRef       interface;
+
+           interface = CFArrayGetValueAtIndex(interfaces, i);
+           dict = createInterfaceDict(interface);
+           CFArrayAppendValue(S_dblist, dict);
+           CFRelease(dict);
+       }
+       CFRelease(interfaces);
+    }
+    updatePlatformUUID();
+    CFRelease(S_dblist);
+    exit(0);
+    return 0;
+}
+#endif /* TEST_PLATFORM_UUID */
index 2af2501acec9423d83e2b04380677d5c81592bf2..d0cb258db2566830a392b5dc87d09f908dbca25b 100644 (file)
@@ -15,7 +15,7 @@
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
index cbcfd2e5f5801b2dc74e1e1c449dacfd330c8176..d48d5e5988da5916ae0f038a86021d3f23a1db93 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -43,12 +43,12 @@ get_atalk_interface_cfg(const char *if_name, at_if_cfg_t *cfg)
        int     fd;
 
        /* open socket */
        int     fd;
 
        /* open socket */
-       if ((fd = socket(AF_APPLETALK, SOCK_RAW, 0)) < 0)
+       if ((fd = socket(AF_APPLETALK, SOCK_RAW, 0)) == -1)
                return -1;
 
        /* get config info for given interface */
        strncpy(cfg->ifr_name, if_name, sizeof(cfg->ifr_name));
                return -1;
 
        /* get config info for given interface */
        strncpy(cfg->ifr_name, if_name, sizeof(cfg->ifr_name));
-       if (ioctl(fd, AIOCGETIFCFG, (caddr_t)cfg) < 0) {
+       if (ioctl(fd, AIOCGETIFCFG, (caddr_t)cfg) == -1) {
                (void)close(fd);
                return -1;
        }
                (void)close(fd);
                return -1;
        }
@@ -107,6 +107,7 @@ updateStore(const void *key, const void *value, void *context)
                } else if (dict) {
                        cache_SCDynamicStoreRemoveValue(store, key);
                }
                } else if (dict) {
                        cache_SCDynamicStoreRemoveValue(store, key);
                }
+               network_changed = TRUE;
        }
 
        return;
        }
 
        return;
@@ -136,7 +137,7 @@ interface_update_appletalk(struct ifaddrs *ifap, const char *if_name)
                                           &kCFTypeDictionaryValueCallBacks);
 
        if (!ifap) {
                                           &kCFTypeDictionaryValueCallBacks);
 
        if (!ifap) {
-               if (getifaddrs(&ifap_temp) < 0) {
+               if (getifaddrs(&ifap_temp) == -1) {
                        SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
                        goto error;
                }
                        SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
                        goto error;
                }
@@ -303,6 +304,7 @@ interface_update_atalk_address(struct kev_atalk_data *aEvent, const char *if_nam
 
        /* update cache */
        cache_SCDynamicStoreSetValue(store, key, newDict);
 
        /* update cache */
        cache_SCDynamicStoreSetValue(store, key, newDict);
+       network_changed = TRUE;
        CFRelease(newDict);
        CFRelease(key);
        return;
        CFRelease(newDict);
        CFRelease(key);
        return;
@@ -351,6 +353,7 @@ interface_update_atalk_zone(struct kev_atalk_data *aEvent, const char *if_name)
 
        /* update cache */
        cache_SCDynamicStoreSetValue(store, key, newDict);
 
        /* update cache */
        cache_SCDynamicStoreSetValue(store, key, newDict);
+       network_changed = TRUE;
        CFRelease(newDict);
        CFRelease(key);
        return;
        CFRelease(newDict);
        CFRelease(key);
        return;
@@ -377,7 +380,7 @@ interface_update_shutdown_atalk()
        if (dict) {
                if (isA_CFDictionary(dict)) {
                        /*get a list of the interfaces*/
        if (dict) {
                if (isA_CFDictionary(dict)) {
                        /*get a list of the interfaces*/
-                       ifList  = isA_CFArray(CFDictionaryGetValue(dict, kSCDynamicStorePropNetInterfaces));
+                       ifList  = isA_CFArray(CFDictionaryGetValue(dict, kSCPropNetInterfaces));
                        if (ifList) {
                                count = CFArrayGetCount(ifList);
 
                        if (ifList) {
                                count = CFArrayGetCount(ifList);
 
@@ -389,6 +392,7 @@ interface_update_shutdown_atalk()
                                                                                                  interface,
                                                                                                  kSCEntNetAppleTalk);
                                        cache_SCDynamicStoreRemoveValue(store, key);
                                                                                                  interface,
                                                                                                  kSCEntNetAppleTalk);
                                        cache_SCDynamicStoreRemoveValue(store, key);
+                                       network_changed = TRUE;
                                        CFRelease(key);
                                }
                        }
                                        CFRelease(key);
                                }
                        }
index bb48ef40bf4f3e14f5140fa1ff5595f6e7f99eef..f02f72201af12e1d5021bffd96ca9dcc0409613f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 516fe99e609240439cc04ed827eb9305d31cc2ef..debda25784e15c447a847745d6553379d86bad48 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -144,7 +144,7 @@ link_update_status(const char *if_name, boolean_t attach)
        int                     sock;
 
        sock = dgram_socket(AF_INET);
        int                     sock;
 
        sock = dgram_socket(AF_INET);
-       if (sock < 0) {
+       if (sock == -1) {
                SCLog(TRUE, LOG_NOTICE, CFSTR("link_update_status: socket open failed,  %s"), strerror(errno));
                goto done;
        }
                SCLog(TRUE, LOG_NOTICE, CFSTR("link_update_status: socket open failed,  %s"), strerror(errno));
                goto done;
        }
@@ -174,7 +174,7 @@ link_update_status(const char *if_name, boolean_t attach)
 
  done:
        interface_update_status(if_name, active, attach);
 
  done:
        interface_update_status(if_name, active, attach);
-       if (sock >= 0)
+       if (sock != -1)
                close(sock);
        return;
 }
                close(sock);
        return;
 }
@@ -199,7 +199,7 @@ link_add(const char *if_name)
        if (dict) {
                if (isA_CFDictionary(dict)) {
                        newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
        if (dict) {
                if (isA_CFDictionary(dict)) {
                        newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
-                       ifList  = CFDictionaryGetValue(newDict, kSCDynamicStorePropNetInterfaces);
+                       ifList  = CFDictionaryGetValue(newDict, kSCPropNetInterfaces);
                        if (isA_CFArray(ifList)) {
                                newIFList = CFArrayCreateMutableCopy(NULL, 0, ifList);
                        }
                        if (isA_CFArray(ifList)) {
                                newIFList = CFArrayCreateMutableCopy(NULL, 0, ifList);
                        }
@@ -222,9 +222,7 @@ link_add(const char *if_name)
                                 CFRangeMake(0, CFArrayGetCount(newIFList)),
                                 interface) == FALSE) {
                CFArrayAppendValue(newIFList, interface);
                                 CFRangeMake(0, CFArrayGetCount(newIFList)),
                                 interface) == FALSE) {
                CFArrayAppendValue(newIFList, interface);
-               CFDictionarySetValue(newDict,
-                                    kSCDynamicStorePropNetInterfaces,
-                                    newIFList);
+               CFDictionarySetValue(newDict, kSCPropNetInterfaces, newIFList);
        }
        cache_SCDynamicStoreSetValue(store, cacheKey, newDict);
        link_update_status(if_name, TRUE);
        }
        cache_SCDynamicStoreSetValue(store, cacheKey, newDict);
        link_update_status(if_name, TRUE);
@@ -257,7 +255,7 @@ link_remove(const char *if_name)
        if (dict) {
                if (isA_CFDictionary(dict)) {
                        newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
        if (dict) {
                if (isA_CFDictionary(dict)) {
                        newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
-                       ifList  = CFDictionaryGetValue(newDict, kSCDynamicStorePropNetInterfaces);
+                       ifList  = CFDictionaryGetValue(newDict, kSCPropNetInterfaces);
                        if (isA_CFArray(ifList)) {
                                newIFList = CFArrayCreateMutableCopy(NULL, 0, ifList);
                        }
                        if (isA_CFArray(ifList)) {
                                newIFList = CFArrayCreateMutableCopy(NULL, 0, ifList);
                        }
@@ -275,7 +273,7 @@ link_remove(const char *if_name)
        }
 
        CFArrayRemoveValueAtIndex(newIFList, i);
        }
 
        CFArrayRemoveValueAtIndex(newIFList, i);
-       CFDictionarySetValue(newDict, kSCDynamicStorePropNetInterfaces, newIFList);
+       CFDictionarySetValue(newDict, kSCPropNetInterfaces, newIFList);
        cache_SCDynamicStoreSetValue(store, cacheKey, newDict);
 
        interface_remove(if_name);
        cache_SCDynamicStoreSetValue(store, cacheKey, newDict);
 
        interface_remove(if_name);
index 6ab9a80f6baa3a7e1fa235654eec041c3db8306b..7e21623d9bcce65252bff7733f3fbee3d08e5937 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index c8071e7827707b0c6418a06d4c055baef3af8985..40518e47cb9c60a9e47ca5e828c17ddeb803ccaa 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2005, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 #ifndef kSCEntNetIPv4ARPCollision
 #define kSCEntNetIPv4ARPCollision      CFSTR("IPv4ARPCollision")
 
 #ifndef kSCEntNetIPv4ARPCollision
 #define kSCEntNetIPv4ARPCollision      CFSTR("IPv4ARPCollision")
-#endif kSCEntNetIPv4ARPCollision
+#endif /* kSCEntNetIPv4ARPCollision */
+
+#ifndef kSCEntNetIPv4PortInUse
+#define kSCEntNetIPv4PortInUse         CFSTR("PortInUse")
+#endif /* kSCEntNetIPv4PortInUse */
 
 #define IP_FORMAT      "%d.%d.%d.%d"
 #define IP_CH(ip, i)   (((u_char *)(ip))[i])
 
 #define IP_FORMAT      "%d.%d.%d.%d"
 #define IP_CH(ip, i)   (((u_char *)(ip))[i])
@@ -114,6 +118,7 @@ updateStore(const void *key, const void *value, void *context)
                } else if (dict) {
                        cache_SCDynamicStoreRemoveValue(store, key);
                }
                } else if (dict) {
                        cache_SCDynamicStoreRemoveValue(store, key);
                }
+               network_changed = TRUE;
        }
 
        return;
        }
 
        return;
@@ -143,7 +148,7 @@ interface_update_ipv4(struct ifaddrs *ifap, const char *if_name)
                                           &kCFTypeDictionaryValueCallBacks);
 
        if (!ifap) {
                                           &kCFTypeDictionaryValueCallBacks);
 
        if (!ifap) {
-               if (getifaddrs(&ifap_temp) < 0) {
+               if (getifaddrs(&ifap_temp) == -1) {
                        SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
                        goto error;
                }
                        SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
                        goto error;
                }
@@ -254,3 +259,21 @@ interface_collision_ipv4(const char *if_name, struct in_addr ip_addr, int hw_len
        CFRelease(if_name_cf);
        return;
 }
        CFRelease(if_name_cf);
        return;
 }
+
+__private_extern__
+void
+port_in_use_ipv4(uint16_t port, pid_t req_pid)
+{
+       CFStringRef             key;
+
+       key = SCDynamicStoreKeyCreate(NULL,
+                                     CFSTR("%@/%@/Protocol/%@/%@/%d/%d"),
+                                     kSCDynamicStoreDomainState,
+                                     kSCCompNetwork,
+                                     kSCEntNetIPv4,
+                                     kSCEntNetIPv4PortInUse,
+                                     port, req_pid);
+       cache_SCDynamicStoreNotifyValue(store, key);
+       CFRelease(key);
+       return;
+}
index 8a38843d2183be873dfb053ec68716c5efe36673..b4f17189c6057a9d9f1c477e8940354999756894 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -40,6 +40,7 @@ void  interface_update_ipv4   (struct ifaddrs *ifap, const char *if_name);
 void   interface_collision_ipv4(const char *if_name,
                                 struct in_addr ip_addr,
                                 int hw_len, const void * hw_addr);
 void   interface_collision_ipv4(const char *if_name,
                                 struct in_addr ip_addr,
                                 int hw_len, const void * hw_addr);
+void   port_in_use_ipv4(uint16_t port, pid_t req_pid);
 __END_DECLS
 
 #endif /* _EV_IPV4_H */
 __END_DECLS
 
 #endif /* _EV_IPV4_H */
index 47705c43135012f9105183ba35f8463ce3e46f3d..880713a63e87fcfa574d857d3d3ad856f4ee35ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 #define s6_addr16 __u6_addr.__u6_addr16
 
 
 #define s6_addr16 __u6_addr.__u6_addr16
 
-#ifndef        kSCPropNetIPv6DestAddresses
-#define kSCPropNetIPv6DestAddresses            SCSTR("DestAddresses")
-#endif
-
-#ifndef        kSCPropNetIPv6Flags
-#define kSCPropNetIPv6Flags                    SCSTR("Flags")
-#endif
-
-#ifndef        kSCPropNetIPv6PrefixLength
-#define kSCPropNetIPv6PrefixLength             SCSTR("PrefixLength")
-#endif
-
 #ifdef NOTYET
 #ifndef        kSCPropNetIPv6ScopeID
 #define kSCPropNetIPv6ScopeID                  SCSTR("ScopeID")
 #ifdef NOTYET
 #ifndef        kSCPropNetIPv6ScopeID
 #define kSCPropNetIPv6ScopeID                  SCSTR("ScopeID")
@@ -248,6 +236,7 @@ updateStore(const void *key, const void *value, void *context)
                } else if (dict) {
                        cache_SCDynamicStoreRemoveValue(store, key);
                }
                } else if (dict) {
                        cache_SCDynamicStoreRemoveValue(store, key);
                }
+               network_changed = TRUE;
        }
 
        return;
        }
 
        return;
@@ -278,7 +267,7 @@ interface_update_ipv6(struct ifaddrs *ifap, const char *if_name)
                                           &kCFTypeDictionaryValueCallBacks);
 
        if (!ifap) {
                                           &kCFTypeDictionaryValueCallBacks);
 
        if (!ifap) {
-               if (getifaddrs(&ifap_temp) < 0) {
+               if (getifaddrs(&ifap_temp) == -1) {
                        SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
                        goto error;
                }
                        SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
                        goto error;
                }
@@ -303,9 +292,9 @@ interface_update_ipv6(struct ifaddrs *ifap, const char *if_name)
                        }
                }
 
                        }
                }
 
-               if (sock < 0) {
+               if (sock == -1) {
                        sock = dgram_socket(AF_INET6);
                        sock = dgram_socket(AF_INET6);
-                       if (sock < 0) {
+                       if (sock == -1) {
                                SCLog(TRUE, LOG_NOTICE, CFSTR("interface_update_ipv6: socket open failed, %s"), strerror(errno));
                                goto error;
                        }
                                SCLog(TRUE, LOG_NOTICE, CFSTR("interface_update_ipv6: socket open failed, %s"), strerror(errno));
                                goto error;
                        }
@@ -399,7 +388,7 @@ interface_update_ipv6(struct ifaddrs *ifap, const char *if_name)
     error :
 
        if (ifap_temp)  freeifaddrs(ifap_temp);
     error :
 
        if (ifap_temp)  freeifaddrs(ifap_temp);
-       if (sock >= 0)  close(sock);
+       if (sock != -1) close(sock);
        CFRelease(oldIFs);
        CFRelease(newIFs);
 
        CFRelease(oldIFs);
        CFRelease(newIFs);
 
index 24113d554a0762033c0f59cbdc5045e144793cb8..23f1ced448b1b57cf4cecf345ff9577969a7405a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 24946f3603acbf03d8213750f96d6f611553f7a7..9c74f178935002911a7224f7505021fb04317772 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -60,6 +60,8 @@
 #include "ev_ipv6.h"
 #include "ev_appletalk.h"
 
 #include "ev_ipv6.h"
 #include "ev_appletalk.h"
 
+#include <notify.h>
+
 static const char *inetEventName[] = {
        "",
        "INET address added",
 static const char *inetEventName[] = {
        "",
        "INET address added",
@@ -109,10 +111,10 @@ static const char *inet6EventName[] = {
        "KEV_INET6_NEW_LL_ADDR",
        "KEV_INET6_NEW_RTADV_ADDR",
        "KEV_INET6_DEFROUTER"
        "KEV_INET6_NEW_LL_ADDR",
        "KEV_INET6_NEW_RTADV_ADDR",
        "KEV_INET6_DEFROUTER"
-
 };
 
 
 };
 
 
+__private_extern__ Boolean             network_changed = FALSE;
 __private_extern__ SCDynamicStoreRef   store           = NULL;
 __private_extern__ Boolean             _verbose        = FALSE;
 
 __private_extern__ SCDynamicStoreRef   store           = NULL;
 __private_extern__ Boolean             _verbose        = FALSE;
 
@@ -133,7 +135,7 @@ ifflags_set(int s, char * name, short flags)
     bzero(&ifr, sizeof(ifr));
     strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
     ret = ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr);
     bzero(&ifr, sizeof(ifr));
     strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
     ret = ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr);
-    if (ret < 0) {
+    if (ret == -1) {
                return (ret);
     }
     ifr.ifr_flags |= flags;
                return (ret);
     }
     ifr.ifr_flags |= flags;
@@ -149,7 +151,7 @@ ifflags_clear(int s, char * name, short flags)
     bzero(&ifr, sizeof(ifr));
     strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
     ret = ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr);
     bzero(&ifr, sizeof(ifr));
     strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
     ret = ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr);
-    if (ret < 0) {
+    if (ret == -1) {
                return (ret);
     }
     ifr.ifr_flags &= ~flags;
                return (ret);
     }
     ifr.ifr_flags &= ~flags;
@@ -160,7 +162,7 @@ static void
 mark_if_up(char * name)
 {
        int s = dgram_socket(AF_INET);
 mark_if_up(char * name)
 {
        int s = dgram_socket(AF_INET);
-       if (s < 0)
+       if (s == -1)
                return;
        ifflags_set(s, name, IFF_UP);
        close(s);
                return;
        ifflags_set(s, name, IFF_UP);
        close(s);
@@ -170,12 +172,29 @@ static void
 mark_if_down(char * name)
 {
        int s = dgram_socket(AF_INET);
 mark_if_down(char * name)
 {
        int s = dgram_socket(AF_INET);
-       if (s < 0)
+       if (s == -1)
                return;
        ifflags_clear(s, name, IFF_UP);
        close(s);
 }
 
                return;
        ifflags_clear(s, name, IFF_UP);
        close(s);
 }
 
+static void
+post_network_changed(void)
+{
+       if (network_changed) {
+               uint32_t        status;
+
+               status = notify_post("com.apple.system.config.network_change");
+               if (status != NOTIFY_STATUS_OK) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("notify_post() failed: error=%ld"), status);
+               }
+
+               network_changed = FALSE;
+       }
+
+       return;
+}
+
 static void
 logEvent(CFStringRef evStr, struct kern_event_msg *ev_msg)
 {
 static void
 logEvent(CFStringRef evStr, struct kern_event_msg *ev_msg)
 {
@@ -197,7 +216,7 @@ logEvent(CFStringRef evStr, struct kern_event_msg *ev_msg)
 }
 
 static const char *
 }
 
 static const char *
-inetEventNameString(u_long event_code)
+inetEventNameString(uint32_t event_code)
 {
        if (event_code <= KEV_INET_ARPCOLLISION) {
                return (inetEventName[event_code]);
 {
        if (event_code <= KEV_INET_ARPCOLLISION) {
                return (inetEventName[event_code]);
@@ -206,7 +225,7 @@ inetEventNameString(u_long event_code)
 }
 
 static const char *
 }
 
 static const char *
-inet6EventNameString(u_long event_code)
+inet6EventNameString(uint32_t event_code)
 {
        if (event_code <= KEV_INET6_DEFROUTER) {
                return (inet6EventName[event_code]);
 {
        if (event_code <= KEV_INET6_DEFROUTER) {
                return (inet6EventName[event_code]);
@@ -215,7 +234,7 @@ inet6EventNameString(u_long event_code)
 }
 
 static const char *
 }
 
 static const char *
-dlEventNameString(u_long event_code)
+dlEventNameString(uint32_t event_code)
 {
        if (event_code <= KEV_DL_PROTO_DETACHED) {
                return (dlEventName[event_code]);
 {
        if (event_code <= KEV_DL_PROTO_DETACHED) {
                return (dlEventName[event_code]);
@@ -224,7 +243,7 @@ dlEventNameString(u_long event_code)
 }
 
 static const char *
 }
 
 static const char *
-atalkEventNameString(u_long event_code)
+atalkEventNameString(uint32_t event_code)
 {
        if (event_code <= KEV_ATALK_ZONELISTCHANGED) {
                return (atalkEventName[event_code]);
 {
        if (event_code <= KEV_ATALK_ZONELISTCHANGED) {
                return (atalkEventName[event_code]);
@@ -236,7 +255,7 @@ atalkEventNameString(u_long event_code)
 static void
 copy_if_name(struct net_event_data * ev, char * ifr_name, int ifr_len)
 {
 static void
 copy_if_name(struct net_event_data * ev, char * ifr_name, int ifr_len)
 {
-       snprintf(ifr_name, ifr_len, "%s%ld", ev->if_name, ev->if_unit);
+       snprintf(ifr_name, ifr_len, "%s%d", ev->if_name, ev->if_unit);
        return;
 }
 
        return;
 }
 
@@ -247,7 +266,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
        int                             dataLen = (ev_msg->total_size - KEV_MSG_HEADER_SIZE);
        void *                          event_data = &ev_msg->event_data[0];
        Boolean                         handled = TRUE;
        int                             dataLen = (ev_msg->total_size - KEV_MSG_HEADER_SIZE);
        void *                          event_data = &ev_msg->event_data[0];
        Boolean                         handled = TRUE;
-       char                            ifr_name[IFNAMSIZ+1];
+       char                            ifr_name[IFNAMSIZ + 1];
 
        switch (ev_msg->kev_subclass) {
                case KEV_INET_SUBCLASS : {
 
        switch (ev_msg->kev_subclass) {
                case KEV_INET_SUBCLASS : {
@@ -286,6 +305,16 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
                                                                 ev->hw_addr);
                                        break;
                                }
                                                                 ev->hw_addr);
                                        break;
                                }
+                               case KEV_INET_PORTINUSE : {
+                                       struct kev_in_portinuse * ev;
+                                       ev = (struct kev_in_portinuse *)event_data;
+                                       if (dataLen < sizeof(*ev)) {
+                                               handled = FALSE;
+                                               break;
+                                       }
+                                       port_in_use_ipv4(ev->port, ev->req_pid);
+                                       break;
+                               }
                                default :
                                        handled = FALSE;
                                        break;
                                default :
                                        handled = FALSE;
                                        break;
@@ -527,6 +556,7 @@ eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const
 
        cache_write(store);
        cache_close();
 
        cache_write(store);
        cache_close();
+       post_network_changed();
 
        return;
 
 
        return;
 
@@ -557,7 +587,7 @@ prime_KernelEventMonitor()
                goto done;
        }
 
                goto done;
        }
 
-       if (getifaddrs(&ifap) < 0) {
+       if (getifaddrs(&ifap) == -1) {
                SCLog(TRUE,
                      LOG_ERR,
                      CFSTR("could not get interface info, getifaddrs() failed: %s"),
                SCLog(TRUE,
                      LOG_ERR,
                      CFSTR("could not get interface info, getifaddrs() failed: %s"),
@@ -596,16 +626,26 @@ prime_KernelEventMonitor()
        freeifaddrs(ifap);
 
  done:
        freeifaddrs(ifap);
 
  done:
-       if (sock >= 0)
+       if (sock != -1)
                close(sock);
 
        cache_write(store);
        cache_close();
 
                close(sock);
 
        cache_write(store);
        cache_close();
 
+       network_changed = TRUE;
+       post_network_changed();
+
        return;
 }
 
 
        return;
 }
 
 
+static CFStringRef
+kevSocketCopyDescription(const void *info)
+{
+       return CFStringCreateWithFormat(NULL, NULL, CFSTR("<kernel event socket>"));
+}
+
+
 __private_extern__
 void
 load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 __private_extern__
 void
 load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
@@ -614,7 +654,12 @@ load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
        int                     status;
        struct kev_request      kev_req;
        CFSocketRef             es;
        int                     status;
        struct kev_request      kev_req;
        CFSocketRef             es;
-       CFSocketContext         context = { 0, NULL, NULL, NULL, NULL };
+       CFSocketContext         context = { 0
+                                         , (void *)1
+                                         , NULL
+                                         , NULL
+                                         , kevSocketCopyDescription
+                                         };
        CFRunLoopSourceRef      rls;
 
        if (bundleVerbose) {
        CFRunLoopSourceRef      rls;
 
        if (bundleVerbose) {
@@ -629,7 +674,7 @@ load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
                                     CFSTR("Kernel Event Monitor plug-in"),
                                     NULL,
                                     NULL);
                                     CFSTR("Kernel Event Monitor plug-in"),
                                     NULL,
                                     NULL);
-       if (!store) {
+       if (store == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("SCDnamicStoreCreate() failed: %s"), SCErrorString(SCError()));
                SCLog(TRUE, LOG_ERR, CFSTR("kernel event monitor disabled."));
                return;
                SCLog(TRUE, LOG_ERR, CFSTR("SCDnamicStoreCreate() failed: %s"), SCErrorString(SCError()));
                SCLog(TRUE, LOG_ERR, CFSTR("kernel event monitor disabled."));
                return;
index ed6054cc3952052832216397ec7e87879b64f6c6..c9a81c05ed7f0b7704b5bb86931bcd2eaf6b91bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2005, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -56,6 +56,7 @@
 #include <SystemConfiguration/SCValidation.h>
 
 
 #include <SystemConfiguration/SCValidation.h>
 
 
+extern Boolean                 network_changed;
 extern SCDynamicStoreRef       store;
 extern Boolean                 _verbose;
 
 extern SCDynamicStoreRef       store;
 extern Boolean                 _verbose;
 
index 2a981383fb5677dd009d49c6d3b803fa77536bd7..bc42eb32614569932b96e86a05534086fab7a491 100644 (file)
@@ -15,7 +15,7 @@
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
index 182a9aa61a2dbcef314ae56207252239d41e8d32..db550c44beef5e5f4fe6b3747fa8fe6017f0569b 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?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">
 <array>
        <dict>
 <plist version="1.0">
 <array>
        <dict>
                <key>name</key>
                <string>enable-network</string>
        </dict>
                <key>name</key>
                <string>enable-network</string>
        </dict>
-       <dict>
-               <key>keys</key>
-               <array>
-                       <string>State:/Network/Global/DNS</string>
-                       <string>State:/Network/Global/IPv4</string>
-                       <string>State:/Network/Global/IPv6</string>
-                       <string>State:/Network/Global/NetInfo</string>
-               </array>
-               <key>name</key>
-               <string>network_change</string>
-               <key>postName</key>
-               <string>com.apple.system.config.network_change</string>
-       </dict>
-       <dict>
-               <key>execCommand</key>
-               <string>/usr/sbin/AppleFileServer</string>
-               <key>execUID</key>
-               <integer>0</integer>
-               <key>keys</key>
-               <array>
-                       <string>daemon:AppleFileServer</string>
-               </array>
-               <key>name</key>
-               <string>AppleFileServer</string>
-       </dict>
 </array>
 </plist>
 </array>
 </plist>
index b68cc8dec5911160ef3806c84d40ac5bc55a8d3f..106de56acf38c2a49dfca04e173e52fcc0a2a9c0 100755 (executable)
@@ -8,8 +8,16 @@ logger -i -p daemon.debug -t enable-network "process network configuration chang
 CheckForNetwork
 if [ "${NETWORKUP}" = "-NO-" ]; then exit 0; fi
 
 CheckForNetwork
 if [ "${NETWORKUP}" = "-NO-" ]; then exit 0; fi
 
-/System/Library/StartupItems/NetworkTime/NetworkTime start
-/System/Library/StartupItems/NIS/NIS start
-/System/Library/StartupItems/NFS/NFS start
+if [ -x /System/Library/StartupItems/NetworkTime/NetworkTime ]; then
+       /System/Library/StartupItems/NetworkTime/NetworkTime start
+fi
+
+if [ -x /System/Library/StartupItems/NIS/NIS ]; then
+       /System/Library/StartupItems/NIS/NIS start
+fi
+
+if [ -x /System/Library/StartupItems/NFS/NFS ]; then
+       /System/Library/StartupItems/NFS/NFS start
+fi
 
 exit 1
 
 exit 1
index efc49aa75a3787561fbc4aee73702a1303fb5a5c..ad552d2aff49dfd9f80a8077740ef5f784932059 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -317,7 +317,7 @@ booterExit(pid_t pid, int status, struct rusage *rusage, void *context)
                        cleanupKicker(target);
                        target = NULL;
                }
                        cleanupKicker(target);
                        target = NULL;
                }
-       } 
+       }
        if (target != NULL && target->needsKick) {
                target->needsKick = FALSE;
                booter(target);
        if (target != NULL && target->needsKick) {
                target->needsKick = FALSE;
                booter(target);
index 588b111f9eb0ddd856285adf77865892f2656e4f..abac7dc13491ade5c67800f2da0ddfcdd571b7d9 100644 (file)
@@ -15,7 +15,7 @@
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
index 595a89f9c8641ed4e164dcba19b0656931678cf4..b0d89df0a762d797a0c0c7d0463f1fb6d6834950 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 
 static CFMutableDictionaryRef  baseSettings    = NULL;
 
 
 static CFMutableDictionaryRef  baseSettings    = NULL;
+static CFStringRef             interfacesKey   = NULL;
 static SCDynamicStoreRef       store           = NULL;
 static CFRunLoopSourceRef      rls             = NULL;
 static SCDynamicStoreRef       store           = NULL;
 static CFRunLoopSourceRef      rls             = NULL;
+static CFMutableDictionaryRef  wantSettings    = NULL;
 
 static Boolean                 _verbose        = FALSE;
 
 
 /* in SystemConfiguration/LinkConfiguration.c */
 int
 
 static Boolean                 _verbose        = FALSE;
 
 
 /* in SystemConfiguration/LinkConfiguration.c */
 int
-__createMediaOptions(CFStringRef interface, CFDictionaryRef media_options);
+__createMediaOptions(CFStringRef interfaceName, CFDictionaryRef media_options);
 
 
 static CFDictionaryRef
 
 
 static CFDictionaryRef
@@ -94,21 +96,30 @@ __copyMediaOptions(CFDictionaryRef options)
 
 __private_extern__
 Boolean
 
 __private_extern__
 Boolean
-_NetworkInterfaceSetMediaOptions(CFStringRef           interface,
-                                CFDictionaryRef        options)
+_SCNetworkInterfaceSetMediaOptions(SCNetworkInterfaceRef       interface,
+                                  CFDictionaryRef              options)
 {
        CFArrayRef              available       = NULL;
        CFDictionaryRef         current         = NULL;
        struct ifmediareq       ifm;
        struct ifreq            ifr;
 {
        CFArrayRef              available       = NULL;
        CFDictionaryRef         current         = NULL;
        struct ifmediareq       ifm;
        struct ifreq            ifr;
+       CFStringRef             interfaceName;
        Boolean                 ok              = FALSE;
        int                     newOptions;
        CFDictionaryRef         requested;
        int                     sock            = -1;
 
        Boolean                 ok              = FALSE;
        int                     newOptions;
        CFDictionaryRef         requested;
        int                     sock            = -1;
 
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               /* if no BSD interface name */
+               SCLog(_verbose, LOG_INFO, CFSTR("no BSD interface name for %@"), interface);
+               return FALSE;
+       }
+
        /* get current & available options */
        /* get current & available options */
-       if (!NetworkInterfaceCopyMediaOptions(interface, &current, NULL, &available, FALSE)) {
+       if (!SCNetworkInterfaceCopyMediaOptions(interface, &current, NULL, &available, FALSE)) {
                /* could not get current media options */
                /* could not get current media options */
+               SCLog(_verbose, LOG_INFO, CFSTR("no media options for %@"), interfaceName);
                return FALSE;
        }
 
                return FALSE;
        }
 
@@ -118,7 +129,7 @@ _NetworkInterfaceSetMediaOptions(CFStringRef                interface,
                CFDictionaryRef baseOptions;
 
                /* get base options */
                CFDictionaryRef baseOptions;
 
                /* get base options */
-               baseOptions = CFDictionaryGetValue(baseSettings, interface);
+               baseOptions = CFDictionaryGetValue(baseSettings, interfaceName);
                requested = __copyMediaOptions(baseOptions);
        }
        if (requested == NULL) {
                requested = __copyMediaOptions(baseOptions);
        }
        if (requested == NULL) {
@@ -138,26 +149,26 @@ _NetworkInterfaceSetMediaOptions(CFStringRef              interface,
 
        if (!CFArrayContainsValue(available, CFRangeMake(0, CFArrayGetCount(available)), requested)) {
                /* if requested settings not currently available */
 
        if (!CFArrayContainsValue(available, CFRangeMake(0, CFArrayGetCount(available)), requested)) {
                /* if requested settings not currently available */
-               SCLog(TRUE, LOG_DEBUG, CFSTR("requested media settings unavailable"));
+               SCLog(_verbose, LOG_INFO, CFSTR("requested media settings unavailable for %@"), interfaceName);
                goto done;
        }
 
                goto done;
        }
 
-       newOptions = __createMediaOptions(interface, requested);
+       newOptions = __createMediaOptions(interfaceName, requested);
        if (newOptions == -1) {
                /* since we have just validated, this should never happen */
                goto done;
        }
 
        sock = socket(AF_INET, SOCK_DGRAM, 0);
        if (newOptions == -1) {
                /* since we have just validated, this should never happen */
                goto done;
        }
 
        sock = socket(AF_INET, SOCK_DGRAM, 0);
-       if (sock < 0) {
+       if (sock == -1) {
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
                goto done;
        }
 
        bzero((char *)&ifm, sizeof(ifm));
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
                goto done;
        }
 
        bzero((char *)&ifm, sizeof(ifm));
-       (void)_SC_cfstring_to_cstring(interface, ifm.ifm_name, sizeof(ifm.ifm_name), kCFStringEncodingASCII);
+       (void)_SC_cfstring_to_cstring(interfaceName, ifm.ifm_name, sizeof(ifm.ifm_name), kCFStringEncodingASCII);
 
 
-       if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifm) < 0) {
+       if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifm) == -1) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("ioctl(SIOCGIFMEDIA) failed: %s"), strerror(errno));
                goto done;
        }
                SCLog(TRUE, LOG_DEBUG, CFSTR("ioctl(SIOCGIFMEDIA) failed: %s"), strerror(errno));
                goto done;
        }
@@ -167,11 +178,11 @@ _NetworkInterfaceSetMediaOptions(CFStringRef              interface,
        ifr.ifr_media =  ifm.ifm_current & ~(IFM_NMASK|IFM_TMASK|IFM_OMASK|IFM_GMASK);
        ifr.ifr_media |= newOptions;
 
        ifr.ifr_media =  ifm.ifm_current & ~(IFM_NMASK|IFM_TMASK|IFM_OMASK|IFM_GMASK);
        ifr.ifr_media |= newOptions;
 
-//SCLog(TRUE, LOG_INFO, CFSTR("old media settings: 0x%8.8x (0x%8.8x)"), ifm.ifm_current, ifm.ifm_active);
-//SCLog(TRUE, LOG_INFO, CFSTR("new media settings: 0x%8.8x"), ifr.ifr_media);
+       SCLog(_verbose, LOG_INFO, CFSTR("old media settings: 0x%8.8x (0x%8.8x)"), ifm.ifm_current, ifm.ifm_active);
+       SCLog(_verbose, LOG_INFO, CFSTR("new media settings: 0x%8.8x"), ifr.ifr_media);
 
 
-       if (ioctl(sock, SIOCSIFMEDIA, (caddr_t)&ifr) < 0) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("ioctl(SIOCSIFMEDIA) failed: %s"), strerror(errno));
+       if (ioctl(sock, SIOCSIFMEDIA, (caddr_t)&ifr) == -1) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("%@: ioctl(SIOCSIFMEDIA) failed: %s"), interfaceName, strerror(errno));
                goto done;
        }
 
                goto done;
        }
 
@@ -179,10 +190,10 @@ _NetworkInterfaceSetMediaOptions(CFStringRef              interface,
 
     done :
 
 
     done :
 
-       if (available)  CFRelease(available);
-       if (current)    CFRelease(current);
-       if (requested)  CFRelease(requested);
-       if (sock >= 0)  (void)close(sock);
+       if (available != NULL)  CFRelease(available);
+       if (current != NULL)    CFRelease(current);
+       if (requested != NULL)  CFRelease(requested);
+       if (sock != -1) (void)close(sock);
 
        return ok;
 }
 
        return ok;
 }
@@ -221,16 +232,23 @@ ifconfig_exit(pid_t pid, int status, struct rusage *rusage, void *context)
 
 __private_extern__
 Boolean
 
 __private_extern__
 Boolean
-_NetworkInterfaceSetMTU(CFStringRef    interface,
-                       CFDictionaryRef options)
+_SCNetworkInterfaceSetMTU(SCNetworkInterfaceRef        interface,
+                         CFDictionaryRef       options)
 {
 {
+       CFStringRef     interfaceName;
        int             mtu_cur         = -1;
        int             mtu_max         = -1;
        int             mtu_min         = -1;
        int             requested;
        CFNumberRef     val;
 
        int             mtu_cur         = -1;
        int             mtu_max         = -1;
        int             mtu_min         = -1;
        int             requested;
        CFNumberRef     val;
 
-       if (!NetworkInterfaceCopyMTU(interface, &mtu_cur, &mtu_min, &mtu_max)) {
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               /* if no BSD interface name */
+               return FALSE;
+       }
+
+       if (!SCNetworkInterfaceCopyMTU(interface, &mtu_cur, &mtu_min, &mtu_max)) {
                /* could not get current MTU */
                return FALSE;
        }
                /* could not get current MTU */
                return FALSE;
        }
@@ -244,7 +262,7 @@ _NetworkInterfaceSetMTU(CFStringRef interface,
                CFDictionaryRef baseOptions;
 
                /* get base MTU */
                CFDictionaryRef baseOptions;
 
                /* get base MTU */
-               baseOptions = CFDictionaryGetValue(baseSettings, interface);
+               baseOptions = CFDictionaryGetValue(baseSettings, interfaceName);
                if (baseOptions != NULL) {
                        val = CFDictionaryGetValue(baseOptions, kSCPropNetEthernetMTU);
                }
                if (baseOptions != NULL) {
                        val = CFDictionaryGetValue(baseOptions, kSCPropNetEthernetMTU);
                }
@@ -273,11 +291,11 @@ _NetworkInterfaceSetMTU(CFStringRef       interface,
        int             sock;
 
        bzero((char *)&ifr, sizeof(ifr));
        int             sock;
 
        bzero((char *)&ifr, sizeof(ifr));
-       (void)_SC_cfstring_to_cstring(interface, ifr.ifr_name, sizeof(ifr.ifr_name), kCFStringEncodingASCII);
+       (void)_SC_cfstring_to_cstring(interfaceName, ifr.ifr_name, sizeof(ifr.ifr_name), kCFStringEncodingASCII);
        ifr.ifr_mtu = requested;
 
        sock = socket(AF_INET, SOCK_DGRAM, 0);
        ifr.ifr_mtu = requested;
 
        sock = socket(AF_INET, SOCK_DGRAM, 0);
-       if (sock < 0) {
+       if (sock == -1) {
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
                return FALSE;
        }
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
                return FALSE;
        }
@@ -294,7 +312,7 @@ _NetworkInterfaceSetMTU(CFStringRef interface,
        char    *ifconfig_argv[] = { "ifconfig", NULL, "mtu", NULL, NULL };
        pid_t   pid;
 
        char    *ifconfig_argv[] = { "ifconfig", NULL, "mtu", NULL, NULL };
        pid_t   pid;
 
-       ifconfig_argv[1] = _SC_cfstring_to_cstring(interface, NULL, 0, kCFStringEncodingASCII);
+       ifconfig_argv[1] = _SC_cfstring_to_cstring(interfaceName, NULL, 0, kCFStringEncodingASCII);
        (void)asprintf(&ifconfig_argv[3], "%d", requested);
 
        pid = _SCDPluginExecCommand(ifconfig_exit,      // callout,
        (void)asprintf(&ifconfig_argv[3], "%d", requested);
 
        pid = _SCDPluginExecCommand(ifconfig_exit,      // callout,
@@ -352,33 +370,69 @@ parse_component(CFStringRef key, CFStringRef prefix)
 }
 
 
 }
 
 
+static void updateLink(CFStringRef interfaceName, CFDictionaryRef options);
+
+
 static void
 static void
-updateLink(CFStringRef ifKey, CFDictionaryRef options)
+updateInterfaces(CFArrayRef newInterfaces)
 {
 {
-       CFStringRef             interface       = NULL;
-       static CFStringRef      prefix          = NULL;
+       CFIndex                 i;
+       CFIndex                 n_old;
+       CFIndex                 n_new;
+       static CFArrayRef       oldInterfaces   = NULL;
 
 
-       if (!prefix) {
-               prefix = SCDynamicStoreKeyCreate(NULL,
-                                                CFSTR("%@/%@/%@/"),
-                                                kSCDynamicStoreDomainSetup,
-                                                kSCCompNetwork,
-                                                kSCCompInterface);
+       n_old = (oldInterfaces != NULL) ? CFArrayGetCount(oldInterfaces) : 0;
+       n_new = CFArrayGetCount(newInterfaces);
+
+       for (i = 0; i < n_new; i++) {
+               CFStringRef     interfaceName;
+
+               interfaceName = CFArrayGetValueAtIndex(newInterfaces, i);
+
+               if ((n_old == 0) ||
+                   !CFArrayContainsValue(oldInterfaces,
+                                         CFRangeMake(0, n_old),
+                                         interfaceName)) {
+                       CFDictionaryRef options;
+
+                       // if new interface
+                       options = CFDictionaryGetValue(wantSettings, interfaceName);
+                       updateLink(interfaceName, options);
+               }
        }
 
        }
 
-       interface = parse_component(ifKey, prefix);
-       if (!interface) {
-               goto done;
+       if (oldInterfaces != NULL) CFRelease(oldInterfaces);
+       oldInterfaces = CFRetain(newInterfaces);
+}
+
+
+static void
+updateLink(CFStringRef interfaceName, CFDictionaryRef options)
+{
+       SCNetworkInterfaceRef   interface;
+
+       /* retain requested configuration */
+       if (options != NULL) {
+               CFDictionarySetValue(wantSettings, interfaceName, options);
+       } else {
+               CFDictionaryRemoveValue(wantSettings, interfaceName);
+       }
+
+       /* apply requested configuration */
+       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, interfaceName,
+                                                        kIncludeAllVirtualInterfaces);
+       if (interface == NULL) {
+               return;
        }
 
        }
 
-       if (options) {
-               if (!CFDictionaryContainsKey(baseSettings, interface)) {
+       if (options != NULL) {
+               if (!CFDictionaryContainsKey(baseSettings, interfaceName)) {
                        CFDictionaryRef         cur_media       = NULL;
                        CFMutableDictionaryRef  new_media       = NULL;
                        int                     cur_mtu         = -1;
 
                        /* preserve current media options */
                        CFDictionaryRef         cur_media       = NULL;
                        CFMutableDictionaryRef  new_media       = NULL;
                        int                     cur_mtu         = -1;
 
                        /* preserve current media options */
-                       if (NetworkInterfaceCopyMediaOptions(interface, &cur_media, NULL, NULL, FALSE)) {
+                       if (SCNetworkInterfaceCopyMediaOptions(interface, &cur_media, NULL, NULL, FALSE)) {
                                if (cur_media != NULL) {
                                        new_media = CFDictionaryCreateMutableCopy(NULL, 0, cur_media);
                                        CFRelease(cur_media);
                                if (cur_media != NULL) {
                                        new_media = CFDictionaryCreateMutableCopy(NULL, 0, cur_media);
                                        CFRelease(cur_media);
@@ -386,7 +440,7 @@ updateLink(CFStringRef ifKey, CFDictionaryRef options)
                        }
 
                        /* preserve current MTU */
                        }
 
                        /* preserve current MTU */
-                       if (NetworkInterfaceCopyMTU(interface, &cur_mtu, NULL, NULL)) {
+                       if (SCNetworkInterfaceCopyMTU(interface, &cur_mtu, NULL, NULL)) {
                                if (cur_mtu != -1) {
                                        CFNumberRef     num;
 
                                if (cur_mtu != -1) {
                                        CFNumberRef     num;
 
@@ -404,28 +458,26 @@ updateLink(CFStringRef ifKey, CFDictionaryRef options)
                        }
 
                        if (new_media != NULL) {
                        }
 
                        if (new_media != NULL) {
-                               CFDictionarySetValue(baseSettings, interface, new_media);
+                               CFDictionarySetValue(baseSettings, interfaceName, new_media);
                                CFRelease(new_media);
                        }
                }
 
                /* establish new settings */
                                CFRelease(new_media);
                        }
                }
 
                /* establish new settings */
-               (void)_NetworkInterfaceSetMediaOptions(interface, options);
-               (void)_NetworkInterfaceSetMTU         (interface, options);
+               (void)_SCNetworkInterfaceSetMediaOptions(interface, options);
+               (void)_SCNetworkInterfaceSetMTU         (interface, options);
        } else {
                /* no requested settings */
        } else {
                /* no requested settings */
-               options = CFDictionaryGetValue(baseSettings, interface);
-               if (options) {
+               options = CFDictionaryGetValue(baseSettings, interfaceName);
+               if (options != NULL) {
                        /* restore original settings */
                        /* restore original settings */
-                       (void)_NetworkInterfaceSetMediaOptions(interface, options);
-                       (void)_NetworkInterfaceSetMTU         (interface, options);
-                       CFDictionaryRemoveValue(baseSettings, interface);
+                       (void)_SCNetworkInterfaceSetMediaOptions(interface, options);
+                       (void)_SCNetworkInterfaceSetMTU         (interface, options);
+                       CFDictionaryRemoveValue(baseSettings, interfaceName);
                }
        }
 
                }
        }
 
-    done :
-
-       if (interface)  CFRelease(interface);
+       CFRelease(interface);
        return;
 }
 
        return;
 }
 
@@ -433,23 +485,48 @@ updateLink(CFStringRef ifKey, CFDictionaryRef options)
 static void
 linkConfigChangedCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *arg)
 {
 static void
 linkConfigChangedCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *arg)
 {
+       CFDictionaryRef         changes;
        CFIndex                 i;
        CFIndex                 n;
        CFIndex                 i;
        CFIndex                 n;
-       CFDictionaryRef         linkInfo;
+       static CFStringRef      prefix          = NULL;
+
+       if (prefix == NULL) {
+               prefix = SCDynamicStoreKeyCreate(NULL,
+                                                CFSTR("%@/%@/%@/"),
+                                                kSCDynamicStoreDomainSetup,
+                                                kSCCompNetwork,
+                                                kSCCompInterface);
+       }
 
 
-       linkInfo = SCDynamicStoreCopyMultiple(store, changedKeys, NULL);
+       changes = SCDynamicStoreCopyMultiple(store, changedKeys, NULL);
 
        n = CFArrayGetCount(changedKeys);
        for (i = 0; i < n; i++) {
                CFStringRef     key;
 
        n = CFArrayGetCount(changedKeys);
        for (i = 0; i < n; i++) {
                CFStringRef     key;
-               CFDictionaryRef link;
+               CFDictionaryRef info;
 
                key  = CFArrayGetValueAtIndex(changedKeys, i);
 
                key  = CFArrayGetValueAtIndex(changedKeys, i);
-               link = CFDictionaryGetValue(linkInfo, key);
-               updateLink(key, link);
+               info = CFDictionaryGetValue(changes, key);
+
+               if (CFEqual(key, interfacesKey)) {
+                       CFArrayRef      interfaces;
+
+                       interfaces = CFDictionaryGetValue(info, kSCPropNetInterfaces);
+                       if (isA_CFArray(interfaces)) {
+                               updateInterfaces(interfaces);
+                       }
+               } else {
+                       CFStringRef     interfaceName;
+
+                       interfaceName = parse_component(key, prefix);
+                       if (interfaceName != NULL) {
+                               updateLink(interfaceName, info);
+                               CFRelease(interfaceName);
+                       }
+               }
        }
 
        }
 
-       CFRelease(linkInfo);
+       CFRelease(changes);
 
        return;
 }
 
        return;
 }
@@ -460,6 +537,8 @@ void
 load_LinkConfiguration(CFBundleRef bundle, Boolean bundleVerbose)
 {
        CFStringRef             key;
 load_LinkConfiguration(CFBundleRef bundle, Boolean bundleVerbose)
 {
        CFStringRef             key;
+       CFMutableArrayRef       keys            = NULL;
+       Boolean                 ok;
        CFMutableArrayRef       patterns        = NULL;
 
        if (bundleVerbose) {
        CFMutableArrayRef       patterns        = NULL;
 
        if (bundleVerbose) {
@@ -475,21 +554,30 @@ load_LinkConfiguration(CFBundleRef bundle, Boolean bundleVerbose)
                                                 0,
                                                 &kCFTypeDictionaryKeyCallBacks,
                                                 &kCFTypeDictionaryValueCallBacks);
                                                 0,
                                                 &kCFTypeDictionaryKeyCallBacks,
                                                 &kCFTypeDictionaryValueCallBacks);
+       wantSettings = CFDictionaryCreateMutable(NULL,
+                                                0,
+                                                &kCFTypeDictionaryKeyCallBacks,
+                                                &kCFTypeDictionaryValueCallBacks);
 
        /* open a "configd" store to allow cache updates */
        store = SCDynamicStoreCreate(NULL,
                                     CFSTR("Link Configuraton plug-in"),
                                     linkConfigChangedCallback,
                                     NULL);
 
        /* open a "configd" store to allow cache updates */
        store = SCDynamicStoreCreate(NULL,
                                     CFSTR("Link Configuraton plug-in"),
                                     linkConfigChangedCallback,
                                     NULL);
-       if (!store) {
+       if (store == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCreate() failed: %s"), SCErrorString(SCError()));
                goto error;
        }
 
        /* establish notification keys and patterns */
                SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCreate() failed: %s"), SCErrorString(SCError()));
                goto error;
        }
 
        /* establish notification keys and patterns */
-
+       keys     = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
        patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
+       /* ...watch for a change in the list of network interfaces */
+       interfacesKey = SCDynamicStoreKeyCreateNetworkInterface(NULL,
+                                                               kSCDynamicStoreDomainState);
+       CFArrayAppendValue(keys, interfacesKey);
+
        /* ...watch for (per-interface) AirPort configuration changes */
        key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
                                                            kSCDynamicStoreDomainSetup,
        /* ...watch for (per-interface) AirPort configuration changes */
        key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
                                                            kSCDynamicStoreDomainSetup,
@@ -515,7 +603,10 @@ load_LinkConfiguration(CFBundleRef bundle, Boolean bundleVerbose)
        CFRelease(key);
 
        /* register the keys/patterns */
        CFRelease(key);
 
        /* register the keys/patterns */
-       if (!SCDynamicStoreSetNotificationKeys(store, NULL, patterns)) {
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, patterns);
+       CFRelease(keys);
+       CFRelease(patterns);
+       if (!ok) {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s"),
                      SCErrorString(SCError()));
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s"),
                      SCErrorString(SCError()));
@@ -523,7 +614,7 @@ load_LinkConfiguration(CFBundleRef bundle, Boolean bundleVerbose)
        }
 
        rls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
        }
 
        rls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
-       if (!rls) {
+       if (rls == NULL) {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCDynamicStoreCreateRunLoopSource() failed: %s"),
                      SCErrorString(SCError()));
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCDynamicStoreCreateRunLoopSource() failed: %s"),
                      SCErrorString(SCError()));
@@ -531,15 +622,13 @@ load_LinkConfiguration(CFBundleRef bundle, Boolean bundleVerbose)
        }
 
        CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
        }
 
        CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
-
-       CFRelease(patterns);
        return;
 
     error :
 
        return;
 
     error :
 
-       if (baseSettings)       CFRelease(baseSettings);
-       if (store)              CFRelease(store);
-       if (patterns)           CFRelease(patterns);
+       if (baseSettings != NULL)       CFRelease(baseSettings);
+       if (wantSettings != NULL)       CFRelease(wantSettings);
+       if (store != NULL)              CFRelease(store);
        return;
 }
 
        return;
 }
 
diff --git a/Plugins/NetworkIdentification/Info.plist b/Plugins/NetworkIdentification/Info.plist
new file mode 100644 (file)
index 0000000..4a4623e
--- /dev/null
@@ -0,0 +1,26 @@
+<?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">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>NetworkIdentification</string>
+       <key>CFBundleIdentifier</key>
+       <string>com.apple.SystemConfiguration.NetworkIdentification</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>SystemConfiguration</string>
+       <key>CFBundlePackageType</key>
+       <string>BNDL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.9.0</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>0.0.1d1</string>
+       <key>Builtin</key>
+       <true/>
+</dict>
+</plist>
diff --git a/Plugins/NetworkIdentification/Makefile b/Plugins/NetworkIdentification/Makefile
new file mode 100644 (file)
index 0000000..1220f47
--- /dev/null
@@ -0,0 +1,6 @@
+netsig: NetworkIdentification.c
+       cc -Wall -g -DTEST_NETWORKIDENTIFICATION -o netsig NetworkIdentification.c -framework CoreFoundation -framework SystemConfiguration
+
+clean:
+       rm -f netsig
+
diff --git a/Plugins/NetworkIdentification/NetworkIdentification.c b/Plugins/NetworkIdentification/NetworkIdentification.c
new file mode 100644 (file)
index 0000000..c5444df
--- /dev/null
@@ -0,0 +1,1247 @@
+/*
+ * Copyright (c) 2005-2007 Apple 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@
+ */
+
+/*
+ * NetworkIdentification.c
+ * - maintains a history of networks that the system has connected to by
+ *   watching the Network Services that post data to the SCDynamicStore
+ */
+
+/* 
+ * Modification History
+ *
+ * November 9, 2006    Dieter Siegmund (dieter@apple.com)
+ * - created
+ */
+
+#include <notify.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCValidation.h>
+#include <SystemConfiguration/SCPrivate.h>
+#include <CoreFoundation/CFDictionary.h>
+#include <SystemConfiguration/SCNetworkSignature.h>
+#include <SystemConfiguration/SCNetworkSignaturePrivate.h>
+
+/* debug output on/off */
+static Boolean                 S_NetworkIdentification_debug;
+
+/* should we bother keeping track of networks? */
+static Boolean                 S_NetworkIdentification_disabled;
+
+typedef struct ServiceWatcher_s ServiceWatcher, * ServiceWatcherRef;
+
+/* returns an array of currently available information */
+static CFArrayRef
+ServiceWatcherCopyCurrent(ServiceWatcherRef watcher);
+
+static ServiceWatcherRef
+ServiceWatcherCreate();
+
+static void
+ServiceWatcherFree(ServiceWatcherRef * watcher_p);
+
+/* XXX these should be made tunable */
+#define SIGNATURE_HISTORY_MAX                  150
+#define SERVICE_HISTORY_MAX                    5
+
+/* don't re-write the prefs file unless this time interval has elapsed */
+#define SIGNATURE_UPDATE_INTERVAL_SECS (24 * 3600) /* 24 hours */
+
+struct ServiceWatcher_s {
+    CFRunLoopSourceRef         rls;
+    SCDynamicStoreRef          store;
+    CFMutableArrayRef          signatures;
+    CFArrayRef                 active_signatures;
+    CFStringRef                        primary_ipv4;
+    CFStringRef                        setup_ipv4_key;
+    CFStringRef                        state_ipv4_key;
+};
+
+#define kIdentifier            CFSTR("Identifier")
+#define kService               CFSTR("Service")
+#define kServices              CFSTR("Services")
+#define kSignature             CFSTR("Signature")
+#define kSignatures            CFSTR("Signatures")
+#define kTimestamp             CFSTR("Timestamp")
+#define kServiceID             CFSTR("ServiceID")
+#define kNetworkSignature      CFSTR("NetworkSignature")
+#define kServiceIdentifiers    kStoreKeyServiceIdentifiers
+
+static CFArrayRef
+make_service_entity_pattern_array(CFStringRef * keys, int n_keys)
+{
+    int                i;
+    CFArrayRef list;
+
+    for (i = 0; i < n_keys; i++) {
+       /* re-use the array that was passed in to get the pattern */
+       keys[i] = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, 
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             keys[i]);
+    }
+    list = CFArrayCreate(NULL, (const void * *)keys, n_keys,
+                        &kCFTypeArrayCallBacks);
+    for (i = 0; i < n_keys; i++) {
+       /* then release the allocated patterns */
+       CFRelease(keys[i]);
+    }
+    return (list);
+}
+
+static CFArrayRef
+ServiceWatcherNotificationPatterns(void)
+{
+    CFStringRef        keys[1] = { kSCEntNetIPv4 };
+    
+    return (make_service_entity_pattern_array(keys, 
+                                             sizeof(keys) / sizeof(keys[0])));
+}
+
+static CFArrayRef
+ServiceWatcherPatterns(void)
+{
+    CFStringRef        keys[2] = { kSCEntNetIPv4, kSCEntNetDNS };
+    
+    return (make_service_entity_pattern_array(keys,
+                                             sizeof(keys) / sizeof(keys[0])));
+}
+
+static CFTypeRef
+myCFDictionaryArrayGetValue(CFArrayRef array, CFStringRef key, CFTypeRef value,
+                           int * ret_index)
+{
+    int        count = 0;
+    int                i;
+
+    if (array != NULL) {
+       count = CFArrayGetCount(array);
+    }
+    if (count == 0) {
+       goto done;
+    }
+    for (i = 0; i < count; i++) {
+       CFDictionaryRef         dict;
+       CFTypeRef               this_val;
+
+       dict = CFArrayGetValueAtIndex(array, i);
+       if (isA_CFDictionary(dict) == NULL) {
+           continue;
+       }
+       this_val = CFDictionaryGetValue(dict, key);
+       if (CFEqual(this_val, value)) {
+           if (ret_index != NULL) {
+               *ret_index = i;
+           }
+           return (dict);
+       }
+    }
+ done:
+    if (ret_index != NULL) {
+       *ret_index = -1;
+    }
+    return (NULL);
+}
+
+static CFDictionaryRef
+copy_airport_dict(SCDynamicStoreRef store, CFStringRef if_name)
+{
+    CFDictionaryRef    dict;
+    CFStringRef                key;
+
+    key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, 
+                                                       kSCDynamicStoreDomainState,
+                                                       if_name,
+                                                       kSCEntNetAirPort);
+    dict = SCDynamicStoreCopyValue(store, key);
+    CFRelease(key);
+    return (dict);
+}
+
+static void
+add_airport_info(SCDynamicStoreRef store, CFMutableDictionaryRef dict)
+{
+    CFDictionaryRef    airport_dict = NULL;
+    CFStringRef                key;
+    CFStringRef                if_name;
+    CFDictionaryRef    simple_dict;
+    CFStringRef                value;
+
+    if_name = CFDictionaryGetValue(dict, kSCPropInterfaceName);
+    if (isA_CFString(if_name) == NULL) {
+       goto done;
+    }
+    airport_dict = copy_airport_dict(store, if_name);
+    if (airport_dict == NULL) {
+       goto done;
+    }
+    key = CFSTR("SSID");
+    value = CFDictionaryGetValue(airport_dict, key);
+    if (value == NULL) {
+       goto done;
+    }
+    simple_dict =
+       CFDictionaryCreate(NULL, 
+                          (const void * *)&key, (const void * *)&value, 1, 
+                          &kCFTypeDictionaryKeyCallBacks,
+                          &kCFTypeDictionaryValueCallBacks);
+    CFDictionarySetValue(dict, kSCEntNetAirPort, simple_dict);
+    CFRelease(simple_dict);
+
+ done:
+    if (airport_dict != NULL) {
+       CFRelease(airport_dict);
+    }
+    return;
+}
+
+static CFDictionaryRef
+get_current_dict(CFDictionaryRef current, CFStringRef entity,
+                CFArrayRef components)
+{
+    CFDictionaryRef    dict;
+    CFStringRef                key;
+
+    if (CFArrayGetCount(components) < 5) {
+       /* this can't happen, we already checked */
+       return (NULL);
+    }
+    key = CFStringCreateWithFormat(NULL, NULL,
+                                  CFSTR("%@/%@/%@/%@/%@"),
+                                  CFArrayGetValueAtIndex(components, 0),
+                                  CFArrayGetValueAtIndex(components, 1),
+                                  CFArrayGetValueAtIndex(components, 2),
+                                  CFArrayGetValueAtIndex(components, 3),
+                                  entity);
+    dict = CFDictionaryGetValue(current, key);
+    CFRelease(key);
+    return (isA_CFDictionary(dict));
+}
+
+static CFArrayRef
+process_dict(SCDynamicStoreRef store, CFDictionaryRef current)
+{
+    CFMutableArrayRef          array = NULL;
+    int                                count = 0;
+    int                                i;
+    const void * *             keys = NULL;
+    const void * *             values = NULL;
+
+    count = CFDictionaryGetCount(current);
+    if (count == 0) {
+       goto done;
+    }
+    array = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    keys = (const void * *)malloc(sizeof(keys) * count);
+    values = (const void * *)malloc(sizeof(values) * count);
+    CFDictionaryGetKeysAndValues(current, keys, values);
+    for (i = 0; i < count; i++) {
+       CFArrayRef              components = NULL;
+       CFDictionaryRef         dns_dict;
+       CFStringRef             entity;
+       CFMutableDictionaryRef  entity_dict = NULL;
+       CFMutableDictionaryRef  new_dict = NULL;
+       CFStringRef             sig_str = NULL;
+       CFMutableDictionaryRef  service_dict = NULL;
+       CFStringRef             serviceID;
+       
+       if (isA_CFDictionary(values[i]) == NULL) {
+           goto loop_done;
+       }
+       components = CFStringCreateArrayBySeparatingStrings(NULL, keys[i],
+                                                           CFSTR("/"));
+       if (components == NULL) {
+           goto loop_done;
+       }
+       if (CFArrayGetCount(components) < 5) {
+           /* too few components */
+           goto loop_done;
+       }
+       entity = CFArrayGetValueAtIndex(components, 4);
+       if (!CFEqual(entity, kSCEntNetIPv4)) {
+           goto loop_done;
+       }
+       serviceID = CFArrayGetValueAtIndex(components, 3);
+       sig_str = CFDictionaryGetValue(values[i], kNetworkSignature);
+       if (isA_CFString(sig_str) == NULL
+           || CFStringGetLength(sig_str) == 0) {
+           goto loop_done;
+       }
+       /* create a new entry */
+       new_dict = CFDictionaryCreateMutable(NULL, 0, 
+                                            &kCFTypeDictionaryKeyCallBacks,
+                                            &kCFTypeDictionaryValueCallBacks);
+       CFDictionarySetValue(new_dict, kSignature, sig_str);
+       service_dict = CFDictionaryCreateMutable(NULL, 0, 
+                                                &kCFTypeDictionaryKeyCallBacks,
+                                                &kCFTypeDictionaryValueCallBacks);
+       CFDictionarySetValue(service_dict, kServiceID, serviceID);
+       add_airport_info(store, service_dict);
+       entity_dict = CFDictionaryCreateMutableCopy(NULL, 0, values[i]);
+       CFDictionaryRemoveValue(entity_dict, kNetworkSignature);
+       CFDictionarySetValue(service_dict, kSCEntNetIPv4, entity_dict);
+       dns_dict = get_current_dict(current, kSCEntNetDNS, components);
+       if (dns_dict != NULL) {
+           CFDictionarySetValue(service_dict, kSCEntNetDNS, dns_dict);
+       }
+       CFDictionarySetValue(new_dict, kService, service_dict);
+       CFArrayAppendValue(array, new_dict);
+
+    loop_done:
+       if (entity_dict != NULL) {
+           CFRelease(entity_dict);
+       }
+       if (service_dict != NULL) {
+           CFRelease(service_dict);
+       }
+       if (components != NULL) {
+           CFRelease(components);
+       }
+       if (new_dict != NULL) {
+           CFRelease(new_dict);
+       }
+    }
+    count = CFArrayGetCount(array);
+    if (count == 0) {
+       CFRelease(array);
+       array = NULL;
+       goto done;
+    }
+
+ done:
+    if (keys != NULL) {
+       free(keys);
+    }
+    if (values != NULL) {
+       free(values);
+    }
+    return (array);
+
+}
+
+static CFArrayRef
+ServiceWatcherCopyCurrent(ServiceWatcherRef watcher)
+{
+    CFDictionaryRef    current;
+    CFArrayRef         list;
+    CFArrayRef         ret = NULL;
+    
+    list = ServiceWatcherPatterns();
+    current = SCDynamicStoreCopyMultiple(watcher->store, NULL, list);
+    CFRelease(list);
+    if (current == NULL) {
+       goto done;
+    }
+    ret = process_dict(watcher->store, current);
+ done:
+    if (current != NULL) {
+       CFRelease(current);
+    }
+    return (ret);
+}
+
+static Boolean
+ServiceWatcherSetActiveSignatures(ServiceWatcherRef watcher, CFArrayRef active)
+{
+    Boolean    changed = FALSE;
+    CFArrayRef prev_active;
+
+    prev_active = watcher->active_signatures;
+    if (prev_active == NULL && active == NULL) {
+       /* nothing to do */
+       goto done;
+    }
+    if (prev_active != NULL && active != NULL) {
+       changed = !CFEqual(prev_active, active);
+    }
+    else {
+       changed = TRUE;
+    }
+    if (active != NULL) {
+       CFRetain(active);
+    }
+    if (prev_active != NULL) {
+       CFRelease(prev_active);
+    }
+    watcher->active_signatures = active;
+    if (changed) {
+       if (active != NULL) {
+           SCLog(S_NetworkIdentification_debug,
+                 LOG_NOTICE, CFSTR("Active Signatures %@"), active);
+       }
+       else {
+           SCLog(S_NetworkIdentification_debug,
+                 LOG_NOTICE, CFSTR("No Active Signatures"));
+       }
+    }
+ done:
+    return (changed);
+}
+
+static Boolean
+ServiceWatcherSetPrimaryIPv4(ServiceWatcherRef watcher,
+                            CFStringRef primary_ipv4)
+{
+    Boolean            changed = FALSE;
+    CFStringRef                prev_ipv4_primary;
+
+    prev_ipv4_primary = watcher->primary_ipv4;
+    if (prev_ipv4_primary == NULL && primary_ipv4 == NULL) {
+       /* nothing to do */
+       goto done;
+    }
+    if (prev_ipv4_primary != NULL && primary_ipv4 != NULL) {
+       changed = !CFEqual(prev_ipv4_primary, primary_ipv4);
+    }
+    else {
+       changed = TRUE;
+    }
+    if (primary_ipv4 != NULL) {
+       CFRetain(primary_ipv4);
+    }
+    if (prev_ipv4_primary != NULL) {
+       CFRelease(prev_ipv4_primary);
+    }
+    watcher->primary_ipv4 = primary_ipv4;
+    if (changed) {
+       if (primary_ipv4 != NULL) {
+           SCLog(S_NetworkIdentification_debug,
+                 LOG_NOTICE, CFSTR("Primary IPv4 %@"), primary_ipv4);
+       }
+       else {
+           SCLog(S_NetworkIdentification_debug, LOG_NOTICE,
+                 CFSTR("No Primary IPv4"));
+       }
+    }
+ done:
+    return (changed);
+}
+
+
+static CFDictionaryRef
+signature_add_service(CFDictionaryRef sig_dict, CFDictionaryRef service,
+                     CFArrayRef active_services)
+{
+    CFArrayRef                 list;
+    CFMutableDictionaryRef     new_dict = NULL;
+    CFDateRef                  now;
+
+    list = CFDictionaryGetValue(sig_dict, kServices);
+    now = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
+    if (list == NULL) {
+       list = CFArrayCreate(NULL, (const void * *)&service, 1,
+                            &kCFTypeArrayCallBacks);
+    }
+    else {
+       int                     list_count = CFArrayGetCount(list);
+       CFMutableArrayRef       new_list = NULL;
+       CFRange                 range = CFRangeMake(0, list_count);
+       int                     where;
+
+       where = CFArrayGetFirstIndexOfValue(list, range, service);
+       if (where != kCFNotFound) {
+           CFDateRef           date;
+
+           date = CFDictionaryGetValue(sig_dict, kTimestamp);
+           if (date != NULL) {
+               CFTimeInterval  time_interval;
+               
+               time_interval = CFDateGetTimeIntervalSinceDate(now, date);
+               /* don't bother updating timestamp until interval has passed */
+               if (time_interval < (SIGNATURE_UPDATE_INTERVAL_SECS)) {
+                   goto done;
+               }
+           }
+           if (where == 0) {
+               /* it's already in the right place */
+               list = NULL;
+           }
+       }
+
+       if (list != NULL) {
+           new_list = CFArrayCreateMutableCopy(NULL, 0, list);
+           if (where != kCFNotFound) {
+               CFArrayRemoveValueAtIndex(new_list, where);
+           }
+           else {
+               list_count++;
+           }
+           CFArrayInsertValueAtIndex(new_list, 0, service);
+           /* try to remove stale entries */
+           if (list_count > SERVICE_HISTORY_MAX) {
+               int i;
+               int remove_count = list_count - SERVICE_HISTORY_MAX;
+
+               SCLog(S_NetworkIdentification_debug,
+                     LOG_NOTICE, CFSTR("Attempting to remove %d services"),
+                     remove_count);
+               for (i = list_count - 1; i >= 0 && remove_count > 0; i--) {
+                   CFDictionaryRef     dict;
+           
+                   dict = CFArrayGetValueAtIndex(new_list, i);
+                   if (myCFDictionaryArrayGetValue(active_services,
+                                                   kService, dict, NULL)
+                       != NULL) {
+                       /* skip anything that's currently active */
+                       SCLog(S_NetworkIdentification_debug,
+                             LOG_NOTICE, CFSTR("Skipping Service %@"),
+                             dict);
+                   }
+                   else {
+                       SCLog(S_NetworkIdentification_debug, LOG_NOTICE,
+                             CFSTR("Removing Service %@"), dict);
+                       CFArrayRemoveValueAtIndex(new_list, i);
+                       remove_count--;
+                   }
+               }
+           }
+           list = (CFArrayRef)new_list;
+           
+       }
+    }
+
+    new_dict = CFDictionaryCreateMutableCopy(NULL, 0, sig_dict);
+    if (list != NULL) {
+       CFDictionarySetValue(new_dict, kServices, list);
+       CFRelease(list);
+    }
+    CFDictionarySetValue(new_dict, kTimestamp, now);
+
+ done:
+    CFRelease(now);
+    return (new_dict);
+}
+
+#define ARBITRARILY_LARGE_NUMBER       (1024 * 1024)
+static CFStringRef
+get_best_serviceID(CFArrayRef serviceID_list, CFArrayRef order)
+{
+    int                        best_rank;
+    CFStringRef                best_serviceID;
+    int                        count;
+    int                        i;
+    CFRange            range;
+
+    count = CFArrayGetCount(serviceID_list);
+    if (count == 1 || order == NULL) {
+       return (CFArrayGetValueAtIndex(serviceID_list, 0));
+    }
+    best_serviceID = NULL;
+    best_rank = ARBITRARILY_LARGE_NUMBER;
+    range = CFRangeMake(0, CFArrayGetCount(order));
+    for (i = 0; i < count; i++) {
+       CFStringRef     serviceID = CFArrayGetValueAtIndex(serviceID_list, i);
+       int             this_rank;
+
+       this_rank = CFArrayGetFirstIndexOfValue(order, range, serviceID);
+       if (this_rank == kCFNotFound) {
+           this_rank = ARBITRARILY_LARGE_NUMBER;
+       }
+       if (best_serviceID == NULL || this_rank < best_rank) {
+           best_serviceID = serviceID;
+           best_rank = this_rank;
+       }
+    }
+    return (best_serviceID);
+}
+
+static CFArrayRef
+copy_service_order(SCDynamicStoreRef session, CFStringRef ipv4_key)
+{
+    CFArrayRef                 order = NULL;
+    CFDictionaryRef            ipv4_dict = NULL;
+
+    if (session == NULL) {
+       return (NULL);
+    }
+    ipv4_dict = SCDynamicStoreCopyValue(session, ipv4_key);
+    if (isA_CFDictionary(ipv4_dict) != NULL) {
+       order = CFDictionaryGetValue(ipv4_dict, kSCPropNetServiceOrder);
+       order = isA_CFArray(order);
+       if (order) {
+           CFRetain(order);
+       }
+    }
+    if (ipv4_dict != NULL) {
+       CFRelease(ipv4_dict);
+    }
+    return (order);
+}
+
+typedef struct service_order_with_range {
+    CFArrayRef service_order;
+    CFRange    range;
+} service_order_with_range_t;
+
+static void
+add_netID_and_serviceID(service_order_with_range_t * order, int count,
+                       CFMutableArrayRef netID_list, CFStringRef netID,
+                       CFMutableArrayRef serviceID_list, CFStringRef serviceID)
+        
+{
+    int                i;
+    int                serviceID_index;
+
+    if (count == 0 || order->service_order == NULL) {
+       goto add_to_end;
+    }
+    serviceID_index = CFArrayGetFirstIndexOfValue(order->service_order,
+                                                 order->range,
+                                                 serviceID);
+    if (serviceID_index == kCFNotFound) {
+       goto add_to_end;
+    }
+    for (i = 0; i < count; i++) {
+       CFStringRef     scan = CFArrayGetValueAtIndex(serviceID_list, i);
+       int             scan_index;
+       
+       scan_index = CFArrayGetFirstIndexOfValue(order->service_order,
+                                                order->range,
+                                                scan);
+       if (scan_index == kCFNotFound
+           || serviceID_index < scan_index) {
+           /* found our insertion point */
+           CFArrayInsertValueAtIndex(netID_list, i, netID);
+           CFArrayInsertValueAtIndex(serviceID_list, i, serviceID);
+           return;
+       }
+    }
+
+ add_to_end:
+    CFArrayAppendValue(netID_list, netID);
+    CFArrayAppendValue(serviceID_list, serviceID);
+    return;
+}
+
+static Boolean
+ServiceWatcherPublishActiveIdentifiers(ServiceWatcherRef watcher)
+{
+    Boolean    updated = FALSE;
+
+    if (watcher->active_signatures == NULL) {
+       CFDictionaryRef dict;
+
+       dict = SCDynamicStoreCopyValue(watcher->store,
+                                      kSCNetworkIdentificationStoreKey);
+       if (dict != NULL) {
+           updated = TRUE;
+           SCLog(S_NetworkIdentification_debug,
+                 LOG_NOTICE, CFSTR("Removing %@"),
+                 kSCNetworkIdentificationStoreKey);
+           SCDynamicStoreRemoveValue(watcher->store,
+                                     kSCNetworkIdentificationStoreKey);
+           CFRelease(dict);
+       }
+    }
+    else {
+       int                     count;
+       CFDictionaryRef         dict;
+       int                     i;
+       CFMutableArrayRef       id_list;
+       CFStringRef             keys[3];
+       int                     keys_count;
+       service_order_with_range_t order;
+       CFStringRef             primary_ipv4_id = NULL;
+       CFMutableArrayRef       serviceID_list;
+       CFDictionaryRef         store_dict;
+       CFTypeRef               values[3];
+
+       order.service_order = copy_service_order(watcher->store,
+                                                watcher->setup_ipv4_key);
+       if (order.service_order != NULL) {
+           order.range = CFRangeMake(0, CFArrayGetCount(order.service_order));
+       }
+       id_list = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       serviceID_list = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       count = CFArrayGetCount(watcher->active_signatures);
+       for (i = 0; i < count; i++) {
+           CFStringRef                 this_id;
+           CFStringRef                 serviceID;
+           CFArrayRef                  this_list;
+
+           dict = CFArrayGetValueAtIndex(watcher->active_signatures, i);
+           this_id = CFDictionaryGetValue(dict, kIdentifier);
+           this_list = CFDictionaryGetValue(dict, kServiceIdentifiers);
+           if (primary_ipv4_id == NULL && watcher->primary_ipv4 != NULL) {
+               CFRange                 range;
+
+               range = CFRangeMake(0, CFArrayGetCount(this_list));
+               if (CFArrayContainsValue(this_list, range, 
+                                        watcher->primary_ipv4)) {
+                   primary_ipv4_id = this_id;
+               }
+           }
+           serviceID = get_best_serviceID(this_list, order.service_order);
+           add_netID_and_serviceID(&order, i, id_list, this_id,
+                                   serviceID_list, serviceID);
+       }
+       keys[0] = kStoreKeyActiveIdentifiers;
+       values[0] = id_list;
+       keys[1] = kStoreKeyServiceIdentifiers;
+       values[1] = serviceID_list;
+       if (primary_ipv4_id != NULL) {
+           keys_count = 3;
+           keys[2] = kStoreKeyPrimaryIPv4Identifier;
+           values[2] = primary_ipv4_id;
+       }
+       else {
+           keys_count = 2;
+       }
+       dict = CFDictionaryCreate(NULL, (const void * *)keys,
+                                 (const void * *)values, keys_count,
+                                 &kCFTypeDictionaryKeyCallBacks,
+                                 &kCFTypeDictionaryValueCallBacks);
+       store_dict
+           = SCDynamicStoreCopyValue(watcher->store,
+                                     kSCNetworkIdentificationStoreKey);
+       if (isA_CFDictionary(store_dict) == NULL
+           || CFEqual(store_dict, dict) == FALSE) {
+           updated = TRUE;
+           SCDynamicStoreSetValue(watcher->store,
+                                  kSCNetworkIdentificationStoreKey, dict);
+           SCLog(S_NetworkIdentification_debug,
+                 LOG_NOTICE, CFSTR("Setting %@ = %@"),
+                 kSCNetworkIdentificationStoreKey,
+                 dict);
+       }
+       else {
+           SCLog(S_NetworkIdentification_debug,
+                 LOG_NOTICE, CFSTR("Not setting %@"),
+                 kSCNetworkIdentificationStoreKey);
+       }
+       CFRelease(dict);
+       CFRelease(id_list);
+       CFRelease(serviceID_list);
+       if (order.service_order != NULL) {
+           CFRelease(order.service_order);
+       }
+       if (store_dict != NULL) {
+           CFRelease(store_dict);
+       }
+    }
+    return (updated);
+}
+
+static CFDictionaryRef
+signature_dict_create(CFStringRef this_sig, CFDictionaryRef service)
+{
+    CFDictionaryRef            dict;
+    const void *               keys[4];
+    const void *               values[4];
+
+    keys[0] = kSignature;
+    values[0] = this_sig;
+
+    keys[1] = kServices;
+    values[1] = CFArrayCreate(NULL, (const void * *)&service, 1,
+                             &kCFTypeArrayCallBacks);
+    keys[2] = kIdentifier;
+    values[2] = this_sig;
+
+    keys[3] = kTimestamp;
+    values[3] = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
+
+    dict = CFDictionaryCreate(NULL, keys, values,
+                             sizeof(keys) / sizeof(keys[0]),
+                             &kCFTypeDictionaryKeyCallBacks,
+                             &kCFTypeDictionaryValueCallBacks);
+    CFRelease(values[1]);
+    CFRelease(values[3]);
+    return (dict);
+}
+
+static void
+ServiceWatcherRemoveStaleSignatures(ServiceWatcherRef watcher)
+{
+    int                        active_count = 0;
+    int                        count;
+    int                        i;
+    int                        remove_count;
+
+    count = CFArrayGetCount(watcher->signatures);
+    if (watcher->active_signatures != NULL) {
+       active_count = CFArrayGetCount(watcher->active_signatures);
+    }
+    if ((count - active_count) <= SIGNATURE_HISTORY_MAX) {
+       return;
+    }
+    remove_count = count - active_count - SIGNATURE_HISTORY_MAX;
+    for (i = count - 1; i >= 0 && remove_count > 0; i--) {
+       CFDictionaryRef         sig_dict;
+       CFStringRef             sig_str;
+       
+       sig_dict = CFArrayGetValueAtIndex(watcher->signatures, i);
+       sig_str = CFDictionaryGetValue(sig_dict, kSignature);
+       
+       if (myCFDictionaryArrayGetValue(watcher->active_signatures, 
+                                       kSignature, sig_str, NULL)
+           != NULL) {
+           /* skip anything that's currently active */
+           SCLog(S_NetworkIdentification_debug,
+                 LOG_NOTICE, CFSTR("Skipping %@"), sig_dict);
+       }
+       else {
+           SCLog(S_NetworkIdentification_debug,
+                 LOG_NOTICE, CFSTR("ServiceWatcher: Removing %@"),
+                 sig_dict);
+           CFArrayRemoveValueAtIndex(watcher->signatures, i);
+           remove_count--;
+       }
+    }
+    return;
+}
+
+static void
+ServiceWatcherSaveSignatures(ServiceWatcherRef watcher)
+{
+    SCPreferencesRef   prefs;
+
+    prefs = SCPreferencesCreate(NULL, CFSTR("ServiceWatcher"),
+                               kSCNetworkIdentificationPrefsKey);
+    if (prefs == NULL) {
+       SCLog(TRUE, LOG_NOTICE, CFSTR("ServiceWatcherSaveSignatures: Create failed %s"),
+             SCErrorString(SCError()));
+       return;
+    }
+    ServiceWatcherRemoveStaleSignatures(watcher);
+    if (SCPreferencesSetValue(prefs, kSignatures, watcher->signatures)
+       == FALSE) {
+       SCLog(TRUE, LOG_NOTICE, CFSTR("ServiceWatcherSaveSignatures: Set failed %s"),
+             SCErrorString(SCError()));
+    }
+    else if (SCPreferencesCommitChanges(prefs) == FALSE) {
+       // An EROFS error is expected during installation.  All other
+       // errors should be reported.
+       if (SCError() != EROFS) {
+           SCLog(TRUE, LOG_NOTICE, CFSTR("ServiceWatcherSaveSignatures: Commit failed %s"),
+                 SCErrorString(SCError()));
+       }
+    }
+    CFRelease(prefs);
+    return;
+
+}
+
+static void
+ServiceWatcherLoadSignatures(ServiceWatcherRef watcher)
+{
+    int                        count;
+    int                        i;
+    SCPreferencesRef   prefs;
+    CFArrayRef         signatures;
+
+    watcher->signatures 
+       = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    prefs = SCPreferencesCreate(NULL, CFSTR("ServiceWatcher"),
+                               kSCNetworkIdentificationPrefsKey);
+    if (prefs == NULL) {
+       SCLog(TRUE, LOG_NOTICE, CFSTR("ServiceWatcherLoadSignatures: Create failed %s"),
+             SCErrorString(SCError()));
+       return;
+    }
+    signatures = SCPreferencesGetValue(prefs, kSignatures);
+    if (signatures == NULL) {
+       goto done;
+    }
+    if (isA_CFArray(signatures) == NULL) {
+       SCLog(TRUE, LOG_NOTICE,
+             CFSTR("ServiceWatcherLoadSignatures: Signatures is not an array"));
+       goto done;
+    }
+    count = CFArrayGetCount(signatures);
+    for (i = 0; i < count; i++) {
+       CFDictionaryRef         dict;
+       CFArrayRef              services;
+       CFStringRef             sig_id;
+       CFStringRef             sig_str;
+       CFDateRef               timestamp;
+
+       dict = CFArrayGetValueAtIndex(signatures, i);
+       if (isA_CFDictionary(dict) == NULL) {
+           continue;
+       }
+       sig_id = CFDictionaryGetValue(dict, kIdentifier);
+       if (isA_CFString(sig_id) == NULL) {
+           continue;
+       }
+       sig_str = CFDictionaryGetValue(dict, kSignature);
+       if (isA_CFString(sig_str) == NULL) {
+           continue;
+       }
+       timestamp = CFDictionaryGetValue(dict, kTimestamp);
+       if (isA_CFDate(timestamp) == NULL) {
+           continue;
+       }
+       services = CFDictionaryGetValue(dict, kServices);
+       if (isA_CFArray(services) == NULL) {
+           continue;
+       }
+       CFArrayAppendValue(watcher->signatures, dict);
+    }
+
+ done:
+    CFRelease(prefs);
+    return;
+
+}
+
+static void
+ServiceWatcherUpdate(ServiceWatcherRef watcher, Boolean update_signatures)
+{
+    CFMutableArrayRef  active_signatures = NULL;
+    int                        count;
+    int                        i;
+    Boolean            save_signatures = FALSE;
+    CFArrayRef         service_list;
+    Boolean            update_store = FALSE;
+
+    service_list = ServiceWatcherCopyCurrent(watcher);
+    SCLog(S_NetworkIdentification_debug,
+         LOG_NOTICE, CFSTR("service_list = %@"), service_list);
+    if (service_list == NULL) {
+       goto done;
+    }
+    active_signatures = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    count = CFArrayGetCount(service_list);
+    for (i = 0; i < count; i++) {
+       CFDictionaryRef         dict;
+       CFDictionaryRef         active_dict;
+       CFArrayRef              id_list;
+       CFMutableDictionaryRef  new_active_dict;
+       CFDictionaryRef         new_sig_dict;
+       CFStringRef             serviceID;
+       CFStringRef             sig_id;
+       CFDictionaryRef         service;
+       CFDictionaryRef         sig_dict;
+       CFStringRef             this_sig;
+       int                     where;
+
+       dict = CFArrayGetValueAtIndex(service_list, i);
+       service = CFDictionaryGetValue(dict, kService);
+       this_sig = CFDictionaryGetValue(dict, kSignature);
+       if (this_sig == NULL) {
+           /* service has no signature */
+           continue;
+       }
+       sig_dict =  myCFDictionaryArrayGetValue(watcher->signatures, kSignature,
+                                               this_sig, &where);
+       if (sig_dict == NULL) {
+           /* add a new signature entry */
+           sig_dict = signature_dict_create(this_sig, service);
+           CFArrayInsertValueAtIndex(watcher->signatures, 0, sig_dict);
+           CFRelease(sig_dict);
+           save_signatures = TRUE;
+           sig_id = CFDictionaryGetValue(sig_dict, kIdentifier);
+           active_dict = NULL;
+       }
+       else {
+           /* update an existing signature entry */
+           
+           sig_id = CFDictionaryGetValue(sig_dict, kIdentifier);
+           new_sig_dict = signature_add_service(sig_dict, service,
+                                                service_list);
+           if (new_sig_dict != NULL) {
+               CFArrayRemoveValueAtIndex(watcher->signatures, where);
+               CFArrayInsertValueAtIndex(watcher->signatures, 0,
+                                         new_sig_dict);
+               CFRelease(new_sig_dict);
+               sig_dict = new_sig_dict;
+               save_signatures = TRUE;
+           }
+           active_dict
+               = myCFDictionaryArrayGetValue(active_signatures, 
+                                             kSignature, this_sig,
+                                             &where);
+       }
+       if (active_dict == NULL) {
+           /* signature now active, this is the first/only service */
+           new_active_dict 
+               = CFDictionaryCreateMutable(NULL, 0,
+                                           &kCFTypeDictionaryKeyCallBacks,
+                                           &kCFTypeDictionaryValueCallBacks);
+           CFDictionarySetValue(new_active_dict, kSignature, this_sig);
+           CFDictionarySetValue(new_active_dict, kIdentifier, sig_id);
+           serviceID = CFDictionaryGetValue(service, kServiceID);
+           id_list = CFArrayCreate(NULL, (const void * *)&serviceID, 1,
+                                   &kCFTypeArrayCallBacks);
+           CFDictionarySetValue(new_active_dict, kServiceIdentifiers,
+                                id_list);
+           CFArrayAppendValue(active_signatures, new_active_dict);
+           CFRelease(new_active_dict);
+           CFRelease(id_list);
+       }
+       else {
+           /* signature already active, add this serviceID */
+           CFRange                     range;
+           
+           id_list = CFDictionaryGetValue(active_dict,
+                                          kServiceIdentifiers);
+           range = CFRangeMake(0, CFArrayGetCount(id_list));
+           serviceID = CFDictionaryGetValue(service, kServiceID);
+           if (CFArrayContainsValue(id_list, range, serviceID) == FALSE) {
+               CFMutableDictionaryRef  new_active_dict;
+               CFMutableArrayRef       new_id_list;
+               
+               new_id_list = CFArrayCreateMutableCopy(NULL, 0, id_list);
+               CFArrayAppendValue(new_id_list, serviceID);
+               new_active_dict 
+                   = CFDictionaryCreateMutableCopy(NULL, 0, active_dict);
+               CFDictionarySetValue(new_active_dict, kServiceIdentifiers,
+                                    new_id_list);
+               CFArraySetValueAtIndex(active_signatures, where,
+                                      new_active_dict);
+               CFRelease(new_active_dict);
+               CFRelease(new_id_list);
+           }
+       }
+    }
+ done:
+    if (active_signatures == NULL
+       || CFArrayGetCount(active_signatures) == 0) {
+       update_store
+           = ServiceWatcherSetActiveSignatures(watcher, NULL);
+    }
+    else {
+       update_store
+           = ServiceWatcherSetActiveSignatures(watcher, active_signatures);
+    }
+    if (save_signatures) {
+       /* write out the file */
+       ServiceWatcherSaveSignatures(watcher);
+    }
+
+    if (service_list != NULL) {
+       CFRelease(service_list);
+    }
+    if (active_signatures != NULL) {
+       CFRelease(active_signatures);
+    }
+    if (update_signatures || update_store) {
+       if (ServiceWatcherPublishActiveIdentifiers(watcher)) {
+           notify_post(kSCNetworkSignatureActiveChangedNotifyName);
+       }
+    }
+    return;
+}
+
+static Boolean
+update_primary_ipv4(ServiceWatcherRef watcher)
+{
+    Boolean            changed = FALSE;
+    CFDictionaryRef    global_ipv4;
+    
+    global_ipv4 = SCDynamicStoreCopyValue(watcher->store,
+                                         watcher->state_ipv4_key);
+    if (isA_CFDictionary(global_ipv4) != NULL) {
+       CFStringRef             primary_ipv4;
+
+       primary_ipv4 
+           = CFDictionaryGetValue(global_ipv4,
+                                  kSCDynamicStorePropNetPrimaryService);
+       changed = ServiceWatcherSetPrimaryIPv4(watcher,
+                                              isA_CFString(primary_ipv4));
+    }
+    if (global_ipv4 != NULL) {
+       CFRelease(global_ipv4);
+    }
+    return (changed);
+}
+
+static void
+ServiceWatcherNotifier(SCDynamicStoreRef not_used, CFArrayRef changes,
+                      void * info)
+{
+    int                        count;
+    int                        i;
+    Boolean            order_changed = FALSE;
+    Boolean            global_ipv4_changed = FALSE;
+    Boolean            primary_ipv4_changed = FALSE;
+    ServiceWatcherRef  watcher = (ServiceWatcherRef)info;
+
+    count = CFArrayGetCount(changes);
+    if (count == 0) {
+       return;
+    }
+    for (i = 0; i < count; i++) {
+       CFStringRef     key = CFArrayGetValueAtIndex(changes, i);
+
+       if (CFStringHasPrefix(key, kSCDynamicStoreDomainSetup)) {
+           order_changed = TRUE;
+       }
+       else if (CFEqual(key, watcher->state_ipv4_key)) {
+           global_ipv4_changed = TRUE;
+       }
+    }
+    if (global_ipv4_changed) {
+       primary_ipv4_changed = update_primary_ipv4(watcher);
+    }
+    if (count == 1
+       && (order_changed || primary_ipv4_changed)) {
+       /* just the service order or the primary service changed */
+       if (ServiceWatcherPublishActiveIdentifiers(watcher)) {
+           notify_post(kSCNetworkSignatureActiveChangedNotifyName);
+       }
+    }
+    else {
+       ServiceWatcherUpdate(watcher, order_changed || primary_ipv4_changed);
+    }
+    return;
+}
+
+static ServiceWatcherRef
+ServiceWatcherCreate()
+{
+    SCDynamicStoreContext      context = { 0, 0, 0, 0, 0};
+    CFArrayRef                 patterns;
+    CFStringRef                        keys[2];
+    CFArrayRef                 key_list;
+    ServiceWatcherRef          watcher;
+
+    watcher = malloc(sizeof(*watcher));
+    bzero(watcher, sizeof(*watcher));
+    context.info = watcher;
+    watcher->store = SCDynamicStoreCreate(NULL, CFSTR("Service Watcher"),
+                                         ServiceWatcherNotifier, &context);
+    if (watcher->store == NULL) {
+       SCLog(TRUE, LOG_NOTICE, CFSTR("SCDynamicStoreCreate failed: %s"),
+             SCErrorString(SCError()));
+       goto failed;
+    }
+    watcher->setup_ipv4_key 
+       = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, 
+                                                    kSCDynamicStoreDomainSetup,
+                                                    kSCEntNetIPv4);
+    watcher->state_ipv4_key 
+       = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, 
+                                                    kSCDynamicStoreDomainState,
+                                                    kSCEntNetIPv4);
+    keys[0] = watcher->setup_ipv4_key;
+    keys[1] = watcher->state_ipv4_key;
+    key_list = CFArrayCreate(NULL, (const void * *)keys, sizeof(keys) / sizeof(keys[0]),
+                            &kCFTypeArrayCallBacks);
+    patterns = ServiceWatcherNotificationPatterns();
+    (void)SCDynamicStoreSetNotificationKeys(watcher->store, key_list, patterns);
+    CFRelease(patterns);
+    CFRelease(key_list);
+    watcher->rls = SCDynamicStoreCreateRunLoopSource(NULL, watcher->store, 0);
+    CFRunLoopAddSource(CFRunLoopGetCurrent(), watcher->rls, 
+                      kCFRunLoopDefaultMode);
+    ServiceWatcherLoadSignatures(watcher);
+    update_primary_ipv4(watcher);
+    return (watcher);
+ failed:
+    ServiceWatcherFree(&watcher);
+    return (NULL);
+}
+
+void
+ServiceWatcherFree(ServiceWatcherRef * watcher_p)
+{
+    ServiceWatcherRef  watcher;
+
+    if (watcher_p == NULL) {
+       return;
+    }
+    watcher = *watcher_p;
+    if (watcher == NULL) {
+       return;
+    }
+    *watcher_p = NULL;
+    if (watcher->store != NULL) {
+       CFRelease(watcher->store);
+       watcher->store = NULL;
+    }
+    if (watcher->rls != NULL) {
+       CFRunLoopSourceInvalidate(watcher->rls);
+       CFRelease(watcher->rls);
+       watcher->rls = NULL;
+    }
+    if (watcher->signatures != NULL) {
+       CFRelease(watcher->signatures);
+       watcher->signatures = NULL;
+    }
+    if (watcher->state_ipv4_key != NULL) {
+       CFRelease(watcher->state_ipv4_key);
+       watcher->state_ipv4_key = NULL;
+    }
+    if (watcher->setup_ipv4_key != NULL) {
+       CFRelease(watcher->setup_ipv4_key);
+       watcher->setup_ipv4_key = NULL;
+    }
+    free(watcher);
+    return;
+}
+
+/* global service watcher instance */
+static ServiceWatcherRef       S_watcher;
+
+__private_extern__
+void
+prime_NetworkIdentification()
+{
+    if (S_NetworkIdentification_disabled) {
+       return;
+    }
+    S_watcher = ServiceWatcherCreate();
+    ServiceWatcherUpdate(S_watcher, TRUE);
+}
+
+__private_extern__
+void
+load_NetworkIdentification(CFBundleRef bundle, Boolean bundleVerbose)
+{
+    if (bundleVerbose) {
+       S_NetworkIdentification_debug = 1;
+    }
+    return;
+}
+
+__private_extern__
+void
+stop_NetworkIdentification(CFRunLoopSourceRef stopRls)
+{
+    if (S_watcher != NULL) {
+       ServiceWatcherSaveSignatures(S_watcher);
+    }
+    CFRunLoopSourceSignal(stopRls);
+}
+
+
+#ifdef  TEST_NETWORKIDENTIFICATION
+#undef  TEST_NETWORKIDENTIFICATION
+
+int
+main(int argc, char **argv)
+{
+    _sc_log     = FALSE;
+    _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+    load_NetworkIdentification(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE);
+    prime_NetworkIdentification();
+    CFRunLoopRun();
+    /* not reached */
+    exit(0);
+    return 0;
+}
+#endif
+
index d9ae6426dc536f927ec70bcff57d74c71526c036..d0b4485d50117de62426b1ce06601a4d3e7a7137 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>0.0.1d1</string>
        <key>Builtin</key>
        <true/>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>0.0.1d1</string>
        <key>Builtin</key>
        <true/>
+       <key>Requires</key>
+       <array>
+               <string>com.apple.SystemConfiguration.InterfaceNamer</string>
+       </array>
 </dict>
 </plist>
 </dict>
 </plist>
index c96145789328e76846c8cd96819cee3af814458b..5466f22386ec008bd9356a2bc7304b165ad325d4 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 
 
 
 
 
+/* globals */
 static SCPreferencesRef                prefs           = NULL;
 static SCDynamicStoreRef       store           = NULL;
 
 static SCPreferencesRef                prefs           = NULL;
 static SCDynamicStoreRef       store           = NULL;
 
+/* preferences "initialization" globals */
+static CFStringRef             initKey         = NULL;
+static CFRunLoopSourceRef      initRls         = NULL;
+
+/* SCDynamicStore (Setup:) */
 static CFMutableDictionaryRef  currentPrefs;           /* current prefs */
 static CFMutableDictionaryRef  newPrefs;               /* new prefs */
 static CFMutableArrayRef       unchangedPrefsKeys;     /* new prefs keys which match current */
 static CFMutableDictionaryRef  currentPrefs;           /* current prefs */
 static CFMutableDictionaryRef  newPrefs;               /* new prefs */
 static CFMutableArrayRef       unchangedPrefsKeys;     /* new prefs keys which match current */
@@ -59,6 +65,176 @@ static CFMutableArrayRef    removedPrefsKeys;       /* old prefs keys to be removed */
 static Boolean                 _verbose        = FALSE;
 
 
 static Boolean                 _verbose        = FALSE;
 
 
+static void
+establishNewPreferences()
+{
+       CFBundleRef     bundle;
+       Boolean         ok              = FALSE;
+       int             sc_status       = kSCStatusFailed;
+       SCNetworkSetRef set             = NULL;
+       CFStringRef     setName         = NULL;
+
+       while (TRUE) {
+               ok = SCPreferencesLock(prefs, TRUE);
+               if (ok) {
+                       break;
+               }
+
+               sc_status = SCError();
+               if (sc_status == kSCStatusStale) {
+                       (void) SCPreferencesSynchronize(prefs);
+               } else {
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("Could not acquire network configuration lock: %s"),
+                             SCErrorString(sc_status));
+                       return;
+               }
+       }
+
+       set = SCNetworkSetCreate(prefs);
+       if (set == NULL) {
+               ok = FALSE;
+               sc_status = SCError();
+               goto done;
+       }
+
+       bundle = _SC_CFBundleGet();
+       if (bundle != NULL) {
+               setName = CFBundleCopyLocalizedString(bundle,
+                                                     CFSTR("DEFAULT_SET_NAME"),
+                                                     CFSTR("Automatic"),
+                                                     NULL);
+       }
+
+       ok = SCNetworkSetSetName(set, (setName != NULL) ? setName : CFSTR("Automatic"));
+       if (!ok) {
+               sc_status = SCError();
+               goto done;
+       }
+
+       ok = SCNetworkSetSetCurrent(set);
+       if (!ok) {
+               sc_status = SCError();
+               goto done;
+       }
+
+       ok = SCNetworkSetEstablishDefaultConfiguration(set);
+       if (!ok) {
+               sc_status = SCError();
+               goto done;
+       }
+
+    done :
+
+       if (ok) {
+               ok = SCPreferencesCommitChanges(prefs);
+               if (ok) {
+                       SCLog(TRUE, LOG_NOTICE, CFSTR("New network configuration saved"));
+               } else {
+                       sc_status = SCError();
+                       if (sc_status == EROFS) {
+                               /* a read-only fileysstem is OK */
+                               ok = TRUE;
+                       }
+               }
+
+               /* apply (committed or temporary/read-only) changes */
+               (void) SCPreferencesApplyChanges(prefs);
+       } else if (set != NULL) {
+               (void) SCNetworkSetRemove(set);
+       }
+
+       if (!ok) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("Could not establish network configuration: %s"),
+                     SCErrorString(sc_status));
+       }
+
+       (void)SCPreferencesUnlock(prefs);
+       if (setName != NULL) CFRelease(setName);
+       if (set != NULL) CFRelease(set);
+       return;
+}
+
+
+static Boolean
+quiet()
+{
+       CFDictionaryRef dict;
+       Boolean         quiet   = FALSE;
+
+       // check if quiet
+       dict = SCDynamicStoreCopyValue(store, initKey);
+       if (dict != NULL) {
+               if (isA_CFDictionary(dict) &&
+                   (CFDictionaryContainsKey(dict, CFSTR("*QUIET*")) ||
+                    CFDictionaryContainsKey(dict, CFSTR("*TIMEOUT*")))) {
+                       quiet = TRUE;
+               }
+               CFRelease(dict);
+       }
+
+       return quiet;
+}
+
+
+static void
+watchQuietDisable()
+{
+       if ((initKey == NULL) && (initRls == NULL)) {
+               return;
+       }
+
+       (void) SCDynamicStoreSetNotificationKeys(store, NULL, NULL);
+
+       CFRunLoopSourceInvalidate(initRls);
+       CFRelease(initRls);
+       initRls = NULL;
+
+       CFRelease(initKey);
+       initKey = NULL;
+
+       return;
+}
+
+
+static void
+watchQuietEnable()
+{
+       CFArrayRef      keys;
+       Boolean         ok;
+
+       initKey = SCDynamicStoreKeyCreate(NULL,
+                                         CFSTR("%@" "InterfaceNamer"),
+                                         kSCDynamicStoreDomainPlugin);
+
+       initRls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), initRls, kCFRunLoopDefaultMode);
+
+       keys = CFArrayCreate(NULL, (const void **)&initKey, 1, &kCFTypeArrayCallBacks);
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
+       CFRelease(keys);
+       if (!ok) {
+               SCPrint(TRUE, stderr,
+                       CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s\n"), SCErrorString(SCError()));
+               watchQuietDisable();
+       }
+
+       return;
+}
+
+static void
+watchQuietCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
+{
+       if (quiet()) {
+               watchQuietDisable();
+               establishNewPreferences();
+       }
+
+       return;
+}
+
+
 static void
 updateCache(const void *key, const void *value, void *context)
 {
 static void
 updateCache(const void *key, const void *value, void *context)
 {
@@ -185,9 +361,7 @@ flatten(SCPreferencesRef    prefs,
 
 
 static void
 
 
 static void
-updateConfiguration(SCPreferencesRef           prefs,
-                   SCPreferencesNotification   notificationType,
-                   void                        *info)
+updateSCDynamicStore(SCPreferencesRef prefs)
 {
        CFStringRef             current         = NULL;
        CFDateRef               date            = NULL;
 {
        CFStringRef             current         = NULL;
        CFDateRef               date            = NULL;
@@ -200,13 +374,6 @@ updateConfiguration(SCPreferencesRef               prefs,
        CFMutableArrayRef       patterns;
        CFDictionaryRef         set             = NULL;
 
        CFMutableArrayRef       patterns;
        CFDictionaryRef         set             = NULL;
 
-
-       if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) {
-               return;
-       }
-
-       SCLog(_verbose, LOG_DEBUG, CFSTR("updating configuration"));
-
        /*
         * initialize old preferences, new preferences, an array
         * of keys which have not changed, and an array of keys
        /*
         * initialize old preferences, new preferences, an array
         * of keys which have not changed, and an array of keys
@@ -369,9 +536,6 @@ updateConfiguration(SCPreferencesRef                prefs,
                      SCErrorString(SCError()));
        }
 
                      SCErrorString(SCError()));
        }
 
-       /* finished with current prefs, wait for changes */
-       SCPreferencesSynchronize(prefs);
-
        CFRelease(currentPrefs);
        CFRelease(newPrefs);
        CFRelease(unchangedPrefsKeys);
        CFRelease(currentPrefs);
        CFRelease(newPrefs);
        CFRelease(unchangedPrefsKeys);
@@ -383,12 +547,48 @@ updateConfiguration(SCPreferencesRef              prefs,
 }
 
 
 }
 
 
+static void
+updateConfiguration(SCPreferencesRef           prefs,
+                   SCPreferencesNotification   notificationType,
+                   void                        *info)
+{
+
+
+       if ((notificationType & kSCPreferencesNotificationCommit) == kSCPreferencesNotificationCommit) {
+               SCNetworkSetRef current;
+
+               current = SCNetworkSetCopyCurrent(prefs);
+               if (current != NULL) {
+                       /* network configuration available, disable template creation */
+                       watchQuietDisable();
+                       CFRelease(current);
+               }
+       }
+
+       if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) {
+               return;
+       }
+
+       SCLog(_verbose, LOG_DEBUG, CFSTR("updating configuration"));
+
+       /* update SCDynamicStore (Setup:) */
+       updateSCDynamicStore(prefs);
+
+       /* finished with current prefs, wait for changes */
+       SCPreferencesSynchronize(prefs);
+
+       return;
+}
+
+
 __private_extern__
 void
 stop_PreferencesMonitor(CFRunLoopSourceRef stopRls)
 {
        // cleanup
 
 __private_extern__
 void
 stop_PreferencesMonitor(CFRunLoopSourceRef stopRls)
 {
        // cleanup
 
+       watchQuietDisable();
+
        if (prefs != NULL) {
                if (!SCPreferencesUnscheduleFromRunLoop(prefs,
                                                        CFRunLoopGetCurrent(),
        if (prefs != NULL) {
                if (!SCPreferencesUnscheduleFromRunLoop(prefs,
                                                        CFRunLoopGetCurrent(),
@@ -428,6 +628,8 @@ __private_extern__
 void
 load_PreferencesMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 {
 void
 load_PreferencesMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 {
+       Boolean initPrefs       = TRUE;
+
        if (bundleVerbose) {
                _verbose = TRUE;
        }
        if (bundleVerbose) {
                _verbose = TRUE;
        }
@@ -436,7 +638,10 @@ load_PreferencesMonitor(CFBundleRef bundle, Boolean bundleVerbose)
        SCLog(_verbose, LOG_DEBUG, CFSTR("  bundle ID = %@"), CFBundleGetIdentifier(bundle));
 
        /* open a SCDynamicStore session to allow cache updates */
        SCLog(_verbose, LOG_DEBUG, CFSTR("  bundle ID = %@"), CFBundleGetIdentifier(bundle));
 
        /* open a SCDynamicStore session to allow cache updates */
-       store = SCDynamicStoreCreate(NULL, CFSTR("PreferencesMonitor.bundle"), NULL, NULL);
+       store = SCDynamicStoreCreate(NULL,
+                                    CFSTR("PreferencesMonitor.bundle"),
+                                    watchQuietCallback,
+                                    NULL);
        if (store == NULL) {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCDynamicStoreCreate() failed: %s"),
        if (store == NULL) {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCDynamicStoreCreate() failed: %s"),
@@ -446,13 +651,25 @@ load_PreferencesMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 
        /* open a SCPreferences session */
        prefs = SCPreferencesCreate(NULL, CFSTR("PreferencesMonitor.bundle"), NULL);
 
        /* open a SCPreferences session */
        prefs = SCPreferencesCreate(NULL, CFSTR("PreferencesMonitor.bundle"), NULL);
-       if (prefs == NULL) {
+       if (prefs != NULL) {
+               SCNetworkSetRef current;
+
+               current = SCNetworkSetCopyCurrent(prefs);
+               if (current != NULL) {
+                       /* network configuration available, disable template creation */
+                       initPrefs = FALSE;
+                       CFRelease(current);
+               }
+       } else {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCPreferencesCreate() failed: %s"),
                      SCErrorString(SCError()));
                goto error;
        }
 
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCPreferencesCreate() failed: %s"),
                      SCErrorString(SCError()));
                goto error;
        }
 
+       /*
+        * register for change notifications.
+        */
        if (!SCPreferencesSetCallback(prefs, updateConfiguration, NULL)) {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCPreferencesSetCallBack() failed: %s"),
        if (!SCPreferencesSetCallback(prefs, updateConfiguration, NULL)) {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCPreferencesSetCallBack() failed: %s"),
@@ -460,9 +677,6 @@ load_PreferencesMonitor(CFBundleRef bundle, Boolean bundleVerbose)
                goto error;
        }
 
                goto error;
        }
 
-       /*
-        * register for change notifications.
-        */
        if (!SCPreferencesScheduleWithRunLoop(prefs, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCPreferencesScheduleWithRunLoop() failed: %s"),
        if (!SCPreferencesScheduleWithRunLoop(prefs, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
                SCLog(TRUE, LOG_ERR,
                      CFSTR("SCPreferencesScheduleWithRunLoop() failed: %s"),
@@ -470,12 +684,22 @@ load_PreferencesMonitor(CFBundleRef bundle, Boolean bundleVerbose)
                goto error;
        }
 
                goto error;
        }
 
+       /*
+        * if no preferences, initialize with a template (now or
+        * when IOKit has quiesced).
+        */
+       if (initPrefs) {
+               watchQuietEnable();
+               watchQuietCallback(store, NULL, NULL);
+       }
+
        return;
 
     error :
 
        return;
 
     error :
 
-       if (store)      CFRelease(store);
-       if (prefs)      CFRelease(prefs);
+       watchQuietDisable();
+       if (store != NULL)      CFRelease(store);
+       if (prefs != NULL)      CFRelease(prefs);
 
        return;
 }
 
        return;
 }
index 04415d680ab207b7da2e9025ac00b7a7942b0cc7..fbc326f4c96db81c631f0c2e0c9ab750b5eedbdc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -44,7 +44,7 @@ static        CFMutableArrayRef       cached_notifys  = NULL;
 
 __private_extern__
 void
 
 __private_extern__
 void
-cache_open()
+cache_open(void)
 {
        cached_keys     = CFDictionaryCreateMutable(NULL,
                                                    0,
 {
        cached_keys     = CFDictionaryCreateMutable(NULL,
                                                    0,
@@ -172,7 +172,7 @@ cache_write(SCDynamicStoreRef store)
 
 __private_extern__
 void
 
 __private_extern__
 void
-cache_close()
+cache_close(void)
 {
        CFRelease(cached_keys);
        CFRelease(cached_set);
 {
        CFRelease(cached_keys);
        CFRelease(cached_set);
index c2847f4896f1612848a6f7572918e39584cca52a..f8efe16a06309d2c8efc123e73950a4d3f067f3d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -39,7 +39,7 @@
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
-void                   cache_open                      ();
+void                   cache_open                      (void);
 
 CFPropertyListRef      cache_SCDynamicStoreCopyValue   (SCDynamicStoreRef      store,
                                                         CFStringRef            key);
 
 CFPropertyListRef      cache_SCDynamicStoreCopyValue   (SCDynamicStoreRef      store,
                                                         CFStringRef            key);
@@ -56,7 +56,7 @@ void                  cache_SCDynamicStoreNotifyValue (SCDynamicStoreRef      store,
 
 void                   cache_write                     (SCDynamicStoreRef      store);
 
 
 void                   cache_write                     (SCDynamicStoreRef      store);
 
-void                   cache_close                     ();
+void                   cache_close                     (void);
 
 __END_DECLS
 
 
 __END_DECLS
 
index 5343842f6afcb89d5301de9b937e9bc3e7f26204..bc5ed686b68a2f93cb16888a8136092e29cea6bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -24,6 +24,9 @@
 /*
  * Modification History
  *
 /*
  * Modification History
  *
+ * November 28, 2005           Allan Nathanson <ajn@apple.com>
+ * - public API
+ *
  * July 22, 2004               Allan Nathanson <ajn@apple.com>
  * - initial revision
  */
  * July 22, 2004               Allan Nathanson <ajn@apple.com>
  * - initial revision
  */
 #include <CoreFoundation/CFRuntime.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CFRuntime.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCNetworkConfigurationInternal.h>
+#include "SCNetworkConfigurationInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/BondConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/BondConfiguration.h>
-#include <SystemConfiguration/BondConfigurationPrivate.h>
 
 #include <ifaddrs.h>
 #include <pthread.h>
 
 #include <ifaddrs.h>
 #include <pthread.h>
@@ -67,7 +69,6 @@ inet_dgram_socket()
        s = socket(AF_INET, SOCK_DGRAM, 0);
        if (s == -1) {
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
        s = socket(AF_INET, SOCK_DGRAM, 0);
        if (s == -1) {
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
        }
 
        return s;
        }
 
        return s;
@@ -82,9 +83,7 @@ siocgifmedia(int s, const char * ifname, int * status, int * active)
        *active = 0;
        bzero(&ifmr, sizeof(ifmr));
        strncpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
        *active = 0;
        bzero(&ifmr, sizeof(ifmr));
        strncpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
-       if (ioctl(s, SIOCGIFMEDIA, &ifmr) < 0) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SIOCGIFMEDIA(%s) failed, %s\n"),
-                       ifname, strerror(errno));
+       if (ioctl(s, SIOCGIFMEDIA, &ifmr) == -1) {
                return (-1);
        }
        if (ifmr.ifm_count != 0) {
                return (-1);
        }
        if (ifmr.ifm_count != 0) {
@@ -111,9 +110,7 @@ if_bond_status_req_copy(int s, const char * ifname)
        ifr.ifr_data = (caddr_t)&ibr;
 
        /* how many of them are there? */
        ifr.ifr_data = (caddr_t)&ibr;
 
        /* how many of them are there? */
-       if (ioctl(s, SIOCGIFBOND, (caddr_t)&ifr) < 0) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SIOCGIFBOND(%s) failed: %s"),
-                     ifname, strerror(errno));
+       if (ioctl(s, SIOCGIFBOND, (caddr_t)&ifr) == -1) {
                goto failed;
        }
        buf = malloc(sizeof(struct if_bond_status) * ibsr_p->ibsr_total + sizeof(*ibsr_p));
                goto failed;
        }
        buf = malloc(sizeof(struct if_bond_status) * ibsr_p->ibsr_total + sizeof(*ibsr_p));
@@ -127,9 +124,7 @@ if_bond_status_req_copy(int s, const char * ifname)
        ibsr_p->ibsr_buffer = buf + sizeof(*ibsr_p);
 
        /* get the list */
        ibsr_p->ibsr_buffer = buf + sizeof(*ibsr_p);
 
        /* get the list */
-       if (ioctl(s, SIOCGIFBOND, (caddr_t)&ifr) < 0) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SIOCGIFBOND(%s) failed: %s"),
-                     ifname, strerror(errno));
+       if (ioctl(s, SIOCGIFBOND, (caddr_t)&ifr) == -1) {
                goto failed;
        }
  done:
                goto failed;
        }
  done:
@@ -143,113 +138,1764 @@ if_bond_status_req_copy(int s, const char * ifname)
        return (NULL);
 }
 
        return (NULL);
 }
 
+
+static void
+add_interface(CFMutableArrayRef *interfaces, CFStringRef if_name)
+{
+       SCNetworkInterfaceRef   interface;
+
+       if (*interfaces == NULL) {
+               *interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       }
+
+       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, if_name,
+                                                        kIncludeNoVirtualInterfaces);
+       CFArrayAppendValue(*interfaces, interface);
+       CFRelease(interface);
+}
+
+
 static Boolean
 static Boolean
-_Bond_addDevice(int s, CFStringRef interface, CFStringRef device)
+_SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members);
+
+static Boolean
+_SCBondInterfaceSetMode(SCBondInterfaceRef bond, CFNumberRef mode);
+
+
+typedef struct {
+       CFMutableArrayRef       bonds;
+       SCPreferencesRef        prefs;
+} addContext, *addContextRef;
+
+
+static void
+add_configured_interface(const void *key, const void *value, void *context)
 {
 {
-       struct if_bond_req      breq;
-       struct ifreq            ifr;
+       SCBondInterfaceRef              bond;
+       CFStringRef                     bond_if         = (CFStringRef)key;
+       CFDictionaryRef                 bond_info       = (CFDictionaryRef)value;
+       CFDictionaryRef                 bond_options;
+       CFIndex                         i;
+       CFArrayRef                      interfaces;
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       CFMutableArrayRef               members         = NULL;
+       CFNumberRef                     mode;
+       addContextRef                   myContext       = (addContextRef)context;
+       CFStringRef                     name;
+       CFIndex                         n;
 
 
-       // bond interface
-       bzero(&ifr, sizeof(ifr));
-       (void) _SC_cfstring_to_cstring(interface,
-                                      ifr.ifr_name,
-                                      sizeof(ifr.ifr_name),
-                                      kCFStringEncodingASCII);
-       ifr.ifr_data = (caddr_t)&breq;
+       // create the bond interface
+       bond = (SCBondInterfaceRef)_SCBondInterfaceCreatePrivate(NULL, bond_if);
 
 
-       // new bond member
-       bzero(&breq, sizeof(breq));
-       breq.ibr_op = IF_BOND_OP_ADD_INTERFACE;
-       (void) _SC_cfstring_to_cstring(device,
-                                      breq.ibr_ibru.ibru_if_name,
-                                      sizeof(breq.ibr_ibru.ibru_if_name),
-                                      kCFStringEncodingASCII);
+       // add member interfaces
+       interfaces = CFDictionaryGetValue(bond_info, kSCPropVirtualNetworkInterfacesBondInterfaces);
+       n = isA_CFArray(interfaces) ? CFArrayGetCount(interfaces) : 0;
+       for (i = 0; i < n; i++) {
+               CFStringRef     member;
 
 
-       // add new bond member
-       if (ioctl(s, SIOCSIFBOND, (caddr_t)&ifr) == -1) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("could not add interface \"%@\" to bond \"%@\": %s"),
-                     device,
-                     interface,
-                     strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
-               return FALSE;
+               member = CFArrayGetValueAtIndex(interfaces, i);
+               if (isA_CFString(member)) {
+                       add_interface(&members, member);
+               }
+       }
+       if (members != NULL) {
+               _SCBondInterfaceSetMemberInterfaces(bond, members);
+               CFRelease(members);
        }
 
        }
 
-       // mark the added interface "up"
-       if (!__markInterfaceUp(s, device)) {
-               _SCErrorSet(kSCStatusFailed);
-               return FALSE;
+       // set display name
+       name = CFDictionaryGetValue(bond_info, kSCPropUserDefinedName);
+       if (isA_CFString(name)) {
+               SCBondInterfaceSetLocalizedDisplayName(bond, name);
        }
 
        }
 
-       return TRUE;
+       // set options
+       bond_options = CFDictionaryGetValue(bond_info, kSCPropVirtualNetworkInterfacesBondOptions);
+       if (isA_CFDictionary(bond_options)) {
+               SCBondInterfaceSetOptions(bond, bond_options);
+       }
+
+       // set the mode
+       mode = CFDictionaryGetValue(bond_info, kSCPropVirtualNetworkInterfacesBondMode);
+       _SCBondInterfaceSetMode(bond, isA_CFNumber(mode));
+
+       // estabish link to the stored configuration
+       interfacePrivate = (SCNetworkInterfacePrivateRef)bond;
+       interfacePrivate->prefs = CFRetain(myContext->prefs);
+
+       CFArrayAppendValue(myContext->bonds, bond);
+       CFRelease(bond);
+
+       return;
 }
 
 
 }
 
 
-static Boolean
-_Bond_removeDevice(int s, CFStringRef interface, CFStringRef device)
+static void
+add_legacy_configuration(addContextRef myContext)
 {
 {
-       struct if_bond_req      breq;
-       struct ifreq            ifr;
+       CFArrayRef              bonds;
+       CFIndex                 i;
+       CFIndex                 n_bonds;
+       SCPreferencesRef        prefs;
 
 
-       // bond interface
-       bzero(&ifr, sizeof(ifr));
-       (void) _SC_cfstring_to_cstring(interface,
-                                      ifr.ifr_name,
-                                      sizeof(ifr.ifr_name),
-                                      kCFStringEncodingASCII);
-       ifr.ifr_data = (caddr_t)&breq;
+#define BOND_PREFERENCES_ID            CFSTR("VirtualNetworkInterfaces.plist")
+#define        BOND_PREFERENCES_BONDS          CFSTR("Bonds")
+#define        __kBondInterface_interface      CFSTR("interface")      // e.g. bond0, bond1, ...
+#define        __kBondInterface_devices        CFSTR("devices")        // e.g. en0, en1, ...
+#define __kBondInterface_options       CFSTR("options")        // e.g. UserDefinedName
 
 
-       // bond member to remove
-       bzero(&breq, sizeof(breq));
-       breq.ibr_op = IF_BOND_OP_REMOVE_INTERFACE;
-       (void) _SC_cfstring_to_cstring(device,
-                                      breq.ibr_ibru.ibru_if_name,
-                                      sizeof(breq.ibr_ibru.ibru_if_name),
-                                      kCFStringEncodingASCII);
+       prefs = SCPreferencesCreate(NULL, CFSTR("SCBondInterfaceCopyAll"), BOND_PREFERENCES_ID);
+       if (prefs == NULL) {
+               return;
+       }
+
+       bonds = SCPreferencesGetValue(prefs, BOND_PREFERENCES_BONDS);
+       if ((bonds != NULL) && !isA_CFArray(bonds)) {
+               CFRelease(prefs);       // if the prefs are confused
+               return;
+       }
+
+       n_bonds = (bonds != NULL) ? CFArrayGetCount(bonds) : 0;
+       for (i = 0; i < n_bonds; i++) {
+               SCBondInterfaceRef              bond;
+               CFDictionaryRef                 bond_dict;
+               CFStringRef                     bond_if;
+               CFDictionaryRef                 dict;
+               CFArrayRef                      interfaces;
+               SCNetworkInterfacePrivateRef    interfacePrivate;
+               CFIndex                         j;
+               CFMutableArrayRef               members         = NULL;
+               CFMutableDictionaryRef          newDict;
+               CFArrayRef                      newInterfaces;
+               CFIndex                         n_interfaces;
+               Boolean                         ok;
+               CFDictionaryRef                 options;
+               CFStringRef                     path;
+
+               bond_dict = CFArrayGetValueAtIndex(bonds, i);
+               if (!isA_CFDictionary(bond_dict)) {
+                       continue;       // if the prefs are confused
+               }
+
+               bond_if = CFDictionaryGetValue(bond_dict, __kBondInterface_interface);
+               if (!isA_CFString(bond_if)) {
+                       continue;       // if the prefs are confused
+               }
+
+               // check if this bond has already been allocated
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeBond,
+                                               bond_if);
+               dict = SCPreferencesPathGetValue(myContext->prefs, path);
+               if (dict != NULL) {
+                       // if bond interface name not available
+                       CFRelease(path);
+                       continue;
+               }
+
+               // add a placeholder for the bond in the stored preferences
+               newDict = CFDictionaryCreateMutable(NULL,
+                                                   0,
+                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                   &kCFTypeDictionaryValueCallBacks);
+               newInterfaces = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
+               CFDictionaryAddValue(newDict, kSCPropVirtualNetworkInterfacesBondInterfaces, newInterfaces);
+               CFRelease(newInterfaces);
+               ok = SCPreferencesPathSetValue(myContext->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+               if (!ok) {
+                       // if the bond could not be saved
+                       continue;
+               }
+
+               // create the bond interface
+               bond = (SCBondInterfaceRef)_SCBondInterfaceCreatePrivate(NULL, bond_if);
+
+               // estabish link to the stored configuration
+               interfacePrivate = (SCNetworkInterfacePrivateRef)bond;
+               interfacePrivate->prefs = CFRetain(myContext->prefs);
+
+               // add member interfaces
+               interfaces = CFDictionaryGetValue(bond_dict, __kBondInterface_devices);
+               n_interfaces = isA_CFArray(interfaces) ? CFArrayGetCount(interfaces) : 0;
+               for (j = 0; j < n_interfaces; j++) {
+                       CFStringRef     member;
+
+                       member = CFArrayGetValueAtIndex(interfaces, j);
+                       if (isA_CFString(member)) {
+                               add_interface(&members, member);
+                       }
+               }
+               if (members != NULL) {
+                       _SCBondInterfaceSetMemberInterfaces(bond, members);
+                       CFRelease(members);
+               }
+
+               // set display name
+               options = CFDictionaryGetValue(bond_dict, __kBondInterface_options);
+               if (isA_CFDictionary(options)) {
+                       CFStringRef     name;
+
+                       name = CFDictionaryGetValue(options, kSCPropUserDefinedName);
+                       if (isA_CFString(name)) {
+                               SCBondInterfaceSetLocalizedDisplayName(bond, name);
+                       }
+               }
+
+               CFArrayAppendValue(myContext->bonds, bond);
+               CFRelease(bond);
+       }
+
+       CFRelease(prefs);
+       return;
+}
+
+
+#pragma mark -
+#pragma mark SCBondInterface APIs
+
+
+CFArrayRef
+SCBondInterfaceCopyAll(SCPreferencesRef prefs)
+{
+       addContext              context;
+       CFDictionaryRef         dict;
+       CFStringRef             path;
+
+       context.bonds = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       context.prefs = prefs;
+
+       path = CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("/%@/%@"),
+                                       kSCPrefVirtualNetworkInterfaces,
+                                       kSCNetworkInterfaceTypeBond);
+       dict = SCPreferencesPathGetValue(prefs, path);
+       if (isA_CFDictionary(dict)) {
+               CFDictionaryApplyFunction(dict, add_configured_interface, &context);
+       } else {
+               // no bond configuration, upgrade from legacy configuration
+               dict = CFDictionaryCreate(NULL,
+                                         NULL, NULL, 0,
+                                         &kCFTypeDictionaryKeyCallBacks,
+                                         &kCFTypeDictionaryValueCallBacks);
+               (void) SCPreferencesPathSetValue(prefs, path, dict);
+               CFRelease(dict);
+
+               add_legacy_configuration(&context);
+       }
+       CFRelease(path);
+
+       return context.bonds;
+}
+
+
+__private_extern__ void
+__SCBondInterfaceListCopyMembers(CFArrayRef interfaces, CFMutableSetRef set)
+{
+       CFIndex i;
+       CFIndex n;
+
+       n = CFArrayGetCount(interfaces);
+       for (i = 0; i < n; i++) {
+               SCBondInterfaceRef      bondInterface;
+               CFArrayRef              members;
+
+               bondInterface = CFArrayGetValueAtIndex(interfaces, i);
+               members = SCBondInterfaceGetMemberInterfaces(bondInterface);
+               if (members != NULL) {
+                       CFIndex j;
+                       CFIndex n_members;
+
+                       // exclude the member interfaces of this bond
+                       n_members = CFArrayGetCount(members);
+                       for (j = 0; j < n_members; j++) {
+                               SCNetworkInterfaceRef   member;
+
+                               member = CFArrayGetValueAtIndex(members, j);
+                               CFSetAddValue(set, member);
+                       }
+               }
+
+       }
+       return;
+}
+
+
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCBondInterfaceCopyAvailableMemberInterfaces(SCPreferencesRef prefs)
+{
+       CFMutableArrayRef       available;
+       CFMutableSetRef         exclude;
+       CFArrayRef              interfaces;
+
+       available = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       exclude   = CFSetCreateMutable  (NULL, 0, &kCFTypeSetCallBacks);
+
+       // exclude Bond [member] interfaces
+       interfaces = SCBondInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               __SCBondInterfaceListCopyMembers(interfaces, exclude);
+               CFRelease(interfaces);
+       }
+
+       // exclude VLAN [physical] interfaces
+       interfaces = SCVLANInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               CFIndex i;
+               CFIndex n;
+
+               n = CFArrayGetCount(interfaces);
+               for (i = 0; i < n; i++) {
+                       SCVLANInterfaceRef      vlanInterface;
+                       SCNetworkInterfaceRef   physical;
+
+                       // exclude the physical interface of this VLAN
+                       vlanInterface = CFArrayGetValueAtIndex(interfaces, i);
+                       physical = SCVLANInterfaceGetPhysicalInterface(vlanInterface);
+                       CFSetAddValue(exclude, physical);
+               }
+               CFRelease(interfaces);
+       }
+
+       // identify available interfaces
+       interfaces = __SCNetworkInterfaceCopyAll_IONetworkInterface();
+       if (interfaces != NULL) {
+               CFIndex i;
+               CFIndex n;
+
+               n = CFArrayGetCount(interfaces);
+               for (i = 0; i < n; i++) {
+                       SCNetworkInterfaceRef           interface;
+                       SCNetworkInterfacePrivateRef    interfacePrivate;
+
+                       interface = CFArrayGetValueAtIndex(interfaces, i);
+                       interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
+
+                       if (!interfacePrivate->supportsBond) {
+                               // if this interface is not available
+                               continue;
+                       }
+
+                       if (CFSetContainsValue(exclude, interface)) {
+                               // if excluded
+                               continue;
+                       }
+
+                       CFArrayAppendValue(available, interface);
+               }
+               CFRelease(interfaces);
+       }
+
+       CFRelease(exclude);
+
+       return available;
+}
+
+
+CFArrayRef
+_SCBondInterfaceCopyActive(void)
+{
+       struct ifaddrs          *ifap;
+       struct ifaddrs          *ifp;
+       int                     s;
+       CFMutableArrayRef       bonds   = NULL;
+
+       if (getifaddrs(&ifap) == -1) {
+               _SCErrorSet(errno);
+               SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
+               return NULL;
+       }
+
+       s = inet_dgram_socket();
+       if (s == -1) {
+               _SCErrorSet(errno);
+               goto done;
+       }
+
+       bonds = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       for (ifp = ifap; ifp != NULL; ifp = ifp->ifa_next) {
+               SCBondInterfaceRef              bond;
+               CFStringRef                     bond_if;
+               struct if_bond_status_req       *ibsr_p;
+               struct if_data                  *if_data;
+               int                             int_val;
+               CFNumberRef                     mode;
+               CFMutableArrayRef               members         = NULL;
+
+               if_data = (struct if_data *)ifp->ifa_data;
+               if (if_data == NULL
+                   || ifp->ifa_addr->sa_family != AF_LINK
+                   || if_data->ifi_type != IFT_IEEE8023ADLAG) {
+                       continue;
+               }
+
+               ibsr_p = if_bond_status_req_copy(s, ifp->ifa_name);
+               if (ibsr_p == NULL) {
+                       if (errno == EBUSY) {
+                               continue;
+                       }
+                       _SCErrorSet(errno);
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("if_bond_status_req_copy(%s) failed: %s"),
+                             ifp->ifa_name,
+                             strerror(errno));
+                       CFRelease(bonds);
+                       bonds = NULL;
+                       goto done;
+               }
+
+               // create the bond interface
+               bond_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII);
+               bond    = (SCBondInterfaceRef)_SCBondInterfaceCreatePrivate(NULL, bond_if);
+               CFRelease(bond_if);
+
+               // set the mode
+               int_val = ibsr_p->ibsr_mode;
+               mode = CFNumberCreate(NULL, kCFNumberIntType, &int_val);
+               _SCBondInterfaceSetMode(bond, mode);
+               CFRelease(mode);
+
+               // add member interfaces
+               if (ibsr_p->ibsr_total > 0) {
+                       int                     i;
+                       struct if_bond_status * ibs_p;
+
+                       // iterate over each member interface
+                       ibs_p = (struct if_bond_status *)ibsr_p->ibsr_buffer;
+                       for (i = 0; i < ibsr_p->ibsr_total; i++) {
+                               char            if_name[IFNAMSIZ + 1];
+                               CFStringRef     member;
+
+                               bzero(&if_name, sizeof(if_name));
+                               bcopy(ibs_p[i].ibs_if_name, if_name, IFNAMSIZ);
+                               member = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
+                               add_interface(&members, member);
+                               CFRelease(member);
+                       }
+               }
+               free(ibsr_p);
+
+               if (members != NULL) {
+                       _SCBondInterfaceSetMemberInterfaces(bond, members);
+                       CFRelease(members);
+               }
+
+               // add bond
+               CFArrayAppendValue(bonds, bond);
+               CFRelease(bond);
+       }
+
+    done :
+
+       (void) close(s);
+       freeifaddrs(ifap);
+       return bonds;
+}
+
+
+SCBondInterfaceRef
+SCBondInterfaceCreate(SCPreferencesRef prefs)
+{
+       CFAllocatorRef          allocator;
+       SCBondInterfaceRef      bond            = NULL;
+       CFIndex                 i;
+
+       if (prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       allocator = CFGetAllocator(prefs);
+
+       // create a new bond using an unused interface name
+       for (i = 0; bond == NULL; i++) {
+               CFDictionaryRef                 dict;
+               CFStringRef                     bond_if;
+               SCNetworkInterfacePrivateRef    interfacePrivate;
+               CFMutableDictionaryRef          newDict;
+               CFArrayRef                      newInterfaces;
+               Boolean                         ok;
+               CFStringRef                     path;
+
+               bond_if = CFStringCreateWithFormat(allocator, NULL, CFSTR("bond%d"), i);
+               path    = CFStringCreateWithFormat(allocator,
+                                                  NULL,
+                                                  CFSTR("/%@/%@/%@"),
+                                                  kSCPrefVirtualNetworkInterfaces,
+                                                  kSCNetworkInterfaceTypeBond,
+                                                  bond_if);
+               dict = SCPreferencesPathGetValue(prefs, path);
+               if (dict != NULL) {
+                       // if bond interface name not available
+                       CFRelease(path);
+                       CFRelease(bond_if);
+                       continue;
+               }
+
+               // add the bond to the stored preferences
+               newDict = CFDictionaryCreateMutable(allocator,
+                                                   0,
+                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                   &kCFTypeDictionaryValueCallBacks);
+               newInterfaces = CFArrayCreate(allocator, NULL, 0, &kCFTypeArrayCallBacks);
+               CFDictionaryAddValue(newDict, kSCPropVirtualNetworkInterfacesBondInterfaces, newInterfaces);
+               CFRelease(newInterfaces);
+               ok = SCPreferencesPathSetValue(prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+               if (!ok) {
+                       // if the bond could not be saved
+                       CFRelease(bond_if);
+                       break;
+               }
+
+               // create the SCBondInterfaceRef
+               bond = (SCBondInterfaceRef)_SCBondInterfaceCreatePrivate(allocator, bond_if);
+               CFRelease(bond_if);
+
+               // estabish link to the stored configuration
+               interfacePrivate = (SCNetworkInterfacePrivateRef)bond;
+               interfacePrivate->prefs = CFRetain(prefs);
+       }
+
+       return bond;
+}
+
+
+Boolean
+SCBondInterfaceRemove(SCBondInterfaceRef bond)
+{
+       CFStringRef                     bond_if;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+       Boolean                         ok;
+       CFStringRef                     path;
+
+       if (!isA_SCBondInterface(bond)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (interfacePrivate->prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       bond_if = SCNetworkInterfaceGetBSDName(bond);
+       path    = CFStringCreateWithFormat(NULL,
+                                          NULL,
+                                          CFSTR("/%@/%@/%@"),
+                                          kSCPrefVirtualNetworkInterfaces,
+                                          kSCNetworkInterfaceTypeBond,
+                                          bond_if);
+       ok = SCPreferencesPathRemoveValue(interfacePrivate->prefs, path);
+       CFRelease(path);
+
+       return ok;
+}
+
+
+CFArrayRef
+SCBondInterfaceGetMemberInterfaces(SCBondInterfaceRef bond)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+
+       if (!isA_SCBondInterface(bond)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       return interfacePrivate->bond.interfaces;
+}
+
+
+CFDictionaryRef
+SCBondInterfaceGetOptions(SCBondInterfaceRef bond)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+
+       if (!isA_SCBondInterface(bond)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       return interfacePrivate->bond.options;
+}
+
+
+static Boolean
+_SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+       Boolean                         ok                      = TRUE;
+
+       // set member interfaces in the stored preferences
+       if (interfacePrivate->prefs != NULL) {
+               CFDictionaryRef         dict;
+               CFIndex                 i;
+               CFIndex                 n;
+               CFMutableDictionaryRef  newDict;
+               CFMutableArrayRef       newMembers;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeBond,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newMembers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               n = (members != NULL) ? CFArrayGetCount(members) : 0;
+               for (i = 0; i < n; i++) {
+                       SCNetworkInterfaceRef   interface;
+                       CFStringRef             memberName;
+
+                       interface = CFArrayGetValueAtIndex(members, i);
+                       memberName = SCNetworkInterfaceGetBSDName(interface);
+                       CFArrayAppendValue(newMembers, memberName);
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               CFDictionarySetValue(newDict, kSCPropVirtualNetworkInterfacesBondInterfaces, newMembers);
+               CFRelease(newMembers);
+
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       if (ok) {
+               CFRelease(interfacePrivate->bond.interfaces);
+               if (members == NULL) {
+                       interfacePrivate->bond.interfaces = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
+               } else {
+                       interfacePrivate->bond.interfaces = CFArrayCreateCopy(NULL, members);
+               }
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+       Boolean                         ok                      = TRUE;
+
+       if (!isA_SCBondInterface(bond)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((members != NULL) && !isA_CFArray(members)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (interfacePrivate->prefs != NULL) {
+               CFArrayRef      available;
+               CFArrayRef      current;
+               CFIndex         i;
+               CFIndex         n_available;
+               CFIndex         n_current;
+               CFIndex         n_members;
+
+               current     = SCBondInterfaceGetMemberInterfaces(bond);
+               n_current   = (current != NULL) ? CFArrayGetCount(current) : 0;
+
+               available   = SCBondInterfaceCopyAvailableMemberInterfaces(interfacePrivate->prefs);
+               n_available = (available != NULL) ? CFArrayGetCount(available) : 0;
+
+               n_members = (members != NULL) ? CFArrayGetCount(members) : 0;
+               for (i = 0; i < n_members; i++) {
+                       SCNetworkInterfaceRef   member;
+
+                       member = CFArrayGetValueAtIndex(members, i);
+
+                       if ((current != NULL) &&
+                           CFArrayContainsValue(current, CFRangeMake(0, n_current), member)) {
+                               // current members are allowed
+                               continue;
+                       }
+
+                       if ((available != NULL) &&
+                           CFArrayContainsValue(available, CFRangeMake(0, n_available), member)) {
+                               // available members are allowed
+                               continue;
+                       }
+
+                       // if member not allowed
+                       ok = FALSE;
+                       break;
+               }
+
+               CFRelease(available);
+
+               if (!ok) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+               }
+       }
+
+       if (ok) {
+               ok = _SCBondInterfaceSetMemberInterfaces(bond, members);
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCBondInterfaceSetLocalizedDisplayName(SCBondInterfaceRef bond, CFStringRef newName)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+       Boolean                         ok                      = TRUE;
+
+       if (!isA_SCBondInterface(bond)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((newName != NULL) && !isA_CFString(newName)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // set name in the stored preferences
+       if (interfacePrivate->prefs != NULL) {
+               CFDictionaryRef         dict;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeBond,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               if (newName != NULL) {
+                       CFDictionarySetValue(newDict, kSCPropUserDefinedName, newName);
+               } else {
+                       CFDictionaryRemoveValue(newDict, kSCPropUserDefinedName);
+               }
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       // set name in the SCBondInterfaceRef
+       if (ok) {
+               if (interfacePrivate->localized_name != NULL) {
+                       CFRelease(interfacePrivate->localized_name);
+                       interfacePrivate->localized_name = NULL;
+               }
+               if (newName != NULL) {
+                       interfacePrivate->localized_name = CFStringCreateCopy(NULL, newName);
+               }
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCBondInterfaceSetOptions(SCBondInterfaceRef bond, CFDictionaryRef newOptions)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+       Boolean                         ok                      = TRUE;
+
+       if (!isA_SCBondInterface(bond)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((newOptions != NULL) && !isA_CFDictionary(newOptions)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // set options in the stored preferences
+       if (interfacePrivate->prefs != NULL) {
+               CFDictionaryRef         dict;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeBond,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               if (newOptions != NULL) {
+                       CFDictionarySetValue(newDict, kSCPropVirtualNetworkInterfacesBondOptions, newOptions);
+               } else {
+                       CFDictionaryRemoveValue(newDict, kSCPropVirtualNetworkInterfacesBondOptions);
+               }
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       // set options in the SCBondInterfaceRef
+       if (ok) {
+               if (interfacePrivate->bond.options != NULL) {
+                       CFRelease(interfacePrivate->bond.options);
+                       interfacePrivate->bond.options = NULL;
+               }
+               if (newOptions != NULL) {
+                       interfacePrivate->bond.options = CFDictionaryCreateCopy(NULL, newOptions);
+               }
+       }
+
+       return ok;
+}
+
+
+static Boolean
+_SCBondInterfaceSetMode(SCBondInterfaceRef bond, CFNumberRef mode)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+       Boolean                         needs_release           = FALSE;
+       Boolean                         ok                      = TRUE;
+
+       if (mode == NULL) {
+               int     mode_num        = IF_BOND_MODE_LACP;
+
+               mode = CFNumberCreate(NULL, kCFNumberIntType, &mode_num);
+               needs_release = TRUE;
+       }
+
+       // set mode in the stored preferences
+       if (interfacePrivate->prefs != NULL) {
+               CFDictionaryRef         dict;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeBond,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       ok = FALSE;
+                       goto done;
+               }
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               CFDictionarySetValue(newDict, kSCPropVirtualNetworkInterfacesBondMode, mode);
+
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       if (ok) {
+               CFRetain(mode);
+               if (interfacePrivate->bond.mode != NULL) {
+                       CFRelease(interfacePrivate->bond.mode);
+               }
+               interfacePrivate->bond.mode = mode;
+       }
+
+    done :
+
+       if (needs_release) CFRelease(mode);
+       return ok;
+}
+
+Boolean
+SCBondInterfaceSetMode(SCBondInterfaceRef bond, CFNumberRef mode)
+{
+       int     mode_num;
+
+       if (!isA_SCBondInterface(bond) || !isA_CFNumber(mode)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (CFNumberGetValue(mode, kCFNumberIntType, &mode_num) == FALSE) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       switch (mode_num) {
+               case IF_BOND_MODE_LACP:
+               case IF_BOND_MODE_STATIC:
+                       break;
+               default:
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+       }
+
+       return (_SCBondInterfaceSetMode(bond, mode));
+}
+
+CFNumberRef
+SCBondInterfaceGetMode(SCBondInterfaceRef bond)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+
+       if (!isA_SCBondInterface(bond)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+       return (interfacePrivate->bond.mode);
+}
+
+
+#pragma mark -
+#pragma mark SCBondStatus APIs
+
+
+typedef struct {
+
+       // base CFType information
+       CFRuntimeBase                   cfBase;
+
+       // bond status
+       SCBondInterfaceRef              bond;
+       CFDictionaryRef                 status_bond;
+
+       // member interfaces and status
+       CFArrayRef                      interfaces;             // of SCNetworkInterfaceRef's
+       CFDictionaryRef                 status_interfaces;      // key = interface, val = interface status)
+
+} SCBondStatusPrivate, * SCBondStatusPrivateRef;
+
+
+const CFStringRef kSCBondStatusDeviceAggregationStatus = CFSTR("AggregationStatus");
+const CFStringRef kSCBondStatusDeviceCollecting                = CFSTR("Collecting");
+const CFStringRef kSCBondStatusDeviceDistributing      = CFSTR("Distributing");
+
+
+static CFStringRef     __SCBondStatusCopyDescription   (CFTypeRef cf);
+static void            __SCBondStatusDeallocate        (CFTypeRef cf);
+static Boolean         __SCBondStatusEqual             (CFTypeRef cf1, CFTypeRef cf2);
+
+
+static const CFRuntimeClass __SCBondStatusClass = {
+       0,                              // version
+       "BondStatus",                   // className
+       NULL,                           // init
+       NULL,                           // copy
+       __SCBondStatusDeallocate,       // dealloc
+       __SCBondStatusEqual,            // equal
+       NULL,                           // hash
+       NULL,                           // copyFormattingDesc
+       __SCBondStatusCopyDescription   // copyDebugDesc
+};
+
+
+static CFTypeID                __kSCBondStatusTypeID   = _kCFRuntimeNotATypeID;
+
+
+static pthread_once_t  bondStatus_init         = PTHREAD_ONCE_INIT;
+
+
+static CFStringRef
+__SCBondStatusCopyDescription(CFTypeRef cf)
+{
+       CFAllocatorRef          allocator       = CFGetAllocator(cf);
+       CFMutableStringRef      result;
+       SCBondStatusPrivateRef  statusPrivate   = (SCBondStatusPrivateRef)cf;
+
+       result = CFStringCreateMutable(allocator, 0);
+       CFStringAppendFormat(result, NULL, CFSTR("<SCBondStatus %p [%p]> {"), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR(" bond = %@"), statusPrivate->bond);
+       CFStringAppendFormat(result, NULL, CFSTR(", interface = %@"), statusPrivate->status_bond);
+       CFStringAppendFormat(result, NULL, CFSTR(", members = %@"),   statusPrivate->status_interfaces);
+       CFStringAppendFormat(result, NULL, CFSTR(" }"));
+
+       return result;
+}
+
+
+static void
+__SCBondStatusDeallocate(CFTypeRef cf)
+{
+       SCBondStatusPrivateRef  statusPrivate   = (SCBondStatusPrivateRef)cf;
+
+       /* release resources */
+
+       CFRelease(statusPrivate->bond);
+       CFRelease(statusPrivate->status_bond);
+       if (statusPrivate->interfaces != NULL) CFRelease(statusPrivate->interfaces);
+       CFRelease(statusPrivate->status_interfaces);
+       return;
+}
+
+
+static Boolean
+__SCBondStatusEqual(CFTypeRef cf1, CFTypeRef cf2)
+{
+       SCBondStatusPrivateRef  status1 = (SCBondStatusPrivateRef)cf1;
+       SCBondStatusPrivateRef  status2 = (SCBondStatusPrivateRef)cf2;
+
+       if (status1 == status2)
+               return TRUE;
+
+       if (!CFEqual(status1->bond, status2->bond))
+               return FALSE;   // if not the same bond
+
+       if (!CFEqual(status1->status_bond, status2->status_bond))
+               return FALSE;   // if not the same interface status
+
+       if (!CFEqual(status1->status_interfaces, status2->status_interfaces))
+               return FALSE;   // if not the same status of the member interfaces
+
+       return TRUE;
+}
+
+
+static void
+__SCBondStatusInitialize(void)
+{
+       __kSCBondStatusTypeID = _CFRuntimeRegisterClass(&__SCBondStatusClass);
+       return;
+}
+
+
+static SCBondStatusRef
+__SCBondStatusCreatePrivate(CFAllocatorRef     allocator,
+                           SCBondInterfaceRef  bond,
+                           CFDictionaryRef     status_bond,
+                           CFDictionaryRef     status_interfaces)
+{
+       SCBondStatusPrivateRef  statusPrivate;
+       uint32_t                size;
+
+       /* initialize runtime */
+       pthread_once(&bondStatus_init, __SCBondStatusInitialize);
+
+       /* allocate bond */
+       size          = sizeof(SCBondStatusPrivate) - sizeof(CFRuntimeBase);
+       statusPrivate = (SCBondStatusPrivateRef)_CFRuntimeCreateInstance(allocator,
+                                                                        __kSCBondStatusTypeID,
+                                                                        size,
+                                                                        NULL);
+       if (statusPrivate == NULL) {
+               return NULL;
+       }
+
+       /* establish the bond status */
+
+       statusPrivate->bond              = CFRetain(bond);
+       statusPrivate->status_bond       = CFDictionaryCreateCopy(NULL, status_bond);
+
+       statusPrivate->interfaces        = NULL;
+       statusPrivate->status_interfaces = CFDictionaryCreateCopy(NULL, status_interfaces);
+
+       return (SCBondStatusRef)statusPrivate;
+}
+
+
+static __inline__ CFTypeRef
+isA_SCBondStatus(CFTypeRef obj)
+{
+       return (isA_CFType(obj, SCBondStatusGetTypeID()));
+}
+
+
+CFTypeID
+SCBondStatusGetTypeID()
+{
+       pthread_once(&bondStatus_init, __SCBondStatusInitialize);       /* initialize runtime */
+       return __kSCBondStatusTypeID;
+}
+
+
+#define        N_QUICK 16
+
+
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCBondStatusGetMemberInterfaces(SCBondStatusRef bondStatus)
+{
+       SCBondStatusPrivateRef  statusPrivate   = (SCBondStatusPrivateRef)bondStatus;
+
+       if (!isA_SCBondStatus(bondStatus)) {
+               return NULL;
+       }
+
+       if (statusPrivate->interfaces == NULL) {
+               const void *    keys_q[N_QUICK];
+               const void **   keys    = keys_q;
+               CFIndex         n;
+
+               n = CFDictionaryGetCount(statusPrivate->status_interfaces);
+               if (n > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
+                       keys = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0);
+               }
+               CFDictionaryGetKeysAndValues(statusPrivate->status_interfaces, keys, NULL);
+               statusPrivate->interfaces = CFArrayCreate(NULL, keys, n, &kCFTypeArrayCallBacks);
+               if (keys != keys_q) {
+                       CFAllocatorDeallocate(NULL, keys);
+               }
+       }
+
+       return statusPrivate->interfaces;
+}
+
+
+CFDictionaryRef
+SCBondStatusGetInterfaceStatus(SCBondStatusRef bondStatus, SCNetworkInterfaceRef interface)
+{
+       CFDictionaryRef         status          = NULL;
+       SCBondStatusPrivateRef  statusPrivate   = (SCBondStatusPrivateRef)bondStatus;
+
+       if (!isA_SCBondStatus(bondStatus)) {
+               return NULL;
+       }
+
+       if (interface == NULL) {
+               // return status of the bond
+               status = statusPrivate->status_bond;
+       } else {
+               // return status of the member interface
+               status = CFDictionaryGetValue(statusPrivate->status_interfaces, interface);
+       }
+
+       return status;
+}
+
+
+SCBondStatusRef
+SCBondInterfaceCopyStatus(SCBondInterfaceRef bond)
+{
+       int                             bond_if_active;
+       int                             bond_if_status;
+       CFIndex                         i;
+       struct if_bond_status_req       *ibsr_p         = NULL;
+       char                            if_name[IFNAMSIZ + 1];
+       CFIndex                         n;
+       CFNumberRef                     num;
+       int                             s;
+       struct if_bond_status           *scan_p;
+       SCBondStatusRef                 status          = NULL;
+       CFMutableDictionaryRef          status_bond;
+       CFMutableDictionaryRef          status_interfaces;
+
+       if (!isA_SCBondInterface(bond)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       s = inet_dgram_socket();
+       if (s == -1) {
+               _SCErrorSet(errno);
+               goto done;
+       }
+
+       _SC_cfstring_to_cstring(SCNetworkInterfaceGetBSDName(bond),
+                               if_name,
+                               sizeof(if_name),
+                               kCFStringEncodingASCII);
+       if (siocgifmedia(s, if_name, &bond_if_status, &bond_if_active) == -1) {
+               _SCErrorSet(errno);
+               switch (errno) {
+                       case EBUSY :
+                       case ENXIO :
+                               break;
+                       default :
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("siocgifmedia(%s) failed: %s"),
+                                     if_name,
+                                     strerror(errno));
+               }
+               goto done;
+       }
+       ibsr_p = if_bond_status_req_copy(s, if_name);
+       if (ibsr_p == NULL) {
+               _SCErrorSet(errno);
+               goto done;
+       }
+
+       status_bond = CFDictionaryCreateMutable(NULL,
+                                               0,
+                                               &kCFTypeDictionaryKeyCallBacks,
+                                               &kCFTypeDictionaryValueCallBacks);
+
+       status_interfaces = CFDictionaryCreateMutable(NULL,
+                                                     0,
+                                                     &kCFTypeDictionaryKeyCallBacks,
+                                                     &kCFTypeDictionaryValueCallBacks);
+       n = ibsr_p->ibsr_total;
+       for (i = 0, scan_p = (struct if_bond_status *)ibsr_p->ibsr_buffer; i < n; i++, scan_p++) {
+               int                             collecting      = 0;
+               int                             distributing    = 0;
+               SCNetworkInterfaceRef           interface;
+               CFStringRef                     interface_name;
+               struct if_bond_partner_state *  ps;
+               CFMutableDictionaryRef          status_interface;
+               int                             status_val;
+
+               ps = &scan_p->ibs_partner_state;
+
+               if (lacp_actor_partner_state_in_sync(scan_p->ibs_state)) {
+                       /* we're in-sync */
+                       status_val = kSCBondStatusOK;
+                       if (lacp_actor_partner_state_in_sync(ps->ibps_state)) {
+                               /* partner is also in-sync */
+                               if (lacp_actor_partner_state_collecting(scan_p->ibs_state)
+                                   && lacp_actor_partner_state_distributing(ps->ibps_state)) {
+                                       /* we're able to collect (receive) frames */
+                                       collecting = 1;
+                               }
+                               if (lacp_actor_partner_state_distributing(scan_p->ibs_state)
+                                   && lacp_actor_partner_state_collecting(ps->ibps_state)) {
+                                       /* we're able to distribute (transmit) frames */
+                                       distributing = 1;
+                               }
+                       }
+               } else {
+                       int                     active = 0;
+                       int                     status = 0;
+                       static lacp_system      zeroes = { {0, 0, 0, 0, 0, 0}};
+
+                       if (siocgifmedia(s, scan_p->ibs_if_name, &status, &active) == -1) {
+                               switch (errno) {
+                                       case EBUSY :
+                                       case ENXIO :
+                                               break;
+                                       default :
+                                               SCLog(TRUE, LOG_ERR,
+                                                     CFSTR("siocgifmedia(%s) failed: %s"),
+                                                     if_name,
+                                                     strerror(errno));
+                                               break;
+                               }
+                       }
+                       if (((status & IFM_AVALID) == 0) ||
+                           ((status & IFM_ACTIVE) == 0) ||
+                           ((active & IFM_FDX   ) == 0)) {
+                               /* link down or not full-duplex */
+                               status_val = kSCBondStatusLinkInvalid;
+                       } else if ((ps->ibps_system_priority == 0) &&
+                                  (bcmp(&zeroes, &ps->ibps_system, sizeof(zeroes)) == 0)) {
+                               /* no one on the other end of the link */
+                               status_val = kSCBondStatusNoPartner;
+                       } else if (active != bond_if_active) {
+                               /* the link speed was different */
+                               status_val = kSCBondStatusLinkInvalid;
+                       } else {
+                               /* partner is not in the active group */
+                               status_val = kSCBondStatusNotInActiveGroup;
+                       }
+               }
+
+               // interface
+               bzero(&if_name, sizeof(if_name));
+               bcopy(scan_p->ibs_if_name, if_name, IFNAMSIZ);
+               interface_name = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
+               interface = _SCNetworkInterfaceCreateWithBSDName(NULL, interface_name,
+                                                                kIncludeNoVirtualInterfaces);
+               CFRelease(interface_name);
+
+               // interface status
+               status_interface = CFDictionaryCreateMutable(NULL,
+                                                            0,
+                                                            &kCFTypeDictionaryKeyCallBacks,
+                                                            &kCFTypeDictionaryValueCallBacks);
+               num = CFNumberCreate(NULL, kCFNumberIntType, &status_val);
+               CFDictionarySetValue(status_interface, kSCBondStatusDeviceAggregationStatus, num);
+               CFRelease(num);
+               num = CFNumberCreate(NULL, kCFNumberIntType, &collecting);
+               CFDictionarySetValue(status_interface, kSCBondStatusDeviceCollecting, num);
+               CFRelease(num);
+               num = CFNumberCreate(NULL, kCFNumberIntType, &distributing);
+               CFDictionarySetValue(status_interface, kSCBondStatusDeviceDistributing, num);
+               CFRelease(num);
+
+               CFDictionarySetValue(status_interfaces, interface, status_interface);
+               CFRelease(interface);
+               CFRelease(status_interface);
+       }
+
+       status = __SCBondStatusCreatePrivate(NULL, bond, status_bond, status_interfaces);
+       CFRelease(status_bond);
+       CFRelease(status_interfaces);
+
+    done:
+
+       if (s != -1) {
+               close(s);
+       }
+       if (ibsr_p != NULL) {
+               free(ibsr_p);
+       }
+       return (SCBondStatusRef)status;
+}
+
+
+#pragma mark -
+#pragma mark SCBondInterface management
+
+
+static Boolean
+__bond_set_mode(int s, CFStringRef bond_if, CFNumberRef mode)
+{
+       struct if_bond_req      breq;
+       struct ifreq            ifr;
+       int                                     mode_num;
+
+       mode_num = IF_BOND_MODE_LACP;
+       if (mode != NULL) {
+               CFNumberGetValue(mode, kCFNumberIntType, &mode_num);
+       }
+
+       // bond interface
+       bzero(&ifr, sizeof(ifr));
+       (void) _SC_cfstring_to_cstring(bond_if,
+                                      ifr.ifr_name,
+                                      sizeof(ifr.ifr_name),
+                                      kCFStringEncodingASCII);
+       ifr.ifr_data = (caddr_t)&breq;
+       bzero(&breq, sizeof(breq));
+       breq.ibr_op = IF_BOND_OP_SET_MODE;
+       breq.ibr_ibru.ibru_int_val = mode_num;
+       if (ioctl(s, SIOCSIFBOND, (caddr_t)&ifr) == -1) {
+               _SCErrorSet(errno);
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("could not set mode to %d on bond \"%@\": %s"),
+                     mode,
+                     bond_if,
+                     strerror(errno));
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+static Boolean
+__bond_add_interface(int s, CFStringRef bond_if, CFStringRef interface_if)
+{
+       struct if_bond_req      breq;
+       struct ifreq            ifr;
+
+       // bond interface
+       bzero(&ifr, sizeof(ifr));
+       (void) _SC_cfstring_to_cstring(bond_if,
+                                      ifr.ifr_name,
+                                      sizeof(ifr.ifr_name),
+                                      kCFStringEncodingASCII);
+       ifr.ifr_data = (caddr_t)&breq;
+
+       // new bond member
+       bzero(&breq, sizeof(breq));
+       breq.ibr_op = IF_BOND_OP_ADD_INTERFACE;
+       (void) _SC_cfstring_to_cstring(interface_if,
+                                      breq.ibr_ibru.ibru_if_name,
+                                      sizeof(breq.ibr_ibru.ibru_if_name),
+                                      kCFStringEncodingASCII);
+
+       // add new bond member
+       if (ioctl(s, SIOCSIFBOND, (caddr_t)&ifr) == -1) {
+               _SCErrorSet(errno);
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("could not add interface \"%@\" to bond \"%@\": %s"),
+                     interface_if,
+                     bond_if,
+                     strerror(errno));
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+static Boolean
+__bond_remove_interface(int s, CFStringRef bond_if, CFStringRef interface_if)
+{
+       struct if_bond_req      breq;
+       struct ifreq            ifr;
+
+       // bond interface
+       bzero(&ifr, sizeof(ifr));
+       (void) _SC_cfstring_to_cstring(bond_if,
+                                      ifr.ifr_name,
+                                      sizeof(ifr.ifr_name),
+                                      kCFStringEncodingASCII);
+       ifr.ifr_data = (caddr_t)&breq;
+
+       // bond member to remove
+       bzero(&breq, sizeof(breq));
+       breq.ibr_op = IF_BOND_OP_REMOVE_INTERFACE;
+       (void) _SC_cfstring_to_cstring(interface_if,
+                                      breq.ibr_ibru.ibru_if_name,
+                                      sizeof(breq.ibr_ibru.ibru_if_name),
+                                      kCFStringEncodingASCII);
+
+       // remove bond member
+       if (ioctl(s, SIOCSIFBOND, (caddr_t)&ifr) == -1) {
+               _SCErrorSet(errno);
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("could not remove interface \"%@\" from bond \"%@\": %s"),
+                     interface_if,
+                     bond_if,
+                     strerror(errno));
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+Boolean
+_SCBondInterfaceUpdateConfiguration(SCPreferencesRef prefs)
+{
+       CFArrayRef                      active          = NULL;
+       CFArrayRef                      config          = NULL;
+       CFIndex                         i;
+       CFIndex                         nActive;
+       CFIndex                         nConfig;
+       Boolean                         ok              = TRUE;
+       int                             s               = -1;
+
+       if (prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       /* configured Bonds */
+       config  = SCBondInterfaceCopyAll(prefs);
+       nConfig = CFArrayGetCount(config);
+
+       /* active Bonds */
+       active  = _SCBondInterfaceCopyActive();
+       nActive = CFArrayGetCount(active);
+
+       /*
+        * remove any no-longer-configured bond interfaces and
+        * any devices associated with a bond that are no longer
+        * associated with a bond.
+        */
+       for (i = 0; i < nActive; i++) {
+               SCBondInterfaceRef      a_bond;
+               CFStringRef             a_bond_if;
+               CFIndex                 j;
+               Boolean                 found   = FALSE;
+
+               a_bond    = CFArrayGetValueAtIndex(active, i);
+               a_bond_if = SCNetworkInterfaceGetBSDName(a_bond);
+
+               for (j = 0; j < nConfig; j++) {
+                       SCBondInterfaceRef      c_bond;
+                       CFStringRef             c_bond_if;
+
+                       c_bond    = CFArrayGetValueAtIndex(config, j);
+                       c_bond_if = SCNetworkInterfaceGetBSDName(c_bond);
+
+                       if (CFEqual(a_bond_if, c_bond_if)) {
+                               CFIndex         a;
+                               CFArrayRef      a_bond_interfaces;
+                               CFIndex         a_count;
+                               CFArrayRef      c_bond_interfaces;
+                               CFIndex         c_count;
+
+                               c_bond_interfaces = SCBondInterfaceGetMemberInterfaces(c_bond);
+                               c_count           = (c_bond_interfaces != NULL) ? CFArrayGetCount(c_bond_interfaces) : 0;
+
+                               a_bond_interfaces = SCBondInterfaceGetMemberInterfaces(a_bond);
+                               a_count           = (a_bond_interfaces != NULL) ? CFArrayGetCount(a_bond_interfaces) : 0;
+
+                               for (a = 0; a < a_count; a++) {
+                                       SCNetworkInterfaceRef   a_interface;
+                                       CFStringRef             a_interface_if;
+
+                                       a_interface = CFArrayGetValueAtIndex(a_bond_interfaces, a);
+                                       if ((c_count == 0) ||
+                                           !CFArrayContainsValue(c_bond_interfaces,
+                                                                 CFRangeMake(0, c_count),
+                                                                 a_interface)) {
+                                               /*
+                                                * if this device is no longer part
+                                                * of the bond.
+                                                */
+                                               if (s == -1) {
+                                                       s = inet_dgram_socket();
+                                                       if (s == -1) {
+                                                               _SCErrorSet(errno);
+                                                               ok = FALSE;
+                                                               goto done;
+                                                       }
+                                               }
+
+                                               a_interface_if = SCNetworkInterfaceGetBSDName(a_interface);
+                                               if (!__bond_remove_interface(s, a_bond_if, a_interface_if)) {
+                                                       ok = FALSE;
+                                               }
+                                       }
+                               }
+
+                               found = TRUE;
+                               break;
+                       }
+               }
+
+               if (!found) {
+                       /*
+                        * if this interface is no longer configured
+                        */
+                       if (s == -1) {
+                               s = inet_dgram_socket();
+                               if (s == -1) {
+                                       _SCErrorSet(errno);
+                                       ok = FALSE;
+                                       goto done;
+                               }
+                       }
+
+                       if (!__destroyInterface(s, a_bond_if)) {
+                               _SCErrorSet(errno);
+                               ok = FALSE;
+                       }
+               }
+       }
+
+       /*
+        * add any newly-configured bond interfaces and add any
+        * devices that should now be associated with the bond.
+        */
+       for (i = 0; i < nConfig; i++) {
+               CFNumberRef             c_bond_mode;
+               SCBondInterfaceRef      c_bond;
+               CFArrayRef              c_bond_interfaces;
+               CFStringRef             c_bond_if;
+               CFIndex                 c_count;
+               Boolean                 found           = FALSE;
+               CFIndex                 j;
+
+               c_bond            = CFArrayGetValueAtIndex(config, i);
+               c_bond_if         = SCNetworkInterfaceGetBSDName(c_bond);
+               c_bond_interfaces = SCBondInterfaceGetMemberInterfaces(c_bond);
+               c_bond_mode               = SCBondInterfaceGetMode(c_bond);
+               c_count           = (c_bond_interfaces != NULL) ? CFArrayGetCount(c_bond_interfaces) : 0;
+
+               for (j = 0; j < nActive; j++) {
+                       SCBondInterfaceRef      a_bond;
+                       CFArrayRef              a_bond_interfaces;
+                       CFNumberRef             a_bond_mode;
+                       CFStringRef             a_bond_if;
+                       CFIndex                 a_count;
+
+                       a_bond            = CFArrayGetValueAtIndex(active, j);
+                       a_bond_if         = SCNetworkInterfaceGetBSDName(a_bond);
+                       a_bond_interfaces = SCBondInterfaceGetMemberInterfaces(a_bond);
+                       a_bond_mode               = SCBondInterfaceGetMode(a_bond);
+                       a_count           = (a_bond_interfaces != NULL) ? CFArrayGetCount(a_bond_interfaces) : 0;
+
+                       if (CFEqual(c_bond_if, a_bond_if)) {
+                               CFIndex c;
+                               Boolean if_list_change = FALSE;
+                               Boolean mode_change = FALSE;
+
+                               found = TRUE;
+
+                               if (!_SC_CFEqual(a_bond_mode, c_bond_mode)) {
+                                       mode_change = TRUE;
+                               }
+
+                               if (!_SC_CFEqual(c_bond_interfaces, a_bond_interfaces)) {
+                                       if_list_change = TRUE;
+                               }
+                               if (!mode_change && !if_list_change) {
+                                       break;  // if no change
+                               }
+                               if (s == -1) {
+                                       s = inet_dgram_socket();
+                                       if (s == -1) {
+                                               _SCErrorSet(errno);
+                                               ok = FALSE;
+                                               goto done;
+                                       }
+                               }
+                               if (mode_change) {
+                                       __bond_set_mode(s, a_bond_if, c_bond_mode);
+                               }
+                               if (!if_list_change) {
+                                       break; // no if list changes
+                               }
+
+                               /*
+                                * ensure that the first device of the bond matches, if
+                                * not then we remove all current devices and add them
+                                * back in the preferred order.
+                                */
+                               if ((c_count > 0) &&
+                                   (a_count > 0) &&
+                                   !CFEqual(CFArrayGetValueAtIndex(c_bond_interfaces, 0),
+                                            CFArrayGetValueAtIndex(a_bond_interfaces, 0))) {
+                                       CFIndex a;
+
+                                       for (a = 0; a < a_count; a++) {
+                                               SCNetworkInterfaceRef   a_interface;
+                                               CFStringRef             a_interface_if;
+
+                                               a_interface = CFArrayGetValueAtIndex(a_bond_interfaces, a);
+                                               if (!CFArrayContainsValue(c_bond_interfaces,
+                                                                        CFRangeMake(0, c_count),
+                                                                        a_interface)) {
+                                                       continue;       // if already removed
+                                               }
+
+                                               a_interface_if = SCNetworkInterfaceGetBSDName(a_interface);
+                                               if (!__bond_remove_interface(s, a_bond_if, a_interface_if)) {
+                                                       ok = FALSE;
+                                               }
+                                       }
+
+                                       a_count = 0;    // all active devices have been removed
+                               }
+
+                               /*
+                                * add any devices which are not currently associated
+                                * with the bond interface.
+                                */
+                               for (c = 0; c < c_count; c++) {
+                                       SCNetworkInterfaceRef           c_interface;
+                                       SCNetworkInterfacePrivateRef    c_interfacePrivate;
+                                       CFStringRef                     c_interface_if;
+
+                                       c_interface = CFArrayGetValueAtIndex(c_bond_interfaces, c);
+                                       if ((a_count == 0) ||
+                                           !CFArrayContainsValue(a_bond_interfaces,
+                                                                 CFRangeMake(0, a_count),
+                                                                 c_interface)) {
+                                               /*
+                                                * check if this member interface can be added to a bond.
+                                                */
+                                               c_interfacePrivate = (SCNetworkInterfacePrivateRef)c_interface;
+                                               if (!c_interfacePrivate->supportsBond) {
+                                                       // if member not supported
+                                                       continue;
+                                               }
+
+                                               /*
+                                                * if this member interface is not currently part of the bond.
+                                                */
+                                               c_interface_if = SCNetworkInterfaceGetBSDName(c_interface);
+                                               if (!__bond_add_interface(s, c_bond_if, c_interface_if)) {
+                                                       // if member could not be added
+                                                       ok = FALSE;
+                                               }
+                                       }
+                               }
+
+                               break;
+                       }
+               }
+
+               if (!found) {
+                       CFIndex c;
+
+                       if (s == -1) {
+                               s = inet_dgram_socket();
+                               if (s == -1) {
+                                       _SCErrorSet(errno);
+                                       ok = FALSE;
+                                       goto done;
+                               }
+                       }
+
+                       /*
+                        * establish the new bond interface.
+                        */
+                       if (!__createInterface(s, c_bond_if)) {
+                               _SCErrorSet(errno);
+                               ok = FALSE;
+                               continue;
+                       }
+
+                       /* set the mode */
+                       __bond_set_mode(s, c_bond_if, c_bond_mode);
+
+                       /*
+                        * add the member interfaces
+                        */
+                       for (c = 0; c < c_count; c++) {
+                               SCNetworkInterfaceRef           c_interface;
+                               SCNetworkInterfacePrivateRef    c_interfacePrivate;
+                               CFStringRef                     c_interface_if;
+
+                               c_interface = CFArrayGetValueAtIndex(c_bond_interfaces, c);
+                               c_interfacePrivate = (SCNetworkInterfacePrivateRef)c_interface;
+                               if (!c_interfacePrivate->supportsBond) {
+                                       // if member not supported
+                                       continue;
+                               }
+
+                               c_interface_if = SCNetworkInterfaceGetBSDName(c_interface);
+                               if (!__bond_add_interface(s, c_bond_if, c_interface_if)) {
+                                       // if member could not be added
+                                       ok = FALSE;
+                               }
+                       }
+               }
 
 
-       // remove bond member
-       if (ioctl(s, SIOCSIFBOND, (caddr_t)&ifr) == -1) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("could not remove interface \"%@\" from bond \"%@\": %s"),
-                     device,
-                     interface,
-                     strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
-               return FALSE;
        }
 
        }
 
-       return TRUE;
+    done :
+
+       if (active != NULL)     CFRelease(active);
+       if (config != NULL)     CFRelease(config);
+       if (s != -1)            (void) close(s);
+
+       return ok;
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark Deprecated SPIs (remove when no longer referenced)
+
+
 /* ---------- Bond "device" ---------- */
 
 Boolean
 IsBondSupported(CFStringRef device)
 {
 /* ---------- Bond "device" ---------- */
 
 Boolean
 IsBondSupported(CFStringRef device)
 {
-       CFMutableDictionaryRef  entity;
-       SCNetworkInterfaceRef   interface;
-       Boolean                 isBond          = FALSE;
-
-       entity = CFDictionaryCreateMutable(NULL,
-                                          0,
-                                          &kCFTypeDictionaryKeyCallBacks,
-                                          &kCFTypeDictionaryValueCallBacks);
-       CFDictionarySetValue(entity, kSCPropNetInterfaceType, kSCValNetInterfaceTypeEthernet);
-       CFDictionarySetValue(entity, kSCPropNetInterfaceDeviceName, device);
-       interface = __SCNetworkInterfaceCreateWithEntity(NULL, entity, NULL);
-       CFRelease(entity);
-
-       if (interface != NULL) {
-               SCNetworkInterfacePrivateRef    interfacePrivate;
+       SCNetworkInterfaceRef           interface;
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       Boolean                         isBond          = FALSE;
 
 
-               interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
-               if (interfacePrivate->path != NULL) {
-                       isBond = interfacePrivate->supportsBond;
-               }
-               CFRelease(interface);
-       }
+       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, device,
+                                                        kIncludeNoVirtualInterfaces);
+       interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
+       isBond = interfacePrivate->supportsBond;
+       CFRelease(interface);
 
        return isBond;
 }
 
        return isBond;
 }
@@ -302,7 +1948,7 @@ __BondInterfaceCopyDescription(CFTypeRef cf)
 
        result = CFStringCreateMutable(allocator, 0);
        CFStringAppendFormat(result, NULL, CFSTR("<BondInterface %p [%p]> {"), cf, allocator);
 
        result = CFStringCreateMutable(allocator, 0);
        CFStringAppendFormat(result, NULL, CFSTR("<BondInterface %p [%p]> {"), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR(" if = %@"), bondPrivate->ifname);
+       CFStringAppendFormat(result, NULL, CFSTR("if = %@"), bondPrivate->ifname);
        if (bondPrivate->devices != NULL) {
                CFIndex i;
                CFIndex n;
        if (bondPrivate->devices != NULL) {
                CFIndex i;
                CFIndex n;
@@ -320,7 +1966,7 @@ __BondInterfaceCopyDescription(CFTypeRef cf)
        if (bondPrivate->options != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), bondPrivate->options);
        }
        if (bondPrivate->options != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), bondPrivate->options);
        }
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
        return result;
 }
@@ -524,12 +2170,6 @@ BondInterfaceSetOptions(BondInterfaceRef bond, CFDictionaryRef newOptions)
 
 /* ---------- BondPreferences ---------- */
 
 
 /* ---------- BondPreferences ---------- */
 
-#define        BOND_PREFERENCES_BONDS          CFSTR("Bonds")
-
-#define        __kBondInterface_interface      CFSTR("interface")      // e.g. bond0, bond1, ...
-#define        __kBondInterface_devices        CFSTR("devices")        // e.g. en0, en1, ...
-#define __kBondInterface_options       CFSTR("options")        // e.g. UserDefinedName
-
 typedef struct {
 
        /* base CFType information */
 typedef struct {
 
        /* base CFType information */
@@ -643,15 +2283,14 @@ _BondPreferencesCopyActiveInterfaces()
        CFMutableArrayRef       bonds   = NULL;
 
        if (getifaddrs(&ifap) == -1) {
        CFMutableArrayRef       bonds   = NULL;
 
        if (getifaddrs(&ifap) == -1) {
+               _SCErrorSet(errno);
                SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
                SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
                return NULL;
        }
 
        s = inet_dgram_socket();
        if (s == -1) {
                return NULL;
        }
 
        s = inet_dgram_socket();
        if (s == -1) {
-               SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
+               _SCErrorSet(errno);
                goto done;
        }
 
                goto done;
        }
 
@@ -674,10 +2313,17 @@ _BondPreferencesCopyActiveInterfaces()
                }
                ibsr_p = if_bond_status_req_copy(s, ifp->ifa_name);
                if (ibsr_p == NULL) {
                }
                ibsr_p = if_bond_status_req_copy(s, ifp->ifa_name);
                if (ibsr_p == NULL) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("if_bond_status_req_copy(%s) failed: %s"),
-                             ifp->ifa_name, strerror(errno));
-                       _SCErrorSet(kSCStatusFailed);
+                       if (errno == EBUSY) {
+                               continue;
+                       }
+
+                       _SCErrorSet(errno);
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("if_bond_status_req_copy(%s) failed: %s"),
+                             ifp->ifa_name,
+                             strerror(errno));
                        CFRelease(bonds);
                        CFRelease(bonds);
+                       bonds = NULL;
                        goto done;
                }
                if (ibsr_p->ibsr_total > 0) {
                        goto done;
                }
                if (ibsr_p->ibsr_total > 0) {
@@ -689,9 +2335,10 @@ _BondPreferencesCopyActiveInterfaces()
                        ibs_p = (struct if_bond_status *)ibsr_p->ibsr_buffer;
                        for (i = 0; i < ibsr_p->ibsr_total; i++) {
                                CFStringRef     device;
                        ibs_p = (struct if_bond_status *)ibsr_p->ibsr_buffer;
                        for (i = 0; i < ibsr_p->ibsr_total; i++) {
                                CFStringRef     device;
-                               char            if_name[IFNAMSIZ+1];
+                               char            if_name[IFNAMSIZ + 1];
 
 
-                               strlcpy(if_name, ibs_p[i].ibs_if_name, sizeof(if_name));
+                               bzero(&if_name, sizeof(if_name));
+                               bcopy(ibs_p[i].ibs_if_name, if_name, IFNAMSIZ);
                                device = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
                                CFArrayAppendValue(devices, device);
                                CFRelease(device);
                                device = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
                                CFArrayAppendValue(devices, device);
                                CFRelease(device);
@@ -1395,288 +3042,14 @@ BondPreferencesCommitChanges(BondPreferencesRef        prefs)
 Boolean
 _BondPreferencesUpdateConfiguration(BondPreferencesRef prefs)
 {
 Boolean
 _BondPreferencesUpdateConfiguration(BondPreferencesRef prefs)
 {
-       CFArrayRef                      active          = NULL;
-       CFArrayRef                      config          = NULL;
-       CFIndex                         i;
-       CFIndex                         nActive;
-       CFIndex                         nConfig;
-       Boolean                         ok              = FALSE;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-       int                             s               = -1;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       /* configured Bonds */
-       if (prefsPrivate->bBase != NULL) {
-               /*
-                * updated Bond preferences have not been committed
-                * so we ignore any in-progress changes and apply the
-                * saved preferences.
-                */
-               config = CFRetain(prefsPrivate->bBase);
-       } else {
-               /*
-                * apply the saved preferences
-                */
-               config = BondPreferencesCopyInterfaces(prefs);
-       }
-       nConfig = CFArrayGetCount(config);
-
-       /* active Bonds */
-       active  = _BondPreferencesCopyActiveInterfaces();
-       nActive = CFArrayGetCount(active);
-
-       /*
-        * remove any no-longer-configured bond interfaces and
-        * any devices associated with a bond that are no longer
-        * associated with a bond.
-        */
-       for (i = 0; i < nActive; i++) {
-               BondInterfaceRef        a_bond;
-               CFStringRef             a_bond_if;
-               CFIndex                 j;
-               Boolean                 found   = FALSE;
-
-               a_bond    = CFArrayGetValueAtIndex(active, i);
-               a_bond_if = BondInterfaceGetInterface(a_bond);
-
-               for (j = 0; j < nConfig; j++) {
-                       BondInterfaceRef        c_bond;
-                       CFStringRef             c_bond_if;
-
-                       c_bond    = CFArrayGetValueAtIndex(config, j);
-                       c_bond_if = BondInterfaceGetInterface(c_bond);
-
-                       if (CFEqual(a_bond_if, c_bond_if)) {
-                               CFIndex         a;
-                               CFIndex         a_count;
-                               CFArrayRef      a_bond_devices;
-                               CFIndex         c_count;
-                               CFArrayRef      c_bond_devices;
-
-                               c_bond_devices = BondInterfaceGetDevices(c_bond);
-                               c_count        = (c_bond_devices != NULL) ? CFArrayGetCount(c_bond_devices) : 0;
-
-                               a_bond_devices = BondInterfaceGetDevices(a_bond);
-                               a_count        = (a_bond_devices != NULL) ? CFArrayGetCount(a_bond_devices) : 0;
-
-                               for (a = 0; a < a_count; a++) {
-                                       CFStringRef     a_device;
-
-                                       a_device = CFArrayGetValueAtIndex(a_bond_devices, a);
-                                       if ((c_count == 0) ||
-                                           !CFArrayContainsValue(c_bond_devices,
-                                                                 CFRangeMake(0, c_count),
-                                                                 a_device)) {
-                                               /*
-                                                * if this device is no longer part
-                                                * of the bond.
-                                                */
-                                               if (s == -1) {
-                                                       s = inet_dgram_socket();
-                                               }
-
-                                               ok = _Bond_removeDevice(s, a_bond_if, a_device);
-                                               if (!ok) {
-                                                       goto done;
-                                               }
-                                       }
-                               }
-
-                               found = TRUE;
-                               break;
-                       }
-               }
-
-               if (!found) {
-                       /*
-                        * if this interface is no longer configured
-                        */
-                       if (s == -1) {
-                               s = inet_dgram_socket();
-                       }
-
-                       ok = __destroyInterface(s, a_bond_if);
-                       if (!ok) {
-                               _SCErrorSet(kSCStatusFailed);
-                               goto done;
-                       }
-               }
-       }
-
-       /*
-        * add any newly-configured bond interfaces and add any
-        * devices that should now be associated with the bond.
-        */
-       for (i = 0; i < nConfig; i++) {
-               BondInterfaceRef        c_bond;
-               CFArrayRef              c_bond_devices;
-               CFStringRef             c_bond_if;
-               CFIndex                 c_count;
-               Boolean                 found           = FALSE;
-               CFIndex                 j;
-
-               c_bond         = CFArrayGetValueAtIndex(config, i);
-               c_bond_if      = BondInterfaceGetInterface(c_bond);
-               c_bond_devices = BondInterfaceGetDevices(c_bond);
-               c_count        = (c_bond_devices != NULL) ? CFArrayGetCount(c_bond_devices) : 0;
-
-               for (j = 0; j < nActive; j++) {
-                       BondInterfaceRef        a_bond;
-                       CFArrayRef              a_bond_devices;
-                       CFStringRef             a_bond_if;
-                       CFIndex                 a_count;
-
-                       a_bond         = CFArrayGetValueAtIndex(active, j);
-                       a_bond_if      = BondInterfaceGetInterface(a_bond);
-                       a_bond_devices = BondInterfaceGetDevices(a_bond);
-                       a_count         = (a_bond_devices != NULL) ? CFArrayGetCount(a_bond_devices) : 0;
-
-                       if (CFEqual(c_bond_if, a_bond_if)) {
-                               CFIndex c;
-
-                               found = TRUE;
-
-                               if ((c_bond_devices == NULL) &&
-                                   (a_bond_devices == NULL)) {
-                                       break;  // if no change
-                               }
-
-                               if ((c_bond_devices != NULL) &&
-                                   (a_bond_devices != NULL) &&
-                                   CFEqual(c_bond_devices, a_bond_devices)) {
-                                       break;  // if no change
-                               }
-
-                               if (s == -1) {
-                                       s = inet_dgram_socket();
-                               }
-
-                               /*
-                                * ensure that the first device of the bond matches, if
-                                * not then we remove all current devices and add them
-                                * back in the preferred order.
-                                */
-                               if ((c_count > 0) &&
-                                   (a_count > 0) &&
-                                   !CFEqual(CFArrayGetValueAtIndex(c_bond_devices, 0),
-                                            CFArrayGetValueAtIndex(a_bond_devices, 0))) {
-                                       CFIndex a;
-
-                                       for (a = 0; a < a_count; a++) {
-                                               CFStringRef     a_device;
-
-                                               a_device = CFArrayGetValueAtIndex(a_bond_devices, a);
-
-                                               if (!CFArrayContainsValue(c_bond_devices,
-                                                                        CFRangeMake(0, c_count),
-                                                                        a_device)) {
-                                                       continue;       // if already removed
-                                               }
-
-                                               ok = _Bond_removeDevice(s, a_bond_if, a_device);
-                                               if (!ok) {
-                                                       goto done;
-                                               }
-                                       }
-
-                                       a_count = 0;    // all active devices have been removed
-                               }
-
-                               /*
-                                * add any devices which are not currently associated
-                                * with the bond interface.
-                                */
-                               for (c = 0; c < c_count; c++) {
-                                       CFStringRef     c_device;
-
-                                       c_device = CFArrayGetValueAtIndex(c_bond_devices, c);
-                                       if ((a_count == 0) ||
-                                           !CFArrayContainsValue(a_bond_devices,
-                                                                 CFRangeMake(0, a_count),
-                                                                 c_device)) {
-                                               /*
-                                                * check if this device can be added to
-                                                * a bond.
-                                                */
-                                               if (!IsBondSupported(c_device)) {
-                                                       // if not supported
-                                                       continue;
-                                               }
-
-                                               /*
-                                                * if this device is not currently part
-                                                * of the bond.
-                                                */
-
-                                               ok = _Bond_addDevice(s, c_bond_if, c_device);
-                                               if (!ok) {
-                                                       goto done;
-                                               }
-                                       }
-                               }
-
-                               break;
-                       }
-               }
-
-               if (!found) {
-                       CFIndex c;
-
-                       if (s == -1) {
-                               s = inet_dgram_socket();
-                       }
-
-                       /*
-                        * establish the new bond interface.
-                        */
-                       ok = __createInterface(s, c_bond_if);
-                       if (!ok) {
-                               _SCErrorSet(kSCStatusFailed);
-                               goto done;
-                       }
-
-                       /*
-                        * add any devices which are not currently associated
-                        * with the bond interface.
-                        */
-                       for (c = 0; c < c_count; c++) {
-                               CFStringRef     c_device;
-
-                               c_device = CFArrayGetValueAtIndex(c_bond_devices, c);
-
-                               if (!IsBondSupported(c_device)) {
-                                       // if not supported
-                                       continue;
-                               }
-
-                               ok = _Bond_addDevice(s, c_bond_if, c_device);
-                               if (!ok) {
-                                       goto done;
-                               }
-                       }
-               }
-
-       }
-
-       ok = TRUE;
-
-    done :
-
-       if (active != NULL)     CFRelease(active);
-       if (config != NULL)     CFRelease(config);
-       if (s != -1)            (void) close(s);
-
-       return ok;
+       return TRUE;
 }
 
 
 Boolean
 BondPreferencesApplyChanges(BondPreferencesRef prefs)
 {
 }
 
 
 Boolean
 BondPreferencesApplyChanges(BondPreferencesRef prefs)
 {
+       SCPreferencesRef                defaultPrefs;
        Boolean                         ok              = FALSE;
        BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
 
        Boolean                         ok              = FALSE;
        BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
 
@@ -1694,7 +3067,28 @@ BondPreferencesApplyChanges(BondPreferencesRef prefs)
        }
 
        /* apply the Bond configuration */
        }
 
        /* apply the Bond configuration */
-       ok = _BondPreferencesUpdateConfiguration(prefs);
+       defaultPrefs = SCPreferencesCreate(NULL, CFSTR("BondPreferencesApplyChanges"), NULL);
+       {
+               /*
+                * Note: In an ideal world, we'd simply call SCPreferencesApplyChanges()
+                *       Unfortunately, it's possible that the caller (e.g NetworkCfgTool)
+                *       is holding the lock on the default prefs and since "Apply" attempts
+                *       to grab the lock we could end up in a deadlock situation.
+                */
+#include "SCPreferencesInternal.h"
+               SCPreferencesPrivateRef         defaultPrefsPrivate;
+
+               defaultPrefsPrivate = (SCPreferencesPrivateRef)defaultPrefs;
+
+               pthread_mutex_lock(&defaultPrefsPrivate->lock);
+               if (defaultPrefsPrivate->session == NULL) {
+                       __SCPreferencesAddSession(defaultPrefs);
+               }
+               pthread_mutex_unlock(&defaultPrefsPrivate->lock);
+
+               ok = SCDynamicStoreNotifyValue(defaultPrefsPrivate->session, defaultPrefsPrivate->sessionKeyApply);
+       }
+       CFRelease(defaultPrefs);
        if (!ok) {
                goto done;
        }
        if (!ok) {
                goto done;
        }
@@ -1725,11 +3119,6 @@ typedef struct {
 } BondStatusPrivate, * BondStatusPrivateRef;
 
 
 } BondStatusPrivate, * BondStatusPrivateRef;
 
 
-const CFStringRef kSCBondStatusDeviceAggregationStatus = CFSTR("AggregationStatus");
-const CFStringRef kSCBondStatusDeviceCollecting                = CFSTR("Collecting");
-const CFStringRef kSCBondStatusDeviceDistributing      = CFSTR("Distributing");
-
-
 static CFStringRef     __BondStatusCopyDescription     (CFTypeRef cf);
 static void            __BondStatusDeallocate          (CFTypeRef cf);
 static Boolean         __BondStatusEqual               (CFTypeRef cf1, CFTypeRef cf2);
 static CFStringRef     __BondStatusCopyDescription     (CFTypeRef cf);
 static void            __BondStatusDeallocate          (CFTypeRef cf);
 static Boolean         __BondStatusEqual               (CFTypeRef cf1, CFTypeRef cf2);
@@ -1751,7 +3140,7 @@ static const CFRuntimeClass __BondStatusClass = {
 static CFTypeID                __kBondStatusTypeID     = _kCFRuntimeNotATypeID;
 
 
 static CFTypeID                __kBondStatusTypeID     = _kCFRuntimeNotATypeID;
 
 
-static pthread_once_t  bondStatus_init         = PTHREAD_ONCE_INIT;
+static pthread_once_t  bondStatus_init_X       = PTHREAD_ONCE_INIT;
 
 
 static CFStringRef
 
 
 static CFStringRef
@@ -1827,7 +3216,7 @@ isA_BondStatus(CFTypeRef obj)
 CFTypeID
 BondStatusGetTypeID(void)
 {
 CFTypeID
 BondStatusGetTypeID(void)
 {
-       pthread_once(&bondStatus_init, __BondStatusInitialize); /* initialize runtime */
+       pthread_once(&bondStatus_init_X, __BondStatusInitialize);       /* initialize runtime */
        return __kBondStatusTypeID;
 }
 
        return __kBondStatusTypeID;
 }
 
@@ -1842,7 +3231,7 @@ __BondStatusCreatePrivate(CFAllocatorRef  allocator,
        uint32_t                size;
 
        /* initialize runtime */
        uint32_t                size;
 
        /* initialize runtime */
-       pthread_once(&bondStatus_init, __BondStatusInitialize);
+       pthread_once(&bondStatus_init_X, __BondStatusInitialize);
 
        /* allocate bond */
        size          = sizeof(BondStatusPrivate) - sizeof(CFRuntimeBase);
 
        /* allocate bond */
        size          = sizeof(BondStatusPrivate) - sizeof(CFRuntimeBase);
@@ -1871,9 +3260,9 @@ BondInterfaceCopyStatus(BondInterfaceRef bond)
        BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)bond;
        int                     bond_if_active;
        int                     bond_if_status;
        BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)bond;
        int                     bond_if_active;
        int                     bond_if_status;
-       char                    bond_ifname[IFNAMSIZ + 1];
        CFIndex                 i;
        struct if_bond_status_req *ibsr_p = NULL;
        CFIndex                 i;
        struct if_bond_status_req *ibsr_p = NULL;
+       char                    if_name[IFNAMSIZ + 1];
        CFIndex                 n;
        CFNumberRef             num;
        int                     s;
        CFIndex                 n;
        CFNumberRef             num;
        int                     s;
@@ -1887,14 +3276,16 @@ BondInterfaceCopyStatus(BondInterfaceRef bond)
        }
 
        s = inet_dgram_socket();
        }
 
        s = inet_dgram_socket();
-       if (s < 0) {
+       if (s == -1) {
+               _SCErrorSet(errno);
                goto done;
        }
                goto done;
        }
-       _SC_cfstring_to_cstring(bondPrivate->ifname, bond_ifname,
-                               sizeof(bond_ifname), kCFStringEncodingASCII);
-       (void)siocgifmedia(s, bond_ifname, &bond_if_status, &bond_if_active);
-       ibsr_p = if_bond_status_req_copy(s, bond_ifname);
+       _SC_cfstring_to_cstring(bondPrivate->ifname, if_name,
+                               sizeof(if_name), kCFStringEncodingASCII);
+       (void)siocgifmedia(s, if_name, &bond_if_status, &bond_if_active);
+       ibsr_p = if_bond_status_req_copy(s, if_name);
        if (ibsr_p == NULL) {
        if (ibsr_p == NULL) {
+               _SCErrorSet(errno);
                goto done;
        }
        status_interface = CFDictionaryCreateMutable(NULL,
                goto done;
        }
        status_interface = CFDictionaryCreateMutable(NULL,
@@ -1939,9 +3330,9 @@ BondInterfaceCopyStatus(BondInterfaceRef bond)
                        }
                }
                else {
                        }
                }
                else {
-                       int             active = 0;
-                       int             status = 0;
-                       lacp_system     zeroes = {{0,0,0,0,0,0}};
+                       int                     active = 0;
+                       int                     status = 0;
+                       static lacp_system      zeroes = {{0,0,0,0,0,0}};
 
                        (void)siocgifmedia(s, scan_p->ibs_if_name, &status, &active);
                        if ((status & IFM_AVALID) == 0 || (status & IFM_ACTIVE) == 0
 
                        (void)siocgifmedia(s, scan_p->ibs_if_name, &status, &active);
                        if ((status & IFM_AVALID) == 0 || (status & IFM_ACTIVE) == 0
@@ -1982,7 +3373,7 @@ BondInterfaceCopyStatus(BondInterfaceRef bond)
        CFRelease(status_interface);
        CFRelease(status_devices);
  done:
        CFRelease(status_interface);
        CFRelease(status_devices);
  done:
-       if (s >= 0) {
+       if (s != -1) {
                close(s);
        }
        if (ibsr_p != NULL) {
                close(s);
        }
        if (ibsr_p != NULL) {
@@ -1992,9 +3383,6 @@ BondInterfaceCopyStatus(BondInterfaceRef bond)
 }
 
 
 }
 
 
-#define        N_QUICK 16
-
-
 CFArrayRef
 BondStatusGetDevices(BondStatusRef bondStatus)
 {
 CFArrayRef
 BondStatusGetDevices(BondStatusRef bondStatus)
 {
index 156ebd3060e9aff3a702adc2edfc480ab74e295a..bcf06b1544fc33cc6bd2a9289ce58152f71d32be 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -42,106 +42,83 @@ typedef const struct __BondPreferences *   BondPreferencesRef;
 typedef const struct __BondStatus *            BondStatusRef;
 
 
 typedef const struct __BondStatus *            BondStatusRef;
 
 
-enum {
-       kSCBondStatusOK                 = 0,    /* enabled, active, running, ... */
-       kSCBondStatusLinkInvalid        = 1,    /* The link state was not valid (i.e. down, half-duplex, wrong speed) */
-       kSCBondStatusNoPartner          = 2,    /* The port on the switch that the device is connected doesn't seem to have 802.3ad Link Aggregation enabled */
-       kSCBondStatusNotInActiveGroup   = 3,    /* We're talking to a partner, but the link aggregation group is different from the one that's active */
-       kSCBondStatusUnknown            = 999   /* Non-specific failure */
-};
-
-extern const CFStringRef kSCBondStatusDeviceAggregationStatus  /* CFNumber */          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-extern const CFStringRef kSCBondStatusDeviceCollecting         /* CFNumber (0 or 1) */ AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-extern const CFStringRef kSCBondStatusDeviceDistributing       /* CFNumber (0 or 1) */ AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-
 __BEGIN_DECLS
 
 // ----------
 
 __BEGIN_DECLS
 
 // ----------
 
-extern const CFStringRef kSCNetworkInterfaceTypeBOND;
-
-Boolean
-SCNetworkInterfaceSupportsBonding      (SCNetworkInterfaceRef  interface)              AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-SCNetworkInterfaceRef
-SCNetworkInterfaceCreateWithBond       (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-// ----------
-
 Boolean
 Boolean
-IsBondSupported                                (CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;      // e.g. "en0", "en1", ...
+IsBondSupported                                (CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. "en0", "en1", ...
 
 // ----------
 
 CFTypeID
 
 // ----------
 
 CFTypeID
-BondInterfaceGetTypeID                 (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondInterfaceGetTypeID                 (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 CFStringRef
 
 CFStringRef
-BondInterfaceGetInterface              (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;      // returns "bond0", "bond1", ...
+BondInterfaceGetInterface              (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // returns "bond0", "bond1", ...
 
 CFArrayRef /* of CFStringRef's */
 
 CFArrayRef /* of CFStringRef's */
-BondInterfaceGetDevices                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondInterfaceGetDevices                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 CFDictionaryRef
 
 CFDictionaryRef
-BondInterfaceGetOptions                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;      // e.g. UserDefinedName, ...
+BondInterfaceGetOptions                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. UserDefinedName, ...
 
 // ----------
 
 CFTypeID
 
 // ----------
 
 CFTypeID
-BondPreferencesGetTypeID               (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondPreferencesGetTypeID               (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 BondPreferencesRef
 
 BondPreferencesRef
-BondPreferencesCreate                  (CFAllocatorRef         allocator)              AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondPreferencesCreate                  (CFAllocatorRef         allocator)              AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 CFArrayRef /* of BondInterfaceRef's */
 
 CFArrayRef /* of BondInterfaceRef's */
-BondPreferencesCopyInterfaces          (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondPreferencesCopyInterfaces          (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 BondInterfaceRef
 
 BondInterfaceRef
-BondPreferencesCreateInterface         (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondPreferencesCreateInterface         (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 Boolean
 BondPreferencesRemoveInterface         (BondPreferencesRef     prefs,
 
 Boolean
 BondPreferencesRemoveInterface         (BondPreferencesRef     prefs,
-                                        BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                        BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 Boolean
 BondPreferencesAddDevice               (BondPreferencesRef     prefs,
                                         BondInterfaceRef       bond,
 
 Boolean
 BondPreferencesAddDevice               (BondPreferencesRef     prefs,
                                         BondInterfaceRef       bond,
-                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;      // e.g. "en0", "en1", ...
+                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. "en0", "en1", ...
 
 Boolean
 BondPreferencesRemoveDevice            (BondPreferencesRef     prefs,
                                         BondInterfaceRef       bond,
 
 Boolean
 BondPreferencesRemoveDevice            (BondPreferencesRef     prefs,
                                         BondInterfaceRef       bond,
-                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;      // e.g. "en0", "en1", ...
+                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. "en0", "en1", ...
 
 Boolean
 BondPreferencesSetOptions              (BondPreferencesRef     prefs,
                                         BondInterfaceRef       bond,
 
 Boolean
 BondPreferencesSetOptions              (BondPreferencesRef     prefs,
                                         BondInterfaceRef       bond,
-                                        CFDictionaryRef        newOptions)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                        CFDictionaryRef        newOptions)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 Boolean
 
 Boolean
-BondPreferencesCommitChanges           (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondPreferencesCommitChanges           (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 Boolean
 
 Boolean
-BondPreferencesApplyChanges            (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondPreferencesApplyChanges            (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 // ----------
 
 CFTypeID
 
 // ----------
 
 CFTypeID
-BondStatusGetTypeID                    (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondStatusGetTypeID                    (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 BondStatusRef
 
 BondStatusRef
-BondInterfaceCopyStatus                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondInterfaceCopyStatus                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 CFArrayRef
 
 CFArrayRef
-BondStatusGetDevices                   (BondStatusRef          bondStatus)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondStatusGetDevices                   (BondStatusRef          bondStatus)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 CFDictionaryRef
 
 CFDictionaryRef
-BondStatusGetInterfaceStatus           (BondStatusRef          bondStatus)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+BondStatusGetInterfaceStatus           (BondStatusRef          bondStatus)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 CFDictionaryRef
 BondStatusGetDeviceStatus              (BondStatusRef          bondStatus,
 
 CFDictionaryRef
 BondStatusGetDeviceStatus              (BondStatusRef          bondStatus,
-                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 __END_DECLS
 
 
 __END_DECLS
 
index 4b7fe4305c71c9606e8a2a45100bc365960eebd8..1eb7419a7fa903d747226d14195a87274b4d0798 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -26,8 +26,6 @@
 
 #include <AvailabilityMacros.h>
 #include <sys/cdefs.h>
 
 #include <AvailabilityMacros.h>
 #include <sys/cdefs.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/BondConfiguration.h>
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 
        @header BONDConfigurationPrivate
  */
 
        @header BONDConfigurationPrivate
  */
 
-
-#define BOND_PREFERENCES_ID    CFSTR("VirtualNetworkInterfaces.plist")
-
-
 __BEGIN_DECLS
 
 __BEGIN_DECLS
 
-CFArrayRef
-_BondPreferencesCopyActiveInterfaces   ();
-
-Boolean
-_BondPreferencesUpdateConfiguration    (BondPreferencesRef     prefs);
-
 __END_DECLS
 
 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
 __END_DECLS
 
 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
index 2adc1949a17fbccd84d31c3ebfd8e8e5689bee76..2a8b3907ea077ce81f564e0fdddf70cc3c702d14 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 5e0d0054e10a1758d904c1f1afab90898900bf8c..9f2e4ba0ded9723973d5a70c5bf9880e02beb724 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index b904d0f3ba024ba30f5b7a532ddc926bad545874..5b1f4372a2fe36add73e1b656a3f8f879b389f5c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -258,9 +258,9 @@ DeviceOnHoldGetStatus(DeviceOnHoldRef       device)
 {
        DeviceOnHoldPrivateRef  devicePrivate   = (DeviceOnHoldPrivateRef)device;
        int                     err;
 {
        DeviceOnHoldPrivateRef  devicePrivate   = (DeviceOnHoldPrivateRef)device;
        int                     err;
-       u_long                  link            = 1;
+       uint32_t                link            = 1;
        void                    *replyBuf;
        void                    *replyBuf;
-       u_long                  replyBufLen;
+       size_t                  replyBufLen;
        int32_t                 result          = -1;
 
        if (!device) {
        int32_t                 result          = -1;
 
        if (!device) {
@@ -297,9 +297,9 @@ DeviceOnHoldSuspend(DeviceOnHoldRef device)
 {
        DeviceOnHoldPrivateRef  devicePrivate   = (DeviceOnHoldPrivateRef)device;
        int                     err;
 {
        DeviceOnHoldPrivateRef  devicePrivate   = (DeviceOnHoldPrivateRef)device;
        int                     err;
-       u_long                  link            = 1;
+       uint32_t                link            = 1;
        void                    *replyBuf;
        void                    *replyBuf;
-       u_long                  replyBufLen;
+       size_t                  replyBufLen;
        Boolean                 result          = FALSE;
 
        if (!device) {
        Boolean                 result          = FALSE;
 
        if (!device) {
@@ -336,9 +336,9 @@ DeviceOnHoldResume(DeviceOnHoldRef  device)
 {
        DeviceOnHoldPrivateRef  devicePrivate   = (DeviceOnHoldPrivateRef)device;
        int                     err;
 {
        DeviceOnHoldPrivateRef  devicePrivate   = (DeviceOnHoldPrivateRef)device;
        int                     err;
-       u_long                  link            = 1;
+       uint32_t                link            = 1;
        void                    *replyBuf;
        void                    *replyBuf;
-       u_long                  replyBufLen;
+       size_t                  replyBufLen;
        Boolean                 result          = FALSE;
 
        if (!device) {
        Boolean                 result          = FALSE;
 
        if (!device) {
index 0d88c539558b1b25ead79f5d56c363e2a90a8a7f..1f1a3612f807d0e12060bcec0b428c6e19d87d99 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
diff --git a/SystemConfiguration.fproj/English.lproj/Localizable.strings b/SystemConfiguration.fproj/English.lproj/Localizable.strings
new file mode 100644 (file)
index 0000000..480aa33
Binary files /dev/null and b/SystemConfiguration.fproj/English.lproj/Localizable.strings differ
index 66ff790aaf2b83c9c2c4222264ada62effd738cc..1c9c12fce6b57f96ea0f6c9bf397693af2f1ee76 100644 (file)
Binary files a/SystemConfiguration.fproj/English.lproj/NetworkInterface.strings and b/SystemConfiguration.fproj/English.lproj/NetworkInterface.strings differ
index a54d77aa909b7a1d7bcc2c871068c0c248c2740e..9b342a72397c916873d115035229b41d64d429c7 100644 (file)
@@ -7,7 +7,7 @@
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.8.6</string>
+       <string>1.9.0</string>
 </dict>
 </plist>
 </dict>
 </plist>
index 4c92666b15878903373865f3a3d796835edc8f41..145c44bbdd2cfc58d8989158038f32ef33e35678 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -41,7 +41,8 @@
 #include <net/if_types.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <net/if_types.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCPrivate.h>             // for SCLog()
+#include <SystemConfiguration/SCPrivate.h>                     // for SCLog()
+#include "SCNetworkConfigurationInternal.h"    // for __SCNetworkInterfaceCreatePrivate
 #include <SystemConfiguration/SCValidation.h>
 
 #include <IOKit/IOKitLib.h>
 #include <SystemConfiguration/SCValidation.h>
 
 #include <IOKit/IOKitLib.h>
@@ -79,7 +80,7 @@ __freeMediaList(struct ifmediareq *ifm)
 
 
 static struct ifmediareq *
 
 
 static struct ifmediareq *
-__copyMediaList(CFStringRef interface)
+__copyMediaList(CFStringRef interfaceName)
 {
        struct ifmediareq       *ifm;
        Boolean                 ok      = FALSE;
 {
        struct ifmediareq       *ifm;
        Boolean                 ok      = FALSE;
@@ -88,8 +89,8 @@ __copyMediaList(CFStringRef interface)
        ifm = (struct ifmediareq *)CFAllocatorAllocate(NULL, sizeof(struct ifmediareq), 0);
        bzero((void *)ifm, sizeof(*ifm));
 
        ifm = (struct ifmediareq *)CFAllocatorAllocate(NULL, sizeof(struct ifmediareq), 0);
        bzero((void *)ifm, sizeof(*ifm));
 
-       if (_SC_cfstring_to_cstring(interface, ifm->ifm_name, sizeof(ifm->ifm_name), kCFStringEncodingASCII) == NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("could not convert inteface name"));
+       if (_SC_cfstring_to_cstring(interfaceName, ifm->ifm_name, sizeof(ifm->ifm_name), kCFStringEncodingASCII) == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("could not convert interface name"));
                goto done;
        }
 
                goto done;
        }
 
@@ -120,6 +121,7 @@ __copyMediaList(CFStringRef interface)
        if (!ok) {
                __freeMediaList(ifm);
                ifm = NULL;
        if (!ok) {
                __freeMediaList(ifm);
                ifm = NULL;
+               _SCErrorSet(kSCStatusFailed);
        }
        return ifm;
 }
        }
        return ifm;
 }
@@ -135,6 +137,12 @@ __createMediaDictionary(int media_options, Boolean filter)
        const struct ifmedia_description        *subtype_descriptions   = NULL;
        CFStringRef                             val;
 
        const struct ifmedia_description        *subtype_descriptions   = NULL;
        CFStringRef                             val;
 
+       if (filter &&
+           ((IFM_SUBTYPE(media_options) == IFM_NONE) ||
+            ((IFM_OPTIONS(media_options) & IFM_LOOP) != 0))) {
+               return NULL;    /* filter */
+       }
+
        switch (IFM_TYPE(media_options)) {
                case IFM_ETHER :
                        option_descriptions  = ifm_subtype_ethernet_option_descriptions;
        switch (IFM_TYPE(media_options)) {
                case IFM_ETHER :
                        option_descriptions  = ifm_subtype_ethernet_option_descriptions;
@@ -148,10 +156,6 @@ __createMediaDictionary(int media_options, Boolean filter)
                        return NULL;
        }
 
                        return NULL;
        }
 
-       if (filter && (IFM_SUBTYPE(media_options) == IFM_NONE)) {
-               return NULL;    /* filter */
-       }
-
        dict = CFDictionaryCreateMutable(NULL,
                                         0,
                                         &kCFTypeDictionaryKeyCallBacks,
        dict = CFDictionaryCreateMutable(NULL,
                                         0,
                                         &kCFTypeDictionaryKeyCallBacks,
@@ -190,11 +194,6 @@ __createMediaDictionary(int media_options, Boolean filter)
        options = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        while (IFM_OPTIONS(media_options) != 0) {
        options = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        while (IFM_OPTIONS(media_options) != 0) {
-               if (filter && (IFM_OPTIONS(media_options) & IFM_LOOP)) {
-                       media_options &= ~IFM_LOOP;     /* filter */
-                       continue;
-               }
-
                val = NULL;
                for (i = 0; !val && ifm_shared_option_descriptions[i].ifmt_string; i++) {
                        if (IFM_OPTIONS(media_options) & ifm_shared_option_descriptions[i].ifmt_word) {
                val = NULL;
                for (i = 0; !val && ifm_shared_option_descriptions[i].ifmt_string; i++) {
                        if (IFM_OPTIONS(media_options) & ifm_shared_option_descriptions[i].ifmt_word) {
@@ -232,7 +231,7 @@ __createMediaDictionary(int media_options, Boolean filter)
 
 
 int
 
 
 int
-__createMediaOptions(CFStringRef interface, CFDictionaryRef media_options)
+__createMediaOptions(CFStringRef interfaceName, CFDictionaryRef media_options)
 {
        CFIndex                                 i;
        struct ifmediareq                       *ifm;
 {
        CFIndex                                 i;
        struct ifmediareq                       *ifm;
@@ -247,7 +246,7 @@ __createMediaOptions(CFStringRef interface, CFDictionaryRef media_options)
 
        /* set type */
 
 
        /* set type */
 
-       ifm = __copyMediaList(interface);
+       ifm = __copyMediaList(interfaceName);
        if (ifm != NULL) {
                if (ifm->ifm_count > 0) {
                        ifm_new = IFM_TYPE(ifm->ifm_ulist[0]);
        if (ifm != NULL) {
                if (ifm->ifm_count > 0) {
                        ifm_new = IFM_TYPE(ifm->ifm_ulist[0]);
@@ -361,23 +360,36 @@ __createMediaOptions(CFStringRef interface, CFDictionaryRef media_options)
 
 
 Boolean
 
 
 Boolean
-NetworkInterfaceCopyMediaOptions(CFStringRef           interface,
-                                CFDictionaryRef        *current,
-                                CFDictionaryRef        *active,
-                                CFArrayRef             *available,
-                                Boolean                filter)
+SCNetworkInterfaceCopyMediaOptions(SCNetworkInterfaceRef       interface,
+                                  CFDictionaryRef              *current,
+                                  CFDictionaryRef              *active,
+                                  CFArrayRef                   *available,
+                                  Boolean                      filter)
 {
        int                     i;
        struct ifmediareq       *ifm;
 {
        int                     i;
        struct ifmediareq       *ifm;
+       CFStringRef             interfaceName;
 
 
-       ifm = __copyMediaList(interface);
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("no interface name"));
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       ifm = __copyMediaList(interfaceName);
        if (ifm == NULL) {
                return FALSE;
        }
 
        if (ifm == NULL) {
                return FALSE;
        }
 
-       if (active)     *active    = NULL;
-       if (current)    *current   = NULL;
-       if (available) {
+       if (active != NULL)     *active    = NULL;
+       if (current != NULL)    *current   = NULL;
+       if (available != NULL) {
                CFMutableArrayRef       media_options;
 
                media_options = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
                CFMutableArrayRef       media_options;
 
                media_options = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
@@ -385,15 +397,15 @@ NetworkInterfaceCopyMediaOptions(CFStringRef              interface,
                        CFDictionaryRef options;
 
                        options = __createMediaDictionary(ifm->ifm_ulist[i], filter);
                        CFDictionaryRef options;
 
                        options = __createMediaDictionary(ifm->ifm_ulist[i], filter);
-                       if (!options) {
+                       if (options == NULL) {
                                continue;
                        }
 
                                continue;
                        }
 
-                       if (active  && (*active == NULL)  && (ifm->ifm_active == ifm->ifm_ulist[i])) {
+                       if ((active != NULL)  && (*active == NULL)  && (ifm->ifm_active == ifm->ifm_ulist[i])) {
                                *active  = CFRetain(options);
                        }
 
                                *active  = CFRetain(options);
                        }
 
-                       if (current && (*current == NULL) && (ifm->ifm_current == ifm->ifm_ulist[i])) {
+                       if ((current != NULL) && (*current == NULL) && (ifm->ifm_current == ifm->ifm_ulist[i])) {
                                *current = CFRetain(options);
                        }
 
                                *current = CFRetain(options);
                        }
 
@@ -406,13 +418,13 @@ NetworkInterfaceCopyMediaOptions(CFStringRef              interface,
                *available = (CFArrayRef)media_options;
        }
 
                *available = (CFArrayRef)media_options;
        }
 
-       if (active  && (*active == NULL)) {
+       if ((active != NULL)  && (*active == NULL)) {
                *active = __createMediaDictionary(ifm->ifm_active, FALSE);
        }
 
                *active = __createMediaDictionary(ifm->ifm_active, FALSE);
        }
 
-       if (current && (*current == NULL)) {
-               if (active && (ifm->ifm_active == ifm->ifm_current)) {
-                       if (*active)    *current = CFRetain(active);
+       if ((current != NULL) && (*current == NULL)) {
+               if ((active != NULL) && (ifm->ifm_active == ifm->ifm_current)) {
+                       if (*active != NULL)    *current = CFRetain(*active);
                } else {
                        *current = __createMediaDictionary(ifm->ifm_current, FALSE);
                }
                } else {
                        *current = __createMediaDictionary(ifm->ifm_current, FALSE);
                }
@@ -424,13 +436,14 @@ NetworkInterfaceCopyMediaOptions(CFStringRef              interface,
 
 
 CFArrayRef
 
 
 CFArrayRef
-NetworkInterfaceCopyMediaSubTypes(CFArrayRef   available)
+SCNetworkInterfaceCopyMediaSubTypes(CFArrayRef available)
 {
        CFIndex                 i;
        CFIndex                 n;
        CFMutableArrayRef       subTypes;
 
        if (!isA_CFArray(available)) {
 {
        CFIndex                 i;
        CFIndex                 n;
        CFMutableArrayRef       subTypes;
 
        if (!isA_CFArray(available)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
                return NULL;
        }
 
@@ -459,6 +472,7 @@ NetworkInterfaceCopyMediaSubTypes(CFArrayRef        available)
        if (CFArrayGetCount(subTypes) == 0) {
                CFRelease(subTypes);
                subTypes = NULL;
        if (CFArrayGetCount(subTypes) == 0) {
                CFRelease(subTypes);
                subTypes = NULL;
+               _SCErrorSet(kSCStatusOK);
        }
 
        return subTypes;
        }
 
        return subTypes;
@@ -466,14 +480,15 @@ NetworkInterfaceCopyMediaSubTypes(CFArrayRef      available)
 
 
 CFArrayRef
 
 
 CFArrayRef
-NetworkInterfaceCopyMediaSubTypeOptions(CFArrayRef     available,
-                                       CFStringRef     subType)
+SCNetworkInterfaceCopyMediaSubTypeOptions(CFArrayRef   available,
+                                         CFStringRef   subType)
 {
        CFIndex                 i;
        CFIndex                 n;
        CFMutableArrayRef       subTypeOptions;
 
        if (!isA_CFArray(available)) {
 {
        CFIndex                 i;
        CFIndex                 n;
        CFMutableArrayRef       subTypeOptions;
 
        if (!isA_CFArray(available)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
                return NULL;
        }
 
@@ -508,6 +523,7 @@ NetworkInterfaceCopyMediaSubTypeOptions(CFArrayRef  available,
        if (CFArrayGetCount(subTypeOptions) == 0) {
                CFRelease(subTypeOptions);
                subTypeOptions = NULL;
        if (CFArrayGetCount(subTypeOptions) == 0) {
                CFRelease(subTypeOptions);
                subTypeOptions = NULL;
+               _SCErrorSet(kSCStatusOK);
        }
 
        return subTypeOptions;
        }
 
        return subTypeOptions;
@@ -606,28 +622,43 @@ __getMTULimits(char       ifr_name[IFNAMSIZ],
 
 
 Boolean
 
 
 Boolean
-NetworkInterfaceCopyMTU(CFStringRef    interface,
-                       int             *mtu_cur,
-                       int             *mtu_min,
-                       int             *mtu_max)
+SCNetworkInterfaceCopyMTU(SCNetworkInterfaceRef        interface,
+                         int                   *mtu_cur,
+                         int                   *mtu_min,
+                         int                   *mtu_max)
 {
        struct ifreq    ifr;
 {
        struct ifreq    ifr;
-       Boolean         ok      = FALSE;
-       int             sock    = -1;
+       CFStringRef     interfaceName;
+       Boolean         ok              = FALSE;
+       int             sock            = -1;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("no interface name"));
+               goto done;
+       }
 
        bzero((void *)&ifr, sizeof(ifr));
 
        bzero((void *)&ifr, sizeof(ifr));
-       if (_SC_cfstring_to_cstring(interface, ifr.ifr_name, sizeof(ifr.ifr_name), kCFStringEncodingASCII) == NULL) {
+       if (_SC_cfstring_to_cstring(interfaceName, ifr.ifr_name, sizeof(ifr.ifr_name), kCFStringEncodingASCII) == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("could not convert interface name"));
                SCLog(TRUE, LOG_ERR, CFSTR("could not convert interface name"));
+               _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
 
        sock = socket(AF_INET, SOCK_DGRAM, 0);
                goto done;
        }
 
        sock = socket(AF_INET, SOCK_DGRAM, 0);
-       if (sock < 0) {
+       if (sock == -1) {
+               _SCErrorSet(errno);
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
                goto done;
        }
 
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
                goto done;
        }
 
-       if (ioctl(sock, SIOCGIFMTU, (caddr_t)&ifr) < 0) {
+       if (ioctl(sock, SIOCGIFMTU, (caddr_t)&ifr) == -1) {
+               _SCErrorSet(errno);
 //             SCLog(TRUE, LOG_DEBUG, CFSTR("ioctl(SIOCGIFMTU) failed: %s"), strerror(errno));
                goto done;
        }
 //             SCLog(TRUE, LOG_DEBUG, CFSTR("ioctl(SIOCGIFMTU) failed: %s"), strerror(errno));
                goto done;
        }
@@ -650,8 +681,7 @@ NetworkInterfaceCopyMTU(CFStringRef interface,
                        if (mtu_max != NULL) {
                                *mtu_max = devmtu_p->ifdm_max;
                        }
                        if (mtu_max != NULL) {
                                *mtu_max = devmtu_p->ifdm_max;
                        }
-               }
-               else {
+               } else {
                        (void)__getMTULimits(ifr.ifr_name, mtu_min, mtu_max);
                }
        }
                        (void)__getMTULimits(ifr.ifr_name, mtu_min, mtu_max);
                }
        }
@@ -660,7 +690,234 @@ NetworkInterfaceCopyMTU(CFStringRef       interface,
 
     done :
 
 
     done :
 
-       if (sock >= 0)  (void)close(sock);
+       if (sock != -1) (void)close(sock);
+
+       return ok;
+}
+
+
+Boolean
+SCNetworkInterfaceSetMediaOptions(SCNetworkInterfaceRef        interface,
+                                 CFStringRef           subtype,
+                                 CFArrayRef            options)
+{
+       CFDictionaryRef         configuration;
+       CFMutableDictionaryRef  newConfiguration        = NULL;
+       Boolean                 ok                      = FALSE;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       configuration = SCNetworkInterfaceGetConfiguration(interface);
+       if (configuration == NULL) {
+               newConfiguration = CFDictionaryCreateMutable(NULL,
+                                                            0,
+                                                            &kCFTypeDictionaryKeyCallBacks,
+                                                            &kCFTypeDictionaryValueCallBacks);
+       } else {
+               newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration);
+               CFDictionaryRemoveValue(newConfiguration, kSCResvInactive);
+       }
+
+       if (subtype != NULL) {
+               CFArrayRef      available       = NULL;
+               CFArrayRef      config_options  = options;
+               CFArrayRef      subtypes        = NULL;
+               CFArrayRef      subtype_options = NULL;
+
+               if (options == NULL) {
+                       config_options = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
+               }
+
+               if (!SCNetworkInterfaceCopyMediaOptions(interface, NULL, NULL, &available, FALSE)) {
+                       SCLog(_sc_debug, LOG_DEBUG, CFSTR("media type / options not available"));
+                       goto checked;
+               }
+
+               if (available == NULL) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       goto checked;
+               }
+
+               subtypes = SCNetworkInterfaceCopyMediaSubTypes(available);
+               if ((subtypes == NULL) ||
+                   !CFArrayContainsValue(subtypes,
+                                        CFRangeMake(0, CFArrayGetCount(subtypes)),
+                                        subtype)) {
+                       SCLog(_sc_debug, LOG_DEBUG, CFSTR("media type not valid"));
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       goto checked;
+               }
+
+               subtype_options = SCNetworkInterfaceCopyMediaSubTypeOptions(available, subtype);
+               if ((subtype_options == NULL) ||
+                   !CFArrayContainsValue(subtype_options,
+                                         CFRangeMake(0, CFArrayGetCount(subtype_options)),
+                                         config_options)) {
+                       SCLog(_sc_debug, LOG_DEBUG, CFSTR("media options not valid for \"%@\""), subtype);
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       goto checked;
+               }
+
+               CFDictionarySetValue(newConfiguration, kSCPropNetEthernetMediaSubType, subtype);
+               CFDictionarySetValue(newConfiguration,
+                                    kSCPropNetEthernetMediaOptions,
+                                    (options != NULL) ? options : config_options);
+
+               ok = TRUE;
+
+           checked :
+
+               if (available       != NULL)    CFRelease(available);
+               if (subtypes        != NULL)    CFRelease(subtypes);
+               if (subtype_options != NULL)    CFRelease(subtype_options);
+               if (options         == NULL)    CFRelease(config_options);
+       } else if (options == NULL) {
+               CFDictionaryRemoveValue(newConfiguration, kSCPropNetEthernetMediaSubType);
+               CFDictionaryRemoveValue(newConfiguration, kSCPropNetEthernetMediaOptions);
+               if (CFDictionaryGetCount(newConfiguration) == 0) {
+                       CFRelease(newConfiguration);
+                       newConfiguration = NULL;
+               }
+               ok = TRUE;
+       } else {
+               SCLog(_sc_debug, LOG_DEBUG, CFSTR("media type must be specified with options"));
+               _SCErrorSet(kSCStatusInvalidArgument);
+       }
+
+       if (ok) {
+               ok = SCNetworkInterfaceSetConfiguration(interface, newConfiguration);
+       }
+
+       if (newConfiguration != NULL) CFRelease(newConfiguration);
+       return ok;
+}
+
+
+Boolean
+SCNetworkInterfaceSetMTU(SCNetworkInterfaceRef interface,
+                        int                    mtu)
+{
+       CFDictionaryRef         configuration;
+       int                     mtu_max;
+       int                     mtu_min;
+       CFMutableDictionaryRef  newConfiguration        = NULL;
+       Boolean                 ok                      = FALSE;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!SCNetworkInterfaceCopyMTU(interface, NULL, &mtu_min, &mtu_max)) {
+               SCLog(_sc_debug, LOG_DEBUG, CFSTR("MTU bounds not available"));
+               return FALSE;
+       }
+
+       configuration = SCNetworkInterfaceGetConfiguration(interface);
+       if (configuration == NULL) {
+               newConfiguration = CFDictionaryCreateMutable(NULL,
+                                                            0,
+                                                            &kCFTypeDictionaryKeyCallBacks,
+                                                            &kCFTypeDictionaryValueCallBacks);
+       } else {
+               newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration);
+               CFDictionaryRemoveValue(newConfiguration, kSCResvInactive);
+       }
+
+       if ((mtu >= mtu_min) && (mtu <= mtu_max)) {
+               CFNumberRef     num;
+
+               num = CFNumberCreate(NULL, kCFNumberIntType, &mtu);
+               CFDictionarySetValue(newConfiguration, kSCPropNetEthernetMTU, num);
+               CFRelease(num);
+               ok = TRUE;
+       } else if (mtu == 0) {
+               CFDictionaryRemoveValue(newConfiguration, kSCPropNetEthernetMTU);
+               if (CFDictionaryGetCount(newConfiguration) == 0) {
+                       CFRelease(newConfiguration);
+                       newConfiguration = NULL;
+               }
+               ok = TRUE;
+       } else {
+               SCLog(_sc_debug, LOG_DEBUG, CFSTR("MTU out of range"));
+               _SCErrorSet(kSCStatusInvalidArgument);
+       }
+
+       if (ok) {
+               ok = SCNetworkInterfaceSetConfiguration(interface, newConfiguration);
+       }
+
+       if (newConfiguration != NULL) CFRelease(newConfiguration);
+       return ok;
+}
+
 
 
+// XXXXX
+// XXXXX Remove the following SPIs as soon as we have migrated all
+// XXXXX internal users
+// XXXXX
+
+/* DEPRECATED */ Boolean
+NetworkInterfaceCopyMediaOptions(CFStringRef           interfaceName,
+                                CFDictionaryRef        *current,
+                                CFDictionaryRef        *active,
+                                CFArrayRef             *available,
+                                Boolean                filter)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       Boolean                         ok;
+
+       interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, NULL);
+       if (interfacePrivate == NULL) {
+               return FALSE;
+       }
+       interfacePrivate->entity_device = CFRetain(interfaceName);
+       ok = SCNetworkInterfaceCopyMediaOptions((SCNetworkInterfaceRef)interfacePrivate,
+                                               current,
+                                               active,
+                                               available,
+                                               filter);
+       CFRelease(interfacePrivate);
+       return ok;
+}
+
+
+/* DEPRECATED */ CFArrayRef
+NetworkInterfaceCopyMediaSubTypes(CFArrayRef   available)
+{
+       return SCNetworkInterfaceCopyMediaSubTypes(available);
+}
+
+
+/* DEPRECATED */ CFArrayRef
+NetworkInterfaceCopyMediaSubTypeOptions(CFArrayRef     available,
+                                       CFStringRef     subType)
+{
+       return SCNetworkInterfaceCopyMediaSubTypeOptions(available, subType);
+}
+
+
+/* DEPRECATED */ Boolean
+NetworkInterfaceCopyMTU(CFStringRef    interfaceName,
+                       int             *mtu_cur,
+                       int             *mtu_min,
+                       int             *mtu_max)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       Boolean                         ok;
+
+       interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, NULL);
+       if (interfacePrivate == NULL) {
+               return FALSE;
+       }
+       interfacePrivate->entity_device = CFRetain(interfaceName);
+       ok = SCNetworkInterfaceCopyMTU((SCNetworkInterfaceRef)interfacePrivate,
+                                      mtu_cur,
+                                      mtu_min,
+                                      mtu_max);
+       CFRelease(interfacePrivate);
        return ok;
 }
        return ok;
 }
index cb598fda7d92f3c36f9a6384f4f2860e5841fff5..95e9ef9a1f10c5b6f302b08b1c2f081d7f5a3814 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -62,7 +62,7 @@ NetworkInterfaceCopyMediaOptions(
                                 CFDictionaryRef        *active,
                                 CFArrayRef             *available,
                                 Boolean                filter
                                 CFDictionaryRef        *active,
                                 CFArrayRef             *available,
                                 Boolean                filter
-                                );
+                                )              AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 /*!
        @function NetworkInterfaceCopyMediaSubTypes
 
 /*!
        @function NetworkInterfaceCopyMediaSubTypes
@@ -76,10 +76,10 @@ NetworkInterfaceCopyMediaOptions(
 CFArrayRef
 NetworkInterfaceCopyMediaSubTypes(
                                  CFArrayRef            available
 CFArrayRef
 NetworkInterfaceCopyMediaSubTypes(
                                  CFArrayRef            available
-                                 );
+                                 )             AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 /*!
 
 /*!
-       @function NetworkInterfaceCopyMediaSubTypes
+       @function NetworkInterfaceCopyMediaSubTypeOptions
        @discussion For the provided interface configuration options and specific
                subtype, return a list of available media options.
        @param available The available options as returned by the
        @discussion For the provided interface configuration options and specific
                subtype, return a list of available media options.
        @param available The available options as returned by the
@@ -93,7 +93,7 @@ CFArrayRef
 NetworkInterfaceCopyMediaSubTypeOptions(
                                        CFArrayRef              available,
                                        CFStringRef             subType
 NetworkInterfaceCopyMediaSubTypeOptions(
                                        CFArrayRef              available,
                                        CFStringRef             subType
-                                       );
+                                       )       AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 /*!
        @function NetworkInterfaceCopyMTU
 
 /*!
        @function NetworkInterfaceCopyMTU
@@ -102,7 +102,7 @@ NetworkInterfaceCopyMediaSubTypeOptions(
        @param mtu_cur A pointer to memory that will be filled with the current
                MTU setting for the interface.
        @param mtu_min A pointer to memory that will be filled with the minimum
        @param mtu_cur A pointer to memory that will be filled with the current
                MTU setting for the interface.
        @param mtu_min A pointer to memory that will be filled with the minimum
-               MTU setting for the interface.  If negative, the minumum setting
+               MTU setting for the interface.  If negative, the minimum setting
                could not be determined.
        @param mtu_max A pointer to memory that will be filled with the maximum
                MTU setting for the interface.  If negative, the maximum setting
                could not be determined.
        @param mtu_max A pointer to memory that will be filled with the maximum
                MTU setting for the interface.  If negative, the maximum setting
@@ -116,7 +116,7 @@ NetworkInterfaceCopyMTU(
                        int             *mtu_cur,
                        int             *mtu_min,
                        int             *mtu_max
                        int             *mtu_cur,
                        int             *mtu_min,
                        int             *mtu_max
-                       );
+                       )                       AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 
 __END_DECLS
 
 
 __END_DECLS
index dad23e63b4cd16868c8f2c7e49bb2de66ebcd978..26856faaf76ce1d67f295c064fa9838d55c41cbb 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for generating the SCSchemaDefinitions.[ch] files
 #
 
 # Makefile for generating the SCSchemaDefinitions.[ch] files
 #
 
-all: SCSchemaDefinitions.h SCSchemaDefinitions.c
+all: SCSchemaDefinitions.h SCSchemaDefinitionsPrivate.h SCSchemaDefinitions.c
 
 /tmp/genSCPreferences: genSCPreferences.c Makefile
        cc -g -o /tmp/genSCPreferences genSCPreferences.c
 
 /tmp/genSCPreferences: genSCPreferences.c Makefile
        cc -g -o /tmp/genSCPreferences genSCPreferences.c
@@ -10,5 +10,8 @@ all: SCSchemaDefinitions.h SCSchemaDefinitions.c
 SCSchemaDefinitions.h: /tmp/genSCPreferences
        /tmp/genSCPreferences header    > SCSchemaDefinitions.h
 
 SCSchemaDefinitions.h: /tmp/genSCPreferences
        /tmp/genSCPreferences header    > SCSchemaDefinitions.h
 
+SCSchemaDefinitionsPrivate.h:  /tmp/genSCPreferences
+       /tmp/genSCPreferences private   > SCSchemaDefinitionsPrivate.h
+
 SCSchemaDefinitions.c: /tmp/genSCPreferences
        /tmp/genSCPreferences cfile     > SCSchemaDefinitions.c
 SCSchemaDefinitions.c: /tmp/genSCPreferences
        /tmp/genSCPreferences cfile     > SCSchemaDefinitions.c
index e75022be1feee273dcfc3118bb40c18864710787..3fb9a4c1fc0c9cd50179c72c8de1bdb31a110a32 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?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>Interface</key>
 <plist version="1.0">
 <dict>
        <key>Interface</key>
@@ -7,7 +7,26 @@
                <key>6to4-IPv4</key>
                <dict/>
                <key>Bluetooth</key>
                <key>6to4-IPv4</key>
                <dict/>
                <key>Bluetooth</key>
-               <dict/>
+               <dict>
+                       <key>ConnectionPersonality</key>
+                       <string>v.34 Personality</string>
+                       <key>ConnectionScript</key>
+                       <string>/Library/Modem Scripts/Apple Modems.ccl</string>
+                       <key>DataCompression</key>
+                       <integer>1</integer>
+                       <key>DeviceModel</key>
+                       <string>Apple Modem (v.34)</string>
+                       <key>DeviceVendor</key>
+                       <string>Apple</string>
+                       <key>DialMode</key>
+                       <string>WaitForDialTone</string>
+                       <key>ErrorCorrection</key>
+                       <integer>1</integer>
+                       <key>PulseDial</key>
+                       <integer>0</integer>
+                       <key>Speaker</key>
+                       <integer>1</integer>
+               </dict>
                <key>Bond</key>
                <dict/>
                <key>Ethernet</key>
                <key>Bond</key>
                <dict/>
                <key>Ethernet</key>
                <key>FireWire</key>
                <dict/>
                <key>IEEE80211</key>
                <key>FireWire</key>
                <dict/>
                <key>IEEE80211</key>
-               <dict/>
+               <dict>
+                       <key>JoinMode</key>
+                       <string>Automatic</string>
+               </dict>
                <key>IrDA</key>
                <dict/>
                <key>L2TP-IPv4</key>
                <dict/>
                <key>Modem</key>
                <dict>
                <key>IrDA</key>
                <dict/>
                <key>L2TP-IPv4</key>
                <dict/>
                <key>Modem</key>
                <dict>
+                       <key>ConnectionPersonality</key>
+                       <string>v.34 Personality</string>
                        <key>ConnectionScript</key>
                        <key>ConnectionScript</key>
-                       <string>Apple Internal 56K Modem (v.34)</string>
+                       <string>/Library/Modem Scripts/Apple Modems.ccl</string>
                        <key>DataCompression</key>
                        <integer>1</integer>
                        <key>DataCompression</key>
                        <integer>1</integer>
+                       <key>DeviceModel</key>
+                       <string>Apple Modem (v.34)</string>
+                       <key>DeviceVendor</key>
+                       <string>Apple</string>
                        <key>DialMode</key>
                        <string>WaitForDialTone</string>
                        <key>ErrorCorrection</key>
                        <key>DialMode</key>
                        <string>WaitForDialTone</string>
                        <key>ErrorCorrection</key>
@@ -46,8 +74,6 @@
                        <integer>1</integer>
                </dict>
                <key>PPP-Bluetooth</key>
                        <integer>1</integer>
                </dict>
                <key>PPP-Bluetooth</key>
-               <dict/>
-               <key>PPP-Ethernet</key>
                <dict>
                        <key>ACSPEnabled</key>
                        <integer>0</integer>
                <dict>
                        <key>ACSPEnabled</key>
                        <integer>0</integer>
                        <integer>0</integer>
                        <key>DialOnDemand</key>
                        <integer>0</integer>
                        <integer>0</integer>
                        <key>DialOnDemand</key>
                        <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
                        <key>DisconnectOnIdle</key>
                        <key>DisconnectOnIdle</key>
-                       <integer>0</integer>
+                       <integer>1</integer>
                        <key>DisconnectOnIdleTimer</key>
                        <key>DisconnectOnIdleTimer</key>
-                       <integer>1800</integer>
+                       <integer>600</integer>
                        <key>DisconnectOnLogout</key>
                        <integer>1</integer>
                        <key>DisconnectOnSleep</key>
                        <key>DisconnectOnLogout</key>
                        <integer>1</integer>
                        <key>DisconnectOnSleep</key>
                        <key>IdleReminderTimer</key>
                        <integer>1800</integer>
                        <key>LCPEchoEnabled</key>
                        <key>IdleReminderTimer</key>
                        <integer>1800</integer>
                        <key>LCPEchoEnabled</key>
+                       <integer>0</integer>
+                       <key>LCPEchoFailure</key>
+                       <integer>4</integer>
+                       <key>LCPEchoInterval</key>
+                       <integer>10</integer>
+                       <key>Logfile</key>
+                       <string>/var/log/ppp.log</string>
+                       <key>VerboseLogging</key>
+                       <integer>0</integer>
+               </dict>
+               <key>PPP-Ethernet</key>
+               <dict>
+                       <key>ACSPEnabled</key>
+                       <integer>0</integer>
+                       <key>CommUseTerminalScript</key>
+                       <integer>0</integer>
+                       <key>DialOnDemand</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnIdle</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnIdleTimer</key>
+                       <integer>1800</integer>
+                       <key>DisconnectOnLogout</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnSleep</key>
+                       <integer>1</integer>
+                       <key>IdleReminder</key>
+                       <integer>0</integer>
+                       <key>IdleReminderTimer</key>
+                       <integer>1800</integer>
+                       <key>LCPEchoEnabled</key>
                        <integer>1</integer>
                        <key>LCPEchoFailure</key>
                        <integer>4</integer>
                        <integer>1</integer>
                        <key>LCPEchoFailure</key>
                        <integer>4</integer>
                        <integer>0</integer>
                </dict>
                <key>PPP-IEEE80211</key>
                        <integer>0</integer>
                </dict>
                <key>PPP-IEEE80211</key>
+               <dict>
+                       <key>ACSPEnabled</key>
+                       <integer>0</integer>
+                       <key>CommUseTerminalScript</key>
+                       <integer>0</integer>
+                       <key>DialOnDemand</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnIdle</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnIdleTimer</key>
+                       <integer>1800</integer>
+                       <key>DisconnectOnLogout</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnSleep</key>
+                       <integer>1</integer>
+                       <key>IdleReminder</key>
+                       <integer>0</integer>
+                       <key>IdleReminderTimer</key>
+                       <integer>1800</integer>
+                       <key>LCPEchoEnabled</key>
+                       <integer>1</integer>
+                       <key>LCPEchoFailure</key>
+                       <integer>4</integer>
+                       <key>LCPEchoInterval</key>
+                       <integer>10</integer>
+                       <key>Logfile</key>
+                       <string>/var/log/ppp.log</string>
+                       <key>VerboseLogging</key>
+                       <integer>0</integer>
+               </dict>
+               <key>PPP-IrDA</key>
                <dict>
                        <key>ACSPEnabled</key>
                        <integer>0</integer>
                <dict>
                        <key>ACSPEnabled</key>
                        <integer>0</integer>
                        <integer>0</integer>
                        <key>DialOnDemand</key>
                        <integer>0</integer>
                        <integer>0</integer>
                        <key>DialOnDemand</key>
                        <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
                        <key>DisconnectOnIdle</key>
                        <key>DisconnectOnIdle</key>
-                       <integer>0</integer>
+                       <integer>1</integer>
                        <key>DisconnectOnIdleTimer</key>
                        <key>DisconnectOnIdleTimer</key>
-                       <integer>1800</integer>
+                       <integer>600</integer>
                        <key>DisconnectOnLogout</key>
                        <integer>1</integer>
                        <key>DisconnectOnSleep</key>
                        <key>DisconnectOnLogout</key>
                        <integer>1</integer>
                        <key>DisconnectOnSleep</key>
                        <key>VerboseLogging</key>
                        <integer>0</integer>
                </dict>
                        <key>VerboseLogging</key>
                        <integer>0</integer>
                </dict>
-               <key>PPP-IrDA</key>
-               <dict/>
                <key>PPP-L2TP</key>
                <key>PPP-L2TP</key>
-               <dict/>
+               <dict>
+                       <key>ACSPEnabled</key>
+                       <integer>1</integer>
+                       <key>CommDisplayTerminalWindow</key>
+                       <integer>0</integer>
+                       <key>CommRedialCount</key>
+                       <integer>1</integer>
+                       <key>CommRedialEnabled</key>
+                       <integer>0</integer>
+                       <key>CommRedialInterval</key>
+                       <integer>5</integer>
+                       <key>CommUseTerminalScript</key>
+                       <integer>0</integer>
+                       <key>DialOnDemand</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnIdle</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnIdleTimer</key>
+                       <integer>600</integer>
+                       <key>DisconnectOnLogout</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnSleep</key>
+                       <integer>0</integer>
+                       <key>IPCPCompressionVJ</key>
+                       <integer>0</integer>
+                       <key>IdleReminder</key>
+                       <integer>0</integer>
+                       <key>IdleReminderTimer</key>
+                       <integer>1800</integer>
+                       <key>LCPEchoEnabled</key>
+                       <integer>1</integer>
+                       <key>LCPEchoFailure</key>
+                       <integer>15</integer>
+                       <key>LCPEchoInterval</key>
+                       <integer>20</integer>
+                       <key>Logfile</key>
+                       <string>/var/log/ppp.log</string>
+                       <key>VerboseLogging</key>
+                       <integer>0</integer>
+               </dict>
                <key>PPP-Modem</key>
                <dict>
                        <key>ACSPEnabled</key>
                <key>PPP-Modem</key>
                <dict>
                        <key>ACSPEnabled</key>
                        <integer>0</integer>
                        <key>DialOnDemand</key>
                        <integer>0</integer>
                        <integer>0</integer>
                        <key>DialOnDemand</key>
                        <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
                        <key>DisconnectOnIdle</key>
                        <integer>1</integer>
                        <key>DisconnectOnIdleTimer</key>
                        <key>DisconnectOnIdle</key>
                        <integer>1</integer>
                        <key>DisconnectOnIdleTimer</key>
                        <integer>0</integer>
                </dict>
                <key>PPP-PPTP</key>
                        <integer>0</integer>
                </dict>
                <key>PPP-PPTP</key>
-               <dict/>
+               <dict>
+                       <key>ACSPEnabled</key>
+                       <integer>1</integer>
+                       <key>CCPEnabled</key>
+                       <integer>1</integer>
+                       <key>CommDisplayTerminalWindow</key>
+                       <integer>0</integer>
+                       <key>CommRedialCount</key>
+                       <integer>1</integer>
+                       <key>CommRedialEnabled</key>
+                       <integer>0</integer>
+                       <key>CommRedialInterval</key>
+                       <integer>5</integer>
+                       <key>CommUseTerminalScript</key>
+                       <integer>0</integer>
+                       <key>DialOnDemand</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnIdle</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnIdleTimer</key>
+                       <integer>600</integer>
+                       <key>DisconnectOnLogout</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnSleep</key>
+                       <integer>0</integer>
+                       <key>IPCPCompressionVJ</key>
+                       <integer>0</integer>
+                       <key>IdleReminder</key>
+                       <integer>0</integer>
+                       <key>IdleReminderTimer</key>
+                       <integer>1800</integer>
+                       <key>LCPEchoEnabled</key>
+                       <integer>1</integer>
+                       <key>LCPEchoFailure</key>
+                       <integer>15</integer>
+                       <key>LCPEchoInterval</key>
+                       <integer>20</integer>
+                       <key>Logfile</key>
+                       <string>/var/log/ppp.log</string>
+                       <key>VerboseLogging</key>
+                       <integer>0</integer>
+               </dict>
                <key>PPP-Serial</key>
                <key>PPP-Serial</key>
-               <dict/>
+               <dict>
+                       <key>ACSPEnabled</key>
+                       <integer>0</integer>
+                       <key>CommDisplayTerminalWindow</key>
+                       <integer>0</integer>
+                       <key>CommRedialCount</key>
+                       <integer>1</integer>
+                       <key>CommRedialEnabled</key>
+                       <integer>1</integer>
+                       <key>CommRedialInterval</key>
+                       <integer>5</integer>
+                       <key>CommUseTerminalScript</key>
+                       <integer>0</integer>
+                       <key>DialOnDemand</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnIdle</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnIdleTimer</key>
+                       <integer>600</integer>
+                       <key>DisconnectOnLogout</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnSleep</key>
+                       <integer>1</integer>
+                       <key>IPCPCompressionVJ</key>
+                       <integer>1</integer>
+                       <key>IdleReminder</key>
+                       <integer>0</integer>
+                       <key>IdleReminderTimer</key>
+                       <integer>1800</integer>
+                       <key>LCPEchoEnabled</key>
+                       <integer>1</integer>
+                       <key>LCPEchoFailure</key>
+                       <integer>4</integer>
+                       <key>LCPEchoInterval</key>
+                       <integer>10</integer>
+                       <key>Logfile</key>
+                       <string>/var/log/ppp.log</string>
+                       <key>VerboseLogging</key>
+                       <integer>0</integer>
+               </dict>
+               <key>PPP-WWAN</key>
+               <dict>
+                       <key>ACSPEnabled</key>
+                       <integer>0</integer>
+                       <key>CommDisplayTerminalWindow</key>
+                       <integer>0</integer>
+                       <key>CommRedialCount</key>
+                       <integer>1</integer>
+                       <key>CommRedialEnabled</key>
+                       <integer>1</integer>
+                       <key>CommRedialInterval</key>
+                       <integer>5</integer>
+                       <key>CommUseTerminalScript</key>
+                       <integer>0</integer>
+                       <key>DialOnDemand</key>
+                       <integer>0</integer>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnIdle</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnIdleTimer</key>
+                       <integer>600</integer>
+                       <key>DisconnectOnLogout</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnSleep</key>
+                       <integer>1</integer>
+                       <key>IPCPCompressionVJ</key>
+                       <integer>1</integer>
+                       <key>IdleReminder</key>
+                       <integer>0</integer>
+                       <key>IdleReminderTimer</key>
+                       <integer>1800</integer>
+                       <key>LCPEchoEnabled</key>
+                       <integer>0</integer>
+                       <key>LCPEchoFailure</key>
+                       <integer>4</integer>
+                       <key>LCPEchoInterval</key>
+                       <integer>10</integer>
+                       <key>Logfile</key>
+                       <string>/var/log/ppp.log</string>
+                       <key>VerboseLogging</key>
+                       <integer>0</integer>
+               </dict>
                <key>PPTP-IPv4</key>
                <dict/>
                <key>Serial</key>
                <dict/>
                <key>VLAN</key>
                <dict/>
                <key>PPTP-IPv4</key>
                <dict/>
                <key>Serial</key>
                <dict/>
                <key>VLAN</key>
                <dict/>
+               <key>WWAN</key>
+               <dict>
+                       <key>ConnectionScript</key>
+                       <string>/Library/Modem Scripts/WWAN Support</string>
+                       <key>DataCompression</key>
+                       <integer>1</integer>
+                       <key>DialMode</key>
+                       <string>WaitForDialTone</string>
+                       <key>ErrorCorrection</key>
+                       <integer>1</integer>
+                       <key>PulseDial</key>
+                       <integer>0</integer>
+                       <key>Speaker</key>
+                       <integer>1</integer>
+               </dict>
        </dict>
        <key>Protocol</key>
        <dict>
        </dict>
        <key>Protocol</key>
        <dict>
                        </dict>
                        <key>Proxies</key>
                        <dict>
                        </dict>
                        <key>Proxies</key>
                        <dict>
+                               <key>ExceptionsList</key>
+                               <array>
+                                       <string>*.local</string>
+                                       <string>169.254/16</string>
+                               </array>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                        <dict>
                                <key>ConfigMethod</key>
                                <string>Node</string>
                        <dict>
                                <key>ConfigMethod</key>
                                <string>Node</string>
+                               <key>__INACTIVE__</key>
+                               <true/>
                        </dict>
                        <key>DNS</key>
                        <dict/>
                        </dict>
                        <key>DNS</key>
                        <dict/>
                        </dict>
                        <key>Proxies</key>
                        <dict>
                        </dict>
                        <key>Proxies</key>
                        <dict>
+                               <key>ExceptionsList</key>
+                               <array>
+                                       <string>*.local</string>
+                                       <string>169.254/16</string>
+                               </array>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                        </dict>
                        <key>Proxies</key>
                        <dict>
                        </dict>
                        <key>Proxies</key>
                        <dict>
+                               <key>ExceptionsList</key>
+                               <array>
+                                       <string>*.local</string>
+                                       <string>169.254/16</string>
+                               </array>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                        <dict>
                                <key>ConfigMethod</key>
                                <string>Node</string>
                        <dict>
                                <key>ConfigMethod</key>
                                <string>Node</string>
+                               <key>__INACTIVE__</key>
+                               <true/>
                        </dict>
                        <key>DNS</key>
                        <dict/>
                        </dict>
                        <key>DNS</key>
                        <dict/>
                        </dict>
                        <key>Proxies</key>
                        <dict>
                        </dict>
                        <key>Proxies</key>
                        <dict>
+                               <key>ExceptionsList</key>
+                               <array>
+                                       <string>*.local</string>
+                                       <string>169.254/16</string>
+                               </array>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                                <integer>1</integer>
                        </dict>
                </dict>
                                <integer>1</integer>
                        </dict>
                </dict>
+               <key>PPP-IEEE80211</key>
+               <dict>
+                       <key>DNS</key>
+                       <dict/>
+                       <key>IPv4</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>PPP</string>
+                       </dict>
+                       <key>IPv6</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>Automatic</string>
+                       </dict>
+                       <key>Proxies</key>
+                       <dict>
+                               <key>FTPPassive</key>
+                               <integer>1</integer>
+                       </dict>
+               </dict>
                <key>PPP-IrDA</key>
                <dict>
                        <key>DNS</key>
                <key>PPP-IrDA</key>
                <dict>
                        <key>DNS</key>
                                <integer>1</integer>
                        </dict>
                </dict>
                                <integer>1</integer>
                        </dict>
                </dict>
+               <key>PPP-WWAN</key>
+               <dict>
+                       <key>DNS</key>
+                       <dict/>
+                       <key>IPv4</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>PPP</string>
+                       </dict>
+                       <key>IPv6</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>Automatic</string>
+                       </dict>
+                       <key>Proxies</key>
+                       <dict>
+                               <key>FTPPassive</key>
+                               <integer>1</integer>
+                       </dict>
+               </dict>
                <key>PPTP-IPv4</key>
                <dict/>
                <key>PPTP-L2TP</key>
                <key>PPTP-IPv4</key>
                <dict/>
                <key>PPTP-L2TP</key>
                        </dict>
                        <key>Proxies</key>
                        <dict>
                        </dict>
                        <key>Proxies</key>
                        <dict>
+                               <key>ExceptionsList</key>
+                               <array>
+                                       <string>*.local</string>
+                                       <string>169.254/16</string>
+                               </array>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
                                <key>FTPPassive</key>
                                <integer>1</integer>
                        </dict>
index 188bfaaa328667b9dd422d5a5ce150d67af661db..797571d2b14acd69a89246dcc1d542e9e21b2301 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -33,7 +33,9 @@
 
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 
 #include <mach/mach.h>
 #include <mach/mach_error.h>
+#include <servers/bootstrap.h>
 #include <pthread.h>
 #include <pthread.h>
+#include <sys/time.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
@@ -64,7 +66,7 @@ static const struct sc_errmsg {
        { kSCStatusNoPrefsSession,      "Preference session not active" },
        { kSCStatusNotifierActive,      "Notifier is currently active" },
        { kSCStatusOK,                  "Success!" },
        { kSCStatusNoPrefsSession,      "Preference session not active" },
        { kSCStatusNotifierActive,      "Notifier is currently active" },
        { kSCStatusOK,                  "Success!" },
-       { kSCStatusPrefsBusy,           "Configuration daemon busy" },
+       { kSCStatusPrefsBusy,           "Preferences update currently in progress" },
        { kSCStatusReachabilityUnknown, "Network reachability cannot be determined" },
        { kSCStatusStale,               "Write attempted on stale version of object" },
 };
        { kSCStatusReachabilityUnknown, "Network reachability cannot be determined" },
        { kSCStatusStale,               "Write attempted on stale version of object" },
 };
@@ -344,8 +346,8 @@ __SCLog(int level, CFStringRef formatString, va_list formatArguments)
 
                        line = CFStringCreateExternalRepresentation(NULL,
                                                                    CFArrayGetValueAtIndex(lines, i),
 
                        line = CFStringCreateExternalRepresentation(NULL,
                                                                    CFArrayGetValueAtIndex(lines, i),
-                                                                   kCFStringEncodingMacRoman,
-                                                                   '?');
+                                                                   kCFStringEncodingUTF8,
+                                                                   (UInt8)'?');
                        if (line) {
                                syslog (level, "%.*s", (int)CFDataGetLength(line), CFDataGetBytePtr(line));
                                CFRelease(line);
                        if (line) {
                                syslog (level, "%.*s", (int)CFDataGetLength(line), CFDataGetBytePtr(line));
                                CFRelease(line);
@@ -380,8 +382,8 @@ __SCPrint(FILE *stream, CFStringRef formatString, va_list formatArguments, Boole
 
        line = CFStringCreateExternalRepresentation(NULL,
                                                    str,
 
        line = CFStringCreateExternalRepresentation(NULL,
                                                    str,
-                                                   kCFStringEncodingMacRoman,
-                                                   '?');
+                                                   kCFStringEncodingUTF8,
+                                                   (UInt8)'?');
        CFRelease(str);
        if (!line) {
                return;
        CFRelease(str);
        if (!line) {
                return;
@@ -389,18 +391,17 @@ __SCPrint(FILE *stream, CFStringRef formatString, va_list formatArguments, Boole
 
        pthread_mutex_lock(&lock);
        if (trace) {
 
        pthread_mutex_lock(&lock);
        if (trace) {
-               time_t          now     = time(NULL);
-               struct tm       tm;
-
-               (void)localtime_r(&now, &tm);
-               fprintf(stream, "%2d:%02d:%02d %.*s%s",
-                       tm.tm_hour, tm.tm_min, tm.tm_sec,
-                       (int)CFDataGetLength(line), CFDataGetBytePtr(line),
-                       addNL ? "\n" : "");
-       } else {
-               fprintf(stream, "%.*s%s",
-                       (int)CFDataGetLength(line), CFDataGetBytePtr(line),
-                       addNL ? "\n" : "");
+               struct tm       tm_now;
+               struct timeval  tv_now;
+
+               (void)gettimeofday(&tv_now, NULL);
+               (void)localtime_r(&tv_now.tv_sec, &tm_now);
+               (void)fprintf(stream, "%2d:%02d:%02d.%03d ",
+                             tm_now.tm_hour, tm_now.tm_min, tm_now.tm_sec, tv_now.tv_usec / 1000);
+       }
+       (void)fwrite((const void *)CFDataGetBytePtr(line), (size_t)CFDataGetLength(line), 1, stream);
+       if (addNL) {
+               (void)fputc('\n', stream);
        }
        fflush (stream);
        pthread_mutex_unlock(&lock);
        }
        fflush (stream);
        pthread_mutex_unlock(&lock);
@@ -420,13 +421,14 @@ SCLog(Boolean condition, int level, CFStringRef formatString, ...)
        }
 
        va_start(formatArguments, formatString);
        }
 
        va_start(formatArguments, formatString);
-       if (_sc_log) {
+       if (_sc_log > 0) {
                __SCLog(level, formatString, formatArguments);
                __SCLog(level, formatString, formatArguments);
-       } else {
+       }
+       if (_sc_log != 1) {
                __SCPrint((LOG_PRI(level) > LOG_NOTICE) ? stderr : stdout,
                          formatString,
                          formatArguments,
                __SCPrint((LOG_PRI(level) > LOG_NOTICE) ? stderr : stdout,
                          formatString,
                          formatArguments,
-                         FALSE,                // trace
+                         (_sc_log > 0),        // trace
                          TRUE);                // add newline
        }
        va_end(formatArguments);
                          TRUE);                // add newline
        }
        va_end(formatArguments);
@@ -498,6 +500,9 @@ __SCThreadSpecificKeyInitialize()
 }
 
 
 }
 
 
+const CFStringRef kCFErrorDomainSystemConfiguration    = CFSTR("com.apple.SystemConfiguration");
+
+
 void
 _SCErrorSet(int error)
 {
 void
 _SCErrorSet(int error)
 {
@@ -517,8 +522,56 @@ _SCErrorSet(int error)
 }
 
 
 }
 
 
+CFErrorRef
+SCCopyLastError(void)
+{
+       CFStringRef                     domain;
+       CFErrorRef                      error;
+       int                             i;
+       int                             code;
+       __SCThreadSpecificDataRef       tsd;
+       CFMutableDictionaryRef          userInfo        = NULL;
+
+       pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize);
+
+       tsd = pthread_getspecific(tsDataKey);
+       code = tsd ? tsd->_sc_error : kSCStatusOK;
+
+       for (i = 0; i < (int)nSC_ERRMSGS; i++) {
+               if (sc_errmsgs[i].status == code) {
+                       CFStringRef     str;
+
+                       domain = kCFErrorDomainSystemConfiguration;
+                       userInfo = CFDictionaryCreateMutable(NULL,
+                                                            0,
+                                                            &kCFCopyStringDictionaryKeyCallBacks,
+                                                            &kCFTypeDictionaryValueCallBacks);
+                       str = CFStringCreateWithCString(NULL,
+                                                       sc_errmsgs[i].message,
+                                                       kCFStringEncodingASCII);
+                       CFDictionarySetValue(userInfo, kCFErrorDescriptionKey, str);
+                       CFRelease(str);
+                       goto done;
+               }
+       }
+
+       if ((code > 0) && (code <= ELAST)) {
+               domain = kCFErrorDomainPOSIX;
+               goto done;
+       }
+
+       domain = kCFErrorDomainMach;
+
+    done :
+    
+       error = CFErrorCreate(NULL, domain, code, userInfo);
+       if (userInfo != NULL) CFRelease(userInfo);
+       return error;
+}
+
+
 int
 int
-SCError()
+SCError(void)
 {
        __SCThreadSpecificDataRef       tsd;
 
 {
        __SCThreadSpecificDataRef       tsd;
 
@@ -544,5 +597,9 @@ SCErrorString(int status)
                return strerror(status);
        }
 
                return strerror(status);
        }
 
+       if ((status >= BOOTSTRAP_SUCCESS) && (status <= BOOTSTRAP_NO_MEMORY)) {
+               return bootstrap_strerror(status);
+       }
+
        return mach_error_string(status);
 }
        return mach_error_string(status);
 }
index 0e12fbb20e21028fc72aff1a43bd672ea12a3b6b..16b464fd9892ff1b1a6d76ea3a9c59f86c506891 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 5d6fc59e70407eb2c2fc783a5f4fa9e2395f2128..3a96c629b82fc51351aefef7993f3d84f2e24674 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - initial revision
  */
 
  * - initial revision
  */
 
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreFoundation/CFStringDefaultEncoding.h>    // for __CFStringGetUserDefaultEncoding
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
+
+#pragma mark ComputerName
+
+
 CFStringRef
 SCDynamicStoreKeyCreateComputerName(CFAllocatorRef allocator)
 {
 CFStringRef
 SCDynamicStoreKeyCreateComputerName(CFAllocatorRef allocator)
 {
@@ -137,10 +144,23 @@ SCPreferencesSetComputerName(SCPreferencesRef     prefs,
 
        CFDictionarySetValue(newDict, kSCPropSystemComputerName, name);
 
 
        CFDictionarySetValue(newDict, kSCPropSystemComputerName, name);
 
-       num = CFNumberCreate(NULL, kCFNumberIntType, &encoding);
+       num = CFNumberCreate(NULL, kCFNumberSInt32Type, &encoding);
        CFDictionarySetValue(newDict, kSCPropSystemComputerNameEncoding, num);
        CFRelease(num);
 
        CFDictionarySetValue(newDict, kSCPropSystemComputerNameEncoding, num);
        CFRelease(num);
 
+       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);
+               }
+       }
+
        ok = SCPreferencesPathSetValue(prefs, path, newDict);
 
        CFRelease(path);
        ok = SCPreferencesPathSetValue(prefs, path, newDict);
 
        CFRelease(path);
@@ -150,9 +170,8 @@ SCPreferencesSetComputerName(SCPreferencesRef       prefs,
 }
 
 
 }
 
 
-#ifndef        kSCPropNetHostName
-#define        kSCPropNetHostName      CFSTR("HostName")
-#endif
+#pragma mark -
+#pragma mark HostName
 
 
 CFStringRef
 
 
 CFStringRef
@@ -175,7 +194,7 @@ SCPreferencesGetHostName(SCPreferencesRef   prefs)
                return NULL;
        }
 
                return NULL;
        }
 
-       name = isA_CFString(CFDictionaryGetValue(dict, kSCPropNetHostName));
+       name = isA_CFString(CFDictionaryGetValue(dict, kSCPropSystemHostName));
        if (name == NULL) {
                _SCErrorSet(kSCStatusNoKey);
                return NULL;
        if (name == NULL) {
                _SCErrorSet(kSCStatusNoKey);
                return NULL;
@@ -225,9 +244,9 @@ SCPreferencesSetHostName(SCPreferencesRef   prefs,
        }
 
        if (name != NULL) {
        }
 
        if (name != NULL) {
-               CFDictionarySetValue(newDict, kSCPropNetHostName, name);
+               CFDictionarySetValue(newDict, kSCPropSystemHostName, name);
        } else {
        } else {
-               CFDictionaryRemoveValue(newDict, kSCPropNetHostName);
+               CFDictionaryRemoveValue(newDict, kSCPropSystemHostName);
        }
 
        if (CFDictionaryGetCount(newDict) > 0) {
        }
 
        if (CFDictionaryGetCount(newDict) > 0) {
@@ -243,6 +262,10 @@ SCPreferencesSetHostName(SCPreferencesRef  prefs,
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark LocalHostName
+
+
 CFStringRef
 SCDynamicStoreKeyCreateHostNames(CFAllocatorRef allocator)
 {
 CFStringRef
 SCDynamicStoreKeyCreateHostNames(CFAllocatorRef allocator)
 {
@@ -346,6 +369,7 @@ _SC_stringIsValidDNSName(const char *name)
        return TRUE;
 }
 
        return TRUE;
 }
 
+
 Boolean
 _SC_CFStringIsValidDNSName(CFStringRef name)
 {
 Boolean
 _SC_CFStringIsValidDNSName(CFStringRef name)
 {
@@ -435,3 +459,18 @@ SCPreferencesSetLocalHostName(SCPreferencesRef     prefs,
 
        return ok;
 }
 
        return ok;
 }
+
+
+Boolean
+_SC_CFStringIsValidNetBIOSName(CFStringRef name)
+{
+       if (!isA_CFString(name)) {
+               return FALSE;
+       }
+
+       if (CFStringGetLength(name) > 15) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
index c52d5ab71e0b473ab6972588d870221c27eda685..a2eb4ccafbae64d18048cdd565cf10cec08b73bb 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 8279699bf3c3b2b5340b60c0caf1e006e858b35d..c3f5d2222e0812ebba85cc2027ecac07f1b961b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 04a17df578a25b1ed7467beea17bc1e7c786840d..063ef9db622f2ded12448f7f4669bd7b5edadc6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index b3f139bcb5b73fd467559da68d29dbf3ba4a9d41..450f1b997cbe2ded76829804d125764df1474a97 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index d64572bf29087fa83c752098e0de62bf0da00274..aa1faefa97065fa6a71402c35444781108d359a1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -100,6 +100,18 @@ informCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
 }
 
 
 }
 
 
+static CFStringRef
+notifyMPCopyDescription(const void *info)
+{
+       SCDynamicStoreRef       store   = (SCDynamicStoreRef)info;
+
+       return CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("<SCDynamicStore notification MP> {store = %p}"),
+                                       store);
+}
+
+
 Boolean
 SCDynamicStoreNotifyCallback(SCDynamicStoreRef         store,
                             CFRunLoopRef               runLoop,
 Boolean
 SCDynamicStoreNotifyCallback(SCDynamicStoreRef         store,
                             CFRunLoopRef               runLoop,
@@ -115,7 +127,7 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef              store,
                                                  , (void *)store
                                                  , CFRetain
                                                  , CFRelease
                                                  , (void *)store
                                                  , CFRetain
                                                  , CFRelease
-                                                 , NULL
+                                                 , notifyMPCopyDescription
                                                  };
 
        if (store == NULL) {
                                                  };
 
        if (store == NULL) {
@@ -268,7 +280,7 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
                                                  , (void *)store
                                                  , CFRetain
                                                  , CFRelease
                                                  , (void *)store
                                                  , CFRetain
                                                  , CFRelease
-                                                 , NULL
+                                                 , notifyMPCopyDescription
                                                  };
                mach_port_t             oldNotify;
                mach_port_t             port;
                                                  };
                mach_port_t             oldNotify;
                mach_port_t             port;
@@ -474,6 +486,42 @@ rlsRelease(CFTypeRef cf)
 }
 
 
 }
 
 
+static CFStringRef
+rlsCopyDescription(const void *info)
+{
+       CFMutableStringRef      result;
+       SCDynamicStoreRef       store           = (SCDynamicStoreRef)info;
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
+
+       result = CFStringCreateMutable(NULL, 0);
+       CFStringAppendFormat(result, NULL, CFSTR("<SCDynamicStore RLS> {"));
+       CFStringAppendFormat(result, NULL, CFSTR("store = %p"), store);
+       if (storePrivate->notifyStatus == Using_NotifierInformViaRunLoop) {
+               CFStringRef     description     = NULL;
+
+               CFStringAppendFormat(result, NULL, CFSTR(", callout = %p"), storePrivate->rlsFunction);
+
+               if ((storePrivate->rlsContext.info != NULL) && (storePrivate->rlsContext.copyDescription != NULL)) {
+                       description = (*storePrivate->rlsContext.copyDescription)(storePrivate->rlsContext.info);
+               }
+               if (description == NULL) {
+                       description = CFStringCreateWithFormat(NULL, NULL, CFSTR("<SCDynamicStore context %p>"), storePrivate->rlsContext.info);
+               }
+               if (description == NULL) {
+                       description = CFRetain(CFSTR("<no description>"));
+               }
+               CFStringAppendFormat(result, NULL, CFSTR(", context = %@"), description);
+               CFRelease(description);
+       } else {
+               CFStringAppendFormat(result, NULL, CFSTR(", callout = %p"), storePrivate->callbackFunction);
+               CFStringAppendFormat(result, NULL, CFSTR(", info = %p"), storePrivate->callbackArgument);
+       }
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
+
+       return result;
+}
+
+
 CFRunLoopSourceRef
 SCDynamicStoreCreateRunLoopSource(CFAllocatorRef       allocator,
                                  SCDynamicStoreRef     store,
 CFRunLoopSourceRef
 SCDynamicStoreCreateRunLoopSource(CFAllocatorRef       allocator,
                                  SCDynamicStoreRef     store,
@@ -511,7 +559,7 @@ SCDynamicStoreCreateRunLoopSource(CFAllocatorRef    allocator,
                                                  , (void *)store       // info
                                                  , rlsRetain           // retain
                                                  , rlsRelease          // release
                                                  , (void *)store       // info
                                                  , rlsRetain           // retain
                                                  , rlsRelease          // release
-                                                 , CFCopyDescription   // copyDescription
+                                                 , rlsCopyDescription  // copyDescription
                                                  , CFEqual             // equal
                                                  , CFHash              // hash
                                                  , rlsSchedule         // schedule
                                                  , CFEqual             // equal
                                                  , CFHash              // hash
                                                  , rlsSchedule         // schedule
index 6e3521e290c1b79a343802c493b92a05a38756f7..54fac507e3a601e4af1c45227810f61dc6e14ad4 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 10b4aa0af0c5bc16c1858b6d4524894a908ee2a1..ded7a256a4269dd2314affe68ec239b0b81c8d19 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 96464a13a69ae2b46b8d830394ad413fd946325e..22986dcd815e5a593865edb2b54ca36ef66eaf49 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 5278a57da987c14a3c33623b62aa724aca57dc38..c392f44ee0a6af2d261cb79a220bc0bcb46b2a84 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index ad5626d48031d5557f84dbbccb0960af4c659e35..9ff03ff843cd3b9224618d3e8684c36eb6c12333 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 7597e93e265a7c8e34e68918146ccc77c21aac26..98ad13ddee2411eadef00c3fb6014c8cd362502b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 static mach_msg_id_t
 waitForMachMessage(mach_port_t port)
 {
 static mach_msg_id_t
 waitForMachMessage(mach_port_t port)
 {
-       kern_return_t           status;
-       mach_msg_empty_rcv_t    *buf;
+       union {
+               u_int8_t                buf[sizeof(mach_msg_empty_t) + MAX_TRAILER_SIZE];
+               mach_msg_empty_rcv_t    msg;
+       } notify_msg;
+       kern_return_t   status;
 
 
-       mach_msg_size_t         size = sizeof(mach_msg_empty_t) + MAX_TRAILER_SIZE;
-
-       status = vm_allocate(mach_task_self(), (vm_address_t *)&buf, size, TRUE);
-       if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("waitForMachMessage vm_allocate(): %s"), mach_error_string(status));
-               return -1;
-       }
-
-       status = mach_msg(&buf->header,                 /* msg */
+       status = mach_msg(&notify_msg.msg.header,       /* msg */
                          MACH_RCV_MSG,                 /* options */
                          0,                            /* send_size */
                          MACH_RCV_MSG,                 /* options */
                          0,                            /* send_size */
-                         size,                         /* rcv_size */
+                         sizeof(notify_msg),           /* rcv_size */
                          port,                         /* rcv_name */
                          MACH_MSG_TIMEOUT_NONE,        /* timeout */
                          MACH_PORT_NULL);              /* notify */
                          port,                         /* rcv_name */
                          MACH_MSG_TIMEOUT_NONE,        /* timeout */
                          MACH_PORT_NULL);              /* notify */
@@ -65,7 +60,7 @@ waitForMachMessage(mach_port_t port)
                return -1;
        }
 
                return -1;
        }
 
-       return buf->header.msgh_id;
+       return notify_msg.msg.header.msgh_id;
 }
 
 
 }
 
 
index c06615b8e425789f017c1676537dc024800241d9..14520e176344ebbc7bfe6ea05a3bd98dd8eaff6e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index aa66c3ec1888a525497a3eade4280ad7808eb5cf..8b2379fa967a047e8debed12055935a49b3b7fd9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -57,9 +57,9 @@ __SCDynamicStoreCopyDescription(CFTypeRef cf) {
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<SCDynamicStore %p [%p]> { "), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR("<SCDynamicStore %p [%p]> {"), cf, allocator);
        if (storePrivate->server != MACH_PORT_NULL) {
        if (storePrivate->server != MACH_PORT_NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR("server port=%d"), storePrivate->server);
+               CFStringAppendFormat(result, NULL, CFSTR("server port = %p"), storePrivate->server);
        } else {
                CFStringAppendFormat(result, NULL, CFSTR("server not (no longer) available"));
        }
        } else {
                CFStringAppendFormat(result, NULL, CFSTR("server not (no longer) available"));
        }
@@ -83,26 +83,26 @@ __SCDynamicStoreCopyDescription(CFTypeRef cf) {
                case Using_NotifierInformViaCallback :
                        if (storePrivate->notifyStatus == Using_NotifierInformViaRunLoop) {
                                CFStringAppendFormat(result, NULL, CFSTR(", runloop notifications"));
                case Using_NotifierInformViaCallback :
                        if (storePrivate->notifyStatus == Using_NotifierInformViaRunLoop) {
                                CFStringAppendFormat(result, NULL, CFSTR(", runloop notifications"));
-                               CFStringAppendFormat(result, NULL, CFSTR(" (func=0x%8.8x"), storePrivate->rlsFunction);
-                               CFStringAppendFormat(result, NULL, CFSTR(", info=0x%8.8x"), storePrivate->rlsContext.info);
-                               CFStringAppendFormat(result, NULL, CFSTR(", rls=0x%8.8x" ), storePrivate->rls);
-                               CFStringAppendFormat(result, NULL, CFSTR(", refs=%d"     ), storePrivate->rlsRefs);
+                               CFStringAppendFormat(result, NULL, CFSTR(" {callout = %p"), storePrivate->rlsFunction);
+                               CFStringAppendFormat(result, NULL, CFSTR(", info = %p"), storePrivate->rlsContext.info);
+                               CFStringAppendFormat(result, NULL, CFSTR(", rls = %p"), storePrivate->rls);
+                               CFStringAppendFormat(result, NULL, CFSTR(", refs = %d"), storePrivate->rlsRefs);
                        } else {
                                CFStringAppendFormat(result, NULL, CFSTR(", mach port/callback notifications"));
                        } else {
                                CFStringAppendFormat(result, NULL, CFSTR(", mach port/callback notifications"));
-                               CFStringAppendFormat(result, NULL, CFSTR(" (func=0x%8.8x"), storePrivate->callbackFunction);
-                               CFStringAppendFormat(result, NULL, CFSTR(", info=0x%8.8x"), storePrivate->callbackArgument);
+                               CFStringAppendFormat(result, NULL, CFSTR(" {callout = %p"), storePrivate->callbackFunction);
+                               CFStringAppendFormat(result, NULL, CFSTR(", info = %p"), storePrivate->callbackArgument);
                        }
                        if (storePrivate->callbackRLS != NULL) {
                        }
                        if (storePrivate->callbackRLS != NULL) {
-                               CFStringAppendFormat(result, NULL, CFSTR(", notify rls=%@" ), storePrivate->callbackRLS);
+                               CFStringAppendFormat(result, NULL, CFSTR(", notify rls = %@" ), storePrivate->callbackRLS);
                        }
                        }
-                       CFStringAppendFormat(result, NULL, CFSTR(")"));
+                       CFStringAppendFormat(result, NULL, CFSTR("}"));
                        break;
                default :
                        CFStringAppendFormat(result, NULL, CFSTR(", notification delivery not requested%s"),
                                             storePrivate->rlsFunction ? " (yet)" : "");
                        break;
        }
                        break;
                default :
                        CFStringAppendFormat(result, NULL, CFSTR(", notification delivery not requested%s"),
                                             storePrivate->rlsFunction ? " (yet)" : "");
                        break;
        }
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
        return result;
 }
@@ -185,7 +185,7 @@ static void
 childForkHandler()
 {
        /* the process has forked (and we are the child process) */
 childForkHandler()
 {
        /* the process has forked (and we are the child process) */
-       
+
        _sc_active = 0;
        _sc_server = MACH_PORT_NULL;
 
        _sc_active = 0;
        _sc_server = MACH_PORT_NULL;
 
@@ -398,7 +398,7 @@ SCDynamicStoreCreateWithOptions(CFAllocatorRef              allocator,
        CFRelease(name);
 
        /* serialize the options */
        CFRelease(name);
 
        /* serialize the options */
-       if (storeOptions) {
+       if (storeOptions != NULL) {
                if (!_SCSerialize(storeOptions, &xmlOptions, (void **)&myOptionsRef, &myOptionsLen)) {
                        CFRelease(utfName);
                        goto done;
                if (!_SCSerialize(storeOptions, &xmlOptions, (void **)&myOptionsRef, &myOptionsLen)) {
                        CFRelease(utfName);
                        goto done;
index c14e62d42201a2483c746c48b37d02e3b68ad92f..4e685b6b611f4df4a7d4385824fe6145f453bcda 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -30,6 +30,7 @@
 
 #include <fcntl.h>
 #include <paths.h>
 
 #include <fcntl.h>
 #include <paths.h>
+#include <pwd.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <sysexits.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <sysexits.h>
@@ -42,6 +43,7 @@
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDPlugin.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDPlugin.h>
+#include <SystemConfiguration/SCPrivate.h>
 
 
 
 
 
 
@@ -108,10 +110,6 @@ unblockSignal()
 static void
 reaper(int sigraised)
 {
 static void
 reaper(int sigraised)
 {
-       mach_msg_empty_send_t   msg;
-       mach_msg_option_t       options;
-       kern_return_t           status;
-
        /*
         * block additional SIGCHLD's until current children have
         * been reaped.
        /*
         * block additional SIGCHLD's until current children have
         * been reaped.
@@ -122,22 +120,7 @@ reaper(int sigraised)
         * send message to indicate that at least one child is ready
         * to be reaped.
         */
         * send message to indicate that at least one child is ready
         * to be reaped.
         */
-       msg.header.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0);
-       msg.header.msgh_size = sizeof(msg);
-       msg.header.msgh_remote_port = CFMachPortGetPort(childReaped);
-       msg.header.msgh_local_port = MACH_PORT_NULL;
-       msg.header.msgh_id = 0;
-       options = MACH_SEND_TIMEOUT;
-       status = mach_msg(&msg.header,                  /* msg */
-                         MACH_SEND_MSG|options,        /* options */
-                         msg.header.msgh_size,         /* send_size */
-                         0,                            /* rcv_size */
-                         MACH_PORT_NULL,               /* rcv_name */
-                         0,                            /* timeout */
-                         MACH_PORT_NULL);              /* notify */
-       if (status == MACH_SEND_TIMED_OUT) {
-               mach_msg_destroy(&msg.header);
-       }
+       _SC_sendMachMessage(CFMachPortGetPort(childReaped), 0);
 
        return;
 }
 
        return;
 }
@@ -228,14 +211,28 @@ childrenReaped(CFMachPortRef port, void *msg, CFIndex size, void *info)
 }
 
 
 }
 
 
+static CFStringRef
+childReapedMPCopyDescription(const void *info)
+{
+       return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SIGCHLD MP>"));
+}
+
+
 void
 _SCDPluginExecInit()
 {
        struct sigaction        act;
 void
 _SCDPluginExecInit()
 {
        struct sigaction        act;
+       CFMachPortContext       context = { 0
+                                         , (void *)1
+                                         , NULL
+                                         , NULL
+                                         , childReapedMPCopyDescription
+                                         };
+
        CFRunLoopSourceRef      rls;
 
        // create the "a child has been reaped" notification port
        CFRunLoopSourceRef      rls;
 
        // create the "a child has been reaped" notification port
-       childReaped = CFMachPortCreate(NULL, childrenReaped, NULL, NULL);
+       childReaped = CFMachPortCreate(NULL, childrenReaped, &context, NULL);
 
        // set queue limit
        {
 
        // set queue limit
        {
@@ -286,6 +283,11 @@ _SCDPluginExecCommand2(SCDPluginExecCallBack       callout,
        // grab the activeChildren mutex
        pthread_mutex_lock(&lock);
 
        // grab the activeChildren mutex
        pthread_mutex_lock(&lock);
 
+       // if needed, initialize
+       if (childReaped == NULL) {
+               _SCDPluginExecInit();
+       }
+
        pid = fork();
 
        switch (pid) {
        pid = fork();
 
        switch (pid) {
@@ -301,10 +303,12 @@ _SCDPluginExecCommand2(SCDPluginExecCallBack      callout,
 
                case 0 : {      /* if child */
 
 
                case 0 : {      /* if child */
 
+                       gid_t   egid;
+                       uid_t   euid;
                        int     i;
                        int     status;
 
                        int     i;
                        int     status;
 
-                       if (setup) {
+                       if (setup != NULL) {
                                (setup)(pid, setupContext);
                        } else {
                                /* close any open FDs */
                                (setup)(pid, setupContext);
                        } else {
                                /* close any open FDs */
@@ -314,11 +318,25 @@ _SCDPluginExecCommand2(SCDPluginExecCallBack      callout,
                                dup(0);
                        }
 
                                dup(0);
                        }
 
-                       if (gid != getegid()) {
+                       egid = getegid();
+                       euid = geteuid();
+
+                       if (egid != gid) {
                                (void) setgid(gid);
                        }
 
                                (void) setgid(gid);
                        }
 
-                       if (uid != geteuid()) {
+                       if ((euid != uid) || (egid != gid)) {
+                               char            buf[1024];
+                               struct passwd   pwd;
+                               struct passwd   *result = NULL;
+
+                               if ((getpwuid_r(uid, &pwd, buf, sizeof(buf), &result) == 0) &&
+                                   (result != NULL)) {
+                                       initgroups(result->pw_name, gid);
+                               }
+                       }
+
+                       if (euid != uid) {
                                (void) setuid(uid);
                        }
 
                                (void) setuid(uid);
                        }
 
@@ -337,11 +355,11 @@ _SCDPluginExecCommand2(SCDPluginExecCallBack      callout,
                }
 
                default : {     /* if parent */
                }
 
                default : {     /* if parent */
-                       if (setup) {
+                       if (setup != NULL) {
                                (setup)(pid, setupContext);
                        }
 
                                (setup)(pid, setupContext);
                        }
 
-                       if (callout) {
+                       if (callout != NULL) {
                                childInfoRef    child;
 
                                // create child process info
                                childInfoRef    child;
 
                                // create child process info
index 9aa8f1dfaf781c118871e1c4faf1a415dcc78693..f64ac1314070041ed97aecf9f0382cab66603e0d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #define kSCBundleRequiresKey           CFSTR("Requires")
 
 
 #define kSCBundleRequiresKey           CFSTR("Requires")
 
 
+/*
+       @defined kSCBundleEnabledKey
+ */
+#define kSCBundleEnabledKey            CFSTR("Enabled")
+
+
 /*
        @defined kSCBundleVerboseKey
  */
 /*
        @defined kSCBundleVerboseKey
  */
@@ -89,7 +95,7 @@ typedef void  (*SCDynamicStoreBundleStartFunction)    (const char     *bundleName,
                be used to initialize any configuration information and/or state
                in the store.
  */
                be used to initialize any configuration information and/or state
                in the store.
  */
-typedef void   (*SCDynamicStoreBundlePrimeFunction)    ();
+typedef void   (*SCDynamicStoreBundlePrimeFunction)    (void);
 
 
 /*!
 
 
 /*!
index 732141b7bf3c2454af07e359832660841769a939..368814980a8a280f507693ee03b53412209400d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -35,6 +35,7 @@
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
+#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <net/if.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <net/if.h>
 #define        N_QUICK 32
 
 
 #define        N_QUICK 32
 
 
+#pragma mark -
+#pragma mark Miscellaneous
+
+
 char *
 char *
-_SC_cfstring_to_cstring(CFStringRef cfstr, char *buf, int bufLen, CFStringEncoding encoding)
+_SC_cfstring_to_cstring(CFStringRef cfstr, char *buf, CFIndex bufLen, CFStringEncoding encoding)
 {
 {
-       CFIndex last;
+       CFIndex converted;
+       CFIndex last    = 0;
        CFIndex len     = CFStringGetLength(cfstr);
 
        /* how much buffer space will we really need? */
        CFIndex len     = CFStringGetLength(cfstr);
 
        /* how much buffer space will we really need? */
-       (void)CFStringGetBytes(cfstr,
-                              CFRangeMake(0, len),
-                              encoding,
-                              0,
-                              FALSE,
-                              NULL,
-                              0,
-                              &len);
+       converted = CFStringGetBytes(cfstr,
+                                    CFRangeMake(0, len),
+                                    encoding,
+                                    0,
+                                    FALSE,
+                                    NULL,
+                                    0,
+                                    &last);
+       if (converted < len) {
+               /* if full string could not be converted */
+               if (buf != NULL) {
+                       buf[0] = '\0';
+               }
+               return NULL;
+       }
 
 
-       if (buf) {
-               /* check the size of the provided buffer */
-               if (bufLen < (len + 1)) {
-                       return NULL;    /* if too small */
+       if (buf != NULL) {
+               if (bufLen < (last + 1)) {
+                       /* if the size of the provided buffer is too small */
+                       buf[0] = '\0';
+                       return NULL;
                }
        } else {
                /* allocate a buffer */
                }
        } else {
                /* allocate a buffer */
-               bufLen = len + 1;
+               bufLen = last + 1;
                buf = CFAllocatorAllocate(NULL, bufLen, 0);
                buf = CFAllocatorAllocate(NULL, bufLen, 0);
-               if (!buf) {
+               if (buf == NULL) {
                        return NULL;
                }
        }
                        return NULL;
                }
        }
@@ -139,13 +153,45 @@ _SC_sockaddr_to_string(const struct sockaddr *address, char *buf, size_t bufLen)
 }
 
 
 }
 
 
+void
+_SC_sendMachMessage(mach_port_t port, mach_msg_id_t msg_id)
+{
+       mach_msg_empty_send_t   msg;
+       mach_msg_option_t       options;
+       kern_return_t           status;
+
+       msg.header.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0);
+       msg.header.msgh_size = sizeof(msg);
+       msg.header.msgh_remote_port = port;
+       msg.header.msgh_local_port = MACH_PORT_NULL;
+       msg.header.msgh_id = msg_id;
+       options = MACH_SEND_TIMEOUT;
+       status = mach_msg(&msg.header,                  /* msg */
+                         MACH_SEND_MSG|options,        /* options */
+                         msg.header.msgh_size,         /* send_size */
+                         0,                            /* rcv_size */
+                         MACH_PORT_NULL,               /* rcv_name */
+                         0,                            /* timeout */
+                         MACH_PORT_NULL);              /* notify */
+       if (status == MACH_SEND_TIMED_OUT) {
+               mach_msg_destroy(&msg.header);
+       }
+
+       return;
+}
+
+
+#pragma mark -
+#pragma mark Serialization
+
+
 Boolean
 _SCSerialize(CFPropertyListRef obj, CFDataRef *xml, void **dataRef, CFIndex *dataLen)
 {
 Boolean
 _SCSerialize(CFPropertyListRef obj, CFDataRef *xml, void **dataRef, CFIndex *dataLen)
 {
-       CFDataRef       myXml;
+       CFDataRef               myXml;
        CFWriteStreamRef        stream;
 
        CFWriteStreamRef        stream;
 
-       if (!xml && !(dataRef && dataLen)) {
+       if ((xml == NULL) && ((dataRef == NULL) || (dataLen == NULL))) {
                /* if not keeping track of allocated space */
                return FALSE;
        }
                /* if not keeping track of allocated space */
                return FALSE;
        }
@@ -156,27 +202,33 @@ _SCSerialize(CFPropertyListRef obj, CFDataRef *xml, void **dataRef, CFIndex *dat
        CFWriteStreamClose(stream);
        myXml = CFWriteStreamCopyProperty(stream, kCFStreamPropertyDataWritten);
        CFRelease(stream);
        CFWriteStreamClose(stream);
        myXml = CFWriteStreamCopyProperty(stream, kCFStreamPropertyDataWritten);
        CFRelease(stream);
-       if (!myXml) {
+       if (myXml == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("_SCSerialize() failed"));
                SCLog(TRUE, LOG_ERR, CFSTR("_SCSerialize() failed"));
-               if (xml)        *xml     = NULL;
-               if (dataRef)    *dataRef = NULL;
-               if (dataLen)    *dataLen = 0;
+               if (xml != NULL) {
+                       *xml = NULL;
+               }
+               if ((dataRef != NULL) && (dataLen != NULL)) {
+                       *dataLen = 0;
+                       *dataRef = NULL;
+               }
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (xml) {
+       if (xml != NULL) {
                *xml = myXml;
                *xml = myXml;
-               if (dataRef) {
+               if ((dataRef != NULL) && (dataLen != NULL)) {
                        *dataRef = (void *)CFDataGetBytePtr(myXml);
                        *dataRef = (void *)CFDataGetBytePtr(myXml);
-               }
-               if (dataLen) {
                        *dataLen = CFDataGetLength(myXml);
                }
        } else {
                        *dataLen = CFDataGetLength(myXml);
                }
        } else {
-               kern_return_t   status;
+               mach_msg_type_number_t  len;
+               kern_return_t           status;
 
 
-               *dataLen = CFDataGetLength(myXml);
-               status = vm_allocate(mach_task_self(), (void *)dataRef, *dataLen, TRUE);
+               status = vm_read(mach_task_self(),
+                                (vm_address_t)CFDataGetBytePtr(myXml), // address
+                                (vm_size_t)   CFDataGetLength(myXml),  // size
+                                (void *)dataRef,
+                                &len);
                if (status != KERN_SUCCESS) {
                        SCLog(TRUE, LOG_ERR, CFSTR("_SCSerialize(): %s"), mach_error_string(status));
                        CFRelease(myXml);
                if (status != KERN_SUCCESS) {
                        SCLog(TRUE, LOG_ERR, CFSTR("_SCSerialize(): %s"), mach_error_string(status));
                        CFRelease(myXml);
@@ -185,7 +237,7 @@ _SCSerialize(CFPropertyListRef obj, CFDataRef *xml, void **dataRef, CFIndex *dat
                        return FALSE;
                }
 
                        return FALSE;
                }
 
-               bcopy((char *)CFDataGetBytePtr(myXml), *dataRef, *dataLen);
+               *dataLen = len;
                CFRelease(myXml);
        }
 
                CFRelease(myXml);
        }
 
@@ -198,7 +250,7 @@ _SCUnserialize(CFPropertyListRef *obj, CFDataRef xml, void *dataRef, CFIndex dat
 {
        CFStringRef     xmlError;
 
 {
        CFStringRef     xmlError;
 
-       if (!xml) {
+       if (xml == NULL) {
                kern_return_t   status;
 
                xml = CFDataCreateWithBytesNoCopy(NULL, (void *)dataRef, dataLen, kCFAllocatorNull);
                kern_return_t   status;
 
                xml = CFDataCreateWithBytesNoCopy(NULL, (void *)dataRef, dataLen, kCFAllocatorNull);
@@ -221,7 +273,7 @@ _SCUnserialize(CFPropertyListRef *obj, CFDataRef xml, void *dataRef, CFIndex dat
        }
 
        if (*obj == NULL) {
        }
 
        if (*obj == NULL) {
-               if (xmlError) {
+               if (xmlError != NULL) {
                        SCLog(TRUE, LOG_ERR, CFSTR("_SCUnserialize(): %@"), xmlError);
                        CFRelease(xmlError);
                }
                        SCLog(TRUE, LOG_ERR, CFSTR("_SCUnserialize(): %@"), xmlError);
                        CFRelease(xmlError);
                }
@@ -243,33 +295,40 @@ _SCSerializeString(CFStringRef str, CFDataRef *data, void **dataRef, CFIndex *da
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (!data && !(dataRef && dataLen)) {
+       if ((data == NULL) && ((dataRef == NULL) || (dataLen == NULL))) {
                /* if not keeping track of allocated space */
                return FALSE;
        }
 
        myData = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingUTF8, 0);
                /* if not keeping track of allocated space */
                return FALSE;
        }
 
        myData = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingUTF8, 0);
-       if (!myData) {
+       if (myData == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("_SCSerializeString() failed"));
                SCLog(TRUE, LOG_ERR, CFSTR("_SCSerializeString() failed"));
-               if (data)       *data    = NULL;
-               if (dataRef)    *dataRef = NULL;
-               if (dataLen)    *dataLen = 0;
+               if (data != NULL) {
+                       *data = NULL;
+               }
+               if ((dataRef != NULL) && (dataLen != NULL)) {
+                       *dataRef = NULL;
+                       *dataLen = 0;
+               }
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (data) {
+       if (data != NULL) {
                *data = myData;
                *data = myData;
-               if (dataRef) {
+               if ((dataRef != NULL) && (dataLen != NULL)) {
                        *dataRef = (void *)CFDataGetBytePtr(myData);
                        *dataRef = (void *)CFDataGetBytePtr(myData);
-               }
-               if (dataLen) {
                        *dataLen = CFDataGetLength(myData);
                }
        } else {
                        *dataLen = CFDataGetLength(myData);
                }
        } else {
-               kern_return_t   status;
+               mach_msg_type_number_t  len;
+               kern_return_t           status;
 
                *dataLen = CFDataGetLength(myData);
 
                *dataLen = CFDataGetLength(myData);
-               status = vm_allocate(mach_task_self(), (void *)dataRef, *dataLen, TRUE);
+               status = vm_read(mach_task_self(),
+                                (vm_address_t)CFDataGetBytePtr(myData),        // address
+                                (vm_size_t)   CFDataGetLength(myData),         // size
+                                (void *)dataRef,
+                                &len);
                if (status != KERN_SUCCESS) {
                        SCLog(TRUE, LOG_ERR, CFSTR("_SCSerializeString(): %s"), mach_error_string(status));
                        CFRelease(myData);
                if (status != KERN_SUCCESS) {
                        SCLog(TRUE, LOG_ERR, CFSTR("_SCSerializeString(): %s"), mach_error_string(status));
                        CFRelease(myData);
@@ -278,7 +337,7 @@ _SCSerializeString(CFStringRef str, CFDataRef *data, void **dataRef, CFIndex *da
                        return FALSE;
                }
 
                        return FALSE;
                }
 
-               bcopy((char *)CFDataGetBytePtr(myData), *dataRef, *dataLen);
+               *dataLen = len;
                CFRelease(myData);
        }
 
                CFRelease(myData);
        }
 
@@ -289,7 +348,7 @@ _SCSerializeString(CFStringRef str, CFDataRef *data, void **dataRef, CFIndex *da
 Boolean
 _SCUnserializeString(CFStringRef *str, CFDataRef utf8, void *dataRef, CFIndex dataLen)
 {
 Boolean
 _SCUnserializeString(CFStringRef *str, CFDataRef utf8, void *dataRef, CFIndex dataLen)
 {
-       if (!utf8) {
+       if (utf8 == NULL) {
                kern_return_t   status;
 
                utf8 = CFDataCreateWithBytesNoCopy(NULL, dataRef, dataLen, kCFAllocatorNull);
                kern_return_t   status;
 
                utf8 = CFDataCreateWithBytesNoCopy(NULL, dataRef, dataLen, kCFAllocatorNull);
@@ -317,7 +376,8 @@ _SCUnserializeString(CFStringRef *str, CFDataRef utf8, void *dataRef, CFIndex da
 Boolean
 _SCSerializeData(CFDataRef data, void **dataRef, CFIndex *dataLen)
 {
 Boolean
 _SCSerializeData(CFDataRef data, void **dataRef, CFIndex *dataLen)
 {
-       kern_return_t   status;
+       mach_msg_type_number_t  len;
+       kern_return_t           status;
 
        if (!isA_CFData(data)) {
                /* if not a CFData */
 
        if (!isA_CFData(data)) {
                /* if not a CFData */
@@ -325,7 +385,11 @@ _SCSerializeData(CFDataRef data, void **dataRef, CFIndex *dataLen)
        }
 
        *dataLen = CFDataGetLength(data);
        }
 
        *dataLen = CFDataGetLength(data);
-       status = vm_allocate(mach_task_self(), (void *)dataRef, *dataLen, TRUE);
+       status = vm_read(mach_task_self(),
+                        (vm_address_t)CFDataGetBytePtr(data),  // address
+                        CFDataGetLength(data),                 // size
+                        (void *)dataRef,
+                        &len);
        if (status != KERN_SUCCESS) {
                SCLog(TRUE, LOG_ERR, CFSTR("_SCSerializeData(): %s"), mach_error_string(status));
                *dataRef = NULL;
        if (status != KERN_SUCCESS) {
                SCLog(TRUE, LOG_ERR, CFSTR("_SCSerializeData(): %s"), mach_error_string(status));
                *dataRef = NULL;
@@ -333,7 +397,7 @@ _SCSerializeData(CFDataRef data, void **dataRef, CFIndex *dataLen)
                return FALSE;
        }
 
                return FALSE;
        }
 
-       bcopy((char *)CFDataGetBytePtr(data), *dataRef, *dataLen);
+       *dataLen = len;
 
        return TRUE;
 }
 
        return TRUE;
 }
@@ -472,6 +536,10 @@ _SCUnserializeMultiple(CFDictionaryRef dict)
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark CFRunLoop scheduling
+
+
 __private_extern__ void
 _SC_signalRunLoop(CFTypeRef obj, CFRunLoopSourceRef rls, CFArrayRef rlList)
 {
 __private_extern__ void
 _SC_signalRunLoop(CFTypeRef obj, CFRunLoopSourceRef rls, CFArrayRef rlList)
 {
@@ -494,7 +562,7 @@ _SC_signalRunLoop(CFTypeRef obj, CFRunLoopSourceRef rls, CFArrayRef rlList)
                break;
        }
 
                break;
        }
 
-       if (!rl1) {
+       if (rl1 == NULL) {
                /* if not scheduled */
                return;
        }
                /* if not scheduled */
                return;
        }
@@ -516,7 +584,7 @@ _SC_signalRunLoop(CFTypeRef obj, CFRunLoopSourceRef rls, CFArrayRef rlList)
                }
        }
 
                }
        }
 
-       if (rl) {
+       if (rl != NULL) {
                /* if we only have one runLoop */
                CFRunLoopWakeUp(rl);
                return;
                /* if we only have one runLoop */
                CFRunLoopWakeUp(rl);
                return;
@@ -532,13 +600,17 @@ _SC_signalRunLoop(CFTypeRef obj, CFRunLoopSourceRef rls, CFArrayRef rlList)
 
                rl     = (CFRunLoopRef)CFArrayGetValueAtIndex(rlList, i+1);
                rlMode = CFRunLoopCopyCurrentMode(rl);
 
                rl     = (CFRunLoopRef)CFArrayGetValueAtIndex(rlList, i+1);
                rlMode = CFRunLoopCopyCurrentMode(rl);
-               if (rlMode && CFRunLoopIsWaiting(rl) && CFRunLoopContainsSource(rl, rls, rlMode)) {
-                       /* we've found a runLoop that's "ready" */
+               if (rlMode != NULL) {
+                       Boolean waiting;
+
+                       waiting = (CFRunLoopIsWaiting(rl) && CFRunLoopContainsSource(rl, rls, rlMode));
                        CFRelease(rlMode);
                        CFRelease(rlMode);
-                       CFRunLoopWakeUp(rl);
-                       return;
+                       if (waiting) {
+                               /* we've found a runLoop that's "ready" */
+                               CFRunLoopWakeUp(rl);
+                               return;
+                       }
                }
                }
-               if (rlMode) CFRelease(rlMode);
        }
 
        /* didn't choose one above, so choose first */
        }
 
        /* didn't choose one above, so choose first */
@@ -554,13 +626,13 @@ _SC_isScheduled(CFTypeRef obj, CFRunLoopRef runLoop, CFStringRef runLoopMode, CF
        CFIndex n       = CFArrayGetCount(rlList);
 
        for (i = 0; i < n; i += 3) {
        CFIndex n       = CFArrayGetCount(rlList);
 
        for (i = 0; i < n; i += 3) {
-               if (obj         && !CFEqual(obj,         CFArrayGetValueAtIndex(rlList, i))) {
+               if ((obj != NULL)         && !CFEqual(obj,         CFArrayGetValueAtIndex(rlList, i))) {
                        continue;
                }
                        continue;
                }
-               if (runLoop     && !CFEqual(runLoop,     CFArrayGetValueAtIndex(rlList, i+1))) {
+               if ((runLoop != NULL)     && !CFEqual(runLoop,     CFArrayGetValueAtIndex(rlList, i+1))) {
                        continue;
                }
                        continue;
                }
-               if (runLoopMode && !CFEqual(runLoopMode, CFArrayGetValueAtIndex(rlList, i+2))) {
+               if ((runLoopMode != NULL) && !CFEqual(runLoopMode, CFArrayGetValueAtIndex(rlList, i+2))) {
                        continue;
                }
                return TRUE;
                        continue;
                }
                return TRUE;
@@ -589,15 +661,15 @@ _SC_unschedule(CFTypeRef obj, CFRunLoopRef runLoop, CFStringRef runLoopMode, CFM
        CFIndex n       = CFArrayGetCount(rlList);
 
        while (i < n) {
        CFIndex n       = CFArrayGetCount(rlList);
 
        while (i < n) {
-               if (obj         && !CFEqual(obj,         CFArrayGetValueAtIndex(rlList, i))) {
+               if ((obj != NULL)         && !CFEqual(obj,         CFArrayGetValueAtIndex(rlList, i))) {
                        i += 3;
                        continue;
                }
                        i += 3;
                        continue;
                }
-               if (runLoop     && !CFEqual(runLoop,     CFArrayGetValueAtIndex(rlList, i+1))) {
+               if ((runLoop != NULL)     && !CFEqual(runLoop,     CFArrayGetValueAtIndex(rlList, i+1))) {
                        i += 3;
                        continue;
                }
                        i += 3;
                        continue;
                }
-               if (runLoopMode && !CFEqual(runLoopMode, CFArrayGetValueAtIndex(rlList, i+2))) {
+               if ((runLoopMode != NULL) && !CFEqual(runLoopMode, CFArrayGetValueAtIndex(rlList, i+2))) {
                        i += 3;
                        continue;
                }
                        i += 3;
                        continue;
                }
@@ -619,8 +691,329 @@ _SC_unschedule(CFTypeRef obj, CFRunLoopRef runLoop, CFStringRef runLoopMode, CFM
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark Bundle
+
+
+#define SYSTEMCONFIGURATION_BUNDLE_ID          CFSTR("com.apple.SystemConfiguration")
+#define        SYSTEMCONFIGURATION_FRAMEWORK_PATH      "/System/Library/Frameworks/SystemConfiguration.framework"
+#define        SYSTEMCONFIGURATION_FRAMEWORK_PATH_LEN  (sizeof(SYSTEMCONFIGURATION_FRAMEWORK_PATH) - 1)
+
+#define        SUFFIX_SYM                              "~sym"
+#define        SUFFIX_SYM_LEN                          (sizeof(SUFFIX_SYM) - 1)
+
+#define        SUFFIX_DST                              "~dst"
+
+
+CFBundleRef
+_SC_CFBundleGet(void)
+{
+       static CFBundleRef      bundle  = NULL;
+       char                    *env;
+       size_t                  len;
+
+       if (bundle != NULL) {
+               return bundle;
+       }
+
+       bundle = CFBundleGetBundleWithIdentifier(SYSTEMCONFIGURATION_BUNDLE_ID);
+       if (bundle != NULL) {
+               CFRetain(bundle);       // we want to hold a reference to the bundle
+               return bundle;
+       }
+
+       // if appropriate (e.g. when debugging), try a bit harder
+
+       env = getenv("DYLD_FRAMEWORK_PATH");
+       len = (env != NULL) ? strlen(env) : 0;
+
+       // trim any trailing slashes
+       while (len > 1) {
+               if (env[len - 1] != '/') {
+                       break;
+               }
+               len--;
+       }
+
+       // if DYLD_FRAMEWORK_PATH is ".../xxx~sym" than try ".../xxx~dst"
+       if ((len > SUFFIX_SYM_LEN) &&
+           (strncmp(&env[len - SUFFIX_SYM_LEN], SUFFIX_SYM, SUFFIX_SYM_LEN) == 0) &&
+           ((len + SYSTEMCONFIGURATION_FRAMEWORK_PATH_LEN) < MAXPATHLEN)) {
+               char            path[MAXPATHLEN];
+               CFURLRef        url;
+
+               strlcpy(path, env, sizeof(path));
+               strlcpy(&path[len - SUFFIX_SYM_LEN], SUFFIX_DST, sizeof(path) - (len - SUFFIX_SYM_LEN));
+               strlcat(&path[len], SYSTEMCONFIGURATION_FRAMEWORK_PATH, sizeof(path) - len);
+
+               url = CFURLCreateFromFileSystemRepresentation(NULL,
+                                                             (UInt8 *)path,
+                                                             len + SYSTEMCONFIGURATION_FRAMEWORK_PATH_LEN,
+                                                             TRUE);
+               bundle = CFBundleCreate(NULL, url);
+               CFRelease(url);
+       }
+
+       if (bundle == NULL) {
+               static  Boolean warned  = FALSE;
+
+               SCLog(!warned, LOG_WARNING,
+                     CFSTR("_SC_CFBundleGet(), could not get CFBundle for \"%@\""),
+                     SYSTEMCONFIGURATION_BUNDLE_ID);
+               warned = TRUE;
+       }
+
+       return bundle;
+}
+
+
+CFStringRef
+_SC_CFBundleCopyNonLocalizedString(CFBundleRef bundle, CFStringRef key, CFStringRef value, CFStringRef tableName)
+{
+       CFStringRef     str     = NULL;
+       CFURLRef        url;
+
+       if ((tableName == NULL) || CFEqual(tableName, CFSTR(""))) tableName = CFSTR("Localizable");
+
+       url = CFBundleCopyResourceURLForLocalization(bundle,
+                                                    tableName,
+                                                    CFSTR("strings"),
+                                                    NULL,
+                                                    CFSTR("English"));
+       if (url != NULL) {
+               CFDataRef       data    = NULL;
+               SInt32          errCode = 0;
+
+               if (CFURLCreateDataAndPropertiesFromResource(NULL,
+                                                            url,
+                                                            &data,
+                                                            NULL,
+                                                            NULL,
+                                                            &errCode)) {
+                       CFDictionaryRef table;
+
+                       table = (CFDictionaryRef)CFPropertyListCreateFromXMLData(NULL,
+                                                                                data,
+                                                                                kCFPropertyListImmutable,
+                                                                                NULL);
+                       if (table != NULL) {
+                               if (isA_CFDictionary(table)) {
+                                       str = CFDictionaryGetValue(table, key);
+                                       if (str != NULL) {
+                                               CFRetain(str);
+                                       }
+                               }
+
+                               CFRelease(table);
+                       }
+
+                       CFRelease(data);
+               }
+
+               CFRelease(url);
+       }
+
+       if (str == NULL) {
+               str = CFRetain(value);
+       }
+
+       return str;
+}
+
+
+#pragma mark -
+#pragma mark DOS encoding/codepage
+
+
+void
+_SC_dos_encoding_and_codepage(CFStringEncoding macEncoding,
+                             UInt32            macRegion,
+                             CFStringEncoding  *dosEncoding,
+                             UInt32            *dosCodepage)
+{
+       switch (macEncoding) {
+       case kCFStringEncodingMacRoman:
+               if (macRegion != 0) /* anything non-zero is not US */
+               *dosEncoding = kCFStringEncodingDOSLatin1;
+               else /* US region */
+               *dosEncoding = kCFStringEncodingDOSLatinUS;
+               break;
+
+       case kCFStringEncodingMacJapanese:
+               *dosEncoding = kCFStringEncodingDOSJapanese;
+               break;
+
+       case kCFStringEncodingMacChineseTrad:
+               *dosEncoding = kCFStringEncodingDOSChineseTrad;
+               break;
+
+       case kCFStringEncodingMacKorean:
+               *dosEncoding = kCFStringEncodingDOSKorean;
+               break;
+
+       case kCFStringEncodingMacArabic:
+               *dosEncoding = kCFStringEncodingDOSArabic;
+               break;
+
+       case kCFStringEncodingMacHebrew:
+               *dosEncoding = kCFStringEncodingDOSHebrew;
+               break;
+
+       case kCFStringEncodingMacGreek:
+               *dosEncoding = kCFStringEncodingDOSGreek;
+               break;
+
+       case kCFStringEncodingMacCyrillic:
+               *dosEncoding = kCFStringEncodingDOSCyrillic;
+               break;
+
+       case kCFStringEncodingMacThai:
+               *dosEncoding = kCFStringEncodingDOSThai;
+               break;
+
+       case kCFStringEncodingMacChineseSimp:
+               *dosEncoding = kCFStringEncodingDOSChineseSimplif;
+               break;
+
+       case kCFStringEncodingMacCentralEurRoman:
+               *dosEncoding = kCFStringEncodingDOSLatin2;
+               break;
+
+       case kCFStringEncodingMacTurkish:
+               *dosEncoding = kCFStringEncodingDOSTurkish;
+               break;
+
+       case kCFStringEncodingMacCroatian:
+               *dosEncoding = kCFStringEncodingDOSLatin2;
+               break;
+
+       case kCFStringEncodingMacIcelandic:
+               *dosEncoding = kCFStringEncodingDOSIcelandic;
+               break;
+
+       case kCFStringEncodingMacRomanian:
+               *dosEncoding = kCFStringEncodingDOSLatin2;
+               break;
+
+       case kCFStringEncodingMacFarsi:
+               *dosEncoding = kCFStringEncodingDOSArabic;
+               break;
+
+       case kCFStringEncodingMacUkrainian:
+               *dosEncoding = kCFStringEncodingDOSCyrillic;
+               break;
+
+       default:
+               *dosEncoding = kCFStringEncodingDOSLatin1;
+               break;
+       }
+
+       *dosCodepage = CFStringConvertEncodingToWindowsCodepage(*dosEncoding);
+       return;
+}
+
+
+#include <unicode/uset.h>
+#include <unicode/ucnv.h>
+
+
+CFDataRef
+_SC_dos_copy_string(CFStringRef str, CFStringEncoding dosEncoding, UInt32 dosCodepage)
+{
+       USet                    *charSet        = NULL;
+       UConverter              *conv           = NULL;
+       UErrorCode              ec              = U_ZERO_ERROR;
+       char                    ianaName[16];
+       CFDataRef               line            = NULL;
+       CFMutableStringRef      newStr          = NULL;
+       CFStringRef             set             = NULL;
+       int32_t                 setSize;
+       UChar                   *setChars;
+       CFStringRef             transform;
+
+       /*
+        * using ICU, convert the target character set into the
+        * set of Unicode characters that can be converted to
+        * that character set.
+        *
+        * Note: a full list of character set identifiers accepted
+        *       by ICU can be found at :
+        *
+        *       http://dev.icu-project.org/cgi-bin/viewcvs.cgi/icu/source/data/mappings/convrtrs.txt?view=co
+        */
+       snprintf(ianaName, sizeof(ianaName), "cp%d", (int)dosCodepage);
+       charSet = uset_open(0, 0);
+       //ec = U_ZERO_ERROR;
+       conv = ucnv_open(ianaName, &ec);
+       if (U_FAILURE(ec)) {
+               SCPrint(TRUE, stderr, CFSTR("ucnv_open() failed, ec = %s\n"), u_errorName(ec));
+               goto done;
+       }
+       //ec = U_ZERO_ERROR;
+       ucnv_getUnicodeSet(conv, charSet, UCNV_ROUNDTRIP_SET, &ec);
+       if (U_FAILURE(ec)) {
+               SCPrint(TRUE, stderr, CFSTR("ucnv_getUnicodeSet() failed, ec = %s\n"), u_errorName(ec));
+               goto done;
+       }
+
+       /*
+        * Next, we create a transform pattern that will transform *only*
+        * the characters that are not in the target charset.
+        */
+       //ec = U_ZERO_ERROR;
+       setSize = uset_toPattern(charSet, NULL, 0, FALSE, &ec);
+       if (U_FAILURE(ec)  && (ec != U_BUFFER_OVERFLOW_ERROR)) {
+               SCPrint(TRUE, stderr, CFSTR("uset_toPattern() failed, ec = %s\n"), u_errorName(ec));
+               goto done;
+       }
+       setChars = (UChar *)calloc(setSize, sizeof(UChar));
+       ec = U_ZERO_ERROR;
+       (void)uset_toPattern(charSet, setChars, setSize, FALSE, &ec);
+       set = CFStringCreateWithCharacters(NULL, setChars, setSize);
+       free(setChars);
+
+       /*
+        * Now make a transform pattern that will:
+        * 1. Only affect characters *not* in the target character set
+        * 2. Convert curly quotes, etc. to ASCII equivalents
+        * 3. Convert any non-Latin characters to Latin
+        * 4. Decompose any combining marks if possible
+        * 5. Remove anything that's not ASCII
+        *
+        * ... and transform the string
+        */
+       transform = CFStringCreateWithFormat(NULL, NULL,
+                                            CFSTR("[^%@]; Publishing-Any; Any-Latin; NFKD; [:^ASCII:] Remove"),
+                                            set);
+       newStr = CFStringCreateMutableCopy(NULL, 0, str);
+       CFStringNormalize(newStr, kCFStringNormalizationFormC);
+       if (!CFStringTransform(newStr, NULL, transform, FALSE)) {
+               CFRelease(newStr);
+               newStr = NULL;
+       }
+       CFRelease(transform);
+
+    done :
+
+       if (newStr != NULL) {
+               line = CFStringCreateExternalRepresentation(NULL, newStr, dosEncoding, 0);
+               CFRelease(newStr);
+       }
+
+       if (charSet != NULL)    uset_close(charSet);
+       if (conv != NULL)       ucnv_close(conv);
+       if (set != NULL)        CFRelease(set);
+
+       return line;
+}
+
+
+#pragma mark -
+#pragma mark Debugging
+
+
 void
 void
-__showMachPortStatus()
+__showMachPortStatus(void)
 {
 #ifdef DEBUG
        /* print status of in-use mach ports */
 {
 #ifdef DEBUG
        /* print status of in-use mach ports */
index d3a997c2df249b587cd7ed63d016b2a3c4890265..fa6ef00e5c7dbbcefe9486d41534bc61cba4fcbd 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 5b26a4c9b80b972faa2f8aa0760346b3e04197ce..baa3cb99c906fa24d97dab359ec46fbf31d90643 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -71,40 +71,39 @@ SCDynamicStoreSetMultiple(SCDynamicStoreRef store,
        }
 
        /* serialize the key/value pairs to set*/
        }
 
        /* serialize the key/value pairs to set*/
-       if (keysToSet) {
+       if (keysToSet != NULL) {
                CFDictionaryRef newInfo;
                Boolean         ok;
 
                newInfo = _SCSerializeMultiple(keysToSet);
                CFDictionaryRef newInfo;
                Boolean         ok;
 
                newInfo = _SCSerializeMultiple(keysToSet);
-               if (!newInfo) {
-                       _SCErrorSet(kSCStatusFailed);
+               if (newInfo == NULL) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
                }
 
                ok = _SCSerialize(newInfo, &xmlSet, (void **)&mySetRef, &mySetLen);
                CFRelease(newInfo);
                        return FALSE;
                }
 
                ok = _SCSerialize(newInfo, &xmlSet, (void **)&mySetRef, &mySetLen);
                CFRelease(newInfo);
-
                if (!ok) {
                if (!ok) {
-                       _SCErrorSet(kSCStatusFailed);
+                       _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
                }
        }
 
        /* serialize the keys to remove */
                        return FALSE;
                }
        }
 
        /* serialize the keys to remove */
-       if (keysToRemove) {
+       if (keysToRemove != NULL) {
                if (!_SCSerialize(keysToRemove, &xmlRemove, (void **)&myRemoveRef, &myRemoveLen)) {
                if (!_SCSerialize(keysToRemove, &xmlRemove, (void **)&myRemoveRef, &myRemoveLen)) {
-                       if (xmlSet)     CFRelease(xmlSet);
-                       _SCErrorSet(kSCStatusFailed);
+                       if (xmlSet != NULL)     CFRelease(xmlSet);
+                       _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
                }
        }
 
        /* serialize the keys to notify */
                        return FALSE;
                }
        }
 
        /* serialize the keys to notify */
-       if (keysToNotify) {
+       if (keysToNotify != NULL) {
                if (!_SCSerialize(keysToNotify, &xmlNotify, (void **)&myNotifyRef, &myNotifyLen)) {
                if (!_SCSerialize(keysToNotify, &xmlNotify, (void **)&myNotifyRef, &myNotifyLen)) {
-                       if (xmlSet)     CFRelease(xmlSet);
-                       if (xmlRemove)  CFRelease(xmlRemove);
-                       _SCErrorSet(kSCStatusFailed);
+                       if (xmlSet != NULL)     CFRelease(xmlSet);
+                       if (xmlRemove != NULL)  CFRelease(xmlRemove);
+                       _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
                }
        }
                        return FALSE;
                }
        }
@@ -120,9 +119,9 @@ SCDynamicStoreSetMultiple(SCDynamicStoreRef store,
                             (int *)&sc_status);
 
        /* clean up */
                             (int *)&sc_status);
 
        /* clean up */
-       if (xmlSet)     CFRelease(xmlSet);
-       if (xmlRemove)  CFRelease(xmlRemove);
-       if (xmlNotify)  CFRelease(xmlNotify);
+       if (xmlSet != NULL)     CFRelease(xmlSet);
+       if (xmlRemove != NULL)  CFRelease(xmlRemove);
+       if (xmlNotify != NULL)  CFRelease(xmlNotify);
 
        if (status != KERN_SUCCESS) {
 #ifdef DEBUG
 
        if (status != KERN_SUCCESS) {
 #ifdef DEBUG
@@ -171,14 +170,14 @@ SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
 
        /* serialize the key */
        if (!_SCSerializeString(key, &utfKey, (void **)&myKeyRef, &myKeyLen)) {
 
        /* serialize the key */
        if (!_SCSerializeString(key, &utfKey, (void **)&myKeyRef, &myKeyLen)) {
-               _SCErrorSet(kSCStatusFailed);
+               _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
        /* serialize the data */
        if (!_SCSerialize(value, &xmlData, (void **)&myDataRef, &myDataLen)) {
                CFRelease(utfKey);
                return FALSE;
        }
 
        /* serialize the data */
        if (!_SCSerialize(value, &xmlData, (void **)&myDataRef, &myDataLen)) {
                CFRelease(utfKey);
-               _SCErrorSet(kSCStatusFailed);
+               _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
                return FALSE;
        }
 
index 5f69bb748e668fcbc21bdf36b54aeeeb8e2fbd1e..9af36f0fe1cf0514d7c30c0681822b00c7de64d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 8b71a7bea0aa7c6daf9b2d47ecca3b28bad2273f..1b96735cd49704f270941f488d0111a2f42c76c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index d90117128a0bff315eb7092aa560ac5ffd215c02..462f446e9230c1471b1679f24257d88193e5744c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 5cab3e1c435f0338f66d9386f9a3d110eeac1fc6..88663430eba41c71b8a6ee2c10a686e61aa3d038 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 380f2605334f300f9849597bda8f04a2a15d9aad..4cc0856a5f30812a8574d40684d10c43dee6dd9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 6017d207d70aa19b01c0e24e5c0e02ecc4b5adc2..c03620d1add3cfab1e9a6e8e8da05b8255bda35c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -101,7 +101,7 @@ __SCDynamicStoreCreatePrivate               (CFAllocatorRef                 allocator,
                                         SCDynamicStoreContext          *context);
 
 void
                                         SCDynamicStoreContext          *context);
 
 void
-__showMachPortStatus                   ();
+__showMachPortStatus                   (void);
 
 void
 __showMachPortReferences               (mach_port_t                    port);
 
 void
 __showMachPortReferences               (mach_port_t                    port);
index b875558eacae42b84152c719154ae7323a6bed06..1edb7e17405d5341fb99484deed4c17bcdd68182 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 7ea34c27ca77581f075942f891d0205a06b84d55..326cc36f34c90674ce733493b2d497437ddd79cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 81e7f87d18cefa47e9b042b62b09ca6c9e5f296c..f3b03eb5303fe05c11a9e909625d589764420d1e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index bf049ce63d437ee7a4ed987d34e71a148a12fce6..5704408483704fa5179262d3a37e9dcd57fcdbfc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 23f6648cc3f1b4615ea237c5c7cc436bc01d2832..96ae844d7abc65a0fb62e39ff040db4e774e5981 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 
-#ifndef kSCEntNetRefreshConfiguration
-#define kSCEntNetRefreshConfiguration  CFSTR("RefreshConfiguration")
-#endif kSCEntNetRefreshConfiguration
-
 Boolean
 SCNetworkCheckReachabilityByAddress(const struct sockaddr      *address,
 Boolean
 SCNetworkCheckReachabilityByAddress(const struct sockaddr      *address,
-                                   const int                   addrlen,
+                                   socklen_t                   addrlen,
                                    SCNetworkConnectionFlags    *flags)
 {
        SCNetworkReachabilityRef                networkAddress;
                                    SCNetworkConnectionFlags    *flags)
 {
        SCNetworkReachabilityRef                networkAddress;
@@ -70,6 +66,10 @@ SCNetworkCheckReachabilityByAddress(const struct sockaddr    *address,
        ss.ss_len = addrlen;
 
        networkAddress = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&ss);
        ss.ss_len = addrlen;
 
        networkAddress = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&ss);
+       if (networkAddress == NULL) {
+               return FALSE;
+       }
+
        ok = SCNetworkReachabilityGetFlags(networkAddress, flags);
        CFRelease(networkAddress);
        return ok;
        ok = SCNetworkReachabilityGetFlags(networkAddress, flags);
        CFRelease(networkAddress);
        return ok;
@@ -89,31 +89,11 @@ SCNetworkCheckReachabilityByName(const char                 *nodename,
        }
 
        networkAddress = SCNetworkReachabilityCreateWithName(NULL, nodename);
        }
 
        networkAddress = SCNetworkReachabilityCreateWithName(NULL, nodename);
-       ok = SCNetworkReachabilityGetFlags(networkAddress, flags);
-       CFRelease(networkAddress);
-       return ok;
-}
-
-Boolean
-SCNetworkInterfaceRefreshConfiguration(CFStringRef ifName)
-{
-       CFStringRef             key;
-       Boolean                 ret     = FALSE;
-       SCDynamicStoreRef       store;
-
-       store = SCDynamicStoreCreate(NULL,
-                                    CFSTR("SCNetworkInterfaceRefreshConfiguration"),
-                                    NULL, NULL);
-       if (store == NULL) {
+       if (networkAddress == NULL) {
                return FALSE;
        }
 
                return FALSE;
        }
 
-       key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                           kSCDynamicStoreDomainState,
-                                                           ifName,
-                                                           kSCEntNetRefreshConfiguration);
-       ret = SCDynamicStoreNotifyValue(store, key);
-       CFRelease(key);
-       CFRelease(store);
-       return (ret);
+       ok = SCNetworkReachabilityGetFlags(networkAddress, flags);
+       CFRelease(networkAddress);
+       return ok;
 }
 }
index 8dae0e8f4a564fe9093b547fae102ce375930bcb..b512aca8b589a29beca8660bc0bcdbffc11f36d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
                application into the network stack, can leave the local
                computer.  Note that reachability does <i>not</i> guarantee
                that the data packet will actually be received by the host.
                application into the network stack, can leave the local
                computer.  Note that reachability does <i>not</i> guarantee
                that the data packet will actually be received by the host.
-
-               The SCNetworkInterfaceRefreshConfiguration function sends a
-               notification to interested network configuration agents to
-               retry their configuration immediately. For example, calling
-               this function will cause the DHCP client to contact the DHCP
-               server immediately rather than waiting until its timeout has
-               expired.  The utility of this function is to allow the caller
-               to give a hint to the system that the network infrastructure
-               or configuration has changed.
  */
 
 /*!
  */
 
 /*!
@@ -134,7 +125,7 @@ __BEGIN_DECLS
 Boolean
 SCNetworkCheckReachabilityByAddress    (
                                        const struct sockaddr           *address,
 Boolean
 SCNetworkCheckReachabilityByAddress    (
                                        const struct sockaddr           *address,
-                                       int                             addrlen,
+                                       socklen_t                       addrlen,
                                        SCNetworkConnectionFlags        *flags
                                        );
 
                                        SCNetworkConnectionFlags        *flags
                                        );
 
@@ -167,11 +158,12 @@ SCNetworkCheckReachabilityByName  (
        @param ifName The BSD name of the network interface, such as
                CFSTR("en0").
        @result Returns TRUE if the notification was sent; FALSE otherwise.
        @param ifName The BSD name of the network interface, such as
                CFSTR("en0").
        @result Returns TRUE if the notification was sent; FALSE otherwise.
+       @deprecated in version 10.4. Replaced with SCNetworkInterfaceForceConfigurationRefresh.
  */
 Boolean
 SCNetworkInterfaceRefreshConfiguration (
                                        CFStringRef ifName
  */
 Boolean
 SCNetworkInterfaceRefreshConfiguration (
                                        CFStringRef ifName
-                                       );
+                                       )       DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER;
 
 __END_DECLS
 
 
 __END_DECLS
 
index bb1ab3487b81fd4e55ab0ce621b5a8735970707b..5398682752901de9cee8693f8508c7b55de61ad5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
                SCPreferencesCommitChanges function.
  */
 
                SCPreferencesCommitChanges function.
  */
 
+
 /*!
        @group Interface configuration
  */
 
 /*!
        @group Interface configuration
  */
 
+#pragma mark -
+#pragma mark SCNetworkInterface configuration (typedefs, consts)
+
 /*!
        @typedef SCNetworkInterfaceRef
        @discussion This is the type of a reference to an object that represents
 /*!
        @typedef SCNetworkInterfaceRef
        @discussion This is the type of a reference to an object that represents
@@ -121,6 +125,11 @@ extern const CFStringRef kSCNetworkInterfaceTypeSerial                                             AVAILABLE_MAC_OS_X_V
  */
 extern const CFStringRef kSCNetworkInterfaceTypeVLAN                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
  */
 extern const CFStringRef kSCNetworkInterfaceTypeVLAN                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
+/*!
+       @const kSCNetworkInterfaceTypeWWAN
+ */
+extern const CFStringRef kSCNetworkInterfaceTypeWWAN                                           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
 /* special network interfaces (and types) */
 
 /*!
 /* special network interfaces (and types) */
 
 /*!
@@ -131,16 +140,92 @@ extern const CFStringRef kSCNetworkInterfaceTypeIPv4                                              AVAILABLE_MAC_OS_X_VER
 /*!
        @const kSCNetworkInterfaceIPv4
        @discussion A network interface that can used for layering other
 /*!
        @const kSCNetworkInterfaceIPv4
        @discussion A network interface that can used for layering other
-               interfaces (e.g. 6to4, PPP, PPTP, L2TP) over an existing
+               interfaces (e.g. 6to4, PPTP, L2TP) over an existing
                IPv4 network.
  */
 extern const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4                                     AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
                IPv4 network.
  */
 extern const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4                                     AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @group Interface configuration (Bond)
+ */
+
+#pragma mark -
+
+/*!
+       @typedef SCBondInterfaceRef
+       @discussion This is the type of a reference to an object that represents
+               an Ethernet Bond interface.
+ */
+typedef SCNetworkInterfaceRef SCBondInterfaceRef;
+
+/*!
+       @typedef SCBondStatusRef
+       @discussion This is the type of a reference to an object that represents
+               the status of an Ethernet Bond interface.
+ */
+typedef const struct __SCBondStatus *          SCBondStatusRef;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
+/*!
+       @enum Ethernet Bond Aggregation Status (kSCBondStatusDeviceAggregationStatus) codes
+       @discussion Returned status codes.
+       @constant kSCBondStatusOK               Enabled, active, running, ...
+       @constant kSCBondStatusLinkInvalid      The link state was not valid (i.e. down, half-duplex, wrong speed)
+       @constant kSCBondStatusNoPartner        The port on the switch that the device is connected doesn't seem to have 802.3ad Link Aggregation enabled
+       @constant kSCBondStatusNotInActiveGroup We're talking to a partner, but the link aggregation group is different from the one that's active
+       @constant kSCBondStatusUnknown          Non-specific failure
+ */
+enum {
+       kSCBondStatusOK                 = 0,    /* enabled, active, running, ... */
+       kSCBondStatusLinkInvalid        = 1,    /* The link state was not valid (i.e. down, half-duplex, wrong speed) */
+       kSCBondStatusNoPartner          = 2,    /* The port on the switch that the device is connected doesn't seem to have 802.3ad Link Aggregation enabled */
+       kSCBondStatusNotInActiveGroup   = 3,    /* We're talking to a partner, but the link aggregation group is different from the one that's active */
+       kSCBondStatusUnknown            = 999   /* Non-specific failure */
+};
+
+/*!
+  @const kSCBondStatusDeviceAggregationStatus
+ */
+extern const CFStringRef kSCBondStatusDeviceAggregationStatus  /* CFNumber */                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+/*!
+  @const kSCBondStatusDeviceCollecting
+ */
+extern const CFStringRef kSCBondStatusDeviceCollecting         /* CFNumber (0 or 1) */         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+/*!
+  @const kSCBondStatusDeviceDistributing
+ */
+extern const CFStringRef kSCBondStatusDeviceDistributing       /* CFNumber (0 or 1) */         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @group Interface configuration (VLAN)
+ */
+
+#pragma mark -
+
+/*!
+       @typedef SCVLANInterfaceRef
+       @discussion This is the type of a reference to an object that represents
+               a Virtual LAN (VLAN) interface.
+ */
+typedef SCNetworkInterfaceRef SCVLANInterfaceRef;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
 
 /*!
        @group Protocol configuration
  */
 
 
 /*!
        @group Protocol configuration
  */
 
+#pragma mark -
+#pragma mark SCNetworkProtocol configuration (typedefs, consts)
+
 /*!
        @typedef SCNetworkProtocolRef
        @discussion This is the type of a reference to an object that represents
 /*!
        @typedef SCNetworkProtocolRef
        @discussion This is the type of a reference to an object that represents
@@ -175,11 +260,23 @@ extern const CFStringRef kSCNetworkProtocolTypeIPv6                                               AVAILABLE_MAC_OS_X_VERS
  */
 extern const CFStringRef kSCNetworkProtocolTypeProxies                                         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
  */
 extern const CFStringRef kSCNetworkProtocolTypeProxies                                         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @const kSCNetworkProtocolTypeSMB
+ */
+extern const CFStringRef kSCNetworkProtocolTypeSMB                                             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
 
 /*!
        @group Service configuration
  */
 
 
 /*!
        @group Service configuration
  */
 
+#pragma mark -
+#pragma mark SCNetworkService configuration (typedefs, consts)
+
 /*!
        @typedef SCNetworkServiceRef
        @discussion This is the type of a reference to an object that represents
 /*!
        @typedef SCNetworkServiceRef
        @discussion This is the type of a reference to an object that represents
@@ -192,6 +289,9 @@ typedef const struct __SCNetworkService * SCNetworkServiceRef;
        @group Set configuration
  */
 
        @group Set configuration
  */
 
+#pragma mark -
+#pragma mark SCNetworkSet configuration (typedefs, consts)
+
 /*!
        @typedef SCNetworkSetRef
        @discussion This is the type of a reference to an object that represents
 /*!
        @typedef SCNetworkSetRef
        @discussion This is the type of a reference to an object that represents
@@ -211,6 +311,9 @@ __BEGIN_DECLS
        @group Interface configuration
  */
 
        @group Interface configuration
  */
 
+#pragma mark -
+#pragma mark SCNetworkInterface configuration (APIs)
+
 /*!
        @function SCNetworkInterfaceGetTypeID
        @discussion Returns the type identifier of all SCNetworkInterface instances.
 /*!
        @function SCNetworkInterfaceGetTypeID
        @discussion Returns the type identifier of all SCNetworkInterface instances.
@@ -220,8 +323,8 @@ SCNetworkInterfaceGetTypeID                 (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LA
 
 /*!
        @function SCNetworkInterfaceCopyAll
 
 /*!
        @function SCNetworkInterfaceCopyAll
-       @discussion Returns all network capable devices on the system.
-       @result The list of SCNetworkInterface devices on the system.
+       @discussion Returns all network capable interfaces on the system.
+       @result The list of interfaces on the system.
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
@@ -280,11 +383,29 @@ SCNetworkInterfaceGetBSDName                      (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_
        @discussion Returns the configuration settings associated with a interface.
        @param interface The network interface.
        @result The configuration settings associated with the interface;
        @discussion Returns the configuration settings associated with a interface.
        @param interface The network interface.
        @result The configuration settings associated with the interface;
-               NULL if no changes to the default configuration have been saved.
+               NULL if no configuration settings are associated with the interface
+               or an error was encountered.
  */
 CFDictionaryRef
 SCNetworkInterfaceGetConfiguration             (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
  */
 CFDictionaryRef
 SCNetworkInterfaceGetConfiguration             (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @function SCNetworkInterfaceGetExtendedConfiguration
+       @discussion Returns the configuration settings associated with a interface.
+       @param interface The network interface.
+       @param extendedType A string representing the type of extended information (e.g. EAPOL).
+       @result The configuration settings associated with the interface;
+               NULL if no configuration settings are associated with the interface
+               or an error was encountered.
+ */
+CFDictionaryRef
+SCNetworkInterfaceGetExtendedConfiguration     (SCNetworkInterfaceRef          interface,
+                                                CFStringRef                    extendedType)   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
 /*!
        @function SCNetworkInterfaceGetHardwareAddressString
        @discussion Returns a displayable link layer address for the interface.
 /*!
        @function SCNetworkInterfaceGetHardwareAddressString
        @discussion Returns a displayable link layer address for the interface.
@@ -315,7 +436,7 @@ SCNetworkInterfaceGetInterfaceType          (SCNetworkInterfaceRef          interface)      AVAILABLE
 
 /*!
        @function SCNetworkInterfaceGetLocalizedDisplayName
 
 /*!
        @function SCNetworkInterfaceGetLocalizedDisplayName
-       @discussion Returns the localized name (e.g. "Built-in Ethernet") for
+       @discussion Returns the localized name (e.g. "Ethernet", "FireWire") for
                the interface.
        @param interface The network interface.
        @result A localized, display name for the interface;
                the interface.
        @param interface The network interface.
        @result A localized, display name for the interface;
@@ -335,6 +456,417 @@ Boolean
 SCNetworkInterfaceSetConfiguration             (SCNetworkInterfaceRef          interface,
                                                 CFDictionaryRef                config)         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
 SCNetworkInterfaceSetConfiguration             (SCNetworkInterfaceRef          interface,
                                                 CFDictionaryRef                config)         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @function SCNetworkInterfaceSetExtendedConfiguration
+       @discussion Stores the configuration settings for the interface.
+       @param interface The network interface.
+       @param config The configuration settings to associate with this interface.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCNetworkInterfaceSetExtendedConfiguration     (SCNetworkInterfaceRef          interface,
+                                                CFStringRef                    extendedType,
+                                                CFDictionaryRef                config)         AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+#pragma mark -
+
+/*!
+       @function SCNetworkInterfaceCopyMediaOptions
+       @discussion For the specified network interface, returns information
+               about the currently requested media options, the active media
+               options, and the media options which are available.
+       @param interface The desired network interface.
+       @param current A pointer to memory that will be filled with a CFDictionaryRef
+               representing the currently requested media options (subtype, options).
+               If NULL, the current options will not be returned.
+       @param active A pointer to memory that will be filled with a CFDictionaryRef
+               representing the active media options (subtype, options).
+               If NULL, the active options will not be returned.
+       @param available A pointer to memory that will be filled with a CFArrayRef
+               representing the possible media options (subtype, options).
+               If NULL, the available options will not be returned.
+       @param filter A boolean indicating whether the available options should be
+               filtered to exclude those options which would not normally be
+               requested by a user/admin (e.g. hw-loopback).
+       @result TRUE if requested information has been returned.
+ */
+Boolean
+SCNetworkInterfaceCopyMediaOptions             (SCNetworkInterfaceRef          interface,
+                                                CFDictionaryRef                *current,
+                                                CFDictionaryRef                *active,
+                                                CFArrayRef                     *available,
+                                                Boolean                        filter)         AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCNetworkInterfaceCopyMediaSubTypes
+       @discussion For the provided interface configuration options, return a list
+               of available media subtypes.
+       @param available The available options as returned by the
+               SCNetworkInterfaceCopyMediaOptions function.
+       @result An array of available media subtypes CFString's (e.g. 10BaseT/UTP,
+               100baseTX, etc).  NULL if no subtypes are available.
+ */
+CFArrayRef
+SCNetworkInterfaceCopyMediaSubTypes            (CFArrayRef                     available)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCNetworkInterfaceCopyMediaSubTypeOptions
+       @discussion For the provided interface configuration options and specific
+               subtype, return a list of available media options.
+       @param available The available options as returned by the
+               NetworkInterfaceCopyMediaOptions function.
+       @param subType The subtype
+       @result An array of available media options.  Each of the available options
+               is returned as an array of CFString's (e.g. <half-duplex>,
+               <full-duplex,flow-control>).  NULL if no options are available.
+ */
+CFArrayRef
+SCNetworkInterfaceCopyMediaSubTypeOptions      (CFArrayRef                     available,
+                                                CFStringRef                    subType)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCNetworkInterfaceCopyMTU
+       @discussion For the specified network interface, returns information
+               about the currently MTU setting and the range of allowable
+               values.
+       @param interface The desired network interface.
+       @param mtu_cur A pointer to memory that will be filled with the current
+               MTU setting for the interface.
+       @param mtu_min A pointer to memory that will be filled with the minimum
+               MTU setting for the interface.  If negative, the minimum setting
+               could not be determined.
+       @param mtu_max A pointer to memory that will be filled with the maximum
+               MTU setting for the interface.  If negative, the maximum setting
+               could not be determined.
+       @result TRUE if requested information has been returned.
+ */
+Boolean
+SCNetworkInterfaceCopyMTU                      (SCNetworkInterfaceRef          interface,
+                                                int                            *mtu_cur,
+                                                int                            *mtu_min,
+                                                int                            *mtu_max)       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCNetworkInterfaceSetMediaOptions
+       @discussion For the specified network interface, sets the requested
+               media subtype and options.
+       @param interface The desired network interface.
+       @param subtype The desired media subtype (e.g. "autoselect", "100baseTX", ...).
+       @param options The desired media options (e.g. "half-duplex", "full-duplex", ...).
+               If NULL, the active options will not be returned.
+       @result TRUE if the configuration was updated; FALSE if an error was encountered.
+ */
+Boolean
+SCNetworkInterfaceSetMediaOptions              (SCNetworkInterfaceRef          interface,
+                                                CFStringRef                    subtype,
+                                                CFArrayRef                     options)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCNetworkInterfaceSetMTU
+       @discussion For the specified network interface, sets the
+               requested MTU setting.
+       @param interface The desired network interface.
+       @param mtu The desired MTU setting for the interface.
+       @result TRUE if the configuration was updated; FALSE if an error was encountered.
+ */
+Boolean
+SCNetworkInterfaceSetMTU                       (SCNetworkInterfaceRef          interface,
+                                                int                            mtu)            AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCNetworkInterfaceForceConfigurationRefresh
+       @discussion Sends a notification to interested network configuration
+               agents to immediately retry their configuration. For example,
+               calling this function will cause the DHCP client to contact
+               the DHCP server immediately rather than waiting until its
+               timeout has expired.  The utility of this function is to
+               allow the caller to give a hint to the system that the
+               network infrastructure or configuration has changed.
+
+
+               Note: This function requires root (euid==0) privilege or,
+               alternatively, you may pass an SCNetworkInterface which
+               is derived from a sequence of calls to :
+
+                       SCPreferencesCreateWithAuthorization
+                       SCNetworkSetCopy...
+                       SCNetworkServiceGetInterface
+       @param interface The desired network interface.
+       @result Returns TRUE if the notification was sent; FALSE otherwise.
+ */
+Boolean
+SCNetworkInterfaceForceConfigurationRefresh    (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @group Interface configuration (Bond)
+ */
+
+#pragma mark -
+#pragma mark SCBondInterface configuration (APIs)
+
+/*!
+       @function SCBondInterfaceCopyAll
+       @discussion Returns all Ethernet Bond interfaces on the system.
+       @param prefs The "preferences" session.
+       @result The list of Ethernet Bond interfaces on the system.
+               You must release the returned value.
+ */
+CFArrayRef /* of SCBondInterfaceRef's */
+SCBondInterfaceCopyAll                         (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceCopyAvailableMemberInterfaces
+       @discussion Returns all network capable devices on the system
+               that can be added to an Ethernet Bond interface.
+       @param prefs The "preferences" session.
+       @result The list of interfaces.
+               You must release the returned value.
+ */
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCBondInterfaceCopyAvailableMemberInterfaces   (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceCreate
+       @discussion Create a new SCBondInterface interface.
+       @param prefs The "preferences" session.
+       @result A reference to the new SCBondInterface.
+               You must release the returned value.
+ */
+SCBondInterfaceRef
+SCBondInterfaceCreate                          (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceRemove
+       @discussion Removes the SCBondInterface from the configuration.
+       @param bond The SCBondInterface interface.
+       @result TRUE if the interface was removed; FALSE if an error was encountered.
+ */
+Boolean
+SCBondInterfaceRemove                          (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceGetMemberInterfaces
+       @discussion Returns the member interfaces for the specified Ethernet Bond interface.
+       @param bond The SCBondInterface interface.
+       @result The list of interfaces.
+ */
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCBondInterfaceGetMemberInterfaces             (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceGetOptions
+       @discussion Returns the configuration settings associated with a Ethernet Bond interface.
+       @param bond The SCBondInterface interface.
+       @result The configuration settings associated with the Ethernet Bond interface;
+               NULL if no changes to the default configuration have been saved.
+ */
+CFDictionaryRef
+SCBondInterfaceGetOptions                      (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceSetMemberInterfaces
+       @discussion Sets the member interfaces for the specified Ethernet Bond interface.
+       @param bond The SCBondInterface interface.
+       @param members The desired member interfaces.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCBondInterfaceSetMemberInterfaces             (SCBondInterfaceRef             bond,
+                                                CFArrayRef                     members) /* of SCNetworkInterfaceRef's */
+                                                                                               AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceSetLocalizedDisplayName
+       @discussion Sets the localized display name for the specified Ethernet Bond interface.
+       @param bond The SCBondInterface interface.
+       @param newName The new display name.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCBondInterfaceSetLocalizedDisplayName         (SCBondInterfaceRef             bond,
+                                                CFStringRef                    newName)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceSetOptions
+       @discussion Sets the configuration settings for the specified Ethernet Bond interface.
+       @param bond The SCBondInterface interface.
+       @param newOptions The new configuration settings.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCBondInterfaceSetOptions                      (SCBondInterfaceRef             bond,
+                                                CFDictionaryRef                newOptions)     AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#pragma mark -
+
+/*!
+       @function SCBondInterfaceCopyStatus
+       @discussion Returns the status of the specified Ethernet Bond interface.
+       @param bond The SCBondInterface interface.
+       @result The status associated with the interface.
+               You must release the returned value.
+ */
+SCBondStatusRef
+SCBondInterfaceCopyStatus                      (SCBondInterfaceRef     bond)                   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondStatusGetTypeID
+       @discussion Returns the type identifier of all SCBondStatus instances.
+ */
+CFTypeID
+SCBondStatusGetTypeID                          (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondStatusGetMemberInterfaces
+       @discussion Returns the member interfaces that are represented with the
+               Ethernet Bond interface.
+       @param bondStatus The Ethernet Bond status.
+       @result The list of interfaces.
+ */
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCBondStatusGetMemberInterfaces                        (SCBondStatusRef        bondStatus)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondStatusGetInterfaceStatus
+       @discussion Returns the status of a specific member interface of an
+               Ethernet Bond or the status of the bond as a whole.
+       @param bondStatus The Ethernet Bond status.
+       @param interface The specific member interface; NULL if you want the
+               status of the Ethernet Bond.
+       @result The interface status.
+ */
+CFDictionaryRef
+SCBondStatusGetInterfaceStatus                 (SCBondStatusRef        bondStatus,
+                                                SCNetworkInterfaceRef  interface)              AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @group Interface configuration (VLAN)
+ */
+
+#pragma mark -
+#pragma mark SCVLANInterface configuration (APIs)
+
+/*!
+       @function SCVLANInterfaceCopyAll
+       @discussion Returns all VLAN interfaces on the system.
+       @result The list of VLAN interfaces on the system.
+               You must release the returned value.
+ */
+CFArrayRef /* of SCVLANInterfaceRef's */
+SCVLANInterfaceCopyAll                         (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceCopyAvailablePhysicalInterfaces
+       @discussion Returns the network capable devices on the system
+               that can be associated with a VLAN interface.
+       @result The list of interfaces.
+               You must release the returned value.
+ */
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCVLANInterfaceCopyAvailablePhysicalInterfaces (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceCreate
+       @discussion Create a new SCVLANInterface interface.
+       @param prefs The "preferences" session.
+       @param physical The physical interface to associate with the VLAN.
+       @param tag The tag to associate with the VLAN.
+       @result A reference to the new SCVLANInterface.
+               You must release the returned value.
+
+       Note: the tag must be in the range (1 <= tag <= 4094)
+ */
+SCVLANInterfaceRef
+SCVLANInterfaceCreate                          (SCPreferencesRef               prefs,
+                                                SCNetworkInterfaceRef          physical,
+                                                CFNumberRef                    tag)            AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceRemove
+       @discussion Removes the SCVLANInterface from the configuration.
+       @param vlan The SCVLANInterface interface.
+       @result TRUE if the interface was removed; FALSE if an error was encountered.
+ */
+Boolean
+SCVLANInterfaceRemove                          (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceGetPhysicalInterface
+       @discussion Returns the physical interface for the specified VLAN interface.
+       @param vlan The SCVLANInterface interface.
+       @result The list of interfaces.
+ */
+SCNetworkInterfaceRef
+SCVLANInterfaceGetPhysicalInterface            (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceGetTag
+       @discussion Returns the tag for the specified VLAN interface.
+       @param vlan The SCVLANInterface interface.
+       @result The tag.
+ */
+CFNumberRef
+SCVLANInterfaceGetTag                          (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceGetOptions
+       @discussion Returns the configuration settings associated with the VLAN interface.
+       @param vlan The SCVLANInterface interface.
+       @result The configuration settings associated with the VLAN interface;
+               NULL if no changes to the default configuration have been saved.
+ */
+CFDictionaryRef
+SCVLANInterfaceGetOptions                      (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceSetPhysicalInterfaceAndTag
+       @discussion Updates the specified VLAN interface.
+       @param vlan The SCVLANInterface interface.
+       @param physical The physical interface to associate with the VLAN.
+       @param tag The tag to associate with the VLAN.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+
+       Note: the tag must be in the range (1 <= tag <= 4094)
+ */
+Boolean
+SCVLANInterfaceSetPhysicalInterfaceAndTag      (SCVLANInterfaceRef             vlan,
+                                                SCNetworkInterfaceRef          physical,
+                                                CFNumberRef                    tag)            AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceSetLocalizedDisplayName
+       @discussion Sets the localized display name for the specified VLAN interface.
+       @param vlan The SCVLANInterface interface.
+       @param newName The new display name.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCVLANInterfaceSetLocalizedDisplayName         (SCVLANInterfaceRef             vlan,
+                                                CFStringRef                    newName)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCVLANInterfaceSetOptions
+       @discussion Sets the configuration settings for the specified VLAN interface.
+       @param vlan The SCVLANInterface interface.
+       @param newOptions The new configuration settings.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCVLANInterfaceSetOptions                      (SCVLANInterfaceRef             vlan,
+                                                CFDictionaryRef                newOptions)     AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
 /* --------------------------------------------------------------------------------
  * PROTOCOLS
  * -------------------------------------------------------------------------------- */
 /* --------------------------------------------------------------------------------
  * PROTOCOLS
  * -------------------------------------------------------------------------------- */
@@ -343,6 +875,9 @@ SCNetworkInterfaceSetConfiguration          (SCNetworkInterfaceRef          interface,
        @group Protocol configuration
  */
 
        @group Protocol configuration
  */
 
+#pragma mark -
+#pragma mark SCNetworkProtocol configuration (APIs)
+
 /*!
        @function SCNetworkProtocolGetTypeID
        @discussion Returns the type identifier of all SCNetworkProtocol instances.
 /*!
        @function SCNetworkProtocolGetTypeID
        @discussion Returns the type identifier of all SCNetworkProtocol instances.
@@ -355,7 +890,8 @@ SCNetworkProtocolGetTypeID                  (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LAT
        @discussion Returns the configuration settings associated with the protocol.
        @param protocol The network protocol.
        @result The configuration settings associated with the protocol;
        @discussion Returns the configuration settings associated with the protocol.
        @param protocol The network protocol.
        @result The configuration settings associated with the protocol;
-               NULL if no changes to the default configuration have been saved.
+               NULL if no configuration settings are associated with the protocol
+               or an error was encountered.
  */
 CFDictionaryRef
 SCNetworkProtocolGetConfiguration              (SCNetworkProtocolRef           protocol)       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  */
 CFDictionaryRef
 SCNetworkProtocolGetConfiguration              (SCNetworkProtocolRef           protocol)       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
@@ -408,6 +944,9 @@ SCNetworkProtocolSetEnabled                 (SCNetworkProtocolRef           protocol,
        @group Service configuration
  */
 
        @group Service configuration
  */
 
+#pragma mark -
+#pragma mark SCNetworkService configuration (APIs)
+
 /*!
        @function SCNetworkServiceGetTypeID
        @discussion Returns the type identifier of all SCNetworkService instances.
 /*!
        @function SCNetworkServiceGetTypeID
        @discussion Returns the type identifier of all SCNetworkService instances.
@@ -476,6 +1015,22 @@ SCNetworkServiceRef
 SCNetworkServiceCopy                           (SCPreferencesRef               prefs,
                                                 CFStringRef                    serviceID)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
 SCNetworkServiceCopy                           (SCPreferencesRef               prefs,
                                                 CFStringRef                    serviceID)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @function SCNetworkServiceEstablishDefaultConfiguration
+       @discussion Establishes the "default" configuration for a network
+               service.  This configuration includes the addition of
+               network protocols for the service (with "default"
+               configuration options).
+       @param service The network service.
+       @result TRUE if the configuration was updated; FALSE if an error was encountered.
+*/
+Boolean
+SCNetworkServiceEstablishDefaultConfiguration          (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
 /*!
        @function SCNetworkServiceGetEnabled
        @discussion Returns whether this service has been enabled.
 /*!
        @function SCNetworkServiceGetEnabled
        @discussion Returns whether this service has been enabled.
@@ -574,6 +1129,7 @@ Boolean
 SCNetworkServiceSetName                                (SCNetworkServiceRef            service,
                                                 CFStringRef                    name)           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
 SCNetworkServiceSetName                                (SCNetworkServiceRef            service,
                                                 CFStringRef                    name)           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
+
 /* --------------------------------------------------------------------------------
  * SETS
  * -------------------------------------------------------------------------------- */
 /* --------------------------------------------------------------------------------
  * SETS
  * -------------------------------------------------------------------------------- */
@@ -582,6 +1138,9 @@ SCNetworkServiceSetName                            (SCNetworkServiceRef            service,
        @group Set configuration
  */
 
        @group Set configuration
  */
 
+#pragma mark -
+#pragma mark SCNetworkSet configuration (APIs)
+
 /*!
        @function SCNetworkSetGetTypeID
        @discussion Returns the type identifier of all SCNetworkSet instances.
 /*!
        @function SCNetworkSetGetTypeID
        @discussion Returns the type identifier of all SCNetworkSet instances.
@@ -597,15 +1156,31 @@ SCNetworkSetGetTypeID                            (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
        @result TRUE if the service was added to the set; FALSE if the
                service was already present or an error was encountered.
 
        @result TRUE if the service was added to the set; FALSE if the
                service was already present or an error was encountered.
 
-       Note: at the present time, the Network Prefs UI does not
-       support having a single service be a member of more than
-       one set.  As such, an error will be returned if you attempt
-       to add a service to more than one set.
+       Note: prior to Mac OS X 10.5, the Network Preferences UI
+       did not support having a single service being a member of
+       more than one set.  An error will be returned if you attempt
+       to add a service to more than one set on a pre-10.5 system.
  */
 Boolean
 SCNetworkSetAddService                         (SCNetworkSetRef                set,
                                                 SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
  */
 Boolean
 SCNetworkSetAddService                         (SCNetworkSetRef                set,
                                                 SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @function SCNetworkSetContainsInterface
+       @discussion Checks if an interface is represented by at least one
+               network service in the specified set.
+       @param set The network set.
+       @param interface The network interface.
+       @result TRUE if the interface is represented in the set; FALSE if not.
+ */
+Boolean
+SCNetworkSetContainsInterface                  (SCNetworkSetRef                set,
+                                                SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
 /*!
        @function SCNetworkSetCopyAll
        @discussion Returns all available sets for the specified preferences.
 /*!
        @function SCNetworkSetCopyAll
        @discussion Returns all available sets for the specified preferences.
@@ -737,7 +1312,7 @@ SCNetworkSetSetName                                (SCNetworkSetRef                set,
                                                 CFStringRef                    name)           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
 /*!
                                                 CFStringRef                    name)           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
 /*!
-       @function SCNetworkSetGetServiceOrder
+       @function SCNetworkSetSetServiceOrder
        @discussion Stores the [user specified] ordering of network services for the set.
        @param set The network set.
        @param newOrder The ordered list of CFStringRef service identifiers for the set.
        @discussion Stores the [user specified] ordering of network services for the set.
        @param set The network set.
        @param newOrder The ordered list of CFStringRef service identifiers for the set.
index 14266e6beb4c88488c3b466e340fe8764085f6e7..e1792e0743c0430784dd0bb17594c533d7173716 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004,2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -72,20 +72,28 @@ __setPrefsConfiguration(SCPreferencesRef    prefs,
                        CFDictionaryRef         config,
                        Boolean                 keepInactive)
 {
                        CFDictionaryRef         config,
                        Boolean                 keepInactive)
 {
-       CFMutableDictionaryRef  newConfig;
+       CFMutableDictionaryRef  newConfig       = NULL;
        Boolean                 ok;
 
        Boolean                 ok;
 
-       if (!isA_CFDictionary(config)) {
+       if ((config != NULL) && !isA_CFDictionary(config)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
-       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+       if (config != NULL) {
+               newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+       }
 
        if (keepInactive) {
                CFDictionaryRef curConfig;
 
 
        if (keepInactive) {
                CFDictionaryRef curConfig;
 
-               // preserve enabled/disabled state
+               if (config == NULL) {
+                       newConfig = CFDictionaryCreateMutable(NULL,
+                                                             0,
+                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                             &kCFTypeDictionaryValueCallBacks);
+               }
+
                curConfig = SCPreferencesPathGetValue(prefs, path);
                if (isA_CFDictionary(curConfig) && CFDictionaryContainsKey(curConfig, kSCResvInactive)) {
                        // if currently disabled
                curConfig = SCPreferencesPathGetValue(prefs, path);
                if (isA_CFDictionary(curConfig) && CFDictionaryContainsKey(curConfig, kSCResvInactive)) {
                        // if currently disabled
@@ -97,9 +105,17 @@ __setPrefsConfiguration(SCPreferencesRef    prefs,
        }
 
        // set new configuration
        }
 
        // set new configuration
-       ok = SCPreferencesPathSetValue(prefs, path, newConfig);
+       if (newConfig != NULL) {
+               // if new configuration (or we are preserving a disabled state)
+               ok = SCPreferencesPathSetValue(prefs, path, newConfig);
+               CFRelease(newConfig);
+       } else {
+               ok = SCPreferencesPathRemoveValue(prefs, path);
+               if (!ok && (SCError() == kSCStatusNoKey)) {
+                       ok = TRUE;
+               }
+       }
 
 
-       CFRelease(newConfig);
        return ok;
 }
 
        return ok;
 }
 
@@ -123,7 +139,7 @@ __setPrefsEnabled(SCPreferencesRef      prefs,
                  CFStringRef           path,
                  Boolean               enabled)
 {
                  CFStringRef           path,
                  Boolean               enabled)
 {
-       CFDictionaryRef         curConfig       = NULL;
+       CFDictionaryRef         curConfig;
        CFMutableDictionaryRef  newConfig       = NULL;
        Boolean                 ok              = FALSE;
 
        CFMutableDictionaryRef  newConfig       = NULL;
        Boolean                 ok              = FALSE;
 
@@ -135,39 +151,38 @@ __setPrefsEnabled(SCPreferencesRef      prefs,
                        return FALSE;
                }
                newConfig = CFDictionaryCreateMutableCopy(NULL, 0, curConfig);
                        return FALSE;
                }
                newConfig = CFDictionaryCreateMutableCopy(NULL, 0, curConfig);
-       } else {
-               newConfig = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-       }
 
 
-       if (enabled) {
-               // enable
-               CFDictionaryRemoveValue(newConfig, kSCResvInactive);
+               if (enabled) {
+                       // enable
+                       CFDictionaryRemoveValue(newConfig, kSCResvInactive);
+               } else {
+                       // disable
+                       CFDictionarySetValue(newConfig, kSCResvInactive, kCFBooleanTrue);
+               }
        } else {
        } else {
-               // disable
-               CFDictionarySetValue(newConfig, kSCResvInactive, kCFBooleanTrue);
+               if (!enabled) {
+                       // disable
+                       newConfig = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+                       CFDictionarySetValue(newConfig, kSCResvInactive, kCFBooleanTrue);
+               }
        }
 
        }
 
-       // update configuration
-       if (CFDictionaryGetCount(newConfig) == 0) {
+       // set new configuration
+       if (newConfig != NULL) {
+               // if updated configuration (or we are establishing as disabled)
+               ok = SCPreferencesPathSetValue(prefs, path, newConfig);
                CFRelease(newConfig);
                CFRelease(newConfig);
-               newConfig = NULL;
-       }
-
-       if (newConfig == NULL) {
-               ok = SCPreferencesPathRemoveValue(prefs, path);
        } else {
        } else {
-               ok = SCPreferencesPathSetValue(prefs, path, newConfig);
+               ok = SCPreferencesPathRemoveValue(prefs, path);
+               if (!ok && (SCError() == kSCStatusNoKey)) {
+                       ok = TRUE;
+               }
        }
 
        }
 
-       if (newConfig != NULL)  CFRelease(newConfig);
        return ok;
 }
 
 
        return ok;
 }
 
 
-#define SYSTEMCONFIGURATION_BUNDLE_ID   CFSTR("com.apple.SystemConfiguration")
-#define SYSTEMCONFIGURATION_FRAMEWORK   "SystemConfiguration.framework"
-
-
 static CFDictionaryRef
 __copyTemplates()
 {
 static CFDictionaryRef
 __copyTemplates()
 {
@@ -178,7 +193,7 @@ __copyTemplates()
        CFStringRef     xmlError        = NULL;
        CFDataRef       xmlTemplates    = NULL;
 
        CFStringRef     xmlError        = NULL;
        CFDataRef       xmlTemplates    = NULL;
 
-       bundle = CFBundleGetBundleWithIdentifier(SYSTEMCONFIGURATION_BUNDLE_ID);
+       bundle = _SC_CFBundleGet();
        if (bundle == NULL) {
                return NULL;
        }
        if (bundle == NULL) {
                return NULL;
        }
@@ -296,7 +311,7 @@ __copyProtocolTemplate(CFStringRef      interfaceType,
 
        if (isA_CFDictionary(interface)) {
                protocol = CFDictionaryGetValue(interface, protocolType);
 
        if (isA_CFDictionary(interface)) {
                protocol = CFDictionaryGetValue(interface, protocolType);
-               if (isA_CFDictionary(protocol) && (CFDictionaryGetCount(protocol) > 0)) {
+               if (isA_CFDictionary(protocol)) {
                        CFRetain(protocol);
                } else {
                        protocol = NULL;
                        CFRetain(protocol);
                } else {
                        protocol = NULL;
@@ -357,35 +372,166 @@ __destroyInterface(int s, CFStringRef interface)
 }
 
 
 }
 
 
-__private_extern__ Boolean
-__markInterfaceUp(int s, CFStringRef interface)
+/*
+ * For rdar://problem/4685223
+ *
+ * To keep MoreSCF happy we need to ensure that the first "Set" and
+ * "NetworkService" have a [less than] unique identifier that can
+ * be parsed as a numeric string.
+ *
+ * Note: this backwards compatibility code must be enabled using the
+ *       following command:
+ *
+ *       sudo defaults write                                           \
+ *             /Library/Preferences/SystemConfiguration/preferences    \
+ *             MoreSCF                                                 \
+ *             -bool true
+ */
+__private_extern__
+CFStringRef
+__SCPreferencesPathCreateUniqueChild_WithMoreSCFCompatibility(SCPreferencesRef prefs, CFStringRef prefix)
 {
 {
-       struct ifreq    ifr;
+       static int      hack    = -1;
+       CFStringRef     path    = NULL;
 
 
-       bzero(&ifr, sizeof(ifr));
-       (void) _SC_cfstring_to_cstring(interface,
-                                      ifr.ifr_name,
-                                      sizeof(ifr.ifr_name),
-                                      kCFStringEncodingASCII);
+       if (hack < 0) {
+               CFBooleanRef    enable;
 
 
-       if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) == -1) {
-               SCLog(TRUE,
-                     LOG_ERR,
-                     CFSTR("could not get flags for interface \"%@\": %s"),
-                     interface,
-                     strerror(errno));
-               return FALSE;
+               enable = SCPreferencesGetValue(prefs, CFSTR("MoreSCF"));
+               hack = (isA_CFBoolean(enable) && CFBooleanGetValue(enable)) ? 1 : 0;
        }
 
        }
 
-       ifr.ifr_flags |= IFF_UP;
-       if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) == -1) {
-               SCLog(TRUE,
-                     LOG_ERR,
-                     CFSTR("could not set flags for interface \"%@\": %s"),
-                     interface,
-                     strerror(errno));
-               return FALSE;
+       if (hack > 0) {
+               CFDictionaryRef dict;
+               Boolean ok;
+
+               path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@/%@"), prefix, CFSTR("0"));
+               dict = SCPreferencesPathGetValue(prefs, path);
+               if (dict != NULL) {
+                       // if path "0" exists
+                       CFRelease(path);
+                       return NULL;
+               }
+
+               // unique child with path "0" does not exist, create
+               dict = CFDictionaryCreate(NULL,
+                                         NULL, NULL, 0,
+                                         &kCFTypeDictionaryKeyCallBacks,
+                                         &kCFTypeDictionaryValueCallBacks);
+               ok = SCPreferencesPathSetValue(prefs, path, dict);
+               CFRelease(dict);
+               if (!ok) {
+                       // if create failed
+                       CFRelease(path);
+                       return NULL;
+               }
        }
 
        }
 
-       return TRUE;
+       return path;
+}
+
+
+static CFDataRef
+__copy_legacy_password(CFTypeRef password)
+{
+       if (password == NULL) {
+               return NULL;
+       }
+
+       if (isA_CFData(password)) {
+               CFIndex n;
+
+               n = CFDataGetLength(password);
+               if ((n % sizeof(UniChar)) == 0) {
+                       CFStringEncoding        encoding;
+                       CFStringRef             str;
+
+#if    __BIG_ENDIAN__
+                       encoding = (*(CFDataGetBytePtr(password) + 1) == 0x00) ? kCFStringEncodingUTF16LE : kCFStringEncodingUTF16BE;
+#else  // __LITTLE_ENDIAN__
+                       encoding = (*(CFDataGetBytePtr(password)    ) == 0x00) ? kCFStringEncodingUTF16BE : kCFStringEncodingUTF16LE;
+#endif
+                       str = CFStringCreateWithBytes(NULL,
+                                                     (const UInt8 *)CFDataGetBytePtr(password),
+                                                     n,
+                                                     encoding,
+                                                     FALSE);
+                       password = CFStringCreateExternalRepresentation(NULL,
+                                                                       str,
+                                                                       kCFStringEncodingUTF8,
+                                                                       0);
+                       CFRelease(str);
+               } else {
+                       password = NULL;
+               }
+       } else if (isA_CFString(password) && (CFStringGetLength(password) > 0)) {
+               // convert password to CFData
+               password = CFStringCreateExternalRepresentation(NULL,
+                                                               password,
+                                                               kCFStringEncodingUTF8,
+                                                               0);
+       } else {
+               password = NULL;
+       }
+
+       return password;
 }
 }
+
+
+__private_extern__
+Boolean
+__extract_password(SCPreferencesRef    prefs,
+                  CFDictionaryRef      config,
+                  CFStringRef          passwordKey,
+                  CFStringRef          encryptionKey,
+                  CFStringRef          encryptionKeyChainValue,
+                  CFStringRef          unique_id,
+                  CFDataRef            *password)
+{
+       CFStringRef     encryption      = NULL;
+       Boolean         exists          = FALSE;
+
+       // check for keychain password
+       if (config != NULL) {
+               encryption = CFDictionaryGetValue(config, encryptionKey);
+       }
+       if ((encryption == NULL) ||
+           (isA_CFString(encryption) &&
+            CFEqual(encryption, encryptionKeyChainValue))) {
+               // check password
+               if (password != NULL) {
+                       if (prefs != NULL) {
+                               *password = _SCPreferencesSystemKeychainPasswordItemCopy(prefs, unique_id);
+                       } else {
+                               *password = _SCSecKeychainPasswordItemCopy(NULL, unique_id);
+                       }
+                       exists = (*password != NULL);
+               } else {
+                       if (prefs != NULL) {
+                               exists = _SCPreferencesSystemKeychainPasswordItemExists(prefs, unique_id);
+                       } else {
+                               exists = _SCSecKeychainPasswordItemExists(NULL, unique_id);
+                       }
+               }
+       }
+
+       // as needed, check for in-line password
+       if (!exists && (encryption == NULL) && (config != NULL)) {
+               CFDataRef       inline_password;
+
+               inline_password = CFDictionaryGetValue(config, passwordKey);
+               inline_password = __copy_legacy_password(inline_password);
+               if (inline_password != NULL) {
+                       exists = TRUE;
+
+                       if (password != NULL) {
+                               *password = inline_password;
+                       } else {
+                               CFRelease(inline_password);
+                       }
+               }
+       }
+
+       return exists;
+}
+
index 0a3f2dd39b1c418e18f889f1d1fa8a4e831f0777..f516c823e362b73afce1ce57440047647b0839e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <SystemConfiguration/SCPreferencesPathKey.h>
 #include <IOKit/IOKitLib.h>
 
 #include <SystemConfiguration/SCPreferencesPathKey.h>
 #include <IOKit/IOKitLib.h>
 
-#include "SCNetworkConfiguration.h"
 
 typedef struct {
 
 
 typedef struct {
 
-       /* base CFType information */
+       // base CFType information
        CFRuntimeBase           cfBase;
 
        CFRuntimeBase           cfBase;
 
-       /* set id */
+       // set id
        CFStringRef             setID;
 
        CFStringRef             setID;
 
-       /* prefs */
+       // prefs
        SCPreferencesRef        prefs;
 
        SCPreferencesRef        prefs;
 
+       // name
+       CFStringRef             name;
+
 } SCNetworkSetPrivate, *SCNetworkSetPrivateRef;
 
 
 typedef struct {
 
 } SCNetworkSetPrivate, *SCNetworkSetPrivateRef;
 
 
 typedef struct {
 
-       /* base CFType information */
+       // base CFType information
        CFRuntimeBase           cfBase;
 
        CFRuntimeBase           cfBase;
 
-       /* service id */
+       // service id
        CFStringRef             serviceID;
 
        CFStringRef             serviceID;
 
-       /* interface */
+       // interface
        SCNetworkInterfaceRef   interface;
 
        SCNetworkInterfaceRef   interface;
 
-       /* prefs */
+       // prefs
        SCPreferencesRef        prefs;
 
 } SCNetworkServicePrivate, *SCNetworkServicePrivateRef;
        SCPreferencesRef        prefs;
 
 } SCNetworkServicePrivate, *SCNetworkServicePrivateRef;
@@ -67,13 +69,13 @@ typedef struct {
 
 typedef struct {
 
 
 typedef struct {
 
-       /* base CFType information */
+       // base CFType information
        CFRuntimeBase           cfBase;
 
        CFRuntimeBase           cfBase;
 
-       /* entity id */
+       // entity id
        CFStringRef             entityID;
 
        CFStringRef             entityID;
 
-       /* service */
+       // service
        SCNetworkServiceRef     service;
 
 } SCNetworkProtocolPrivate, *SCNetworkProtocolPrivateRef;
        SCNetworkServiceRef     service;
 
 } SCNetworkProtocolPrivate, *SCNetworkProtocolPrivateRef;
@@ -87,20 +89,26 @@ typedef struct {
        // interface information
        CFStringRef             interface_type;         // interface type
 
        // interface information
        CFStringRef             interface_type;         // interface type
 
+       // [non-localized] name
+       CFStringRef             name;                   // non-localized [display] name
+
        // localized name
        CFStringRef             localized_name;         // localized [display] name
        CFStringRef             localized_key;
        CFStringRef             localized_arg1;
        CFStringRef             localized_arg2;
 
        // localized name
        CFStringRef             localized_name;         // localized [display] name
        CFStringRef             localized_key;
        CFStringRef             localized_arg1;
        CFStringRef             localized_arg2;
 
-       /* [layered] interface*/
+       // [layered] interface
        SCNetworkInterfaceRef   interface;
 
        SCNetworkInterfaceRef   interface;
 
-       /* service (NULL if not associated with a service)  */
-       SCNetworkServiceRef     service;
+       // prefs (for associated service, BOND interfaces, and VLAN interfaces)
+       SCPreferencesRef        prefs;
+
+       // serviceID (NULL if not associated with a service)
+       CFStringRef             serviceID;
 
 
-       /* unsaved configuration (when prefs not [yet] available) */
-       CFDictionaryRef         unsaved;
+       // unsaved configuration (when prefs not [yet] available)
+       CFMutableDictionaryRef  unsaved;
 
        // [SCPreferences] interface entity information
        CFStringRef             entity_device;          // interface device
 
        // [SCPreferences] interface entity information
        CFStringRef             entity_device;          // interface device
@@ -112,69 +120,97 @@ typedef struct {
        CFMutableArrayRef       supported_protocol_types;
 
        // IORegistry (service plane) information
        CFMutableArrayRef       supported_protocol_types;
 
        // IORegistry (service plane) information
-       CFStringRef             address;
+       CFDataRef               address;
+       CFStringRef             addressString;
        Boolean                 builtin;
        CFStringRef             location;
        CFStringRef             path;
        Boolean                 builtin;
        CFStringRef             location;
        CFStringRef             path;
-       CFStringRef             modemCCL;
+       CFMutableDictionaryRef  overrides;
        Boolean                 modemIsV92;
        Boolean                 supportsBond;
        Boolean                 supportsVLAN;
        Boolean                 modemIsV92;
        Boolean                 supportsBond;
        Boolean                 supportsVLAN;
+       CFNumberRef             type;
+       CFNumberRef             unit;
 
        // misc
        int                     sort_order;             // sort order for this interface
 
 
        // misc
        int                     sort_order;             // sort order for this interface
 
+       // for BOND interfaces
+       struct {
+               CFArrayRef              interfaces;
+               CFDictionaryRef         options;
+               CFNumberRef             mode;
+       } bond;
+
+       // for VLAN interfaces
+       struct {
+               SCNetworkInterfaceRef   interface;
+               CFNumberRef             tag;            // e.g. 1 <= tag <= 4094
+               CFDictionaryRef         options;
+       } vlan;
+
 } SCNetworkInterfacePrivate, *SCNetworkInterfacePrivateRef;
 
 
 __BEGIN_DECLS
 
 
 } SCNetworkInterfacePrivate, *SCNetworkInterfacePrivateRef;
 
 
 __BEGIN_DECLS
 
 
-SCNetworkServicePrivateRef
-__SCNetworkServiceCreatePrivate                        (CFAllocatorRef         allocator,
-                                                CFStringRef            serviceID,
-                                                SCNetworkInterfaceRef  interface,
-                                                SCPreferencesRef       prefs);
+#pragma mark -
+#pragma mark SCNetworkInterface configuration (internal)
 
 
 
 
-SCNetworkProtocolPrivateRef
-__SCNetworkProtocolCreatePrivate               (CFAllocatorRef         allocator,
-                                                CFStringRef            entityID,
-                                                SCNetworkServiceRef    service);
-
-Boolean
-__SCNetworkProtocolIsValidType                 (CFStringRef            protocolType);
+CFArrayRef
+__SCNetworkInterfaceCopyAll_IONetworkInterface (void);
 
 SCNetworkInterfacePrivateRef
 __SCNetworkInterfaceCreateCopy                 (CFAllocatorRef         allocator,
                                                 SCNetworkInterfaceRef  interface,
 
 SCNetworkInterfacePrivateRef
 __SCNetworkInterfaceCreateCopy                 (CFAllocatorRef         allocator,
                                                 SCNetworkInterfaceRef  interface,
-                                                SCNetworkServiceRef    service);
+                                                SCPreferencesRef       prefs,
+                                                CFStringRef            serviceID);
 
 SCNetworkInterfacePrivateRef
 __SCNetworkInterfaceCreatePrivate              (CFAllocatorRef         allocator,
                                                 SCNetworkInterfaceRef  interface,
 
 SCNetworkInterfacePrivateRef
 __SCNetworkInterfaceCreatePrivate              (CFAllocatorRef         allocator,
                                                 SCNetworkInterfaceRef  interface,
-                                                SCNetworkServiceRef    service,
+                                                SCPreferencesRef       prefs,
+                                                CFStringRef            serviceID,
                                                 io_string_t            path);
 
                                                 io_string_t            path);
 
+SCNetworkInterfacePrivateRef
+_SCBondInterfaceCreatePrivate                  (CFAllocatorRef         allocator,
+                                                CFStringRef            bond_if);
+
+SCNetworkInterfacePrivateRef
+_SCVLANInterfaceCreatePrivate                  (CFAllocatorRef         allocator,
+                                                CFStringRef            vlan_if);
+
 CFDictionaryRef
 __SCNetworkInterfaceCopyInterfaceEntity                (SCNetworkInterfaceRef  interface);
 
 CFDictionaryRef
 __SCNetworkInterfaceCopyInterfaceEntity                (SCNetworkInterfaceRef  interface);
 
-SCNetworkInterfaceRef
-__SCNetworkInterfaceCreateWithEntity           (CFAllocatorRef         allocator,
-                                                CFDictionaryRef        interface_entity,
-                                                SCNetworkServiceRef    service);
-
 CFArrayRef
 __SCNetworkInterfaceCopyDeepConfiguration       (SCNetworkInterfaceRef  interface);
 
 CFStringRef
 CFArrayRef
 __SCNetworkInterfaceCopyDeepConfiguration       (SCNetworkInterfaceRef  interface);
 
 CFStringRef
-__SCNetworkInterfaceGetModemCCL                        (SCNetworkInterfaceRef  interface);
+__SCNetworkInterfaceGetDefaultConfigurationType        (SCNetworkInterfaceRef  interface);
+
+CFStringRef
+__SCNetworkInterfaceGetNonLocalizedDisplayName (SCNetworkInterfaceRef  interface);
 
 Boolean
 
 Boolean
-__SCNetworkInterfaceIsModemV92                 (SCNetworkInterfaceRef  interface);
+__SCNetworkInterfaceIsValidExtendedConfigurationType
+                                               (SCNetworkInterfaceRef  interface,
+                                                CFStringRef            extendedType,
+                                                Boolean                requirePerInterface);
+
+CFDictionaryRef
+__SCNetworkInterfaceGetTemplateOverrides       (SCNetworkInterfaceRef  interface,
+                                                CFStringRef            interfaceType);
+
+int
+__SCNetworkInterfaceOrder                      (SCNetworkInterfaceRef  interface);
 
 Boolean
 __SCNetworkInterfaceSetConfiguration           (SCNetworkInterfaceRef  interface,
 
 Boolean
 __SCNetworkInterfaceSetConfiguration           (SCNetworkInterfaceRef  interface,
+                                                CFStringRef            extendedType,
                                                 CFDictionaryRef        config,
                                                 Boolean                okToHold);
 
                                                 CFDictionaryRef        config,
                                                 Boolean                okToHold);
 
@@ -182,6 +218,45 @@ void
 __SCNetworkInterfaceSetDeepConfiguration       (SCNetworkInterfaceRef  interface,
                                                 CFArrayRef             configs);
 
 __SCNetworkInterfaceSetDeepConfiguration       (SCNetworkInterfaceRef  interface,
                                                 CFArrayRef             configs);
 
+Boolean
+__SCNetworkInterfaceSupportsVLAN               (CFStringRef            bsd_if);
+
+void
+__SCBondInterfaceListCopyMembers               (CFArrayRef             interfaces,
+                                                CFMutableSetRef        set);
+
+#pragma mark -
+#pragma mark SCNetworkProtocol configuration (internal)
+
+
+SCNetworkProtocolPrivateRef
+__SCNetworkProtocolCreatePrivate               (CFAllocatorRef         allocator,
+                                                CFStringRef            entityID,
+                                                SCNetworkServiceRef    service);
+
+Boolean
+__SCNetworkProtocolIsValidType                 (CFStringRef            protocolType);
+
+
+#pragma mark -
+#pragma mark SCNetworkService configuration (internal)
+
+
+SCNetworkServicePrivateRef
+__SCNetworkServiceCreatePrivate                        (CFAllocatorRef         allocator,
+                                                SCPreferencesRef       prefs,
+                                                CFStringRef            serviceID,
+                                                SCNetworkInterfaceRef  interface);
+
+
+#pragma mark -
+#pragma mark SCNetworkSet configuration (internal)
+
+
+#pragma mark -
+#pragma mark Miscellaneous (internal)
+
+
 CFDictionaryRef
 __copyInterfaceTemplate                                (CFStringRef            interfaceType,
                                                 CFStringRef            childInterfaceType);
 CFDictionaryRef
 __copyInterfaceTemplate                                (CFStringRef            interfaceType,
                                                 CFStringRef            childInterfaceType);
@@ -218,9 +293,19 @@ Boolean
 __destroyInterface                             (int                    s,
                                                 CFStringRef            interface);
 
 __destroyInterface                             (int                    s,
                                                 CFStringRef            interface);
 
+CFStringRef
+__SCPreferencesPathCreateUniqueChild_WithMoreSCFCompatibility
+                                               (SCPreferencesRef       prefs,
+                                                CFStringRef            prefix);
+
 Boolean
 Boolean
-__markInterfaceUp                              (int                    s,
-                                                CFStringRef            interface);
+__extract_password                             (SCPreferencesRef       prefs,
+                                                CFDictionaryRef        config,
+                                                CFStringRef            passwordKey,
+                                                CFStringRef            encryptionKey,
+                                                CFStringRef            encryptionKeyChainValue,
+                                                CFStringRef            unique_id,
+                                                CFDataRef              *password);
 
 __END_DECLS
 
 
 __END_DECLS
 
diff --git a/SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h b/SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h
new file mode 100644 (file)
index 0000000..a51cd29
--- /dev/null
@@ -0,0 +1,383 @@
+/*
+ * Copyright (c) 2005-2007 Apple 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@
+ */
+
+#ifndef _SCNETWORKCONFIGURATIONPRIVATE_H
+#define _SCNETWORKCONFIGURATIONPRIVATE_H
+
+#include <AvailabilityMacros.h>
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCValidation.h>
+#include <IOKit/IOKitLib.h>
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @header SCNetworkConfigurationPrivate
+ */
+
+__BEGIN_DECLS
+
+
+#pragma mark -
+#pragma mark SCNetworkInterface configuration (SPI)
+
+
+/*!
+       @group Interface configuration
+ */
+
+static __inline__ CFTypeRef
+isA_SCNetworkInterface(CFTypeRef obj)
+{
+       return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
+}
+
+static __inline__ CFTypeRef
+isA_SCBondInterface(CFTypeRef obj)
+{
+       CFStringRef     interfaceType;
+
+       if (!isA_SCNetworkInterface(obj)) {
+               // if not an SCNetworkInterface
+               return NULL;
+       }
+
+       interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
+       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
+               // if not a Bond
+               return NULL;
+       }
+
+       return obj;
+}
+
+static __inline__ CFTypeRef
+isA_SCVLANInterface(CFTypeRef obj)
+{
+       CFStringRef     interfaceType;
+
+       if (!isA_SCNetworkInterface(obj)) {
+               // if not an SCNetworkInterface
+               return NULL;
+       }
+
+       interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
+       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
+               // if not a VLAN
+               return NULL;
+       }
+
+       return obj;
+}
+
+/*!
+       @function _SCNetworkInterfaceCompare
+       @discussion Compares two SCNetworkInterface objects.
+       @param val1 The SCNetworkInterface object.
+       @param val2 The SCNetworkInterface object.
+       @param context Not used.
+       @result A comparison result.
+ */
+CFComparisonResult
+_SCNetworkInterfaceCompare                             (const void                     *val1,
+                                                        const void                     *val2,
+                                                        void                           *context)       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#define kIncludeNoVirtualInterfaces    0x0
+#define kIncludeVLANInterfaces         0x1
+#define kIncludeBondInterfaces         0x2
+#define kIncludeAllVirtualInterfaces   0xffffffff
+
+/*!
+       @function _SCNetworkInterfaceCreateWithBSDName
+       @discussion Create a new network interface associated with the provided
+               BSD interface name.  This API supports Ethhernet, FireWire, and
+               IEEE 802.11 interfaces.
+       @param bsdName The BSD interface name.
+       @param flags Indicates whether virtual (Bond, VLAN)
+               network interfaces should be included.
+       @result A reference to the new SCNetworkInterface.
+               You must release the returned value.
+ */
+SCNetworkInterfaceRef
+_SCNetworkInterfaceCreateWithBSDName                   (CFAllocatorRef                 allocator,
+                                                        CFStringRef                    bsdName,
+                                                        UInt32                         flags)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceCreateWithEntity
+       @discussion Create a new network interface associated with the provided
+               SCDynamicStore service entity dictionary.
+       @param interface_entity The entity dictionary.
+       @param service The network service.
+       @result A reference to the new SCNetworkInterface.
+               You must release the returned value.
+ */
+SCNetworkInterfaceRef
+_SCNetworkInterfaceCreateWithEntity                    (CFAllocatorRef                 allocator,
+                                                        CFDictionaryRef                interface_entity,
+                                                        SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject
+       @discussion Create a new network interface associated with the provided
+               IORegistry "IONetworkInterface" object.
+       @param if_obj The IONetworkInterface object.
+       @result A reference to the new SCNetworkInterface.
+               You must release the returned value.
+ */
+SCNetworkInterfaceRef
+_SCNetworkInterfaceCreateWithIONetworkInterfaceObject  (io_object_t                    if_obj)         AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceGetHardwareAddress
+       @discussion Returns a link layer address for the interface.
+       @param interface The network interface.
+       @result The hardware (MAC) address for the interface.
+               NULL if no hardware address is available.
+ */
+CFDataRef
+_SCNetworkInterfaceGetHardwareAddress                  (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceGetIOInterfaceType
+       @discussion Returns the IOInterfaceType for the interface.
+       @param interface The network interface.
+       @result The IOInterfaceType associated with the interface
+ */
+CFNumberRef
+_SCNetworkInterfaceGetIOInterfaceType                  (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceGetIOInterfaceUnit
+       @discussion Returns the IOInterfaceUnit for the interface.
+       @param interface The network interface.
+       @result The IOInterfaceUnit associated with the interface;
+               NULL if no IOLocation is available.
+ */
+CFNumberRef
+_SCNetworkInterfaceGetIOInterfaceUnit                  (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceGetIOPath
+       @discussion Returns the IOPath for the interface.
+       @param interface The network interface.
+       @result The IOPath associated with the interface;
+               NULL if no IOPath is available.
+ */
+CFStringRef
+_SCNetworkInterfaceGetIOPath                           (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceIsBuiltin
+       @discussion Identifies if a network interface is "built-in".
+       @param interface The network interface.
+       @result TRUE if the interface is "built-in".
+ */
+Boolean
+_SCNetworkInterfaceIsBuiltin                           (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceIsModemV92
+       @discussion Identifies if a modem network interface supports
+               v.92 (hold).
+       @param interface The network interface.
+       @result TRUE if the interface is "v.92" modem.
+ */
+Boolean
+_SCNetworkInterfaceIsModemV92                          (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCNetworkInterfaceForceConfigurationRefresh
+       @discussion Forces a configuration refresh of the
+               specified interface.
+       @param ifName Network interface name.
+       @result TRUE if the refresh was successfully posted.
+ */
+Boolean
+_SCNetworkInterfaceForceConfigurationRefresh           (CFStringRef                    ifName)         AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCBondInterfaceCopyActive
+       @discussion Returns all Ethernet Bond interfaces on the system.
+       @result The list of SCBondInterface interfaces on the system.
+               You must release the returned value.
+ */
+CFArrayRef
+_SCBondInterfaceCopyActive                             (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCBondInterfaceUpdateConfiguration
+       @discussion Updates the bond interface configuration.
+       @param prefs The "preferences" session.
+       @result TRUE if the bond interface configuration was updated.; FALSE if the
+               an error was encountered.
+ */
+Boolean
+_SCBondInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceSetMode
+       @discussion Set the mode on the bond interface.
+       @param bond The bond interface on which to adjust the mode.
+       @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
+       @result TRUE if operation succeeded.
+ */
+Boolean
+SCBondInterfaceSetMode                                 (SCBondInterfaceRef             bond,
+                                                        CFNumberRef                    mode)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function SCBondInterfaceSetMode
+       @discussion Return the mode for the given bond interface.
+       @param bond The bond interface to get the mode from.
+       @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
+ */
+CFNumberRef
+SCBondInterfaceGetMode                                 (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCVLANInterfaceCopyActive
+       @discussion Returns all VLAN interfaces on the system.
+       @result The list of SCVLANInterface interfaces on the system.
+               You must release the returned value.
+ */
+CFArrayRef
+_SCVLANInterfaceCopyActive                             (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/*!
+       @function _SCVLANInterfaceUpdateConfiguration
+       @discussion Updates the VLAN interface configuration.
+       @param prefs The "preferences" session.
+       @result TRUE if the VLAN interface configuration was updated.; FALSE if the
+               an error was encountered.
+ */
+Boolean
+_SCVLANInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+
+#pragma mark -
+#pragma mark SCNetworkInterface Password SPIs
+
+
+enum {
+       kSCNetworkInterfacePasswordTypePPP              = 1,
+       kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
+       kSCNetworkInterfacePasswordTypeEAPOL,
+};
+typedef uint32_t       SCNetworkInterfacePasswordType;
+
+Boolean
+SCNetworkInterfaceCheckPassword                                (SCNetworkInterfaceRef          interface,
+                                                        SCNetworkInterfacePasswordType passwordType)   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+CFDataRef
+SCNetworkInterfaceCopyPassword                         (SCNetworkInterfaceRef          interface,
+                                                        SCNetworkInterfacePasswordType passwordType)   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCNetworkInterfaceRemovePassword                       (SCNetworkInterfaceRef          interface,
+                                                        SCNetworkInterfacePasswordType passwordType)   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCNetworkInterfaceSetPassword                          (SCNetworkInterfaceRef          interface,
+                                                        SCNetworkInterfacePasswordType passwordType,
+                                                        CFDataRef                      password,
+                                                        CFDictionaryRef                options)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+
+#pragma mark -
+#pragma mark SCNetworkProtocol configuration (SPI)
+
+
+/*!
+       @group Protocol configuration
+ */
+
+
+static __inline__ CFTypeRef
+isA_SCNetworkProtocol(CFTypeRef obj)
+{
+       return (isA_CFType(obj, SCNetworkProtocolGetTypeID()));
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkService configuration (SPI)
+
+
+/*!
+       @group Service configuration
+ */
+
+
+static __inline__ CFTypeRef
+isA_SCNetworkService(CFTypeRef obj)
+{
+       return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkSet configuration (SPI)
+
+
+/*!
+       @group Set configuration
+ */
+
+
+static __inline__ CFTypeRef
+isA_SCNetworkSet(CFTypeRef obj)
+{
+       return (isA_CFType(obj, SCNetworkSetGetTypeID()));
+}
+
+
+/*!
+       @function SCNetworkSetEstablishDefaultConfiguration
+       @discussion Updates a network set by adding services for
+               any network interface that is not currently
+               represented.
+               If the provided set contains one (or more) services, new
+               services will only be added for those interfaces that are
+               not represented in *any* set.
+               Otherwise, new services will be added for those interfaces
+               that are not represented in the provided set.
+               The new services are established with "default" configuration
+               options.
+       @param set The network set.
+       @result TRUE if the configuration was updated; FALSE if no
+               changes were required or if an error was encountered.
+*/
+Boolean
+SCNetworkSetEstablishDefaultConfiguration              (SCNetworkSetRef                set);
+
+
+__END_DECLS
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
+#endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */
index 88d9170cb5af2dc8ea35eb0f3255574555d75e48..b63ff036f723256604a9c23de6699127a4747533 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,8 +31,6 @@
  * - initial revision
  */
 
  * - initial revision
  */
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <ppp/pppcontroller_types.h>
 
 
 #include <ppp/pppcontroller_types.h>
 
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 typedef struct {
 
        /* base CFType information */
        CFRuntimeBase                   cfBase;
 
 
 typedef struct {
 
        /* base CFType information */
        CFRuntimeBase                   cfBase;
 
-       /* service ID */
-       CFStringRef                     serviceID;
+       /* lock */
+       pthread_mutex_t                 lock;
+
+       /* service */
+       SCNetworkServiceRef             service;
 
        /* ref to PPP controller for control messages */
        mach_port_t                     session_port;
 
        /* ref to PPP controller for control messages */
        mach_port_t                     session_port;
@@ -90,8 +89,6 @@ typedef struct {
 
 } SCNetworkConnectionPrivate, *SCNetworkConnectionPrivateRef;
 
 
 } SCNetworkConnectionPrivate, *SCNetworkConnectionPrivateRef;
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 static __inline__ CFTypeRef
 isA_SCNetworkConnection(CFTypeRef obj)
 
 static __inline__ CFTypeRef
 isA_SCNetworkConnection(CFTypeRef obj)
@@ -99,8 +96,6 @@ isA_SCNetworkConnection(CFTypeRef obj)
        return (isA_CFType(obj, SCNetworkConnectionGetTypeID()));
 }
 
        return (isA_CFType(obj, SCNetworkConnectionGetTypeID()));
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 static CFStringRef
 __SCNetworkConnectionCopyDescription(CFTypeRef cf)
 
 static CFStringRef
 __SCNetworkConnectionCopyDescription(CFTypeRef cf)
@@ -110,15 +105,16 @@ __SCNetworkConnectionCopyDescription(CFTypeRef cf)
        CFMutableStringRef              result;
 
        result = CFStringCreateMutable(allocator, 0);
        CFMutableStringRef              result;
 
        result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkConnection, %p [%p]> {\n"), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR("   serviceID = %@ \n"), connectionPrivate->serviceID);
+       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkConnection, %p [%p]> {"), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR("service = %p"), connectionPrivate->service);
+       if (connectionPrivate->session_port != MACH_PORT_NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", server port = %p"), connectionPrivate->session_port);
+       }
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 static void
 __SCNetworkConnectionDeallocate(CFTypeRef cf)
 
 static void
 __SCNetworkConnectionDeallocate(CFTypeRef cf)
@@ -130,6 +126,8 @@ __SCNetworkConnectionDeallocate(CFTypeRef cf)
        }
 
        /* release resources */
        }
 
        /* release resources */
+       pthread_mutex_destroy(&connectionPrivate->lock);
+
        if (connectionPrivate->rlList != NULL) {
                CFRunLoopSourceInvalidate(connectionPrivate->rls);
                CFRelease(connectionPrivate->rls);
        if (connectionPrivate->rlList != NULL) {
                CFRunLoopSourceInvalidate(connectionPrivate->rls);
                CFRelease(connectionPrivate->rls);
@@ -147,14 +145,11 @@ __SCNetworkConnectionDeallocate(CFTypeRef cf)
        if (connectionPrivate->rlsContext.release != NULL)
                (*connectionPrivate->rlsContext.release)(connectionPrivate->rlsContext.info);
 
        if (connectionPrivate->rlsContext.release != NULL)
                (*connectionPrivate->rlsContext.release)(connectionPrivate->rlsContext.info);
 
-       if (connectionPrivate->serviceID)
-               CFRelease(connectionPrivate->serviceID);
+       CFRelease(connectionPrivate->service);
 
        return;
 }
 
 
        return;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 static pthread_once_t initialized              = PTHREAD_ONCE_INIT;
 
 
 static pthread_once_t initialized              = PTHREAD_ONCE_INIT;
 
@@ -172,8 +167,6 @@ static const CFRuntimeClass __SCNetworkConnectionClass = {
        __SCNetworkConnectionCopyDescription    // copyDebugDesc
 };
 
        __SCNetworkConnectionCopyDescription    // copyDebugDesc
 };
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 static void
 __SCNetworkConnectionInitialize(void)
 
 static void
 __SCNetworkConnectionInitialize(void)
@@ -182,11 +175,9 @@ __SCNetworkConnectionInitialize(void)
        return;
 }
 
        return;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 static SCNetworkConnectionStatus
 
 static SCNetworkConnectionStatus
-__SCNetworkConnectionConvertStatus (int state)
+__SCNetworkConnectionConvertStatus(int state)
 {
        SCNetworkConnectionStatus       status = kSCNetworkConnectionDisconnected;
 
 {
        SCNetworkConnectionStatus       status = kSCNetworkConnectionDisconnected;
 
@@ -217,8 +208,6 @@ __SCNetworkConnectionConvertStatus (int state)
        return status;
 }
 
        return status;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 static void
 __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void * info)
 
 static void
 __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void * info)
@@ -268,38 +257,39 @@ __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void
        return;
 }
 
        return;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
+
+#pragma mark -
+#pragma mark SCNetworkConnection APIs
+
+
+static CFStringRef
+pppMPCopyDescription(const void *info)
+{
+       SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)info;
+
+       return CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("<SCNetworkConnection MP %p> {service = %@, callout = %p}"),
+                                       connectionPrivate,
+                                       connectionPrivate->service,
+                                       connectionPrivate->rlsFunction);
+}
+
+
 static SCNetworkConnectionPrivateRef
 __SCNetworkConnectionCreatePrivate(CFAllocatorRef              allocator,
 static SCNetworkConnectionPrivateRef
 __SCNetworkConnectionCreatePrivate(CFAllocatorRef              allocator,
-                                  CFStringRef                  serviceID,
+                                  SCNetworkServiceRef          service,
                                   SCNetworkConnectionCallBack  callout,
                                   SCNetworkConnectionContext   *context)
 {
                                   SCNetworkConnectionCallBack  callout,
                                   SCNetworkConnectionContext   *context)
 {
-       boolean_t                       active;
        SCNetworkConnectionPrivateRef   connectionPrivate       = NULL;
        SCNetworkConnectionPrivateRef   connectionPrivate       = NULL;
-       void                            *data;
-       CFIndex                         dataLen;
-       CFDataRef                       dataRef                 = NULL;
        char                            *envdebug;
        char                            *envdebug;
-       int                             error                   = kSCStatusFailed;
-       CFMachPortContext               mach_context            = {0, NULL, NULL, NULL, NULL};
-       mach_port_t                     notify_port             = MACH_PORT_NULL;
-       mach_port_t                     port_old;
-       mach_port_t                     server;
        uint32_t                        size;
        uint32_t                        size;
-       kern_return_t                   status;
-       mach_port_t                     unpriv_bootstrap_port;
+
 
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkConnectionInitialize);
 
 
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkConnectionInitialize);
 
-       if ((bootstrap_status (bootstrap_port, PPPCONTROLLER_SERVER, &active) != BOOTSTRAP_SUCCESS) ||
-           (bootstrap_look_up(bootstrap_port, PPPCONTROLLER_SERVER, &server) != BOOTSTRAP_SUCCESS)) {
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("PPP Controller server not found"));
-               goto fail;
-       }
-
        /* allocate NetworkConnection */
        size = sizeof(SCNetworkConnectionPrivate) - sizeof(CFRuntimeBase);
        connectionPrivate = (SCNetworkConnectionPrivateRef)_CFRuntimeCreateInstance(allocator, __kSCNetworkConnectionTypeID, size, NULL);
        /* allocate NetworkConnection */
        size = sizeof(SCNetworkConnectionPrivate) - sizeof(CFRuntimeBase);
        connectionPrivate = (SCNetworkConnectionPrivateRef)_CFRuntimeCreateInstance(allocator, __kSCNetworkConnectionTypeID, size, NULL);
@@ -310,8 +300,10 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef          allocator,
        /* zero the data structure */
        bzero(((u_char*)connectionPrivate)+sizeof(CFRuntimeBase), size);
 
        /* zero the data structure */
        bzero(((u_char*)connectionPrivate)+sizeof(CFRuntimeBase), size);
 
-       /* save the serviceID */
-       connectionPrivate->serviceID = CFStringCreateCopy(NULL, serviceID);
+       pthread_mutex_init(&connectionPrivate->lock, NULL);
+
+       /* save the service */
+       connectionPrivate->service = CFRetain(service);
 
        /* get the debug environment variable */
        envdebug = getenv("PPPDebug");
 
        /* get the debug environment variable */
        envdebug = getenv("PPPDebug");
@@ -320,23 +312,7 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef          allocator,
                        connectionPrivate->debug = 1; /* PPPDebug value is invalid, set debug to 1 */
        }
 
                        connectionPrivate->debug = 1; /* PPPDebug value is invalid, set debug to 1 */
        }
 
-       if (callout != NULL) {
-               connectionPrivate->rlsFunction = callout;
-
-               mach_context.info = (void*)connectionPrivate;
-               connectionPrivate->notify_port = CFMachPortCreate(NULL, __SCNetworkConnectionCallBack, &mach_context, NULL);
-               if (connectionPrivate->notify_port == NULL) {
-                       goto fail;
-               }
-
-               notify_port = CFMachPortGetPort(connectionPrivate->notify_port);
-               status = mach_port_request_notification(mach_task_self(),
-                                                       notify_port, MACH_NOTIFY_NO_SENDERS, 1,
-                                                       notify_port, MACH_MSG_TYPE_MAKE_SEND_ONCE, &port_old);
-               if (status != KERN_SUCCESS) {
-                       goto fail;
-               }
-       }
+       connectionPrivate->rlsFunction = callout;
 
        if (context) {
                bcopy(context, &connectionPrivate->rlsContext, sizeof(SCNetworkConnectionContext));
 
        if (context) {
                bcopy(context, &connectionPrivate->rlsContext, sizeof(SCNetworkConnectionContext));
@@ -345,63 +321,191 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef                allocator,
                }
        }
 
                }
        }
 
-       if (!_SCSerializeString(serviceID, &dataRef, &data, &dataLen)) {
-               goto fail;
+       if (connectionPrivate->debug) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) succeeded for service : %@"), connectionPrivate, service);
+       }
+
+       /* success, return the connection reference */
+       return connectionPrivate;
+
+    fail:
+
+       if (connectionPrivate->debug)
+               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) failed for service : %@"), connectionPrivate, service);
+
+       /* failure, clean up and leave */
+       if (connectionPrivate != NULL) {
+               CFRelease(connectionPrivate);
+       }
+
+       _SCErrorSet(kSCStatusFailed);
+       return NULL;
+}
+
+
+static mach_port_t
+__SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate)
+{
+       void            *data;
+       CFIndex         dataLen;
+       CFDataRef       dataRef                 = NULL;
+       int             error                   = kSCStatusFailed;
+       mach_port_t     notify_port             = MACH_PORT_NULL;
+       mach_port_t     port_old                = MACH_PORT_NULL;
+       mach_port_t     server                  = MACH_PORT_NULL;
+       kern_return_t   status;
+       mach_port_t     unpriv_bootstrap_port   = MACH_PORT_NULL;
+
+       if (connectionPrivate->session_port != MACH_PORT_NULL) {
+               return connectionPrivate->session_port;
+       }
+
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+       if (bootstrap_look_up(bootstrap_port, PPPCONTROLLER_SERVER, &server) != BOOTSTRAP_SUCCESS) {
+               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("PPP Controller server not found"));
+               goto done;
+       }
+
+       if (!_SCSerializeString(SCNetworkServiceGetServiceID(connectionPrivate->service), &dataRef, &data, &dataLen)) {
+               goto done;
        }
 
        status = bootstrap_unprivileged(bootstrap_port, &unpriv_bootstrap_port);
        if (status != BOOTSTRAP_SUCCESS) {
        }
 
        status = bootstrap_unprivileged(bootstrap_port, &unpriv_bootstrap_port);
        if (status != BOOTSTRAP_SUCCESS) {
-               goto fail;
+               goto done;
+       }
+
+       if (connectionPrivate->rlsFunction != NULL) {
+               CFMachPortContext       context = { 0
+                       , (void *)connectionPrivate
+                       , NULL
+                       , NULL
+                       , pppMPCopyDescription
+               };
+
+               /* allocate port (for server response) */
+               connectionPrivate->notify_port = CFMachPortCreate(NULL, __SCNetworkConnectionCallBack, &context, NULL);
+
+               /* request a notification when/if the server dies */
+               notify_port = CFMachPortGetPort(connectionPrivate->notify_port);
+               status = mach_port_request_notification(mach_task_self(),
+                                                       notify_port,
+                                                       MACH_NOTIFY_NO_SENDERS,
+                                                       1,
+                                                       notify_port,
+                                                       MACH_MSG_TYPE_MAKE_SEND_ONCE,
+                                                       &port_old);
+               if (status != KERN_SUCCESS) {
+                       goto done;
+               }
        }
 
        status = pppcontroller_attach(server, data, dataLen, unpriv_bootstrap_port, notify_port,
                                      &connectionPrivate->session_port, &error);
        }
 
        status = pppcontroller_attach(server, data, dataLen, unpriv_bootstrap_port, notify_port,
                                      &connectionPrivate->session_port, &error);
+       if (status != KERN_SUCCESS) {
+               error = kSCStatusFailed;
+       }
+
+    done :
 
 
-       mach_port_deallocate(mach_task_self(), unpriv_bootstrap_port);
-       CFRelease(dataRef);
-       dataRef = NULL;
+       if (dataRef != NULL)    CFRelease(dataRef);
 
 
-       if (status != KERN_SUCCESS) {
-               goto fail;
+       if (unpriv_bootstrap_port != MACH_PORT_NULL) {
+               mach_port_deallocate(mach_task_self(), unpriv_bootstrap_port);
        }
 
        if (error != kSCStatusOK) {
        }
 
        if (error != kSCStatusOK) {
-               goto fail;
+               if (connectionPrivate->session_port != MACH_PORT_NULL) {
+                       mach_port_destroy(mach_task_self(), connectionPrivate->session_port);
+                       connectionPrivate->session_port = MACH_PORT_NULL;
+               }
+               if (connectionPrivate->notify_port != NULL) {
+                       CFMachPortInvalidate(connectionPrivate->notify_port);
+                       CFRelease(connectionPrivate->notify_port);
+                       connectionPrivate->notify_port = NULL;
+               }
+               _SCErrorSet(error);
        }
 
        }
 
-       if (connectionPrivate->debug) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) succeeded for service ID: %@"), connectionPrivate, serviceID);
+       pthread_mutex_unlock(&connectionPrivate->lock);
+
+       return connectionPrivate->session_port;
+}
+
+
+CFTypeID
+SCNetworkConnectionGetTypeID(void) {
+       pthread_once(&initialized, __SCNetworkConnectionInitialize);    /* initialize runtime */
+       return __kSCNetworkConnectionTypeID;
+}
+
+
+CFArrayRef /* of SCNetworkServiceRef's */
+SCNetworkConnectionCopyAvailableServices(SCNetworkSetRef set)
+{
+       CFMutableArrayRef       available;
+       Boolean                 tempSet = FALSE;
+
+       if (set == NULL) {
+               SCPreferencesRef        prefs;
+
+               prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkConnectionCopyAvailableServices"), NULL);
+               set   = SCNetworkSetCopyCurrent(prefs);
+               CFRelease(prefs);
+               tempSet = TRUE;
        }
 
        }
 
-       /* success, return the connection reference */
-       return connectionPrivate;
+       available = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
 
-    fail:
+       if (set != NULL) {
+               CFArrayRef      services;
 
 
+               services = SCNetworkSetCopyServices(set);
+               if (services != NULL) {
+                       CFIndex         i;
+                       CFIndex         n;
 
 
-       /* failure, clean up and leave */
-       if (connectionPrivate != NULL) {
-               if (connectionPrivate->debug)
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) failed for service ID: %@"), connectionPrivate, serviceID);
-               CFRelease(connectionPrivate);
+                       n = CFArrayGetCount(services);
+                       for (i = 0; i < n; i++) {
+                               SCNetworkInterfaceRef   interface;
+                               CFStringRef             interfaceType;
+                               SCNetworkServiceRef     service;
+
+                               service       = CFArrayGetValueAtIndex(services, i);
+                               interface     = SCNetworkServiceGetInterface(service);
+                               interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                               if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                                       CFArrayAppendValue(available, service);
+                               }
+                       }
+
+                       CFRelease(services);
+               }
        }
 
        }
 
-       if (dataRef)            CFRelease(dataRef);
-       _SCErrorSet(error);
-       return NULL;
+       if (tempSet)    CFRelease(set);
+       return available;
 }
 
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 
-CFTypeID
-SCNetworkConnectionGetTypeID(void) {
-       pthread_once(&initialized, __SCNetworkConnectionInitialize);    /* initialize runtime */
-       return __kSCNetworkConnectionTypeID;
+SCNetworkConnectionRef
+SCNetworkConnectionCreateWithService(CFAllocatorRef                    allocator,
+                                    SCNetworkServiceRef                service,
+                                    SCNetworkConnectionCallBack        callout,
+                                    SCNetworkConnectionContext         *context)
+{
+       SCNetworkConnectionPrivateRef   connectionPrivate;
+
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       connectionPrivate = __SCNetworkConnectionCreatePrivate(allocator, service, callout, context);
+       return (SCNetworkConnectionRef)connectionPrivate;
 }
 
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 SCNetworkConnectionRef
 SCNetworkConnectionCreateWithServiceID(CFAllocatorRef                  allocator,
 
 SCNetworkConnectionRef
 SCNetworkConnectionCreateWithServiceID(CFAllocatorRef                  allocator,
@@ -409,35 +513,48 @@ SCNetworkConnectionCreateWithServiceID(CFAllocatorRef                     allocator,
                                       SCNetworkConnectionCallBack      callout,
                                       SCNetworkConnectionContext       *context)
 {
                                       SCNetworkConnectionCallBack      callout,
                                       SCNetworkConnectionContext       *context)
 {
-       SCNetworkConnectionPrivateRef   connectionPrivate;
+       SCNetworkConnectionRef  connection;
+       SCPreferencesRef        prefs;
+       SCNetworkServiceRef     service;
 
        if (!isA_CFString(serviceID)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
 
        if (!isA_CFString(serviceID)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
+       prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkConnectionCreateWithServiceID"), NULL);
+       if (prefs == NULL) {
+               return NULL;
+       }
+
+       service = SCNetworkServiceCopy(prefs, serviceID);
+       CFRelease(prefs);
+       if (service == NULL) {
+               return NULL;
+       }
 
 
-       connectionPrivate = __SCNetworkConnectionCreatePrivate(allocator, serviceID, callout, context);
+       connection = SCNetworkConnectionCreateWithService(allocator, service, callout, context);
+       CFRelease(service);
 
 
-       return (SCNetworkConnectionRef)connectionPrivate;
+       return connection;
 }
 
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 CFStringRef
 SCNetworkConnectionCopyServiceID(SCNetworkConnectionRef connection)
 {
 
 CFStringRef
 SCNetworkConnectionCopyServiceID(SCNetworkConnectionRef connection)
 {
+       SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
+       CFStringRef                     serviceID;
+
        if (!isA_SCNetworkConnection(connection)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
        if (!isA_SCNetworkConnection(connection)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
-       return CFRetain(((SCNetworkConnectionPrivateRef)connection)->serviceID);
+       serviceID = SCNetworkServiceGetServiceID(connectionPrivate->service);
+       return CFRetain(serviceID);
 }
 
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 CFDictionaryRef
 SCNetworkConnectionCopyStatistics(SCNetworkConnectionRef connection)
 
 CFDictionaryRef
 SCNetworkConnectionCopyStatistics(SCNetworkConnectionRef connection)
@@ -446,6 +563,7 @@ SCNetworkConnectionCopyStatistics(SCNetworkConnectionRef connection)
        xmlDataOut_t                    data                    = NULL;
        mach_msg_type_number_t          datalen;
        int                             error                   = kSCStatusFailed;
        xmlDataOut_t                    data                    = NULL;
        mach_msg_type_number_t          datalen;
        int                             error                   = kSCStatusFailed;
+       mach_port_t                     session_port;
        CFPropertyListRef               statistics              = NULL;
        kern_return_t                   status;
 
        CFPropertyListRef               statistics              = NULL;
        kern_return_t                   status;
 
@@ -454,7 +572,13 @@ SCNetworkConnectionCopyStatistics(SCNetworkConnectionRef connection)
                return NULL;
        }
 
                return NULL;
        }
 
-       status = pppcontroller_copystatistics(connectionPrivate->session_port, &data, &datalen, &error);
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       status = pppcontroller_copystatistics(session_port, &data, &datalen, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
        if (status != KERN_SUCCESS) {
                goto fail;
        }
@@ -478,8 +602,20 @@ SCNetworkConnectionCopyStatistics(SCNetworkConnectionRef connection)
        return NULL;
 }
 
        return NULL;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
+
+SCNetworkServiceRef
+SCNetworkConnectionGetService(SCNetworkConnectionRef connection)
+{
+       SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
+
+       if (!isA_SCNetworkConnection(connection)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       return connectionPrivate->service;
+}
+
 
 SCNetworkConnectionStatus
 SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
 
 SCNetworkConnectionStatus
 SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
@@ -488,6 +624,7 @@ SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
        int                             error                   = kSCStatusFailed;
        int                             phase;
        SCNetworkConnectionStatus       scstatus;
        int                             error                   = kSCStatusFailed;
        int                             phase;
        SCNetworkConnectionStatus       scstatus;
+       mach_port_t                     session_port;
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
@@ -495,7 +632,13 @@ SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
                return kSCNetworkConnectionInvalid;
        }
 
                return kSCNetworkConnectionInvalid;
        }
 
-       status = pppcontroller_getstatus(connectionPrivate->session_port, &phase, &error);
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return kSCNetworkConnectionInvalid;
+       }
+
+       status = pppcontroller_getstatus(session_port, &phase, &error);
        if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
                return kSCNetworkConnectionDisconnected;
        }
        if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
                return kSCNetworkConnectionDisconnected;
        }
@@ -504,8 +647,6 @@ SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
        return scstatus;
 }
 
        return scstatus;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 CFDictionaryRef
 SCNetworkConnectionCopyExtendedStatus(SCNetworkConnectionRef connection)
 
 CFDictionaryRef
 SCNetworkConnectionCopyExtendedStatus(SCNetworkConnectionRef connection)
@@ -515,6 +656,7 @@ SCNetworkConnectionCopyExtendedStatus(SCNetworkConnectionRef connection)
        mach_msg_type_number_t          datalen;
        int                             error                   = kSCStatusFailed;
        CFPropertyListRef               extstatus               = NULL;
        mach_msg_type_number_t          datalen;
        int                             error                   = kSCStatusFailed;
        CFPropertyListRef               extstatus               = NULL;
+       mach_port_t                     session_port;
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
@@ -522,7 +664,13 @@ SCNetworkConnectionCopyExtendedStatus(SCNetworkConnectionRef connection)
                return NULL;
        }
 
                return NULL;
        }
 
-       status = pppcontroller_copyextendedstatus(connectionPrivate->session_port, &data, &datalen, &error);
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       status = pppcontroller_copyextendedstatus(session_port, &data, &datalen, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
        if (status != KERN_SUCCESS) {
                goto fail;
        }
@@ -546,8 +694,6 @@ SCNetworkConnectionCopyExtendedStatus(SCNetworkConnectionRef connection)
        return NULL;
 }
 
        return NULL;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 Boolean
 SCNetworkConnectionStart(SCNetworkConnectionRef        connection,
 
 Boolean
 SCNetworkConnectionStart(SCNetworkConnectionRef        connection,
@@ -559,6 +705,7 @@ SCNetworkConnectionStart(SCNetworkConnectionRef     connection,
        void                            *data                   = NULL;
        CFIndex                         datalen                 = 0;
        int                             error                   = kSCStatusFailed;
        void                            *data                   = NULL;
        CFIndex                         datalen                 = 0;
        int                             error                   = kSCStatusFailed;
+       mach_port_t                     session_port;
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
@@ -566,58 +713,76 @@ SCNetworkConnectionStart(SCNetworkConnectionRef   connection,
                return FALSE;
        }
 
                return FALSE;
        }
 
+       if ((userOptions != NULL) && !isA_CFDictionary(userOptions)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        if (connectionPrivate->debug) {
        if (connectionPrivate->debug) {
-               CFMutableDictionaryRef  mdict = NULL, mdict1;
-               CFDictionaryRef dict;
+               CFMutableDictionaryRef  mdict = NULL;
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x)"), connectionPrivate);
 
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x)"), connectionPrivate);
 
-               if (userOptions) {
+               if (userOptions != NULL) {
+                       CFDictionaryRef         dict;
+                       CFStringRef             encryption;
+                       CFMutableDictionaryRef  new_dict;
+
                        /* special code to remove secret information */
                        /* special code to remove secret information */
-                       mdict = CFDictionaryCreateMutableCopy(0, 0, userOptions);
-                       if (mdict) {
-                               dict = CFDictionaryGetValue(mdict, kSCEntNetPPP);
-                               if (isA_CFDictionary(dict)) {
-                                       mdict1 = CFDictionaryCreateMutableCopy(0, 0, dict);
-                                       if (mdict1) {
-                                               CFDictionaryReplaceValue(mdict1, kSCPropNetPPPAuthPassword, CFSTR("******"));
-                                               CFDictionarySetValue(mdict, kSCEntNetPPP, mdict1);
-                                               CFRelease(mdict1);
-                                       }
+                       mdict = CFDictionaryCreateMutableCopy(NULL, 0, userOptions);
+
+                       dict = CFDictionaryGetValue(mdict, kSCEntNetPPP);
+                       if (isA_CFDictionary(dict)) {
+                               encryption = CFDictionaryGetValue(dict, kSCPropNetPPPAuthPasswordEncryption);
+                               if (!isA_CFString(encryption) ||
+                                   !CFEqual(encryption, kSCValNetPPPAuthPasswordEncryptionKeychain)) {
+                                       new_dict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+                                       CFDictionaryReplaceValue(new_dict, kSCPropNetPPPAuthPassword, CFSTR("******"));
+                                       CFDictionarySetValue(mdict, kSCEntNetPPP, new_dict);
+                                       CFRelease(new_dict);
                                }
                                }
+                       }
 
 
-                               dict = CFDictionaryGetValue(mdict, kSCEntNetL2TP);
-                               if (isA_CFDictionary(dict)) {
-                                       mdict1 = CFDictionaryCreateMutableCopy(0, 0, dict);
-                                       if (mdict1) {
-                                               CFDictionaryReplaceValue(mdict1, kSCPropNetL2TPIPSecSharedSecret, CFSTR("******"));
-                                               CFDictionarySetValue(mdict, kSCEntNetL2TP, mdict1);
-                                               CFRelease(mdict1);
-                                       }
+                       dict = CFDictionaryGetValue(mdict, kSCEntNetL2TP);
+                       if (isA_CFDictionary(dict)) {
+                               encryption = CFDictionaryGetValue(dict, kSCPropNetL2TPIPSecSharedSecretEncryption);
+                               if (!isA_CFString(encryption) ||
+                                   !CFEqual(encryption, kSCValNetL2TPIPSecSharedSecretEncryptionKeychain)) {
+                                       new_dict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+                                       CFDictionaryReplaceValue(new_dict, kSCPropNetL2TPIPSecSharedSecret, CFSTR("******"));
+                                       CFDictionarySetValue(mdict, kSCEntNetL2TP, new_dict);
+                                       CFRelease(new_dict);
                                }
                                }
+                       }
 
 
-                               dict = CFDictionaryGetValue(mdict, kSCEntNetIPSec);
-                               if (isA_CFDictionary(dict)) {
-                                       mdict1 = CFDictionaryCreateMutableCopy(0, 0, dict);
-                                       if (mdict1) {
-                                               CFDictionaryReplaceValue(mdict1, kSCPropNetIPSecSharedSecret, CFSTR("******"));
-                                               CFDictionarySetValue(mdict, kSCEntNetIPSec, mdict1);
-                                               CFRelease(mdict1);
-                                       }
+                       dict = CFDictionaryGetValue(mdict, kSCEntNetIPSec);
+                       if (isA_CFDictionary(dict)) {
+                               encryption = CFDictionaryGetValue(dict, kSCPropNetIPSecSharedSecretEncryption);
+                               if (!isA_CFString(encryption) ||
+                                   !CFEqual(encryption, kSCValNetIPSecSharedSecretEncryptionKeychain)) {
+                                       new_dict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+                                       CFDictionaryReplaceValue(new_dict, kSCPropNetIPSecSharedSecret, CFSTR("******"));
+                                       CFDictionarySetValue(mdict, kSCEntNetIPSec, new_dict);
+                                       CFRelease(new_dict);
                                }
                        }
                }
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("User options: %@"), mdict);
                                }
                        }
                }
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("User options: %@"), mdict);
-               if (mdict)
-                       CFRelease(mdict);
+               if (mdict != NULL) CFRelease(mdict);
        }
 
        if (userOptions && !_SCSerialize(userOptions, &dataref, &data, &datalen)) {
                goto fail;
        }
 
        }
 
        if (userOptions && !_SCSerialize(userOptions, &dataref, &data, &datalen)) {
                goto fail;
        }
 
-       status = pppcontroller_start(connectionPrivate->session_port, data, datalen, linger, &error);
+       status = pppcontroller_start(session_port, data, datalen, linger, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
        if (status != KERN_SUCCESS) {
                goto fail;
        }
@@ -644,8 +809,6 @@ SCNetworkConnectionStart(SCNetworkConnectionRef     connection,
        return FALSE;
 }
 
        return FALSE;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 Boolean
 SCNetworkConnectionStop(SCNetworkConnectionRef connection,
 
 Boolean
 SCNetworkConnectionStop(SCNetworkConnectionRef connection,
@@ -653,6 +816,7 @@ SCNetworkConnectionStop(SCNetworkConnectionRef      connection,
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
+       mach_port_t                     session_port;
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
@@ -660,10 +824,16 @@ SCNetworkConnectionStop(SCNetworkConnectionRef    connection,
                return FALSE;
        }
 
                return FALSE;
        }
 
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        if (connectionPrivate->debug)
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x)"), connectionPrivate);
 
        if (connectionPrivate->debug)
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x)"), connectionPrivate);
 
-       status = pppcontroller_stop(connectionPrivate->session_port, forceDisconnect, &error);
+       status = pppcontroller_stop(session_port, forceDisconnect, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
        if (status != KERN_SUCCESS) {
                goto fail;
        }
@@ -684,14 +854,13 @@ SCNetworkConnectionStop(SCNetworkConnectionRef    connection,
        return FALSE;
 }
 
        return FALSE;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 Boolean
 SCNetworkConnectionSuspend(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
 
 Boolean
 SCNetworkConnectionSuspend(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
+       mach_port_t                     session_port;
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
@@ -699,10 +868,16 @@ SCNetworkConnectionSuspend(SCNetworkConnectionRef connection)
                return FALSE;
        }
 
                return FALSE;
        }
 
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        if (connectionPrivate->debug)
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x)"), connectionPrivate);
 
        if (connectionPrivate->debug)
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x)"), connectionPrivate);
 
-       status = pppcontroller_suspend(connectionPrivate->session_port, &error);
+       status = pppcontroller_suspend(session_port, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
        if (status != KERN_SUCCESS) {
                goto fail;
        }
@@ -723,14 +898,13 @@ SCNetworkConnectionSuspend(SCNetworkConnectionRef connection)
        return FALSE;
 }
 
        return FALSE;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 Boolean
 SCNetworkConnectionResume(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
 
 Boolean
 SCNetworkConnectionResume(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
+       mach_port_t                     session_port;
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection)) {
@@ -738,10 +912,16 @@ SCNetworkConnectionResume(SCNetworkConnectionRef connection)
                return FALSE;
        }
 
                return FALSE;
        }
 
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        if (connectionPrivate->debug)
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x)"), connectionPrivate);
 
        if (connectionPrivate->debug)
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x)"), connectionPrivate);
 
-       status = pppcontroller_resume(connectionPrivate->session_port, &error);
+       status = pppcontroller_resume(session_port, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
        if (status != KERN_SUCCESS) {
                goto fail;
        }
@@ -762,8 +942,6 @@ SCNetworkConnectionResume(SCNetworkConnectionRef connection)
        return FALSE;
 }
 
        return FALSE;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 CFDictionaryRef
 SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection)
 
 CFDictionaryRef
 SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection)
@@ -772,6 +950,7 @@ SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection)
        xmlDataOut_t                    data                    = NULL;
        mach_msg_type_number_t          datalen;
        int                             error                   = kSCStatusFailed;
        xmlDataOut_t                    data                    = NULL;
        mach_msg_type_number_t          datalen;
        int                             error                   = kSCStatusFailed;
+       mach_port_t                     session_port;
        kern_return_t                   status;
        CFPropertyListRef               userOptions             = NULL;
 
        kern_return_t                   status;
        CFPropertyListRef               userOptions             = NULL;
 
@@ -780,7 +959,13 @@ SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection)
                return NULL;
        }
 
                return NULL;
        }
 
-       status = pppcontroller_copyuseroptions(connectionPrivate->session_port, &data, &datalen, &error);
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       status = pppcontroller_copyuseroptions(session_port, &data, &datalen, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
        if (status != KERN_SUCCESS) {
                goto fail;
        }
@@ -814,8 +999,6 @@ SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection)
        return NULL;
 }
 
        return NULL;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 Boolean
 SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef  connection,
 
 Boolean
 SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef  connection,
@@ -824,6 +1007,7 @@ SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef      connection,
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
+       mach_port_t                     session_port;
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection) || runLoop == NULL || runLoopMode == NULL) {
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection) || runLoop == NULL || runLoopMode == NULL) {
@@ -843,8 +1027,14 @@ SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef     connection,
                return FALSE;
        }
 
                return FALSE;
        }
 
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        if (connectionPrivate->rlList == NULL) {
        if (connectionPrivate->rlList == NULL) {
-               status = pppcontroller_notification(connectionPrivate->session_port, 1, &error);
+               status = pppcontroller_notification(session_port, 1, &error);
                if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
                        _SCErrorSet(error);
                        return FALSE;
                if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
                        _SCErrorSet(error);
                        return FALSE;
@@ -860,8 +1050,6 @@ SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef      connection,
        return TRUE;
 }
 
        return TRUE;
 }
 
-/* -------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------- */
 
 Boolean
 SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef                connection,
 
 Boolean
 SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef                connection,
@@ -870,6 +1058,7 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef            connection,
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
+       mach_port_t                     session_port;
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection) || runLoop == NULL || runLoopMode == NULL) {
        kern_return_t                   status;
 
        if (!isA_SCNetworkConnection(connection) || runLoop == NULL || runLoopMode == NULL) {
@@ -884,6 +1073,12 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef           connection,
                return FALSE;
        }
 
                return FALSE;
        }
 
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        CFRunLoopRemoveSource(runLoop, connectionPrivate->rls, runLoopMode);
 
        if (CFArrayGetCount(connectionPrivate->rlList) == 0) {
        CFRunLoopRemoveSource(runLoop, connectionPrivate->rls, runLoopMode);
 
        if (CFArrayGetCount(connectionPrivate->rlList) == 0) {
@@ -892,7 +1087,7 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef            connection,
                CFRelease(connectionPrivate->rlList);
                connectionPrivate->rlList = NULL;
 
                CFRelease(connectionPrivate->rlList);
                connectionPrivate->rlList = NULL;
 
-               status = pppcontroller_notification(connectionPrivate->session_port, 0, &error);
+               status = pppcontroller_notification(session_port, 0, &error);
                if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
                        _SCErrorSet(error);
                        return FALSE;
                if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
                        _SCErrorSet(error);
                        return FALSE;
@@ -903,7 +1098,8 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef            connection,
 }
 
 
 }
 
 
-//************************* USER LEVEL DIAL API **********************************
+#pragma mark -
+#pragma mark User level "dial" API
 
 
 #define k_NetworkConnect_Notification  "com.apple.networkConnect"
 
 
 #define k_NetworkConnect_Notification  "com.apple.networkConnect"
@@ -1006,8 +1202,6 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef    selectionOptions,
                notify_check(notify_userprefs_token, &prefsChanged);
 
 
                notify_check(notify_userprefs_token, &prefsChanged);
 
 
-       // NOTE:  we are currently ignoring selectionOptions
-
        *serviceID = NULL;
        *userOptions = NULL;
 
        *serviceID = NULL;
        *userOptions = NULL;
 
@@ -1017,7 +1211,7 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef    selectionOptions,
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (selectionOptions) {
+       if (selectionOptions != NULL) {
                Boolean         catchAllFound   = FALSE;
                CFIndex         catchAllService = 0;
                CFIndex         catchAllConfig  = 0;
                Boolean         catchAllFound   = FALSE;
                CFIndex         catchAllService = 0;
                CFIndex         catchAllConfig  = 0;
@@ -1437,7 +1631,8 @@ addPasswordFromKeychain(SCDynamicStoreRef session, CFStringRef serviceID, CFDict
 
 
                        /* set the PPP password */
 
 
                        /* set the PPP password */
-                       CFDictionarySetValue(newEntity, kSCPropNetPPPAuthPassword, password);
+                       CFDictionarySetValue(newEntity, kSCPropNetPPPAuthPassword, uniqueID);
+                       CFDictionarySetValue(newEntity, kSCPropNetPPPAuthPasswordEncryption, kSCValNetPPPAuthPasswordEncryptionKeychain);
                        CFRelease(password);
 
                        /* update the PPP entity */
                        CFRelease(password);
 
                        /* update the PPP entity */
@@ -1508,7 +1703,9 @@ copyPasswordFromKeychain(CFStringRef uniqueID)
                                                    (void *)&data);     // outData
                if ((result == noErr) && (data != NULL) && (dataLen > 0)) {
                        password = CFStringCreateWithBytes(NULL, data, dataLen, kCFStringEncodingUTF8, TRUE);
                                                    (void *)&data);     // outData
                if ((result == noErr) && (data != NULL) && (dataLen > 0)) {
                        password = CFStringCreateWithBytes(NULL, data, dataLen, kCFStringEncodingUTF8, TRUE);
+                       (void) SecKeychainItemFreeContent(NULL, data);
                }
                }
+
        }
 
        CFRelease(enumerator);
        }
 
        CFRelease(enumerator);
index e33b16cf179b185399d0a5e3cd787371ed2ee4b1..610919032085c3e068662fb8a0ab8ac059a34313 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -266,7 +266,7 @@ SCNetworkConnectionCreateWithServiceID              (
 
 
 /*!
 
 
 /*!
-       @function SCNetworkConnectionCopyService
+       @function SCNetworkConnectionCopyServiceID
        @discussion Returns the service ID associated with the SCNetworkConnection.
        @param connection The SCNetworkConnection to obtain status from.
        @result Returns the service ID associated with the SCNetworkConnection.
        @discussion Returns the service ID associated with the SCNetworkConnection.
        @param connection The SCNetworkConnection to obtain status from.
        @result Returns the service ID associated with the SCNetworkConnection.
@@ -462,7 +462,7 @@ SCNetworkConnectionStop                             (
 
 
 /*!
 
 
 /*!
-       @function SCNetworkConnectionCopyCurrentOptions
+       @function SCNetworkConnectionCopyUserOptions
        @discussion Copies the user options used to start the connection.
                This is a mechanism a client can use to retrieve the user options
                previously passed to the SCNetworkConnectionStart function.
        @discussion Copies the user options used to start the connection.
                This is a mechanism a client can use to retrieve the user options
                previously passed to the SCNetworkConnectionStart function.
diff --git a/SystemConfiguration.fproj/SCNetworkConnectionPrivate.c b/SystemConfiguration.fproj/SCNetworkConnectionPrivate.c
new file mode 100644 (file)
index 0000000..56c444f
--- /dev/null
@@ -0,0 +1,1758 @@
+/*
+ * Copyright (c) 2006, 2007 Apple 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@
+ */
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreFoundation/CFRuntime.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCPrivate.h>             // for SCLog
+#include "SCNetworkConfigurationInternal.h"
+#include <notify.h>
+#include <pthread.h>
+#include <ppp/PPPControllerPriv.h>
+
+
+#pragma mark -
+#pragma mark SCUserPreferences
+
+
+typedef struct {
+
+       // base CFType information
+       CFRuntimeBase           cfBase;
+
+       // serviceID
+       CFStringRef             serviceID;
+
+       // user preferences [unique] id
+       CFStringRef             prefsID;
+
+} SCUserPreferencesPrivate, *SCUserPreferencesPrivateRef;
+
+
+static CFStringRef     __SCUserPreferencesCopyDescription      (CFTypeRef cf);
+static void            __SCUserPreferencesDeallocate           (CFTypeRef cf);
+static Boolean         __SCUserPreferencesEqual                (CFTypeRef cf1, CFTypeRef cf2);
+static CFHashCode      __SCUserPreferencesHash                 (CFTypeRef cf);
+
+
+static CFTypeID __kSCUserPreferencesTypeID     = _kCFRuntimeNotATypeID;
+
+
+static const CFRuntimeClass __SCUserPreferencesClass = {
+       0,                                      // version
+       "SCUserPreferences",                    // className
+       NULL,                                   // init
+       NULL,                                   // copy
+       __SCUserPreferencesDeallocate,          // dealloc
+       __SCUserPreferencesEqual,               // equal
+       __SCUserPreferencesHash,                // hash
+       NULL,                                   // copyFormattingDesc
+       __SCUserPreferencesCopyDescription      // copyDebugDesc
+};
+
+
+static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
+
+
+static CFStringRef
+__SCUserPreferencesCopyDescription(CFTypeRef cf)
+{
+       CFAllocatorRef                  allocator       = CFGetAllocator(cf);
+       CFMutableStringRef              result;
+       SCUserPreferencesPrivateRef     prefsPrivate    = (SCUserPreferencesPrivateRef)cf;
+
+       result = CFStringCreateMutable(allocator, 0);
+       CFStringAppendFormat(result, NULL, CFSTR("<SCUserPreferences %p [%p]> {"), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR("service = %@"), prefsPrivate->serviceID);
+       CFStringAppendFormat(result, NULL, CFSTR(", id = %@"), prefsPrivate->prefsID);
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
+
+       return result;
+}
+
+
+static void
+__SCUserPreferencesDeallocate(CFTypeRef cf)
+{
+       SCUserPreferencesPrivateRef     prefsPrivate    = (SCUserPreferencesPrivateRef)cf;
+
+       /* release resources */
+
+       CFRelease(prefsPrivate->prefsID);
+       CFRelease(prefsPrivate->serviceID);
+
+       return;
+}
+
+
+static Boolean
+__SCUserPreferencesEqual(CFTypeRef cf1, CFTypeRef cf2)
+{
+       SCUserPreferencesPrivateRef     s1      = (SCUserPreferencesPrivateRef)cf1;
+       SCUserPreferencesPrivateRef     s2      = (SCUserPreferencesPrivateRef)cf2;
+
+       if (s1 == s2)
+               return TRUE;
+
+       if (!CFEqual(s1->prefsID, s2->prefsID))
+               return FALSE;   // if not the same [unique] prefs identifier
+
+       return TRUE;
+}
+
+
+static CFHashCode
+__SCUserPreferencesHash(CFTypeRef cf)
+{
+       SCUserPreferencesPrivateRef     prefsPrivate    = (SCUserPreferencesPrivateRef)cf;
+
+       return CFHash(prefsPrivate->prefsID);
+}
+
+
+static void
+__SCUserPreferencesInitialize(void)
+{
+       __kSCUserPreferencesTypeID = _CFRuntimeRegisterClass(&__SCUserPreferencesClass);
+       return;
+}
+
+
+static SCUserPreferencesPrivateRef
+__SCUserPreferencesCreatePrivate(CFAllocatorRef                allocator,
+                                CFStringRef            serviceID,
+                                CFStringRef            prefsID)
+{
+       SCUserPreferencesPrivateRef     prefsPrivate;
+       uint32_t                        size;
+
+       /* initialize runtime */
+       pthread_once(&initialized, __SCUserPreferencesInitialize);
+
+       /* allocate target */
+       size         = sizeof(SCUserPreferencesPrivate) - sizeof(CFRuntimeBase);
+       prefsPrivate = (SCUserPreferencesPrivateRef)_CFRuntimeCreateInstance(allocator,
+                                                                            __kSCUserPreferencesTypeID,
+                                                                            size,
+                                                                            NULL);
+       if (prefsPrivate == NULL) {
+               return NULL;
+       }
+
+       prefsPrivate->serviceID = CFStringCreateCopy(NULL, serviceID);
+       prefsPrivate->prefsID   = CFStringCreateCopy(NULL, prefsID);
+
+       return prefsPrivate;
+}
+
+
+static __inline__ CFTypeRef
+isA_SCUserPreferences(CFTypeRef obj)
+{
+       return (isA_CFType(obj, SCUserPreferencesGetTypeID()));
+}
+
+
+#pragma mark -
+#pragma mark SCUserPreferences SPIs
+
+
+#define        USER_PREFERENCES_NOTIFICATION   "com.apple.networkConnect"
+#define        USER_PREFERENCES_APPLICATION_ID CFSTR("com.apple.networkConnect")
+#define        USER_PREFERENCES_ID             CFSTR("UniqueIdentifier")
+#define        USER_PREFERENCES_DEFAULT        CFSTR("ConnectByDefault")
+
+
+static CFArrayRef
+copyCFPreferencesForServiceID(CFStringRef serviceID)
+{
+       CFArrayRef      prefs;
+
+       // fetch "Managed" or "ByHost" user preferences
+       (void) CFPreferencesAppSynchronize(USER_PREFERENCES_APPLICATION_ID);
+       prefs = CFPreferencesCopyAppValue(serviceID,
+                                         USER_PREFERENCES_APPLICATION_ID);
+
+       if ((prefs != NULL) && !isA_CFArray(prefs)) {
+               CFRelease(prefs);
+               return NULL;
+       }
+
+       return prefs;
+}
+
+
+static Boolean
+setCFPreferencesForServiceID(CFStringRef serviceID, CFArrayRef newPreferences)
+{
+       Boolean ok;
+
+       if (CFPreferencesAppValueIsForced(serviceID, USER_PREFERENCES_APPLICATION_ID)) {
+               return FALSE;
+       }
+
+       CFPreferencesSetValue(serviceID,
+                             newPreferences,
+                             USER_PREFERENCES_APPLICATION_ID,
+                             kCFPreferencesCurrentUser,
+                             kCFPreferencesCurrentHost);
+       ok = CFPreferencesSynchronize(USER_PREFERENCES_APPLICATION_ID,
+                                     kCFPreferencesCurrentUser,
+                                     kCFPreferencesCurrentHost);
+
+       (void) notify_post(USER_PREFERENCES_NOTIFICATION);
+
+       return ok;
+}
+
+
+static void
+addPreference(CFMutableArrayRef *newPrefs, CFDictionaryRef newDict)
+{
+       if (*newPrefs == NULL) {
+               *newPrefs = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       }
+       CFArrayAppendValue(*newPrefs, newDict);
+
+       return;
+}
+
+
+typedef CFDictionaryRef (*processPreferencesCallout)   (CFStringRef            serviceID,
+                                                        CFDictionaryRef        current,
+                                                        void                   *context1,
+                                                        void                   *context2,
+                                                        void                   *context3);
+
+
+static Boolean
+processPreferences(CFStringRef                 serviceID,
+                  processPreferencesCallout    callout,
+                  void                         *context1,
+                  void                         *context2,
+                  void                         *context3)
+{
+       Boolean                         changed         = FALSE;
+       CFIndex                         i;
+       CFIndex                         n;
+       CFDictionaryRef                 newDict         = NULL;
+       CFMutableArrayRef               newPrefs        = NULL;
+       Boolean                         ok              = TRUE;
+       CFArrayRef                      prefs;
+
+       prefs = copyCFPreferencesForServiceID(serviceID);
+       n = (prefs != NULL) ? CFArrayGetCount(prefs) : 0;
+       for (i = 0; i < n; i++) {
+               CFDictionaryRef dict;
+
+               dict = CFArrayGetValueAtIndex(prefs, i);
+               if (isA_CFDictionary(dict)) {
+                       newDict = (*callout)(serviceID, dict, context1, context2, context3);
+                       if (newDict == NULL) {
+                               // if entry to be removed
+                               changed = TRUE;
+                               continue;
+                       }
+               } else {
+                       // if not a CFDictionary, leave as-is
+                       newDict = CFRetain(dict);
+               }
+
+               if (!CFEqual(dict, newDict)) {
+                       changed = TRUE;
+               }
+
+               addPreference(&newPrefs, newDict);
+               CFRelease(newDict);
+       }
+       if (prefs != NULL) CFRelease(prefs);
+
+       newDict = (*callout)(serviceID, NULL, context1, context2, context3);
+       if (newDict != NULL) {
+               // if new entry
+               changed = TRUE;
+               addPreference(&newPrefs, newDict);
+               CFRelease(newDict);
+       }
+
+       if (changed) {
+               ok = setCFPreferencesForServiceID(serviceID, newPrefs);
+       }
+       if (newPrefs != NULL) CFRelease(newPrefs);
+
+       return ok;
+}
+
+
+static __inline__ Boolean
+isMatchingPrefsID(CFDictionaryRef dict, CFStringRef matchID)
+{
+       CFStringRef     prefsID;
+
+       prefsID = CFDictionaryGetValue(dict, USER_PREFERENCES_ID);
+       if (isA_CFString(prefsID)) {
+               if (CFEqual(prefsID, matchID)) {
+                       return TRUE;
+               }
+       }
+
+       return FALSE;
+}
+
+
+CFTypeID
+SCUserPreferencesGetTypeID(void)
+{
+       pthread_once(&initialized, __SCUserPreferencesInitialize);      /* initialize runtime */
+       return __kSCUserPreferencesTypeID;
+}
+
+
+CFStringRef
+SCUserPreferencesGetUniqueID(SCUserPreferencesRef userPreferences)
+{
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return userPrivate->prefsID;
+}
+
+
+Boolean
+SCUserPreferencesIsForced(SCUserPreferencesRef userPreferences)
+{
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return CFPreferencesAppValueIsForced(userPrivate->serviceID, USER_PREFERENCES_APPLICATION_ID);
+}
+
+
+static CFDictionaryRef
+removeCallout(CFStringRef      serviceID,
+             CFDictionaryRef   current,
+             void              *context1,
+             void              *context2,
+             void              *context3)
+{
+       CFStringRef     matchID = (CFStringRef)context1;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       if (isMatchingPrefsID(current, matchID)) {
+               // if we match, don't add (i.e. remove)
+               return NULL;
+       }
+
+       return CFRetain(current);
+}
+
+
+Boolean
+SCUserPreferencesRemove(SCUserPreferencesRef userPreferences)
+{
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return processPreferences(userPrivate->serviceID,
+                                 removeCallout,
+                                 (void *)userPrivate->prefsID,
+                                 NULL,
+                                 NULL);
+}
+
+
+static CFDictionaryRef
+setCurrentCallout(CFStringRef          serviceID,
+                 CFDictionaryRef       current,
+                 void                  *context1,
+                 void                  *context2,
+                 void                  *context3)
+{
+       CFStringRef                     matchID         = (CFStringRef)context1;
+       CFMutableDictionaryRef          newDict;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       newDict = CFDictionaryCreateMutableCopy(NULL, 0, current);
+
+       // remove "default" flag
+       CFDictionaryRemoveValue(newDict, USER_PREFERENCES_DEFAULT);
+
+       if (isMatchingPrefsID(current, matchID)) {
+               // if we match, set "default" flag
+               CFDictionarySetValue(newDict, USER_PREFERENCES_DEFAULT, kCFBooleanTrue);
+       }
+
+       return newDict;
+}
+
+
+Boolean
+SCUserPreferencesSetCurrent(SCUserPreferencesRef userPreferences)
+{
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return processPreferences(userPrivate->serviceID,
+                                 setCurrentCallout,
+                                 (void *)userPrivate->prefsID,
+                                 NULL,
+                                 NULL);
+}
+
+
+static CFDictionaryRef
+copyNameCallout(CFStringRef    serviceID,
+               CFDictionaryRef current,
+               void            *context1,
+               void            *context2,
+               void            *context3)
+{
+       CFStringRef     matchID = (CFStringRef)context1;
+       CFStringRef     *name   = (CFStringRef *)context3;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       if (isMatchingPrefsID(current, matchID)) {
+               *name = CFDictionaryGetValue(current, kSCPropUserDefinedName);
+
+               // for backwards compatibility, we also check for the name in the PPP entity
+               if (*name == NULL) {
+                       CFDictionaryRef ppp;
+
+                       ppp = CFDictionaryGetValue(current, kSCEntNetPPP);
+                       if (isA_CFDictionary(ppp)) {
+                               *name = CFDictionaryGetValue(ppp, kSCPropUserDefinedName);
+                       }
+               }
+
+               *name = isA_CFString(*name);
+               if (*name != NULL) {
+                       CFRetain(*name);
+               }
+       }
+
+       return CFRetain(current);
+}
+
+
+CFStringRef
+SCUserPreferencesCopyName(SCUserPreferencesRef userPreferences)
+{
+       CFStringRef                     name            = NULL;
+       Boolean                         ok;
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // find SCUserPreferences and copy name
+       ok = processPreferences(userPrivate->serviceID,
+                               copyNameCallout,
+                               (void *)userPrivate->prefsID,
+                               NULL,
+                               (void *)&name);
+       if (!ok) {
+               if (name != NULL) {
+                       CFRelease(name);
+                       name = NULL;
+               }
+       }
+
+       return name;
+}
+
+
+static CFDictionaryRef
+setNameCallout(CFStringRef     serviceID,
+              CFDictionaryRef  current,
+              void             *context1,
+              void             *context2,
+              void             *context3)
+{
+       CFStringRef             matchID = (CFStringRef)context1;
+       CFMutableDictionaryRef  newDict;
+       CFStringRef             newName = (CFStringRef)context2;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       newDict = CFDictionaryCreateMutableCopy(NULL, 0, current);
+
+       if (isMatchingPrefsID(current, matchID)) {
+               CFDictionaryRef pppEntity;
+
+               // set the name
+               if (newName != NULL) {
+                       CFDictionarySetValue(newDict, kSCPropUserDefinedName, newName);
+               } else {
+                       CFDictionaryRemoveValue(newDict, kSCPropUserDefinedName);
+               }
+
+               // for backwards compatibility, we also set the name in the PPP entity
+               pppEntity = CFDictionaryGetValue(newDict, kSCEntNetPPP);
+               if (isA_CFDictionary(pppEntity)) {
+                       CFMutableDictionaryRef  newPPPEntity;
+
+                       newPPPEntity = CFDictionaryCreateMutableCopy(NULL, 0, pppEntity);
+                       if (newName != NULL) {
+                               CFDictionarySetValue(newPPPEntity, kSCPropUserDefinedName, newName);
+                       } else {
+                               CFDictionaryRemoveValue(newPPPEntity, kSCPropUserDefinedName);
+                       }
+                       CFDictionarySetValue(newDict, kSCEntNetPPP, newPPPEntity);
+                       CFRelease(newPPPEntity);
+               }
+       }
+
+       return newDict;
+}
+
+
+Boolean
+SCUserPreferencesSetName(SCUserPreferencesRef userPreferences, CFStringRef newName)
+{
+       Boolean                         ok;
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((newName != NULL) && !isA_CFString(newName)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // find SCUserPreferences and set name
+       ok = processPreferences(userPrivate->serviceID,
+                               setNameCallout,
+                               (void *)userPrivate->prefsID,
+                               (void *)newName,
+                               NULL);
+
+       return ok;
+}
+
+
+static CFDictionaryRef
+copyInterfaceConfigurationCallout(CFStringRef          serviceID,
+                                 CFDictionaryRef       current,
+                                 void                  *context1,
+                                 void                  *context2,
+                                 void                  *context3)
+{
+       CFDictionaryRef *dict           = (CFDictionaryRef *)context3;
+       CFStringRef     interfaceType   = (CFStringRef)context2;
+       CFStringRef     matchID         = (CFStringRef)context1;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       if (isMatchingPrefsID(current, matchID)) {
+               *dict = CFDictionaryGetValue(current, interfaceType);
+               *dict = isA_CFDictionary(*dict);
+               if (*dict != NULL) {
+                       CFRetain(*dict);
+               }
+       }
+
+       return CFRetain(current);
+}
+
+
+CFDictionaryRef
+SCUserPreferencesCopyInterfaceConfiguration(SCUserPreferencesRef       userPreferences,
+                                           SCNetworkInterfaceRef       interface)
+{
+       CFStringRef                     defaultType;
+       CFDictionaryRef                 entity          = NULL;
+       Boolean                         ok;
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       // get InterfaceType
+       defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+       if (defaultType == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       // find SCUserPreferences and copy interface entity
+       ok = processPreferences(userPrivate->serviceID,
+                               copyInterfaceConfigurationCallout,
+                               (void *)userPrivate->prefsID,
+                               (void *)defaultType,
+                               (void *)&entity);
+       if (!ok) {
+               if (entity != NULL) {
+                       CFRelease(entity);
+                       entity = NULL;
+               }
+       }
+
+       return entity;
+}
+
+
+static CFDictionaryRef
+setInterfaceConfigurationCallout(CFStringRef           serviceID,
+                                 CFDictionaryRef       current,
+                                 void                  *context1,
+                                 void                  *context2,
+                                 void                  *context3)
+{
+       CFStringRef             interfaceType   = (CFStringRef)context2;
+       CFStringRef             matchID         = (CFStringRef)context1;
+       CFMutableDictionaryRef  newDict;
+       CFDictionaryRef         newOptions      = (CFDictionaryRef)context3;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       newDict = CFDictionaryCreateMutableCopy(NULL, 0, current);
+
+       if (isMatchingPrefsID(current, matchID)) {
+               if (newOptions != NULL) {
+                       CFDictionarySetValue(newDict, interfaceType, newOptions);
+
+                       // for backwards compatibility, we want to ensure that
+                       // the name is set in both the top level and in the PPP
+                       // entity.
+                       if (CFEqual(interfaceType, kSCEntNetPPP)) {
+                               CFStringRef     name;
+
+                               name = CFDictionaryGetValue(newOptions, kSCPropUserDefinedName);
+                               if (name != NULL) {
+                                       // if name was passed in newOptions, push up
+                                       CFDictionarySetValue(newDict, kSCPropUserDefinedName, name);
+                               } else {
+                                       name = CFDictionaryGetValue(newDict, kSCPropUserDefinedName);
+                                       if (name != NULL) {
+                                               CFMutableDictionaryRef  newPPPEntity;
+
+                                               // if name in parent, push into entity
+                                               newPPPEntity = CFDictionaryCreateMutableCopy(NULL, 0, newOptions);
+                                               CFDictionarySetValue(newPPPEntity, kSCPropUserDefinedName, name);
+                                               CFDictionarySetValue(newDict, interfaceType, newPPPEntity);
+                                               CFRelease(newPPPEntity);
+                                       }
+                               }
+                       }
+               } else {
+                       CFDictionaryRemoveValue(newDict, interfaceType);
+               }
+       }
+
+       return newDict;
+}
+
+
+Boolean
+SCUserPreferencesSetInterfaceConfiguration(SCUserPreferencesRef                userPreferences,
+                                          SCNetworkInterfaceRef        interface,
+                                          CFDictionaryRef              newOptions)
+{
+       CFStringRef                     defaultType;
+       Boolean                         ok;
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // get InterfaceType
+       defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+       if (defaultType == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // set new interface entity for SCUserPreferences
+       ok = processPreferences(userPrivate->serviceID,
+                               setInterfaceConfigurationCallout,
+                               (void *)userPrivate->prefsID,
+                               (void *)defaultType,
+                               (void *)newOptions);
+
+       return ok;
+}
+
+
+CFDictionaryRef
+SCUserPreferencesCopyExtendedInterfaceConfiguration(SCUserPreferencesRef       userPreferences,
+                                                   SCNetworkInterfaceRef       interface,
+                                                   CFStringRef                 extendedType)
+{
+       CFDictionaryRef                 entity          = NULL;
+       Boolean                         ok;
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (!__SCNetworkInterfaceIsValidExtendedConfigurationType(interface, extendedType, FALSE)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       // find SCUserPreferences and copy interface entity
+       ok = processPreferences(userPrivate->serviceID,
+                               copyInterfaceConfigurationCallout,
+                               (void *)userPrivate->prefsID,
+                               (void *)extendedType,
+                               (void *)&entity);
+       if (!ok) {
+               if (entity != NULL) {
+                       CFRelease(entity);
+                       entity = NULL;
+               }
+       }
+
+       return entity;
+}
+
+
+Boolean
+SCUserPreferencesSetExtendedInterfaceConfiguration(SCUserPreferencesRef                userPreferences,
+                                                  SCNetworkInterfaceRef        interface,
+                                                  CFStringRef                  extendedType,
+                                                  CFDictionaryRef              newOptions)
+{
+       Boolean                         ok;
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!__SCNetworkInterfaceIsValidExtendedConfigurationType(interface, extendedType, FALSE)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // set new interface entity for SCUserPreferences
+       ok = processPreferences(userPrivate->serviceID,
+                               setInterfaceConfigurationCallout,
+                               (void *)userPrivate->prefsID,
+                               (void *)extendedType,
+                               (void *)newOptions);
+
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkConnection + SCUserPreferences SPIs
+
+
+static CFDictionaryRef
+copyAllCallout(CFStringRef     serviceID,
+              CFDictionaryRef  current,
+              void             *context1,
+              void             *context2,
+              void             *context3)
+{
+       CFMutableArrayRef               *prefs          = (CFMutableArrayRef *)context3;
+       CFStringRef                     prefsID;
+       SCUserPreferencesPrivateRef     userPrivate;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       prefsID = CFDictionaryGetValue(current, USER_PREFERENCES_ID);
+       if (!isA_CFString(prefsID)) {
+               // if no unique ID
+               goto done;
+       }
+
+       userPrivate = __SCUserPreferencesCreatePrivate(NULL, serviceID, prefsID);
+       if (userPrivate != NULL) {
+               if (*prefs == NULL) {
+                       *prefs = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               }
+               CFArrayAppendValue(*prefs, (SCUserPreferencesRef)userPrivate);
+               CFRelease(userPrivate);
+       }
+
+    done :
+
+       return CFRetain(current);
+}
+
+
+CFArrayRef /* of SCUserPreferencesRef's */
+SCNetworkConnectionCopyAllUserPreferences(SCNetworkConnectionRef connection)
+{
+       Boolean                 ok;
+       CFMutableArrayRef       prefs           = NULL;
+       CFStringRef             serviceID;
+
+       // get serviceID
+       serviceID = SCNetworkConnectionCopyServiceID(connection);
+
+       // collect SCUserPreferences
+       ok = processPreferences(serviceID,
+                               copyAllCallout,
+                               NULL,
+                               NULL,
+                               (void *)&prefs);
+       if (!ok) {
+               if (prefs != NULL) {
+                       CFRelease(prefs);
+                       prefs = NULL;
+               }
+       }
+
+       CFRelease(serviceID);
+       return prefs;
+}
+
+
+static CFDictionaryRef
+copyCurrentCallout(CFStringRef         serviceID,
+                  CFDictionaryRef      current,
+                  void                 *context1,
+                  void                 *context2,
+                  void                 *context3)
+{
+       CFBooleanRef                    isDefault;
+       CFStringRef                     prefsID;
+       SCUserPreferencesPrivateRef     *userPrivate    = (SCUserPreferencesPrivateRef *)context3;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       prefsID = CFDictionaryGetValue(current, USER_PREFERENCES_ID);
+       if (!isA_CFString(prefsID)) {
+               // if no unique ID
+               goto done;
+       }
+
+       isDefault = CFDictionaryGetValue(current, USER_PREFERENCES_DEFAULT);
+       if (!isA_CFBoolean(isDefault) || !CFBooleanGetValue(isDefault)) {
+               // if not the default configuration
+               goto done;
+       }
+
+       *userPrivate = __SCUserPreferencesCreatePrivate(NULL, serviceID, prefsID);
+
+    done :
+
+       return CFRetain(current);
+}
+
+
+SCUserPreferencesRef
+SCNetworkConnectionCopyCurrentUserPreferences(SCNetworkConnectionRef connection)
+{
+       SCUserPreferencesRef    current         = NULL;
+       Boolean                 ok;
+       CFStringRef             serviceID;
+
+       // get serviceID
+       serviceID = SCNetworkConnectionCopyServiceID(connection);
+
+       // collect SCUserPreferences
+       ok = processPreferences(serviceID,
+                               copyCurrentCallout,
+                               NULL,
+                               NULL,
+                               (void *)&current);
+       if (!ok) {
+               if (current != NULL) {
+                       CFRelease(current);
+                       current = NULL;
+               }
+       }
+
+       CFRelease(serviceID);
+       return current;
+}
+
+
+static CFDictionaryRef
+createCallout(CFStringRef      serviceID,
+             CFDictionaryRef   current,
+             void              *context1,
+             void              *context2,
+             void              *context3)
+{
+       CFMutableDictionaryRef          newDict;
+       CFStringRef                     newPrefsID      = (CFStringRef)context1;
+
+       if (current != NULL) {
+               // don't change existing entries
+               return CFRetain(current);
+       }
+
+       newDict = CFDictionaryCreateMutable(NULL,
+                                           0,
+                                           &kCFTypeDictionaryKeyCallBacks,
+                                           &kCFTypeDictionaryValueCallBacks);
+       CFDictionarySetValue(newDict, USER_PREFERENCES_ID, newPrefsID);
+       return newDict;
+}
+
+
+SCUserPreferencesRef
+SCNetworkConnectionCreateUserPreferences(SCNetworkConnectionRef connection)
+{
+       CFStringRef                     newPrefsID;
+       CFStringRef                     serviceID;
+       SCUserPreferencesPrivateRef     userPrivate;
+       CFUUIDRef                       uuid;
+
+       // get serviceID
+       serviceID = SCNetworkConnectionCopyServiceID(connection);
+
+       // allocate a new user preferences ID
+       uuid       = CFUUIDCreate(NULL);
+       newPrefsID = CFUUIDCreateString(NULL, uuid);
+       CFRelease(uuid);
+
+       userPrivate = __SCUserPreferencesCreatePrivate(NULL, serviceID, newPrefsID);
+       if (userPrivate != NULL) {
+               (void) processPreferences(serviceID,
+                                         createCallout,
+                                         (void *)newPrefsID,
+                                         NULL,
+                                         NULL);
+       }
+
+       CFRelease(newPrefsID);
+       CFRelease(serviceID);
+       return (SCUserPreferencesRef)userPrivate;
+}
+
+
+#ifdef NOTNOW
+Boolean
+SCNetworkConnectionSelectService(CFDictionaryRef       selectionOptions,
+                                SCNetworkServiceRef    *service,
+                                SCUserPreferencesRef   *userPreferences)
+{
+       return FALSE;
+}
+#endif // NOTNOW
+
+
+static void
+update_PPP_entity(SCUserPreferencesRef userPreferences, CFDictionaryRef *userOptions)
+{
+       CFStringRef     encryption;
+       CFDictionaryRef entity;
+       CFStringRef     keychainID;
+
+       entity = CFDictionaryGetValue(*userOptions, kSCEntNetPPP);
+       if (!isA_CFDictionary(entity)) {
+               return;
+       }
+
+       encryption = CFDictionaryGetValue(entity, kSCPropNetPPPAuthPasswordEncryption);
+       if (encryption == NULL) {
+               // provide default encryption method
+               encryption = kSCValNetPPPAuthPasswordEncryptionKeychain;
+       }
+
+       if (!isA_CFString(encryption) ||
+           !CFEqual(encryption, kSCValNetPPPAuthPasswordEncryptionKeychain)) {
+               return;
+       }
+
+       keychainID = CFDictionaryGetValue(entity, kSCPropNetPPPAuthPassword);
+       if (isA_CFString(keychainID)) {
+               // if password is keychain ID
+       } else if (isA_CFData(keychainID) &&
+                  ((CFDataGetLength((CFDataRef)keychainID) % sizeof(UniChar)) == 0)) {
+               // if inline password
+               return;
+       } else {
+               keychainID = SCUserPreferencesGetUniqueID(userPreferences);
+       }
+
+       if (_SCSecKeychainPasswordItemExists(NULL, keychainID)) {
+               CFMutableDictionaryRef  new_entity;
+               CFMutableDictionaryRef  new_options;
+
+               // access PPP password from system keychain
+               new_entity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+
+               CFDictionarySetValue(new_entity,
+                                    kSCPropNetPPPAuthPassword,
+                                    keychainID);
+               CFDictionarySetValue(new_entity,
+                                    kSCPropNetPPPAuthPasswordEncryption,
+                                    kSCValNetPPPAuthPasswordEncryptionKeychain);
+
+               new_options = CFDictionaryCreateMutableCopy(NULL, 0, *userOptions);
+               CFDictionarySetValue(new_options, kSCEntNetPPP, new_entity);
+               CFRelease(new_entity);
+
+               CFRelease(*userOptions);
+               *userOptions = new_options;
+       }
+
+       return;
+}
+
+
+static void
+update_IPSec_entity(SCUserPreferencesRef userPreferences, CFDictionaryRef *userOptions)
+{
+       CFStringRef     encryption;
+       CFDictionaryRef entity;
+       SecKeychainRef  keychain        = NULL;
+       CFStringRef     keychainID;
+       CFStringRef     method;
+       CFDataRef       sharedSecret;
+
+       entity = CFDictionaryGetValue(*userOptions, kSCEntNetIPSec);
+       if (!isA_CFDictionary(entity)) {
+               return;
+       }
+
+       method = CFDictionaryGetValue(entity, kSCPropNetIPSecAuthenticationMethod);
+       if (!isA_CFString(method) ||
+           !CFEqual(method, kSCValNetIPSecAuthenticationMethodSharedSecret)) {
+               return;
+       }
+
+       encryption = CFDictionaryGetValue(entity, kSCPropNetIPSecSharedSecretEncryption);
+       if (encryption == NULL) {
+               // provide default encryption method
+               encryption = kSCValNetIPSecSharedSecretEncryptionKeychain;
+       }
+
+       if (!isA_CFString(encryption) ||
+           !CFEqual(encryption, kSCValNetIPSecSharedSecretEncryptionKeychain)) {
+               return;
+       }
+
+       keychainID = CFDictionaryGetValue(entity, kSCPropNetIPSecSharedSecret);
+       if (isA_CFString(keychainID)) {
+               // if shared secret is keychain ID
+               CFRetain(keychainID);
+       } else if (isA_CFData(keychainID) &&
+                  ((CFDataGetLength((CFDataRef)keychainID) % sizeof(UniChar)) == 0)) {
+               // if inline shared secret
+               return;
+       } else {
+               CFStringRef     unique_id;
+
+               unique_id = SCUserPreferencesGetUniqueID(userPreferences);
+               keychainID = (CFStringRef)CFStringCreateMutableCopy(NULL, 0, unique_id);
+               CFStringAppend((CFMutableStringRef)keychainID, CFSTR(".SS"));
+       }
+
+       sharedSecret = _SCSecKeychainPasswordItemCopy(NULL, keychainID);
+       if (sharedSecret != NULL) {
+               CFMutableDictionaryRef  new_entity;
+               CFMutableDictionaryRef  new_options;
+               CFStringRef             password;
+
+               // pass SharedSecret from user keychain
+               new_entity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+
+               password = CFStringCreateWithBytes(NULL,
+                                                  CFDataGetBytePtr(sharedSecret),
+                                                  CFDataGetLength(sharedSecret),
+                                                  kCFStringEncodingUTF8,
+                                                  FALSE);
+               CFRelease(sharedSecret);
+               CFDictionarySetValue(new_entity,
+                                    kSCPropNetIPSecSharedSecret,
+                                    password);
+               CFRelease(password);
+               CFDictionaryRemoveValue(new_entity,
+                                       kSCPropNetIPSecSharedSecretEncryption);
+
+               new_options = CFDictionaryCreateMutableCopy(NULL, 0, *userOptions);
+               CFDictionarySetValue(new_options, kSCEntNetIPSec, new_entity);
+               CFRelease(new_entity);
+
+               CFRelease(*userOptions);
+               *userOptions = new_options;
+               goto done;
+       }
+
+       keychain = _SCSecKeychainCopySystemKeychain();
+       if (keychain == NULL) {
+               goto done;
+       }
+
+       if (_SCSecKeychainPasswordItemExists(keychain, keychainID)) {
+               CFMutableDictionaryRef  new_entity;
+               CFMutableDictionaryRef  new_options;
+
+               // access SharedSecret from system keychain
+               new_entity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+
+               CFDictionarySetValue(new_entity,
+                                    kSCPropNetIPSecSharedSecret,
+                                    keychainID);
+               CFDictionarySetValue(new_entity,
+                                    kSCPropNetIPSecSharedSecretEncryption,
+                                    kSCValNetIPSecSharedSecretEncryptionKeychain);
+
+               new_options = CFDictionaryCreateMutableCopy(NULL, 0, *userOptions);
+               CFDictionarySetValue(new_options, kSCEntNetIPSec, new_entity);
+               CFRelease(new_entity);
+
+               CFRelease(*userOptions);
+               *userOptions = new_options;
+       }
+
+    done :
+
+       if (keychain != NULL) CFRelease(keychain);
+       CFRelease(keychainID);
+       return;
+}
+
+
+static CFDictionaryRef
+copyOptionsCallout(CFStringRef         serviceID,
+                  CFDictionaryRef      current,
+                  void                 *context1,
+                  void                 *context2,
+                  void                 *context3)
+{
+       CFStringRef             matchID         = (CFStringRef)context1;
+       CFMutableDictionaryRef  *userOptions    = (CFMutableDictionaryRef *)context3;
+
+       if (current == NULL) {
+               // we have nothing to "add"
+               return NULL;
+       }
+
+       if (isMatchingPrefsID(current, matchID)) {
+               // if we match, return options dictionary
+               if (*userOptions != NULL) CFRelease(*userOptions);
+               *userOptions = CFDictionaryCreateMutableCopy(NULL, 0, current);
+               CFDictionaryRemoveValue(*userOptions, USER_PREFERENCES_ID);
+               CFDictionaryRemoveValue(*userOptions, USER_PREFERENCES_DEFAULT);
+       }
+
+       return CFRetain(current);
+}
+
+
+Boolean
+SCNetworkConnectionStartWithUserPreferences(SCNetworkConnectionRef     connection,
+                                           SCUserPreferencesRef        userPreferences,
+                                           Boolean                     linger)
+{
+       Boolean                         ok;
+       CFDictionaryRef                 userOptions     = NULL;
+       SCUserPreferencesPrivateRef     userPrivate     = (SCUserPreferencesPrivateRef)userPreferences;
+
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       (void) processPreferences(userPrivate->serviceID,
+                                 copyOptionsCallout,
+                                 (void *)userPrivate->prefsID,
+                                 NULL,
+                                 &userOptions);
+
+       /*
+        * For some legacy preferences, some of the user options
+        * were missing yet handled by the APIs.  Make sure that
+        * everything still works!
+        */
+       if (userOptions != NULL) {
+               update_PPP_entity  (userPreferences, &userOptions);
+               update_IPSec_entity(userPreferences, &userOptions);
+       }
+
+       ok = SCNetworkConnectionStart(connection, userOptions, linger);
+
+       if (userOptions != NULL) {
+               CFRelease(userOptions);
+       }
+
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark SCUserPreferences + SCNetworkInterface Password SPIs
+
+
+static CFStringRef
+getUserPasswordID(CFDictionaryRef config, SCUserPreferencesRef userPreferences)
+{
+       CFStringRef     unique_id       = NULL;
+
+       if (config != NULL) {
+               CFStringRef     encryption;
+
+               encryption = CFDictionaryGetValue(config, kSCPropNetPPPAuthPasswordEncryption);
+               if (isA_CFString(encryption) &&
+                   CFEqual(encryption, kSCValNetPPPAuthPasswordEncryptionKeychain)) {
+                       unique_id = CFDictionaryGetValue(config, kSCPropNetPPPAuthPassword);
+               }
+       }
+       if (unique_id == NULL) {
+               unique_id = SCUserPreferencesGetUniqueID(userPreferences);
+       }
+
+       return unique_id;
+}
+
+
+static CFStringRef
+copyUserSharedSecretID(CFDictionaryRef config, SCUserPreferencesRef userPreferences)
+{
+       CFMutableStringRef      sharedSecret    = NULL;
+
+       if (config != NULL) {
+               CFStringRef     encryption;
+
+               encryption = CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecretEncryption);
+               if (isA_CFString(encryption) &&
+                   CFEqual(encryption, kSCValNetIPSecSharedSecretEncryptionKeychain)) {
+                       sharedSecret = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecret);
+                       if (sharedSecret != NULL) {
+                               CFRetain(sharedSecret);
+                       }
+               }
+       }
+
+       if (sharedSecret == NULL) {
+               CFStringRef     unique_id;
+
+               unique_id = getUserPasswordID(config, userPreferences);
+               sharedSecret = CFStringCreateMutableCopy(NULL, 0, unique_id);
+               CFStringAppend(sharedSecret, CFSTR(".SS"));
+       }
+
+       return sharedSecret;
+}
+
+
+static Boolean
+checkUserPreferencesPassword(SCUserPreferencesRef              userPreferences,
+                            SCNetworkInterfaceRef              interface,
+                            SCNetworkInterfacePasswordType     passwordType)
+{
+       if (!isA_SCUserPreferences(userPreferences)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFStringRef     interfaceType;
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFStringRef             interfaceType;
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+
+                       interface = SCNetworkInterfaceGetInterface(interface);
+                       if (interface == NULL) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeEAPOL : {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+               }
+
+               default :
+                       break;
+       }
+
+       return TRUE;
+}
+
+
+Boolean
+SCUserPreferencesCheckInterfacePassword(SCUserPreferencesRef           userPreferences,
+                                       SCNetworkInterfaceRef           interface,
+                                       SCNetworkInterfacePasswordType  passwordType)
+{
+       Boolean         exists  = FALSE;
+
+       if (!checkUserPreferencesPassword(userPreferences, interface, passwordType)) {
+               return FALSE;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get userPreferences ID
+                       unique_id = getUserPasswordID(config, userPreferences);
+
+                       // check
+                       exists = __extract_password(NULL,
+                                                   config,
+                                                   kSCPropNetPPPAuthPassword,
+                                                   kSCPropNetPPPAuthPasswordEncryption,
+                                                   kSCValNetPPPAuthPasswordEncryptionKeychain,
+                                                   unique_id,
+                                                   NULL);
+
+                       if (config != NULL)     CFRelease(config);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFDictionaryRef config;
+                       CFStringRef     shared_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyExtendedInterfaceConfiguration(userPreferences,
+                                                                                    interface,
+                                                                                    kSCEntNetIPSec);
+
+                       // get sharedSecret ID
+                       shared_id = copyUserSharedSecretID(config, userPreferences);
+
+                       // check
+                       exists = __extract_password(NULL,
+                                                   config,
+                                                   kSCPropNetIPSecSharedSecret,
+                                                   kSCPropNetIPSecSharedSecretEncryption,
+                                                   kSCValNetIPSecSharedSecretEncryptionKeychain,
+                                                   shared_id,
+                                                   NULL);
+
+                       if (config != NULL)     CFRelease(config);
+                               CFRelease(shared_id);
+                       break;
+               }
+
+               default :
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+       }
+
+       return exists;
+}
+
+
+CFDataRef
+SCUserPreferencesCopyInterfacePassword(SCUserPreferencesRef            userPreferences,
+                                      SCNetworkInterfaceRef            interface,
+                                      SCNetworkInterfacePasswordType   passwordType)
+{
+       CFDataRef       password        = NULL;
+
+       if (!checkUserPreferencesPassword(userPreferences, interface, passwordType)) {
+               return FALSE;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get userPreferences ID
+                       unique_id = getUserPasswordID(config, userPreferences);
+
+                       // extract
+                       (void) __extract_password(NULL,
+                                                 config,
+                                                 kSCPropNetPPPAuthPassword,
+                                                 kSCPropNetPPPAuthPasswordEncryption,
+                                                 kSCValNetPPPAuthPasswordEncryptionKeychain,
+                                                 unique_id,
+                                                 &password);
+
+                       if (config != NULL)     CFRelease(config);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFDictionaryRef config;
+                       CFStringRef     shared_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyExtendedInterfaceConfiguration(userPreferences,
+                                                                                    interface,
+                                                                                    kSCEntNetIPSec);
+
+                       // get sharedSecret ID
+                       shared_id = copyUserSharedSecretID(config, userPreferences);
+
+                       // extract
+                       (void) __extract_password(NULL,
+                                                 config,
+                                                 kSCPropNetIPSecSharedSecret,
+                                                 kSCPropNetIPSecSharedSecretEncryption,
+                                                 kSCValNetIPSecSharedSecretEncryptionKeychain,
+                                                 shared_id,
+                                                 &password);
+
+                       if (config != NULL)     CFRelease(config);
+                               CFRelease(shared_id);
+                       break;
+               }
+
+               default :
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+       }
+
+       return password;
+}
+
+
+Boolean
+SCUserPreferencesRemoveInterfacePassword(SCUserPreferencesRef          userPreferences,
+                                        SCNetworkInterfaceRef          interface,
+                                        SCNetworkInterfacePasswordType passwordType)
+{
+       Boolean         ok      = FALSE;
+
+       if (!checkUserPreferencesPassword(userPreferences, interface, passwordType)) {
+               return FALSE;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get userPreferences ID
+                       unique_id = getUserPasswordID(config, userPreferences);
+
+                       // remove password
+                       ok = _SCSecKeychainPasswordItemRemove(NULL, unique_id);
+                       if (ok) {
+                               CFDictionaryRef         config;
+                               CFMutableDictionaryRef  newConfig;
+
+                               config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPassword);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPasswordEncryption);
+                                       ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig);
+                                       CFRelease(newConfig);
+                               }
+                       }
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFDictionaryRef config;
+                       CFStringRef     shared_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyExtendedInterfaceConfiguration(userPreferences,
+                                                                                    interface,
+                                                                                    kSCEntNetIPSec);
+
+                       // get sharedSecret ID
+                       shared_id = copyUserSharedSecretID(config, userPreferences);
+
+                       // remove password
+                       ok = _SCSecKeychainPasswordItemRemove(NULL, shared_id);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecret);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecretEncryption);
+                                       ok = SCUserPreferencesSetExtendedInterfaceConfiguration(userPreferences,
+                                                                                               interface,
+                                                                                               kSCEntNetIPSec,
+                                                                                               newConfig);
+                                       CFRelease(newConfig);
+                               }
+                       }
+
+                       if (config != NULL)     CFRelease(config);
+                       CFRelease(shared_id);
+                       break;
+               }
+
+               default :
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef             userPreferences,
+                                     SCNetworkInterfaceRef             interface,
+                                     SCNetworkInterfacePasswordType    passwordType,
+                                     CFDataRef                         password,
+                                     CFDictionaryRef                   options)
+{
+       CFStringRef     account         = NULL;
+       CFBundleRef     bundle;
+       CFDictionaryRef config;
+       CFStringRef     description     = NULL;
+       CFStringRef     label           = NULL;
+       Boolean         ok      = FALSE;
+
+       if (!checkUserPreferencesPassword(userPreferences, interface, passwordType)) {
+               return FALSE;
+       }
+
+       bundle = _SC_CFBundleGet();
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get userPreferences ID
+                       unique_id = getUserPasswordID(config, userPreferences);
+
+                       // User prefs auth name --> keychain "Account"
+                       if (config != NULL) {
+                               account = CFDictionaryGetValue(config, kSCPropNetPPPAuthName);
+                       }
+
+                       // User prefs "name" --> keychain "Name"
+                       label = SCUserPreferencesCopyName(userPreferences);
+
+                       // "PPP Password" --> keychain "Kind"
+                       if (bundle != NULL) {
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_PPP_PASSWORD"),
+                                                                         CFSTR("PPP Password"),
+                                                                         NULL);
+                       }
+
+                       // store password
+                       ok = _SCSecKeychainPasswordItemSet(NULL,
+                                                          unique_id,
+                                                          (label != NULL)       ? label       : CFSTR("PPP"),
+                                                          (description != NULL) ? description : CFSTR("PPP Password"),
+                                                          account,
+                                                          password,
+                                                          options);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                               } else {
+                                       newConfig = CFDictionaryCreateMutable(NULL,
+                                                                             0,
+                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetPPPAuthPassword,
+                                                    unique_id);
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetPPPAuthPasswordEncryption,
+                                                    kSCValNetPPPAuthPasswordEncryptionKeychain);
+                               ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       if (config      != NULL) CFRelease(config);
+                       if (description != NULL) CFRelease(description);
+                       if (label       != NULL) CFRelease(label);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFStringRef     shared_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyExtendedInterfaceConfiguration(userPreferences,
+                                                                                    interface,
+                                                                                    kSCEntNetIPSec);
+
+                       // get sharedSecret ID
+                       shared_id = copyUserSharedSecretID(config, userPreferences);
+
+                       // User prefs "name" --> keychain "Name"
+                       label = SCUserPreferencesCopyName(userPreferences);
+
+                       // "IPSec Shared Secret" --> keychain "Kind"
+                       if (bundle != NULL) {
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_IPSEC_SHARED_SECRET"),
+                                                                         CFSTR("IPSec Shared Secret"),
+                                                                         NULL);
+                       }
+
+                       // set password
+                       ok = _SCSecKeychainPasswordItemSet(NULL,
+                                                          shared_id,
+                                                          (label != NULL)       ? label       : CFSTR("PPP"),
+                                                          (description != NULL) ? description : CFSTR("IPSec Shared Secret"),
+                                                          NULL,
+                                                          password,
+                                                          options);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig       = NULL;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                               } else {
+                                       newConfig = CFDictionaryCreateMutable(NULL,
+                                                                             0,
+                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetIPSecSharedSecret,
+                                                    shared_id);
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetIPSecSharedSecretEncryption,
+                                                    kSCValNetIPSecSharedSecretEncryptionKeychain);
+                               ok = SCUserPreferencesSetExtendedInterfaceConfiguration(userPreferences,
+                                                                                       interface,
+                                                                                       kSCEntNetIPSec,
+                                                                                       newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       if (config      != NULL) CFRelease(config);
+                       if (description != NULL) CFRelease(description);
+                       if (label       != NULL) CFRelease(label);
+                       CFRelease(shared_id);
+                       break;
+               }
+
+               default :
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+       }
+
+       return ok;
+}
diff --git a/SystemConfiguration.fproj/SCNetworkConnectionPrivate.h b/SystemConfiguration.fproj/SCNetworkConnectionPrivate.h
new file mode 100644 (file)
index 0000000..0618c99
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2006 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@
+ */
+
+#ifndef _SCNETWORKCONNECTIONPRIVATE_H
+#define _SCNETWORKCONNECTIONPRIVATE_H
+
+#include <AvailabilityMacros.h>
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCNetworkConfigurationPrivate.h>
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+
+typedef const struct __SCUserPreferencesRef * SCUserPreferencesRef;
+
+
+__BEGIN_DECLS
+
+
+#pragma mark -
+#pragma mark SCNetworkConnection SPIs
+
+
+CFArrayRef /* of SCNetworkServiceRef's */
+SCNetworkConnectionCopyAvailableServices       (SCNetworkSetRef                set)                    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+SCNetworkConnectionRef
+SCNetworkConnectionCreateWithService           (CFAllocatorRef                 allocator,
+                                                SCNetworkServiceRef            service,
+                                                SCNetworkConnectionCallBack    callout,
+                                                SCNetworkConnectionContext     *context)               AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+SCNetworkServiceRef
+SCNetworkConnectionGetService                  (SCNetworkConnectionRef         connection)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+CFArrayRef /* of SCUserPreferencesRef's */
+SCNetworkConnectionCopyAllUserPreferences      (SCNetworkConnectionRef         connection)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+SCUserPreferencesRef
+SCNetworkConnectionCopyCurrentUserPreferences  (SCNetworkConnectionRef         connection)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+SCUserPreferencesRef
+SCNetworkConnectionCreateUserPreferences       (SCNetworkConnectionRef         connection)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+
+#pragma mark -
+#pragma mark SCUserPreferences SPIs
+
+
+Boolean
+SCUserPreferencesRemove                                (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCUserPreferencesSetCurrent                    (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+CFStringRef
+SCUserPreferencesCopyName                      (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+CFTypeID
+SCUserPreferencesGetTypeID                     (void)                                                  AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+CFStringRef
+SCUserPreferencesGetUniqueID                   (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCUserPreferencesIsForced                      (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCUserPreferencesSetName                       (SCUserPreferencesRef           userPreferences,
+                                                CFStringRef                    newName)                AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCNetworkConnectionSelectService               (CFDictionaryRef                selectionOptions,
+                                                SCNetworkServiceRef            *service,
+                                                SCUserPreferencesRef           *userPreferences)       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCNetworkConnectionStartWithUserPreferences    (SCNetworkConnectionRef         connection,
+                                                SCUserPreferencesRef           userPreferences,
+                                                Boolean                        linger)                 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+CFDictionaryRef
+SCUserPreferencesCopyInterfaceConfiguration    (SCUserPreferencesRef           userPreferences,
+                                                SCNetworkInterfaceRef          interface)              AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCUserPreferencesSetInterfaceConfiguration     (SCUserPreferencesRef           userPreferences,
+                                                SCNetworkInterfaceRef          interface,
+                                                CFDictionaryRef                newOptions)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+CFDictionaryRef
+SCUserPreferencesCopyExtendedInterfaceConfiguration
+                                               (SCUserPreferencesRef           userPreferences,
+                                                SCNetworkInterfaceRef          interface,
+                                                CFStringRef                    extendedType)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCUserPreferencesSetExtendedInterfaceConfiguration
+                                               (SCUserPreferencesRef           userPreferences,
+                                                SCNetworkInterfaceRef          interface,
+                                                CFStringRef                    extendedType,
+                                                CFDictionaryRef                newOptions)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+
+#pragma mark -
+#pragma mark SCUserPreferences + SCNetworkInterface Password SPIs
+
+
+Boolean
+SCUserPreferencesCheckInterfacePassword                (SCUserPreferencesRef           userPreferences,
+                                                SCNetworkInterfaceRef          interface,
+                                                SCNetworkInterfacePasswordType passwordType)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+CFDataRef
+SCUserPreferencesCopyInterfacePassword         (SCUserPreferencesRef           userPreferences,
+                                                SCNetworkInterfaceRef          interface,
+                                                SCNetworkInterfacePasswordType passwordType)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCUserPreferencesRemoveInterfacePassword       (SCUserPreferencesRef           userPreferences,
+                                                SCNetworkInterfaceRef          interface,
+                                                SCNetworkInterfacePasswordType passwordType)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+Boolean
+SCUserPreferencesSetInterfacePassword          (SCUserPreferencesRef           userPreferences,
+                                                SCNetworkInterfaceRef          interface,
+                                                SCNetworkInterfacePasswordType passwordType,
+                                                CFDataRef                      password,
+                                                CFDictionaryRef                options)                AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+__END_DECLS
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
+#endif /* _SCNETWORKCONNECTIONPRIVATE_H */
index 9943ed13220554f81db689ffa65ea1b820cf6b5b..d695a6a889ec4bca9cdf4fc88c7a300eb32efdda 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -28,7 +28,7 @@
  * - initial revision
  *     which includes code originally authored by
  *       Robert Ulrich         <rulrich@apple.com>
  * - initial revision
  *     which includes code originally authored by
  *       Robert Ulrich         <rulrich@apple.com>
- *       Elizaabeth Douglas    <elizabeth@apple.com>
+ *       Elizabeth Douglas     <elizabeth@apple.com>
  *       Quinn                 <eskimo1@apple.com>
  */
 
  *       Quinn                 <eskimo1@apple.com>
  */
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCNetworkConfigurationInternal.h>
+#include "SCNetworkConfigurationInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <SystemConfiguration/BondConfiguration.h>
 #include <SystemConfiguration/VLANConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <SystemConfiguration/BondConfiguration.h>
 #include <SystemConfiguration/VLANConfiguration.h>
+#include "SCPreferencesInternal.h"
+#include "SCHelper_client.h"
+
+#include <EAP8021X/EAPClientProperties.h>
 
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOCFBundle.h>
 
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOCFBundle.h>
 #define        kIODeviceSupportsHoldKey        "V92Modem"
 #endif
 
 #define        kIODeviceSupportsHoldKey        "V92Modem"
 #endif
 
-#include "SCNetworkConfiguration.h"
-#include "SCNetworkConfigurationInternal.h"
-
 #include <string.h>
 #include <mach/mach.h>
 #include <net/if.h>
 #include <net/if_types.h>
 #include <string.h>
 #include <mach/mach.h>
 #include <net/if.h>
 #include <net/if_types.h>
+#include <net/route.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/types.h>
+#include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
+#include <sys/sysctl.h>
 #include <pthread.h>
 #include <NSSystemDirectories.h>
 
 
 #include <pthread.h>
 #include <NSSystemDirectories.h>
 
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
+#error MAC_OS_X_VERSION_MIN_REQUIRED < 1040, Check MACOSX_DEPLOYMENT_TARGET
+#endif
+
+
+static CFStringRef     copy_interface_string                   (CFBundleRef bundle, CFStringRef key, Boolean localized);
 static CFStringRef     __SCNetworkInterfaceCopyDescription     (CFTypeRef cf);
 static void            __SCNetworkInterfaceDeallocate          (CFTypeRef cf);
 static Boolean         __SCNetworkInterfaceEqual               (CFTypeRef cf1, CFTypeRef cf2);
 static CFStringRef     __SCNetworkInterfaceCopyDescription     (CFTypeRef cf);
 static void            __SCNetworkInterfaceDeallocate          (CFTypeRef cf);
 static Boolean         __SCNetworkInterfaceEqual               (CFTypeRef cf1, CFTypeRef cf2);
+static CFHashCode      __SCNetworkInterfaceHash                (CFTypeRef cf);
 
 
 enum {
 
 
 enum {
@@ -82,10 +93,12 @@ enum {
        kSortBluetooth,
        kSortIrDA,
        kSortSerialPort,
        kSortBluetooth,
        kSortIrDA,
        kSortSerialPort,
+       kSortWWAN,
        kSortEthernet,
        kSortFireWire,
        kSortAirPort,
        kSortOtherWireless,
        kSortEthernet,
        kSortFireWire,
        kSortAirPort,
        kSortOtherWireless,
+       kSortBluetoothPAN,
        kSortBond,
        kSortVLAN,
        kSortUnknown
        kSortBond,
        kSortVLAN,
        kSortUnknown
@@ -105,18 +118,21 @@ const CFStringRef kSCNetworkInterfaceTypePPP              = CFSTR("PPP");
 const CFStringRef kSCNetworkInterfaceTypePPTP          = CFSTR("PPTP");
 const CFStringRef kSCNetworkInterfaceTypeSerial                = CFSTR("Serial");
 const CFStringRef kSCNetworkInterfaceTypeVLAN          = CFSTR("VLAN");
 const CFStringRef kSCNetworkInterfaceTypePPTP          = CFSTR("PPTP");
 const CFStringRef kSCNetworkInterfaceTypeSerial                = CFSTR("Serial");
 const CFStringRef kSCNetworkInterfaceTypeVLAN          = CFSTR("VLAN");
+const CFStringRef kSCNetworkInterfaceTypeWWAN          = CFSTR("WWAN");
 
 const CFStringRef kSCNetworkInterfaceTypeIPv4          = CFSTR("IPv4");
 
 static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4      = {
        INIT_CFRUNTIME_BASE(NULL, 0, 0x0080),   // cfBase
        NULL,                                   // interface type
 
 const CFStringRef kSCNetworkInterfaceTypeIPv4          = CFSTR("IPv4");
 
 static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4      = {
        INIT_CFRUNTIME_BASE(NULL, 0, 0x0080),   // cfBase
        NULL,                                   // interface type
+       NULL,                                   // name
        NULL,                                   // localized name
        NULL,                                   // localization key
        NULL,                                   // localization arg1
        NULL,                                   // localization arg2
        NULL,                                   // [layered] interface
        NULL,                                   // localized name
        NULL,                                   // localization key
        NULL,                                   // localization arg1
        NULL,                                   // localization arg2
        NULL,                                   // [layered] interface
-       NULL,                                   // service
+       NULL,                                   // prefs
+       NULL,                                   // serviceID
        NULL,                                   // unsaved
        NULL,                                   // entity_device
        NULL,                                   // entity_type
        NULL,                                   // unsaved
        NULL,                                   // entity_device
        NULL,                                   // entity_type
@@ -124,18 +140,26 @@ static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4      = {
        NULL,                                   // supported_interface_types
        NULL,                                   // supported_protocol_types
        NULL,                                   // address
        NULL,                                   // supported_interface_types
        NULL,                                   // supported_protocol_types
        NULL,                                   // address
+       NULL,                                   // addressString
        FALSE,                                  // builtin
        NULL,                                   // location
        NULL,                                   // path
        FALSE,                                  // builtin
        NULL,                                   // location
        NULL,                                   // path
-       NULL,                                   // modemCCL
+       NULL,                                   // overrides
        FALSE,                                  // modemIsV92
        FALSE,                                  // supportsBond
        FALSE,                                  // supportsVLAN
        FALSE,                                  // modemIsV92
        FALSE,                                  // supportsBond
        FALSE,                                  // supportsVLAN
-       kSortUnknown                            // sort_order
+       NULL,                                   // type
+       NULL,                                   // unit
+       kSortUnknown,                           // sort_order
+       { NULL, NULL},                          // bond { interfaces, options }
+       { NULL, NULL, NULL }                    // vlan { interface, tag, options }
 };
 
 const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4     = (SCNetworkInterfaceRef)&__kSCNetworkInterfaceIPv4;
 
 };
 
 const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4     = (SCNetworkInterfaceRef)&__kSCNetworkInterfaceIPv4;
 
+#pragma mark -
+#pragma mark SCNetworkInterface configuration details
+
 #define doNone         0
 
 #define do6to4         1<<0
 #define doNone         0
 
 #define do6to4         1<<0
@@ -148,6 +172,7 @@ const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4     = (SCNetworkInterfaceRef
 #define doIPv4         1<<2
 #define doIPv6         1<<3
 #define doProxies       1<<4
 #define doIPv4         1<<2
 #define doIPv6         1<<3
 #define doProxies       1<<4
+#define doSMB          1<<5
 
 static const struct {
        const CFStringRef       *interface_type;
 
 static const struct {
        const CFStringRef       *interface_type;
@@ -161,23 +186,23 @@ static const struct {
        // =====================================  =================  ========== ======================= ======================================= =========================================
        { &kSCNetworkInterfaceType6to4          , &kSCEntNet6to4    , FALSE,    doNone,                 NULL,                                   doIPv6                                          },
        { &kSCNetworkInterfaceTypeBluetooth     , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
        // =====================================  =================  ========== ======================= ======================================= =========================================
        { &kSCNetworkInterfaceType6to4          , &kSCEntNet6to4    , FALSE,    doNone,                 NULL,                                   doIPv6                                          },
        { &kSCNetworkInterfaceTypeBluetooth     , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
-       { &kSCNetworkInterfaceTypeBond          , &kSCEntNetEthernet, TRUE ,    doNone,                 NULL,                                   doAppleTalk|doDNS|doIPv4|doIPv6|doProxies       },
-       { &kSCNetworkInterfaceTypeEthernet      , &kSCEntNetEthernet, TRUE ,    doPPP,                  &kSCValNetInterfaceSubTypePPPoE,        doAppleTalk|doDNS|doIPv4|doIPv6|doProxies       },
-       { &kSCNetworkInterfaceTypeFireWire      , &kSCEntNetFireWire, TRUE ,    doNone,                 NULL,                                   doDNS|doIPv4|doIPv6|doProxies                   },
-       { &kSCNetworkInterfaceTypeIEEE80211     , &kSCEntNetAirPort , TRUE ,    doPPP,                  &kSCValNetInterfaceSubTypePPPoE,        doAppleTalk|doDNS|doIPv4|doIPv6|doProxies       },
+       { &kSCNetworkInterfaceTypeBond          , &kSCEntNetEthernet, TRUE ,    doNone,                 NULL,                                   doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
+       { &kSCNetworkInterfaceTypeEthernet      , &kSCEntNetEthernet, TRUE ,    doPPP,                  &kSCValNetInterfaceSubTypePPPoE,        doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
+       { &kSCNetworkInterfaceTypeFireWire      , &kSCEntNetFireWire, TRUE ,    doNone,                 NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB             },
+       { &kSCNetworkInterfaceTypeIEEE80211     , &kSCEntNetAirPort , TRUE ,    doPPP,                  &kSCValNetInterfaceSubTypePPPoE,        doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
        { &kSCNetworkInterfaceTypeIrDA          , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
        { &kSCNetworkInterfaceTypeL2TP          , NULL              , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypeL2TP,         doNone                                          },
        { &kSCNetworkInterfaceTypeModem         , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
        { &kSCNetworkInterfaceTypeIrDA          , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
        { &kSCNetworkInterfaceTypeL2TP          , NULL              , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypeL2TP,         doNone                                          },
        { &kSCNetworkInterfaceTypeModem         , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
-       { &kSCNetworkInterfaceTypePPP           , &kSCEntNetPPP     , FALSE,    doNone,                 NULL,                                   doDNS|doIPv4|doIPv6|doProxies                   },
+       { &kSCNetworkInterfaceTypePPP           , &kSCEntNetPPP     , FALSE,    doNone,                 NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB             },
        { &kSCNetworkInterfaceTypePPTP          , NULL              , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPTP,         doNone                                          },
        { &kSCNetworkInterfaceTypeSerial        , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
        { &kSCNetworkInterfaceTypePPTP          , NULL              , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPTP,         doNone                                          },
        { &kSCNetworkInterfaceTypeSerial        , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
-       { &kSCNetworkInterfaceTypeVLAN          , &kSCEntNetEthernet, TRUE ,    doNone,                 NULL,                                   doAppleTalk|doDNS|doIPv4|doIPv6|doProxies       },
+       { &kSCNetworkInterfaceTypeVLAN          , &kSCEntNetEthernet, TRUE ,    doNone,                 NULL,                                   doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
+       { &kSCNetworkInterfaceTypeWWAN          , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
        // =====================================  =================  ========== ======================= ======================================= =========================================
        { &kSCNetworkInterfaceTypeIPv4          , NULL              , FALSE,    do6to4|doL2TP|doPPTP,   NULL,                                   doNone                                          }
 };
 
 
        // =====================================  =================  ========== ======================= ======================================= =========================================
        { &kSCNetworkInterfaceTypeIPv4          , NULL              , FALSE,    do6to4|doL2TP|doPPTP,   NULL,                                   doNone                                          }
 };
 
 
-#define        SYSTEMCONFIGURATION_BUNDLE_ID   CFSTR("com.apple.SystemConfiguration")
 #define        NETWORKINTERFACE_LOCALIZATIONS  CFSTR("NetworkInterface")
 static CFBundleRef bundle                      = NULL;
 
 #define        NETWORKINTERFACE_LOCALIZATIONS  CFSTR("NetworkInterface")
 static CFBundleRef bundle                      = NULL;
 
@@ -192,20 +217,17 @@ static const CFRuntimeClass __SCNetworkInterfaceClass = {
        NULL,                                   // copy
        __SCNetworkInterfaceDeallocate,         // dealloc
        __SCNetworkInterfaceEqual,              // equal
        NULL,                                   // copy
        __SCNetworkInterfaceDeallocate,         // dealloc
        __SCNetworkInterfaceEqual,              // equal
-       NULL,                                   // hash
+       __SCNetworkInterfaceHash,               // hash
        NULL,                                   // copyFormattingDesc
        __SCNetworkInterfaceCopyDescription     // copyDebugDesc
 };
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
        NULL,                                   // copyFormattingDesc
        __SCNetworkInterfaceCopyDescription     // copyDebugDesc
 };
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
+static pthread_once_t          iokit_quiet     = PTHREAD_ONCE_INIT;
 
 
 
 
-static __inline__ CFTypeRef
-isA_SCNetworkInterface(CFTypeRef obj)
-{
-       return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
-}
+static mach_port_t             masterPort      = MACH_PORT_NULL;
 
 
 static CFStringRef
 
 
 static CFStringRef
@@ -223,11 +245,14 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
        if (interfacePrivate->entity_subtype != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(" / %@"), interfacePrivate->entity_subtype);
        }
        if (interfacePrivate->entity_subtype != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(" / %@"), interfacePrivate->entity_subtype);
        }
+       if (interfacePrivate->name != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", name = %@"), interfacePrivate->name);
+       }
        if (interfacePrivate->localized_name != NULL) {
        if (interfacePrivate->localized_name != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", name = %@"), interfacePrivate->localized_name);
+               CFStringAppendFormat(result, NULL, CFSTR(", name(l) = %@"), interfacePrivate->localized_name);
        } else {
                if (interfacePrivate->localized_key != NULL) {
        } else {
                if (interfacePrivate->localized_key != NULL) {
-                       CFStringAppendFormat(result, NULL, CFSTR(", name = \"%@\""), interfacePrivate->localized_key);
+                       CFStringAppendFormat(result, NULL, CFSTR(", name(k) = \"%@\""), interfacePrivate->localized_key);
                        if (interfacePrivate->localized_arg1 != NULL) {
                                CFStringAppendFormat(result, NULL, CFSTR("+\"%@\""), interfacePrivate->localized_arg1);
                        }
                        if (interfacePrivate->localized_arg1 != NULL) {
                                CFStringAppendFormat(result, NULL, CFSTR("+\"%@\""), interfacePrivate->localized_arg1);
                        }
@@ -237,27 +262,84 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
                }
        }
        if (interfacePrivate->address != NULL) {
                }
        }
        if (interfacePrivate->address != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", address = %@"), interfacePrivate->address);
+               const uint8_t           *data;
+               CFIndex                 dataLen;
+               CFIndex                 i;
+
+               CFStringAppendFormat(result, NULL, CFSTR(", address = 0x"));
+
+               data    = CFDataGetBytePtr(interfacePrivate->address);
+               dataLen = CFDataGetLength(interfacePrivate->address);
+               for (i = 0; i < dataLen; i++) {
+                       CFStringAppendFormat(result, NULL, CFSTR("%02x"), data[i]);
+               }
        }
        CFStringAppendFormat(result, NULL, CFSTR(", builtin = %s"), interfacePrivate->builtin ? "TRUE" : "FALSE");
        }
        CFStringAppendFormat(result, NULL, CFSTR(", builtin = %s"), interfacePrivate->builtin ? "TRUE" : "FALSE");
+       if (interfacePrivate->modemIsV92) {
+               CFStringAppendFormat(result, NULL, CFSTR(", v.92"));
+       }
        if (interfacePrivate->location != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", location = %@"), interfacePrivate->location);
        }
        if (interfacePrivate->location != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", location = %@"), interfacePrivate->location);
        }
+       if (interfacePrivate->type != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", type = %@"), interfacePrivate->type);
+       }
+       if (interfacePrivate->unit != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", unit = %@"), interfacePrivate->unit);
+       }
        if (interfacePrivate->path != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", path = %@"), interfacePrivate->path);
        }
        if (interfacePrivate->path != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", path = %@"), interfacePrivate->path);
        }
-       if (interfacePrivate->modemCCL != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", modemCCL = %@"), interfacePrivate->modemCCL);
+       if (interfacePrivate->overrides != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", overrides = %p"), interfacePrivate->overrides);
        }
        CFStringAppendFormat(result, NULL, CFSTR(", order = %d"), interfacePrivate->sort_order);
        }
        CFStringAppendFormat(result, NULL, CFSTR(", order = %d"), interfacePrivate->sort_order);
-       if (interfacePrivate->service != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", service=%@"), interfacePrivate->service);
+       if (interfacePrivate->prefs != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), interfacePrivate->prefs);
+       }
+       if (interfacePrivate->serviceID != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", service = %@"), interfacePrivate->serviceID);
        }
        if (interfacePrivate->interface != NULL) {
        }
        if (interfacePrivate->interface != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", interface=%@"), interfacePrivate->interface);
+               CFStringAppendFormat(result, NULL, CFSTR(", interface = %@"), interfacePrivate->interface);
        }
        if (interfacePrivate->unsaved != NULL) {
        }
        if (interfacePrivate->unsaved != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", unsaved=%@"), interfacePrivate->unsaved);
+               CFStringAppendFormat(result, NULL, CFSTR(", unsaved = %@"), interfacePrivate->unsaved);
+       }
+       if (interfacePrivate->bond.interfaces != NULL) {
+               CFIndex i;
+               CFIndex n;
+
+               n = CFArrayGetCount(interfacePrivate->bond.interfaces);
+               for (i = 0; i < n; i++) {
+                       SCNetworkInterfaceRef   member;
+
+                       member = CFArrayGetValueAtIndex(interfacePrivate->bond.interfaces, i);
+                       CFStringAppendFormat(result, NULL,
+                                            CFSTR("%s%@"),
+                                            (i == 0) ? ", interfaces = " : ", ",
+                                            SCNetworkInterfaceGetBSDName(member));
+               }
+       }
+       if (interfacePrivate->bond.mode != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", mode = %@"), interfacePrivate->bond.mode);
+       }
+       if (interfacePrivate->bond.options != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), interfacePrivate->bond.options);
+       }
+       if (interfacePrivate->bond.mode != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", mode = %@"), interfacePrivate->bond.mode);
+       }
+       if (interfacePrivate->vlan.interface != NULL) {
+               CFStringAppendFormat(result, NULL,
+                                    CFSTR(", interface = %@"),
+                                    SCNetworkInterfaceGetBSDName(interfacePrivate->vlan.interface));
+       }
+       if (interfacePrivate->vlan.tag != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", tag = %@"), interfacePrivate->vlan.tag);
+       }
+       if (interfacePrivate->vlan.options != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), interfacePrivate->vlan.options);
        }
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        }
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
@@ -275,6 +357,9 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->interface != NULL)
                CFRelease(interfacePrivate->interface);
 
        if (interfacePrivate->interface != NULL)
                CFRelease(interfacePrivate->interface);
 
+       if (interfacePrivate->name != NULL)
+               CFRelease(interfacePrivate->name);
+
        if (interfacePrivate->localized_name != NULL)
                CFRelease(interfacePrivate->localized_name);
 
        if (interfacePrivate->localized_name != NULL)
                CFRelease(interfacePrivate->localized_name);
 
@@ -284,6 +369,12 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->localized_arg2 != NULL)
                CFRelease(interfacePrivate->localized_arg2);
 
        if (interfacePrivate->localized_arg2 != NULL)
                CFRelease(interfacePrivate->localized_arg2);
 
+       if (interfacePrivate->prefs != NULL)
+               CFRelease(interfacePrivate->prefs);
+
+       if (interfacePrivate->serviceID != NULL)
+               CFRelease(interfacePrivate->serviceID);
+
        if (interfacePrivate->unsaved != NULL)
                CFRelease(interfacePrivate->unsaved);
 
        if (interfacePrivate->unsaved != NULL)
                CFRelease(interfacePrivate->unsaved);
 
@@ -299,14 +390,41 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->address != NULL)
                CFRelease(interfacePrivate->address);
 
        if (interfacePrivate->address != NULL)
                CFRelease(interfacePrivate->address);
 
+       if (interfacePrivate->addressString != NULL)
+               CFRelease(interfacePrivate->addressString);
+
        if (interfacePrivate->location != NULL)
                CFRelease(interfacePrivate->location);
 
        if (interfacePrivate->path != NULL)
                CFRelease(interfacePrivate->path);
 
        if (interfacePrivate->location != NULL)
                CFRelease(interfacePrivate->location);
 
        if (interfacePrivate->path != NULL)
                CFRelease(interfacePrivate->path);
 
-       if (interfacePrivate->modemCCL != NULL)
-               CFRelease(interfacePrivate->modemCCL);
+       if (interfacePrivate->overrides != NULL)
+               CFRelease(interfacePrivate->overrides);
+
+       if (interfacePrivate->type != NULL)
+               CFRelease(interfacePrivate->type);
+
+       if (interfacePrivate->unit != NULL)
+               CFRelease(interfacePrivate->unit);
+
+       if (interfacePrivate->bond.interfaces != NULL)
+               CFRelease(interfacePrivate->bond.interfaces);
+
+       if (interfacePrivate->bond.mode != NULL)
+               CFRelease(interfacePrivate->bond.mode);
+
+       if (interfacePrivate->bond.options != NULL)
+               CFRelease(interfacePrivate->bond.options);
+
+       if (interfacePrivate->vlan.interface != NULL)
+               CFRelease(interfacePrivate->vlan.interface);
+
+       if (interfacePrivate->vlan.tag != NULL)
+               CFRelease(interfacePrivate->vlan.tag);
+
+       if (interfacePrivate->vlan.options != NULL)
+               CFRelease(interfacePrivate->vlan.options);
 
        return;
 }
 
        return;
 }
@@ -325,23 +443,54 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
                return FALSE;   // if not the same interface type
        }
 
                return FALSE;   // if not the same interface type
        }
 
-       if (if1->entity_device != if2->entity_device) {
-               if ((if1->entity_device != NULL) && (if2->entity_device != NULL)) {
-                       if (!CFEqual(if1->entity_device, if2->entity_device)) {
-                               return FALSE;   // if not the same device
-                       }
-               } else {
-                       return FALSE;   // if only one interface has a device
+       if (!_SC_CFEqual(if1->entity_device, if2->entity_device)) {
+               return FALSE; // if not the same device
+       }
+
+       if (CFEqual(if1->interface_type, kSCNetworkInterfaceTypeBond)) {
+               if (!_SC_CFEqual(if1->bond.interfaces, if2->bond.interfaces)) {
+                       return FALSE; // if not the same interfaces
+               }
+               if (!_SC_CFEqual(if1->bond.mode, if2->bond.mode)) {
+                       return FALSE; // if not the same mode
+               }
+       }
+
+       if (CFEqual(if1->interface_type, kSCNetworkInterfaceTypeVLAN)) {
+               if (!_SC_CFEqual(if1->vlan.interface, if2->vlan.interface)) {
+                       return FALSE;   // if not the same physical interface
                }
                }
+               if (!_SC_CFEqual(if1->vlan.tag, if2->vlan.tag)) {
+                       return FALSE;   // if not the same tag
+               }
+       }
+
+       if (!CFEqual(if1->interface, if2->interface)) {
+               return FALSE;   // if not the same layering
        }
 
        return TRUE;
 }
 
 
        }
 
        return TRUE;
 }
 
 
+static CFHashCode
+__SCNetworkInterfaceHash(CFTypeRef cf)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)cf;
+
+       if (interfacePrivate->entity_device != NULL) {
+               return CFHash(interfacePrivate->entity_device);
+       }
+
+       return 0;
+}
+
+
 static void
 __SCNetworkInterfaceInitialize(void)
 {
 static void
 __SCNetworkInterfaceInitialize(void)
 {
+       kern_return_t   kr;
+
        // register w/CF
        __kSCNetworkInterfaceTypeID = _CFRuntimeRegisterClass(&__SCNetworkInterfaceClass);
 
        // register w/CF
        __kSCNetworkInterfaceTypeID = _CFRuntimeRegisterClass(&__SCNetworkInterfaceClass);
 
@@ -351,27 +500,26 @@ __SCNetworkInterfaceInitialize(void)
        __kSCNetworkInterfaceIPv4.localized_key  = CFSTR("ipv4");
 
        // get CFBundleRef for SystemConfiguration.framework
        __kSCNetworkInterfaceIPv4.localized_key  = CFSTR("ipv4");
 
        // get CFBundleRef for SystemConfiguration.framework
-       bundle = CFBundleGetBundleWithIdentifier(SYSTEMCONFIGURATION_BUNDLE_ID);
-       if (bundle == NULL) {
-               // try a bit harder
-               CFURLRef        url;
-
-               url = CFURLCreateWithFileSystemPath(NULL,
-                                                   CFSTR("/System/Library/Frameworks/SystemConfiguration.framework"),
-                                                   kCFURLPOSIXPathStyle,
-                                                   TRUE);
-               bundle = CFBundleCreate(NULL, url);
-               CFRelease(url);
+       bundle = _SC_CFBundleGet();
+
+       // get mach port used to communication with IOKit
+       kr = IOMasterPort(MACH_PORT_NULL, &masterPort);
+       if (kr != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_DEBUG,
+                     CFSTR("__SCNetworkInterfaceInitialize(), could not get IOMasterPort, kr = 0x%x"),
+                     kr);
        }
 
        return;
 }
 
 
        }
 
        return;
 }
 
 
-__private_extern__ SCNetworkInterfacePrivateRef
+__private_extern__
+SCNetworkInterfacePrivateRef
 __SCNetworkInterfaceCreatePrivate(CFAllocatorRef       allocator,
                                  SCNetworkInterfaceRef interface,
 __SCNetworkInterfaceCreatePrivate(CFAllocatorRef       allocator,
                                  SCNetworkInterfaceRef interface,
-                                 SCNetworkServiceRef   service,
+                                 SCPreferencesRef      prefs,
+                                 CFStringRef           serviceID,
                                  io_string_t           path)
 {
        SCNetworkInterfacePrivateRef            interfacePrivate;
                                  io_string_t           path)
 {
        SCNetworkInterfacePrivateRef            interfacePrivate;
@@ -391,12 +539,14 @@ __SCNetworkInterfaceCreatePrivate(CFAllocatorRef  allocator,
        }
 
        interfacePrivate->interface_type                = NULL;
        }
 
        interfacePrivate->interface_type                = NULL;
+       interfacePrivate->name                          = NULL;
        interfacePrivate->localized_name                = NULL;
        interfacePrivate->localized_key                 = NULL;
        interfacePrivate->localized_arg1                = NULL;
        interfacePrivate->localized_arg2                = NULL;
        interfacePrivate->interface                     = (interface != NULL) ? CFRetain(interface) : NULL;
        interfacePrivate->localized_name                = NULL;
        interfacePrivate->localized_key                 = NULL;
        interfacePrivate->localized_arg1                = NULL;
        interfacePrivate->localized_arg2                = NULL;
        interfacePrivate->interface                     = (interface != NULL) ? CFRetain(interface) : NULL;
-       interfacePrivate->service                       = service;
+       interfacePrivate->prefs                         = (prefs     != NULL) ? CFRetain(prefs)     : NULL;
+       interfacePrivate->serviceID                     = (serviceID != NULL) ? CFRetain(serviceID) : NULL;
        interfacePrivate->unsaved                       = NULL;
        interfacePrivate->entity_device                 = NULL;
        interfacePrivate->entity_type                   = NULL;
        interfacePrivate->unsaved                       = NULL;
        interfacePrivate->entity_device                 = NULL;
        interfacePrivate->entity_type                   = NULL;
@@ -404,21 +554,154 @@ __SCNetworkInterfaceCreatePrivate(CFAllocatorRef allocator,
        interfacePrivate->supported_interface_types     = NULL;
        interfacePrivate->supported_protocol_types      = NULL;
        interfacePrivate->address                       = NULL;
        interfacePrivate->supported_interface_types     = NULL;
        interfacePrivate->supported_protocol_types      = NULL;
        interfacePrivate->address                       = NULL;
+       interfacePrivate->addressString                 = NULL;
        interfacePrivate->builtin                       = FALSE;
        interfacePrivate->path                          = (path != NULL) ? CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8)
                                                                         : NULL;
        interfacePrivate->location                      = NULL;
        interfacePrivate->builtin                       = FALSE;
        interfacePrivate->path                          = (path != NULL) ? CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8)
                                                                         : NULL;
        interfacePrivate->location                      = NULL;
-       interfacePrivate->modemCCL                      = NULL;
+       interfacePrivate->overrides                     = NULL;
        interfacePrivate->modemIsV92                    = FALSE;
        interfacePrivate->supportsBond                  = FALSE;
        interfacePrivate->supportsVLAN                  = FALSE;
        interfacePrivate->modemIsV92                    = FALSE;
        interfacePrivate->supportsBond                  = FALSE;
        interfacePrivate->supportsVLAN                  = FALSE;
+       interfacePrivate->type                          = NULL;
+       interfacePrivate->unit                          = NULL;
        interfacePrivate->sort_order                    = kSortUnknown;
        interfacePrivate->sort_order                    = kSortUnknown;
+       interfacePrivate->bond.interfaces               = NULL;
+       interfacePrivate->bond.mode                     = NULL;
+       interfacePrivate->bond.options                  = NULL;
+       interfacePrivate->vlan.interface                = NULL;
+       interfacePrivate->vlan.tag                      = NULL;
+       interfacePrivate->vlan.options                  = NULL;
+
+       return interfacePrivate;
+}
+
+
+__private_extern__
+Boolean
+__SCNetworkInterfaceSupportsVLAN(CFStringRef bsd_if)
+{
+       char *                  buf     = NULL;
+       size_t                  buf_len = 0;
+       struct if_msghdr *      ifm;
+       char *                  if_name = NULL;
+       unsigned int            if_index;
+       int                     mib[6];
+       Boolean                 vlanOK  = FALSE;
+
+       // get the interface index
+       if_name = _SC_cfstring_to_cstring(bsd_if, NULL, 0, kCFStringEncodingASCII);
+       if (if_name == NULL) {
+               return FALSE;   // if conversion error
+       }
+       if_index = if_nametoindex(if_name);
+       if (if_index == 0) {
+               goto done;      // if unknown interface
+       }
+
+       // get information for the specified interface
+       mib[0] = CTL_NET;
+       mib[1] = PF_ROUTE;
+       mib[2] = 0;
+       mib[3] = AF_LINK;
+       mib[4] = NET_RT_IFLIST;
+       mib[5] = if_index;      /* ask for exactly one interface */
+
+       if (sysctl(mib, 6, NULL, &buf_len, NULL, 0) == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("sysctl() size failed: %s"), strerror(errno));
+               goto done;
+       }
+       buf = CFAllocatorAllocate(NULL, buf_len, 0);
+       if (sysctl(mib, 6, buf, &buf_len, NULL, 0) == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("sysctl() failed: %s"), strerror(errno));
+               goto done;
+       }
+
+       // check the link type and hwassist flags
+       ifm = (struct if_msghdr *)buf;
+       switch (ifm->ifm_type) {
+               case RTM_IFINFO : {
+#if    defined(IF_HWASSIST_VLAN_TAGGING) && defined(IF_HWASSIST_VLAN_MTU)
+                       struct if_data  *if_data = &ifm->ifm_data;
+
+                       if (if_data->ifi_hwassist & (IF_HWASSIST_VLAN_TAGGING | IF_HWASSIST_VLAN_MTU)) {
+                               vlanOK = TRUE;
+                       }
+#endif
+                       break;
+               }
+       }
+
+    done :
+
+       if (if_name != NULL)    CFAllocatorDeallocate(NULL, if_name);
+       if (buf != NULL)        CFAllocatorDeallocate(NULL, buf);
+
+       return vlanOK;
+}
+
+
+__private_extern__
+SCNetworkInterfacePrivateRef
+_SCBondInterfaceCreatePrivate(CFAllocatorRef   allocator,
+                             CFStringRef       bond_if)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+
+       interfacePrivate = __SCNetworkInterfaceCreatePrivate(allocator, NULL, NULL, NULL, NULL);
+       if (interfacePrivate == NULL) {
+               return NULL;
+       }
+
+       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBond;
+       interfacePrivate->entity_type           = kSCEntNetEthernet;
+       interfacePrivate->entity_device         = CFStringCreateCopy(allocator, bond_if);
+       interfacePrivate->builtin               = TRUE;
+       interfacePrivate->supportsVLAN          = __SCNetworkInterfaceSupportsVLAN(bond_if);
+       interfacePrivate->sort_order            = kSortBond;
+
+       interfacePrivate->localized_key         = CFSTR("bond");
+       interfacePrivate->localized_arg1        = CFRetain(interfacePrivate->entity_device);
+
+       interfacePrivate->bond.interfaces       = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
+//     interfacePrivate->bond.mode             = NULL;
+//     interfacePrivate->bond.options          = NULL;
+
+       return interfacePrivate;
+}
+
+
+__private_extern__
+SCNetworkInterfacePrivateRef
+_SCVLANInterfaceCreatePrivate(CFAllocatorRef           allocator,
+                             CFStringRef               vlan_if)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+
+       interfacePrivate = __SCNetworkInterfaceCreatePrivate(allocator, NULL, NULL, NULL, NULL);
+       if (interfacePrivate == NULL) {
+               return NULL;
+       }
+
+       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeVLAN;
+       interfacePrivate->entity_type           = kSCEntNetEthernet;
+       interfacePrivate->entity_device         = CFStringCreateCopy(allocator, vlan_if);
+       interfacePrivate->builtin               = TRUE;
+       interfacePrivate->sort_order            = kSortVLAN;
+
+       interfacePrivate->localized_key         = CFSTR("vlan");
+       interfacePrivate->localized_arg1        = CFRetain(interfacePrivate->entity_device);
+
+//     interfacePrivate->vlan.interface        = NULL;
+//     interfacePrivate->vlan.tag              = NULL;
+//     interfacePrivate->vlan.options          = NULL;
 
        return interfacePrivate;
 }
 
 
 
        return interfacePrivate;
 }
 
 
-/* ---------- ordering ---------- */
+#pragma mark -
+#pragma mark Interface ordering
 
 
 static CFArrayRef
 
 
 static CFArrayRef
@@ -443,8 +726,8 @@ split_path(CFStringRef path)
 }
 
 
 }
 
 
-static CFComparisonResult
-compare_interfaces(const void *val1, const void *val2, void *context)
+CFComparisonResult
+_SCNetworkInterfaceCompare(const void *val1, const void *val2, void *context)
 {
        SCNetworkInterfacePrivateRef    dev1            = (SCNetworkInterfacePrivateRef)val1;
        SCNetworkInterfacePrivateRef    dev2            = (SCNetworkInterfacePrivateRef)val2;
 {
        SCNetworkInterfacePrivateRef    dev1            = (SCNetworkInterfacePrivateRef)val1;
        SCNetworkInterfacePrivateRef    dev2            = (SCNetworkInterfacePrivateRef)val2;
@@ -586,12 +869,23 @@ sort_interfaces(CFMutableArrayRef all_interfaces)
                return;
        }
 
                return;
        }
 
-       CFArraySortValues(all_interfaces, CFRangeMake(0, n), compare_interfaces, NULL);
+       CFArraySortValues(all_interfaces, CFRangeMake(0, n), _SCNetworkInterfaceCompare, NULL);
        return;
 }
 
 
        return;
 }
 
 
-/* ---------- interface details ---------- */
+__private_extern__
+int
+__SCNetworkInterfaceOrder(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->sort_order;
+}
+
+
+#pragma mark -
+#pragma mark Interface details
 
 
 static CFStringRef
 
 
 static CFStringRef
@@ -653,39 +947,6 @@ IOStringValueHasPrefix(CFTypeRef ioVal, CFStringRef prefix)
 }
 
 
 }
 
 
-static CFStringRef
-copyMACAddress(CFDictionaryRef controller_dict)
-{
-       CFStringRef     address = NULL;
-       uint8_t         *bp;
-       char            *cp;
-       CFDataRef       data;
-       CFIndex         n;
-       char            mac[sizeof("xx:xx:xx:xx:xx:xx:xx:xx")];
-       char            *mac_p  = mac;
-
-       data = CFDictionaryGetValue(controller_dict, CFSTR(kIOMACAddress));
-       if (data == NULL) {
-               return NULL;
-       }
-
-       bp = (uint8_t *)CFDataGetBytePtr(data);
-       n  = CFDataGetLength(data) * 3;
-
-       if (n > sizeof(mac)) {
-               mac_p = CFAllocatorAllocate(NULL, 0, n);
-       }
-
-       for (cp = mac_p; n > 0; n -= 3) {
-               cp += snprintf(cp, n, "%2.2x:", *bp++);
-       }
-
-       address = CFStringCreateWithCString(NULL, mac_p, kCFStringEncodingUTF8);
-       if (mac_p != mac)       CFAllocatorDeallocate(NULL, mac_p);
-       return address;
-}
-
-
 static const struct {
        const CFStringRef       name;
        const CFStringRef       slot;
 static const struct {
        const CFStringRef       name;
        const CFStringRef       slot;
@@ -808,7 +1069,7 @@ compare_bsdNames(const void *val1, const void *val2, void *context)
 
 
 static CFStringRef
 
 
 static CFStringRef
-pci_port(mach_port_t masterPort, CFTypeRef slot_name, CFStringRef bsdName)
+pci_port(CFTypeRef slot_name, CFStringRef bsdName)
 {
        CFIndex                 n;
        CFStringRef             port_name       = NULL;
 {
        CFIndex                 n;
        CFStringRef             port_name       = NULL;
@@ -903,7 +1164,7 @@ pci_port(mach_port_t masterPort, CFTypeRef slot_name, CFStringRef bsdName)
 
 
 static Boolean
 
 
 static Boolean
-pci_slot_info(mach_port_t masterPort, io_registry_entry_t interface, CFStringRef *slot_name, CFStringRef *port_name)
+pci_slot_info(io_registry_entry_t interface, CFStringRef *slot_name, CFStringRef *port_name)
 {
        CFStringRef     bsd_name;
        Boolean         ok              = FALSE;
 {
        CFStringRef     bsd_name;
        Boolean         ok              = FALSE;
@@ -920,7 +1181,7 @@ pci_slot_info(mach_port_t masterPort, io_registry_entry_t interface, CFStringRef
        *slot_name = pci_slot(interface, &pci_slot_name);
        if (*slot_name != NULL) {
                if (pci_slot_name != NULL) {
        *slot_name = pci_slot(interface, &pci_slot_name);
        if (*slot_name != NULL) {
                if (pci_slot_name != NULL) {
-                       *port_name = pci_port(masterPort, pci_slot_name, bsd_name);
+                       *port_name = pci_port(pci_slot_name, bsd_name);
                        CFRelease(pci_slot_name);
                }
                ok = TRUE;
                        CFRelease(pci_slot_name);
                }
                ok = TRUE;
@@ -932,7 +1193,7 @@ pci_slot_info(mach_port_t masterPort, io_registry_entry_t interface, CFStringRef
 
 
 static Boolean
 
 
 static Boolean
-isBuiltIn(io_registry_entry_t interface)
+isBuiltin(io_registry_entry_t interface)
 {
        CFStringRef     slot;
 
 {
        CFStringRef     slot;
 
@@ -947,11 +1208,11 @@ isBuiltIn(io_registry_entry_t interface)
 }
 
 
 }
 
 
-/* ---------- interface enumeration ---------- */
+#pragma mark -
+#pragma mark Interface enumeration
 
 
 
 
-typedef Boolean (*processInterface)(mach_port_t                                masterPort,
-                                   SCNetworkInterfacePrivateRef        interfacePrivate,
+typedef Boolean (*processInterface)(SCNetworkInterfacePrivateRef       interfacePrivate,
                                    io_registry_entry_t                 interface,
                                    CFDictionaryRef                     interface_dict,
                                    io_registry_entry_t                 controller,
                                    io_registry_entry_t                 interface,
                                    CFDictionaryRef                     interface_dict,
                                    io_registry_entry_t                 controller,
@@ -961,8 +1222,7 @@ typedef Boolean (*processInterface)(mach_port_t                            masterPort,
 
 
 static Boolean
 
 
 static Boolean
-processNetworkInterface(mach_port_t                    masterPort,
-                       SCNetworkInterfacePrivateRef    interfacePrivate,
+processNetworkInterface(SCNetworkInterfacePrivateRef   interfacePrivate,
                        io_registry_entry_t             interface,
                        CFDictionaryRef                 interface_dict,
                        io_registry_entry_t             controller,
                        io_registry_entry_t             interface,
                        CFDictionaryRef                 interface_dict,
                        io_registry_entry_t             controller,
@@ -971,6 +1231,7 @@ processNetworkInterface(mach_port_t                        masterPort,
                        CFDictionaryRef                 bus_dict)
 {
        CFBooleanRef    bVal;
                        CFDictionaryRef                 bus_dict)
 {
        CFBooleanRef    bVal;
+       CFDataRef       data;
        int             ift     = -1;
        int             iVal;
        CFNumberRef     num;
        int             ift     = -1;
        int             iVal;
        CFNumberRef     num;
@@ -978,9 +1239,11 @@ processNetworkInterface(mach_port_t                       masterPort,
 
        // interface type
        num = CFDictionaryGetValue(interface_dict, CFSTR(kIOInterfaceType));
 
        // interface type
        num = CFDictionaryGetValue(interface_dict, CFSTR(kIOInterfaceType));
-       if (!isA_CFNumber(num) ||
-           !CFNumberGetValue(num, kCFNumberIntType, &ift)) {
-               SCPrint(TRUE, stderr, CFSTR("Could not get interface type\n"));
+       if (isA_CFNumber(num) &&
+           CFNumberGetValue(num, kCFNumberIntType, &ift)) {
+               interfacePrivate->type = CFRetain(num);
+       } else {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("processNetworkInterface() failed, no interface type"));
                return FALSE;
        }
 
                return FALSE;
        }
 
@@ -994,6 +1257,10 @@ processNetworkInterface(mach_port_t                       masterPort,
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeIEEE80211;
                                interfacePrivate->entity_type           = kSCEntNetEthernet;
                                interfacePrivate->sort_order            = kSortAirPort;
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeIEEE80211;
                                interfacePrivate->entity_type           = kSCEntNetEthernet;
                                interfacePrivate->sort_order            = kSortAirPort;
+                       } else if (IOObjectConformsTo(controller, "IOBluetoothBNEPDriver")) {
+                               interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
+                               interfacePrivate->entity_type           = kSCEntNetEthernet;
+                               interfacePrivate->sort_order            = kSortBluetoothPAN;
                        } else {
                                str = IODictionaryCopyCFStringValue(bus_dict, CFSTR("name"));
                                if ((str != NULL) && CFEqual(str, CFSTR("radio"))) {
                        } else {
                                str = IODictionaryCopyCFStringValue(bus_dict, CFSTR("name"));
                                if ((str != NULL) && CFEqual(str, CFSTR("radio"))) {
@@ -1014,13 +1281,13 @@ processNetworkInterface(mach_port_t                     masterPort,
 
                        // built-in
                        bVal = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOBuiltin)));
 
                        // built-in
                        bVal = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOBuiltin)));
-                       if ((bVal == NULL) || !CFBooleanGetValue(bVal)) {
+                       if (bVal == NULL) {
                                bVal = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOPrimaryInterface)));
                        }
                        if (bVal != NULL) {
                                interfacePrivate->builtin = CFBooleanGetValue(bVal);
                        } else {
                                bVal = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOPrimaryInterface)));
                        }
                        if (bVal != NULL) {
                                interfacePrivate->builtin = CFBooleanGetValue(bVal);
                        } else {
-                               interfacePrivate->builtin = isBuiltIn(interface);
+                               interfacePrivate->builtin = isBuiltin(interface);
                        }
 
                        // location
                        }
 
                        // location
@@ -1036,7 +1303,14 @@ processNetworkInterface(mach_port_t                      masterPort,
                        }
 
                        // localized name
                        }
 
                        // localized name
-                       if (interfacePrivate->builtin) {
+                       if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211)) {
+                               interfacePrivate->localized_key = CFSTR("airport");
+                       } else if (interfacePrivate->sort_order == kSortBluetoothPAN) {
+                               interfacePrivate->localized_key  = CFSTR("bluetooth-pan");
+                       } else if (interfacePrivate->sort_order == kSortOtherWireless) {
+                               interfacePrivate->localized_key  = CFSTR("wireless");
+                               interfacePrivate->localized_arg1 = CFRetain(CFSTR(""));         // ??
+                       } else if (interfacePrivate->builtin) {
                                if ((interfacePrivate->location == NULL) ||
                                    (CFStringGetLength(interfacePrivate->location) == 0)) {
                                        interfacePrivate->localized_key = CFSTR("ether");
                                if ((interfacePrivate->location == NULL) ||
                                    (CFStringGetLength(interfacePrivate->location) == 0)) {
                                        interfacePrivate->localized_key = CFSTR("ether");
@@ -1044,11 +1318,6 @@ processNetworkInterface(mach_port_t                      masterPort,
                                        interfacePrivate->localized_key  = CFSTR("multiether");
                                        interfacePrivate->localized_arg1 = CFRetain(interfacePrivate->location);
                                }
                                        interfacePrivate->localized_key  = CFSTR("multiether");
                                        interfacePrivate->localized_arg1 = CFRetain(interfacePrivate->location);
                                }
-                       } else if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211)) {
-                               interfacePrivate->localized_key = CFSTR("airport");
-                       } else  if (interfacePrivate->sort_order == kSortOtherWireless) {
-                               interfacePrivate->localized_key  = CFSTR("wireless");
-                               interfacePrivate->localized_arg1 = CFRetain(CFSTR(""));         // ??
                        } else {
                                CFStringRef     provider;
 
                        } else {
                                CFStringRef     provider;
 
@@ -1063,7 +1332,7 @@ processNetworkInterface(mach_port_t                       masterPort,
                                                CFStringRef             port_name;
                                                CFStringRef             slot_name;
 
                                                CFStringRef             port_name;
                                                CFStringRef             slot_name;
 
-                                               if (pci_slot_info(masterPort, interface, &slot_name, &port_name)) {
+                                               if (pci_slot_info(interface, &slot_name, &port_name)) {
                                                        if (port_name == NULL) {
                                                                interfacePrivate->localized_key  = CFSTR("pci-ether");
                                                                interfacePrivate->localized_arg1 = slot_name;
                                                        if (port_name == NULL) {
                                                                interfacePrivate->localized_key  = CFSTR("pci-ether");
                                                                interfacePrivate->localized_arg1 = slot_name;
@@ -1093,7 +1362,7 @@ processNetworkInterface(mach_port_t                       masterPort,
                        interfacePrivate->entity_type     = kSCEntNetFireWire;
 
                        // built-in
                        interfacePrivate->entity_type     = kSCEntNetFireWire;
 
                        // built-in
-                       interfacePrivate->builtin = isBuiltIn(interface);
+                       interfacePrivate->builtin = isBuiltin(interface);
 
                        // sort order
                        interfacePrivate->sort_order = kSortFireWire;
 
                        // sort order
                        interfacePrivate->sort_order = kSortFireWire;
@@ -1121,15 +1390,136 @@ processNetworkInterface(mach_port_t                    masterPort,
        interfacePrivate->entity_device = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOBSDNameKey));
 
        // Hardware (MAC) address
        interfacePrivate->entity_device = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOBSDNameKey));
 
        // Hardware (MAC) address
-       interfacePrivate->address = copyMACAddress(controller_dict);
+       data = CFDictionaryGetValue(controller_dict, CFSTR(kIOMACAddress));
+       if (isA_CFData(data)) {
+               interfacePrivate->address = CFRetain(data);
+       }
+
+       // interface unit
+       num = CFDictionaryGetValue(interface_dict, CFSTR(kIOInterfaceUnit));
+       if (isA_CFNumber(num) &&
+           CFNumberGetValue(num, kCFNumberIntType, & iVal)) {
+               interfacePrivate->unit = CFRetain(num);
+       }
 
        return TRUE;
 }
 
 
 
        return TRUE;
 }
 
 
+static void
+set_connection_script(SCNetworkInterfacePrivateRef interfacePrivate, CFStringRef script)
+{
+       CFDictionaryRef         dict;
+       CFMutableDictionaryRef  newDict;
+
+       if (interfacePrivate->overrides == NULL) {
+               interfacePrivate->overrides = CFDictionaryCreateMutable(NULL,
+                                                                       0,
+                                                                       &kCFTypeDictionaryKeyCallBacks,
+                                                                       &kCFTypeDictionaryValueCallBacks);
+       }
+
+       dict = CFDictionaryGetValue(interfacePrivate->overrides, kSCNetworkInterfaceTypeModem);
+       if (dict != NULL) {
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+       } else {
+               newDict = CFDictionaryCreateMutable(NULL,
+                                                   0,
+                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                   &kCFTypeDictionaryValueCallBacks);
+       }
+       if (script != NULL) {
+               CFDictionarySetValue(newDict, kSCPropNetModemConnectionScript, script);
+       } else {
+               CFDictionaryRemoveValue(newDict, kSCPropNetModemConnectionScript);
+       }
+       if (CFDictionaryGetCount(newDict) > 0) {
+               CFDictionarySetValue(interfacePrivate->overrides, kSCNetworkInterfaceTypeModem, newDict);
+       } else {
+               CFDictionaryRemoveValue(interfacePrivate->overrides, kSCNetworkInterfaceTypeModem);
+       }
+       CFRelease(newDict);
+
+       if (CFDictionaryGetCount(interfacePrivate->overrides) == 0) {
+               CFRelease(interfacePrivate->overrides);
+               interfacePrivate->overrides = NULL;
+       }
+       return;
+}
+
+
+static Boolean
+is_valid_connection_script(CFStringRef script)
+{
+       char                            ccl[MAXPATHLEN];
+       char                            path[MAXPATHLEN];
+       NSSearchPathEnumerationState    state;
+
+       (void) _SC_cfstring_to_cstring(script,
+                                      ccl,
+                                      sizeof(ccl),
+                                      kCFStringEncodingUTF8);
+
+       state = NSStartSearchPathEnumeration(NSLibraryDirectory,
+                                            NSLocalDomainMask|NSSystemDomainMask);
+       while ((state = NSGetNextSearchPathEnumeration(state, path))) {
+               size_t          n;
+               struct stat     statBuf;
+
+               if (ccl[0] == '/') {
+                       path[0] = '\0';         // if modemCCL is a full path
+               } else {
+                       strlcat(path, "/Modem Scripts/", sizeof(path));
+               }
+               strlcat(path, ccl, sizeof(path));
+
+               if (stat(path, &statBuf) != 0) {
+                       if (errno == ENOENT) {
+                               goto bundle;
+                       }
+
+                       SCLog(TRUE, LOG_DEBUG,
+                             CFSTR("processSerialInterface stat() failed: %s"),
+                             strerror(errno));
+                       continue;
+               }
+               if (S_ISREG(statBuf.st_mode)) {
+                       // if we have a valid CCL script
+                       return TRUE;
+               }
+
+#define        BUNDLE_EXT      ".ccl"
+#define        BUNDLE_EXT_LEN  sizeof(BUNDLE_EXT) - 1
+
+           bundle :
+
+               n = strlen(path);
+               if ((n <= BUNDLE_EXT_LEN) ||
+                   (strstr(&path[n - BUNDLE_EXT_LEN], BUNDLE_EXT) == NULL)) {
+                       strlcat(path, BUNDLE_EXT, sizeof(path));
+                       if (stat(path, &statBuf) != 0) {
+                               if (errno == ENOENT) {
+                                       continue;
+                               }
+
+                               SCLog(TRUE, LOG_DEBUG,
+                                     CFSTR("processSerialInterface stat() failed: %s"),
+                                     strerror(errno));
+                               continue;
+                       }
+               }
+               if (S_ISDIR(statBuf.st_mode)) {
+                       // if we have a valid CCL bundle
+                       return TRUE;
+               }
+       }
+
+       return FALSE;
+}
+
+
 static Boolean
 static Boolean
-processSerialInterface(mach_port_t                     masterPort,
-                      SCNetworkInterfacePrivateRef     interfacePrivate,
+processSerialInterface(SCNetworkInterfacePrivateRef    interfacePrivate,
                       io_registry_entry_t              interface,
                       CFDictionaryRef                  interface_dict,
                       io_registry_entry_t              controller,
                       io_registry_entry_t              interface,
                       CFDictionaryRef                  interface_dict,
                       io_registry_entry_t              controller,
@@ -1138,7 +1528,8 @@ processSerialInterface(mach_port_t                        masterPort,
                       CFDictionaryRef                  bus_dict)
 {
        CFStringRef             ift;
                       CFDictionaryRef                  bus_dict)
 {
        CFStringRef             ift;
-       Boolean                 isModem = FALSE;
+       Boolean                 isModem         = FALSE;
+       CFStringRef             modemCCL        = NULL;
        CFStringRef             str;
        CFTypeRef               val;
 
        CFStringRef             str;
        CFTypeRef               val;
 
@@ -1173,17 +1564,22 @@ processSerialInterface(mach_port_t                      masterPort,
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (IOStringValueHasPrefix(str, CFSTR("irda-ircomm"))) {
-               // IrDA
-               interfacePrivate->interface_type        = kSCNetworkInterfaceTypeIrDA;
-               interfacePrivate->sort_order            = kSortIrDA;
-       } else if (IOStringValueHasPrefix(str, CFSTR("bluetooth"))) {
+       if (IOStringValueHasPrefix(str, CFSTR("bluetooth"))) {
                // Bluetooth
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBluetooth;
                interfacePrivate->sort_order            = kSortBluetooth;
                // Bluetooth
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBluetooth;
                interfacePrivate->sort_order            = kSortBluetooth;
+       } else if (IOStringValueHasPrefix(str, CFSTR("irda-ircomm"))) {
+               // IrDA
+               interfacePrivate->interface_type        = kSCNetworkInterfaceTypeIrDA;
+               interfacePrivate->sort_order            = kSortIrDA;
+       } else if (IOStringValueHasPrefix(str, CFSTR("wwan"))) {
+               // WWAN
+               interfacePrivate->interface_type        = kSCNetworkInterfaceTypeWWAN;
+               interfacePrivate->sort_order            = kSortWWAN;
        } else {
                // Modem
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeModem;
        } else {
                // Modem
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeModem;
+               interfacePrivate->sort_order            = kSortModem;
 
                // V.92 support
                val = IORegistryEntrySearchCFProperty(interface,
 
                // V.92 support
                val = IORegistryEntrySearchCFProperty(interface,
@@ -1220,8 +1616,6 @@ processSerialInterface(mach_port_t                        masterPort,
                        interfacePrivate->sort_order = kSortInternalModem;
                } else if (CFEqual(str, CFSTR("usbmodem"))) {
                        interfacePrivate->sort_order = kSortUSBModem;
                        interfacePrivate->sort_order = kSortInternalModem;
                } else if (CFEqual(str, CFSTR("usbmodem"))) {
                        interfacePrivate->sort_order = kSortUSBModem;
-               } else {
-                       interfacePrivate->sort_order = kSortModem;
                }
        } else if (CFEqual(ift, CFSTR(kIOSerialBSDRS232Type))) {
                // if serial port
                }
        } else if (CFEqual(ift, CFSTR(kIOSerialBSDRS232Type))) {
                // if serial port
@@ -1233,17 +1627,64 @@ processSerialInterface(mach_port_t                      masterPort,
        // Entity (Device)
        interfacePrivate->entity_device = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOTTYDeviceKey));
 
        // Entity (Device)
        interfacePrivate->entity_device = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOTTYDeviceKey));
 
-       // modem CCL
+       // configuration template overrides
+       val = IORegistryEntrySearchCFProperty(interface,
+                                             kIOServicePlane,
+                                             CFSTR("DevicePPPOverrides"),
+                                             NULL,
+                                             kIORegistryIterateRecursively | kIORegistryIterateParents);
+       if (val != NULL) {
+               if (isA_CFDictionary(val)) {
+                       if (interfacePrivate->overrides == NULL) {
+                               interfacePrivate->overrides = CFDictionaryCreateMutable(NULL,
+                                                                                       0,
+                                                                                       &kCFTypeDictionaryKeyCallBacks,
+                                                                                       &kCFTypeDictionaryValueCallBacks);
+                       }
+                       CFDictionarySetValue(interfacePrivate->overrides, kSCNetworkInterfaceTypePPP, val);
+               }
+               CFRelease(val);
+       }
+
        val = IORegistryEntrySearchCFProperty(interface,
                                              kIOServicePlane,
        val = IORegistryEntrySearchCFProperty(interface,
                                              kIOServicePlane,
-                                             CFSTR("ModemCCL"),
+                                             CFSTR("DeviceModemOverrides"),
                                              NULL,
                                              kIORegistryIterateRecursively | kIORegistryIterateParents);
        if (val != NULL) {
                                              NULL,
                                              kIORegistryIterateRecursively | kIORegistryIterateParents);
        if (val != NULL) {
-               interfacePrivate->modemCCL = IOCopyCFStringValue(val);
+               if (isA_CFDictionary(val)) {
+                       if (interfacePrivate->overrides == NULL) {
+                               interfacePrivate->overrides = CFDictionaryCreateMutable(NULL,
+                                                                                       0,
+                                                                                       &kCFTypeDictionaryKeyCallBacks,
+                                                                                       &kCFTypeDictionaryValueCallBacks);
+                       }
+                       CFDictionarySetValue(interfacePrivate->overrides, kSCNetworkInterfaceTypeModem, val);
+
+                       modemCCL = CFDictionaryGetValue(val, kSCPropNetModemConnectionScript);
+                       modemCCL = isA_CFString(modemCCL);
+               }
                CFRelease(val);
        }
 
                CFRelease(val);
        }
 
+       // modem CCL
+       if (modemCCL == NULL) {
+               val = IORegistryEntrySearchCFProperty(interface,
+                                                     kIOServicePlane,
+                                                     CFSTR("ModemCCL"),
+                                                     NULL,
+                                                     kIORegistryIterateRecursively | kIORegistryIterateParents);
+               if (val != NULL) {
+                       modemCCL = IOCopyCFStringValue(val);
+                       if (modemCCL != NULL) {
+                               set_connection_script(interfacePrivate, modemCCL);
+                               CFRelease(modemCCL);
+                       }
+
+                       CFRelease(val);
+               }
+       }
+
        // localized name
        if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIrDA)) {
                interfacePrivate->localized_key = CFSTR("irda");
        // localized name
        if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIrDA)) {
                interfacePrivate->localized_key = CFSTR("irda");
@@ -1251,6 +1692,7 @@ processSerialInterface(mach_port_t                        masterPort,
                interfacePrivate->localized_key = CFSTR("bluetooth");
        } else {
                CFStringRef             localized       = NULL;
                interfacePrivate->localized_key = CFSTR("bluetooth");
        } else {
                CFStringRef             localized       = NULL;
+               CFStringRef             name            = NULL;
                CFMutableStringRef      port;
 
                port = CFStringCreateMutableCopy(NULL, 0, str);
                CFMutableStringRef      port;
 
                port = CFStringCreateMutableCopy(NULL, 0, str);
@@ -1260,11 +1702,26 @@ processSerialInterface(mach_port_t                      masterPort,
                        CFStringAppend(port, CFSTR("-port"));
                }
 
                        CFStringAppend(port, CFSTR("-port"));
                }
 
+               // set non-localized name
+               if (bundle != NULL) {
+                       name = copy_interface_string(bundle, port, FALSE);
+               }
+               if (name != NULL) {
+                       if (!CFEqual(port, name)) {
+                               // if [English] localization available
+                               interfacePrivate->name = name;
+                       } else {
+                               // if no [English] localization available, use TTY base name
+                               CFRelease(name);
+                               interfacePrivate->name = CFStringCreateCopy(NULL, str);
+                       }
+               } else {
+                       interfacePrivate->name = CFStringCreateCopy(NULL, str);
+               }
+
+               // set localized name
                if (bundle != NULL) {
                if (bundle != NULL) {
-                       localized = CFBundleCopyLocalizedString(bundle,
-                                                               port,
-                                                               port,
-                                                               NETWORKINTERFACE_LOCALIZATIONS);
+                       localized = copy_interface_string(bundle, port, TRUE);
                }
                if (localized != NULL) {
                        if (!CFEqual(port, localized)) {
                }
                if (localized != NULL) {
                        if (!CFEqual(port, localized)) {
@@ -1295,13 +1752,21 @@ processSerialInterface(mach_port_t                      masterPort,
                                if (productName != NULL) {
                                        if (CFStringGetLength(productName) > 0) {
                                                // if we have a [somewhat reasonable?] product name
                                if (productName != NULL) {
                                        if (CFStringGetLength(productName) > 0) {
                                                // if we have a [somewhat reasonable?] product name
-                                               CFRelease(interfacePrivate->localized_name);
+                                               if (interfacePrivate->name != NULL) {
+                                                       CFRelease(interfacePrivate->name);
+                                               }
+                                               interfacePrivate->name = CFRetain(productName);
+                                               if (interfacePrivate->localized_name != NULL) {
+                                                       CFRelease(interfacePrivate->localized_name);
+                                               }
                                                interfacePrivate->localized_name = CFRetain(productName);
 
                                                // if not provided, also check if the product name
                                                // matches a CCL script
                                                interfacePrivate->localized_name = CFRetain(productName);
 
                                                // if not provided, also check if the product name
                                                // matches a CCL script
-                                               if (interfacePrivate->modemCCL == NULL) {
-                                                       interfacePrivate->modemCCL = CFRetain(productName);
+                                               if ((modemCCL == NULL) &&
+                                                   is_valid_connection_script(productName)) {
+                                                       set_connection_script(interfacePrivate, productName);
+                                                       modemCCL = productName;
                                                }
                                        }
 
                                                }
                                        }
 
@@ -1313,61 +1778,85 @@ processSerialInterface(mach_port_t                      masterPort,
                CFRelease(port);
        }
 
                CFRelease(port);
        }
 
-       // validate the CCL script
-       if (interfacePrivate->modemCCL != NULL) {
-               char                            ccl[MAXPATHLEN];
-               char                            path[MAXPATHLEN];
-               NSSearchPathEnumerationState    state;
-               Boolean                         valid   = FALSE;
+       return TRUE;
+}
 
 
-               (void) _SC_cfstring_to_cstring(interfacePrivate->modemCCL,
-                                              ccl,
-                                              sizeof(ccl),
-                                              kCFStringEncodingUTF8);
 
 
-               state = NSStartSearchPathEnumeration(NSLibraryDirectory,
-                                                    NSLocalDomainMask|NSSystemDomainMask);
-               while ((state = NSGetNextSearchPathEnumeration(state, path))) {
-                       struct stat     statBuf;
+static SCNetworkInterfaceRef
+createInterface(io_registry_entry_t interface, processInterface func)
+{
+       io_registry_entry_t             bus                     = MACH_PORT_NULL;
+       CFMutableDictionaryRef          bus_dict                = NULL;
+       io_registry_entry_t             controller              = MACH_PORT_NULL;
+       CFMutableDictionaryRef          controller_dict         = NULL;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = NULL;
+       CFMutableDictionaryRef          interface_dict          = NULL;
+       kern_return_t                   kr;
+       io_string_t                     path;
 
 
-                       if (ccl[0] == '/') {
-                               path[0] = '\0';         // if modemCCL is a full path
-                       } else {
-                               strlcat(path, "/Modem Scripts/", sizeof(path));
-                               strlcat(path, ccl, sizeof(path));
-                       }
+       kr = IORegistryEntryGetPath(interface, kIOServicePlane, path);
+       if (kr != kIOReturnSuccess) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("createInterface IORegistryEntryGetPath() failed, kr = 0x%x"), kr);
+               goto done;
+       }
 
 
-                       if (stat(path, &statBuf) == 0) {
-                               if (S_ISREG(statBuf.st_mode)) {
-                                       // if we have a valid CCL script
-                                       valid = TRUE;
-                                       break;
-                               }
-                       } else {
-                               if (errno == ENOENT) {
-                                       continue;
-                               }
+       kr = IORegistryEntryCreateCFProperties(interface, &interface_dict, NULL, kNilOptions);
+       if (kr != kIOReturnSuccess) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("createInterface IORegistryEntryCreateCFProperties() failed, kr = 0x%x"), kr);
+               goto done;
+       }
 
 
-                               SCLog(TRUE, LOG_DEBUG,
-                                     CFSTR("processSerialInterface stat() failed: %s"),
-                                     strerror(errno));
-                               break;
-                       }
-               }
+       /* get the controller node */
+       kr = IORegistryEntryGetParentEntry(interface, kIOServicePlane, &controller);
+       if (kr != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("createInterface IORegistryEntryGetParentEntry() failed, kr = 0x%x"), kr);
+               goto done;
+       }
 
 
-               if (!valid) {
-                       // if the CCL script is not valid
-                       CFRelease(interfacePrivate->modemCCL);
-                       interfacePrivate->modemCCL = NULL;
-               }
+       /* get the dictionary associated with the node */
+       kr = IORegistryEntryCreateCFProperties(controller, &controller_dict, NULL, kNilOptions);
+       if (kr != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("createInterface IORegistryEntryCreateCFProperties() failed, kr = 0x%x"), kr);
+               goto done;
        }
 
        }
 
-       return TRUE;
+       /* get the bus node */
+       kr = IORegistryEntryGetParentEntry(controller, kIOServicePlane, &bus);
+       if (kr != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("createInterface IORegistryEntryGetParentEntry() failed, kr = 0x%x"), kr);
+               goto done;
+       }
+
+       /* get the dictionary associated with the node */
+       kr = IORegistryEntryCreateCFProperties(bus, &bus_dict, NULL, kNilOptions);
+       if (kr != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("createInterface IORegistryEntryCreateCFProperties() failed, kr = 0x%x"), kr);
+               goto done;
+       }
+
+       interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, path);
+
+       if (!(*func)(interfacePrivate, interface, interface_dict, controller, controller_dict, bus, bus_dict)) {
+               CFRelease(interfacePrivate);
+               interfacePrivate = NULL;
+       }
+
+    done :
+
+       if (interface_dict != NULL)             CFRelease(interface_dict);
+
+       if (controller != MACH_PORT_NULL)       IOObjectRelease(controller);
+       if (controller_dict != NULL)            CFRelease(controller_dict);
+
+       if (bus != MACH_PORT_NULL)              IOObjectRelease(bus);
+       if (bus_dict != NULL)                   CFRelease(bus_dict);
+
+       return (SCNetworkInterfaceRef)interfacePrivate;
 }
 
 
 static CFArrayRef
 }
 
 
 static CFArrayRef
-findMatchingInterfaces(mach_port_t masterPort, CFDictionaryRef matching, processInterface func)
+findMatchingInterfaces(CFDictionaryRef matching, processInterface func)
 {
        CFMutableArrayRef       interfaces;
        io_registry_entry_t     interface;
 {
        CFMutableArrayRef       interfaces;
        io_registry_entry_t     interface;
@@ -1383,72 +1872,15 @@ findMatchingInterfaces(mach_port_t masterPort, CFDictionaryRef matching, process
        interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        while ((interface = IOIteratorNext(iterator)) != MACH_PORT_NULL) {
        interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        while ((interface = IOIteratorNext(iterator)) != MACH_PORT_NULL) {
-               io_registry_entry_t             bus                     = MACH_PORT_NULL;
-               CFMutableDictionaryRef          bus_dict                = NULL;
-               io_registry_entry_t             controller              = MACH_PORT_NULL;
-               CFMutableDictionaryRef          controller_dict         = NULL;
-               SCNetworkInterfacePrivateRef    interfacePrivate        = NULL;
-               CFMutableDictionaryRef          interface_dict          = NULL;
-               io_string_t                     path;
-
-               kr = IORegistryEntryGetPath(interface, kIOServicePlane, path);
-               if (kr != kIOReturnSuccess) {
-                       SCPrint(TRUE, stderr, CFSTR("IORegistryEntryGetPath() failed, kr = 0x%x"), kr);
-                       goto done;
-               }
-
-               kr = IORegistryEntryCreateCFProperties(interface, &interface_dict, NULL, kNilOptions);
-               if (kr != kIOReturnSuccess) {
-                       SCPrint(TRUE, stderr, CFSTR("IORegistryEntryCreateCFProperties() failed, kr = 0x%x\n"), kr);
-                       goto done;
-               }
+               SCNetworkInterfaceRef           match;
 
 
-               /* get the controller node */
-               kr = IORegistryEntryGetParentEntry(interface, kIOServicePlane, &controller);
-               if (kr != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_INFO, CFSTR("findMatchingInterfaces IORegistryEntryGetParentEntry() failed, kr = 0x%x"), kr);
-                       goto done;
-               }
-
-               /* get the dictionary associated with the node */
-               kr = IORegistryEntryCreateCFProperties(controller, &controller_dict, NULL, kNilOptions);
-               if (kr != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_INFO, CFSTR("findMatchingInterfaces IORegistryEntryCreateCFProperties() failed, kr = 0x%x"), kr);
-                       goto done;
-               }
-
-               /* get the bus node */
-               kr = IORegistryEntryGetParentEntry(controller, kIOServicePlane, &bus);
-               if (kr != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_INFO, CFSTR("findMatchingInterfaces IORegistryEntryGetParentEntry() failed, kr = 0x%x"), kr);
-                       goto done;
-               }
-
-               /* get the dictionary associated with the node */
-               kr = IORegistryEntryCreateCFProperties(bus, &bus_dict, NULL, kNilOptions);
-               if (kr != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_INFO, CFSTR("findMatchingInterfaces IORegistryEntryCreateCFProperties() failed, kr = 0x%x"), kr);
-                       goto done;
-               }
-
-               interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, path);
-
-               if ((*func)(masterPort, interfacePrivate, interface, interface_dict, controller, controller_dict, bus, bus_dict)) {
-                       CFArrayAppendValue(interfaces, (SCNetworkInterfaceRef)interfacePrivate);
+               match = createInterface(interface, func);
+               if (match != NULL) {
+                       CFArrayAppendValue(interfaces, match);
+                       CFRelease(match);
                }
 
                }
 
-               CFRelease(interfacePrivate);
-
-           done:
-
-               if (interface != MACH_PORT_NULL)        IOObjectRelease(interface);
-               if (interface_dict != NULL)             CFRelease(interface_dict);
-
-               if (controller != MACH_PORT_NULL)       IOObjectRelease(controller);
-               if (controller_dict != NULL)            CFRelease(controller_dict);
-
-               if (bus != MACH_PORT_NULL)              IOObjectRelease(bus);
-               if (bus_dict != NULL)                   CFRelease(bus_dict);
+               IOObjectRelease(interface);
        }
 
        IOObjectRelease(iterator);
        }
 
        IOObjectRelease(iterator);
@@ -1457,297 +1889,327 @@ findMatchingInterfaces(mach_port_t masterPort, CFDictionaryRef matching, process
 }
 
 
 }
 
 
-/* ---------- Bond configuration ---------- */
+#pragma mark -
+#pragma mark helper functions
 
 
-Boolean
-SCNetworkInterfaceSupportsBonding(SCNetworkInterfaceRef interface)
+
+static CFIndex
+findConfiguration(CFStringRef interface_type)
 {
 {
-       return ((SCNetworkInterfacePrivateRef)interface)->supportsBond;
+       CFIndex i;
+
+       for (i = 0; i < sizeof(configurations)/sizeof(configurations[0]); i++) {
+               if (CFEqual(interface_type, *configurations[i].interface_type)) {
+                       return i;
+               }
+       }
+
+       return kCFNotFound;
 }
 
 
 }
 
 
-SCNetworkInterfaceRef
-SCNetworkInterfaceCreateWithBond(BondInterfaceRef bond)
+__private_extern__
+CFStringRef
+__SCNetworkInterfaceGetDefaultConfigurationType(SCNetworkInterfaceRef interface)
 {
 {
-       SCNetworkInterfacePrivateRef    interfacePrivate;
-       CFStringRef                     bond_if;
+       CFIndex                         interfaceIndex;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
 
-       bond_if = BondInterfaceGetInterface(bond);
-       if (bond_if == NULL) {
+       if (interfacePrivate->serviceID == NULL) {
+               // if not associated with a service (yet)
+               _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
                return NULL;
        }
 
-       interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL);
-       if (interfacePrivate == NULL) {
-               return NULL;
+       interfaceIndex = findConfiguration(interfacePrivate->interface_type);
+       if (interfaceIndex == kCFNotFound) {
+               // unknown interface type, use per-service configuration preferences
+               return interfacePrivate->interface_type;        // entity
        }
 
        }
 
-       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBond;
-       interfacePrivate->entity_type           = kSCEntNetEthernet;
-       interfacePrivate->entity_device         = CFStringCreateCopy(NULL, bond_if);
-       interfacePrivate->builtin               = TRUE;
-       interfacePrivate->sort_order            = kSortBond;
-
-       interfacePrivate->localized_key         = CFSTR("bond");
-       interfacePrivate->localized_arg1        = CFRetain(interfacePrivate->entity_device);
+       if (configurations[interfaceIndex].entity_hardware != NULL) {
+               // if configuration information can be associated with this interface type
+               return *configurations[interfaceIndex].entity_hardware;
+       }
 
 
-       return (SCNetworkInterfaceRef)interfacePrivate;
+       _SCErrorSet(kSCStatusInvalidArgument);
+       return NULL;
 }
 
 
 }
 
 
-static CFArrayRef
-findBondInterfaces(CFStringRef match)
+__private_extern__
+Boolean
+__SCNetworkInterfaceIsValidExtendedConfigurationType(SCNetworkInterfaceRef     interface,
+                                                    CFStringRef                extendedType,
+                                                    Boolean                    requirePerInterface)
 {
 {
-       CFMutableArrayRef       interfaces      = NULL;
-       CFIndex                 i;
-       CFIndex                 n;
-       BondPreferencesRef      prefs;
-       CFArrayRef              bonds           = NULL;
+       CFStringRef                     defaultType;
+       CFIndex                         extendedIndex;
+       CFIndex                         interfaceIndex;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+       Boolean                         ok                      = FALSE;
 
 
-       prefs = BondPreferencesCreate(NULL);
-       if (prefs == NULL) {
-               // if no bonds
-               return NULL;
+       defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+       if (defaultType == NULL) {
+               goto done;
        }
 
        }
 
-       bonds = BondPreferencesCopyInterfaces(prefs);
-       if (bonds == NULL) {
-               // if no bonds
+       if (CFEqual(extendedType, defaultType)) {
+               // extended and default configuration types cannot conflict
                goto done;
        }
 
                goto done;
        }
 
-       n = CFArrayGetCount(bonds);
-       if (n == 0) {
-               // if no bonds
+       interfaceIndex = findConfiguration(interfacePrivate->interface_type);
+       if (interfaceIndex == kCFNotFound) {
+               // configuration information for unknown interface type's
+               // are stored along with the service and we don't allow
+               // per-service extended configurations
                goto done;
        }
 
                goto done;
        }
 
-       interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
-       for (i = 0; i < n; i++) {
-               SCNetworkInterfaceRef   interface;
-               BondInterfaceRef        bond            = CFArrayGetValueAtIndex(bonds, i);
-               CFStringRef             bond_if;
-
-               bond_if = BondInterfaceGetInterface(bond);
-               if (bond_if == NULL) {
-                       continue;
-               }
+//     It turns out that, for PPP interfaces, we want to be able to store
+//     some extended interface configuration (e.g. IPSec [for L2TP]).  For
+//     now, I'm commenting out the following test.
+//
+//     if (requirePerInterface && !configurations[interfaceIndex].per_interface_config) {
+//             // we don't allow per-service extended configurations
+//             goto done;
+//     }
+
+       extendedIndex = findConfiguration(extendedType);
+       if (extendedIndex != kCFNotFound) {
+               // extended type cannot match a known interface type
+               goto done;
+       }
 
 
-               if ((match != NULL) && !CFEqual(bond_if, match)) {
-                       continue;
-               }
+       /*
+        * ???
+        * Do we match specific/known extended configuration types (e.g. EAPOL)
+        * and ensure that any non-standard extended configuration types be of
+        * the form com.myCompany.myType?
+        * ???
+        */
 
 
-               interface = SCNetworkInterfaceCreateWithBond(bond);
-               CFArrayAppendValue(interfaces, interface);
-               CFRelease(interface);
-       }
+       ok = TRUE;
 
     done :
 
 
     done :
 
-       if (bonds != NULL)      CFRelease(bonds);
-       CFRelease(prefs);
-       return interfaces;
+       if (!ok) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+       }
+       return ok;
 }
 
 
 }
 
 
-/* ---------- VLAN configuration ---------- */
+typedef struct {
+       CFStringRef             defaultType;
+       CFMutableArrayRef       types;
+} extendedConfiguration, *extendedConfigurationRef;
 
 
-SCNetworkInterfaceRef
-SCNetworkInterfaceCreateWithVLAN(VLANInterfaceRef vlan)
+
+static void
+__addExtendedConfigurationType(const void *key, const void *value, void *context)
 {
 {
-       SCNetworkInterfacePrivateRef    interfacePrivate;
-       CFStringRef                     vlan_if;
+       CFStringRef                     extendedType    = (CFStringRef)key;
+       extendedConfigurationRef        myContextRef    = (extendedConfigurationRef)context;
 
 
-       vlan_if = VLANInterfaceGetInterface(vlan);
-       if (vlan_if == NULL) {
-               return NULL;
+       if (CFEqual(extendedType, myContextRef->defaultType)) {
+               // do not include the default configuration type
+               return;
        }
 
        }
 
-       interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL);
-       if (interfacePrivate == NULL) {
-               return NULL;
+       if (CFArrayContainsValue(myContextRef->types,
+                                CFRangeMake(0, CFArrayGetCount(myContextRef->types)),
+                                extendedType)) {
+               // if extendedType already has already been added
+               return;
        }
 
        }
 
-       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeVLAN;
-       interfacePrivate->entity_type           = kSCEntNetEthernet;
-       interfacePrivate->entity_device         = CFStringCreateCopy(NULL, vlan_if);
-       interfacePrivate->builtin               = TRUE;
-       interfacePrivate->sort_order            = kSortVLAN;
-
-       interfacePrivate->localized_key         = CFSTR("vlan");
-       interfacePrivate->localized_arg1        = CFRetain(interfacePrivate->entity_device);
+       CFArrayAppendValue(myContextRef->types, extendedType);
 
 
-       return (SCNetworkInterfaceRef)interfacePrivate;
+       return;
 }
 
 
 static CFArrayRef
 }
 
 
 static CFArrayRef
-findVLANInterfaces(CFStringRef match)
+extendedConfigurationTypes(SCNetworkInterfaceRef interface)
 {
 {
-       CFMutableArrayRef       interfaces      = NULL;
-       CFIndex                 i;
-       CFIndex                 n;
-       VLANPreferencesRef      prefs;
-       CFArrayRef              vlans           = NULL;
+       CFIndex                         i;
+       CFIndex                         interfaceIndex;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+       extendedConfiguration           myContext;
+       SCNetworkServiceRef             service;
+       CFArrayRef                      sets;
+       CFIndex                         n;
+
+       myContext.defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+       if (myContext.defaultType == NULL) {
+               myContext.types = NULL;
+               goto done;
+       }
 
 
-       prefs = VLANPreferencesCreate(NULL);
-       if (prefs == NULL) {
-               // if no VLANs
-               return NULL;
+       myContext.types = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       if (interfacePrivate->serviceID == NULL) {
+               // if not associated with a service (yet)
+               goto done;
        }
 
        }
 
-       vlans = VLANPreferencesCopyInterfaces(prefs);
-       if (vlans == NULL) {
-               // if no VLANs
+       interfaceIndex = findConfiguration(interfacePrivate->interface_type);
+       if (interfaceIndex == kCFNotFound) {
+               // we don't allow per-service extended configurations
                goto done;
        }
 
                goto done;
        }
 
-       n = CFArrayGetCount(vlans);
-       if (n == 0) {
-               // if no VLANs
+       if (!configurations[interfaceIndex].per_interface_config) {
+               // known interface type but we still don't allow
+               // per-service extended configurations
                goto done;
        }
 
                goto done;
        }
 
-       interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       service = (SCNetworkServiceRef)__SCNetworkServiceCreatePrivate(NULL,
+                                                                      interfacePrivate->prefs,
+                                                                      interfacePrivate->serviceID,
+                                                                      interface);
 
 
-       for (i = 0; i < n; i++) {
-               SCNetworkInterfaceRef   interface;
-               VLANInterfaceRef        vlan            = CFArrayGetValueAtIndex(vlans, i);
-               CFStringRef             vlan_if;
+       sets = SCNetworkSetCopyAll(interfacePrivate->prefs);
+       n = (sets != NULL) ? CFArrayGetCount(sets) : 0;
 
 
-               vlan_if = VLANInterfaceGetInterface(vlan);
-               if (vlan_if == NULL) {
+       for (i = 0; i < n; i++) {
+               CFDictionaryRef         configs;
+               Boolean                 found;
+               CFStringRef             path;
+               CFArrayRef              services;
+               SCNetworkSetRef         set;
+
+               set = CFArrayGetValueAtIndex(sets, i);
+               services = SCNetworkSetCopyServices(set);
+               found = CFArrayContainsValue(services,
+                                            CFRangeMake(0, CFArrayGetCount(services)),
+                                            service);
+               CFRelease(services);
+
+               if (!found) {
                        continue;
                }
 
                        continue;
                }
 
-               if ((match != NULL) && !CFEqual(vlan_if, match)) {
-                       continue;
+               // add stored extended configuration types
+               path = SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(NULL,                                // allocator
+                                                                          SCNetworkSetGetSetID(set),           // set
+                                                                          interfacePrivate->entity_device,     // service
+                                                                          NULL);                               // entity
+               configs = __getPrefsConfiguration(interfacePrivate->prefs, path);
+               CFRelease(path);
+               if (isA_CFDictionary(configs)) {
+                       CFDictionaryApplyFunction(configs,
+                                                 __addExtendedConfigurationType,
+                                                 &myContext);
                }
 
                }
 
-               interface = SCNetworkInterfaceCreateWithVLAN(vlan);
-               CFArrayAppendValue(interfaces, interface);
-               CFRelease(interface);
-       }
-
-    done :
-
-       if (vlans != NULL)      CFRelease(vlans);
-       CFRelease(prefs);
-       return interfaces;
-}
-
-
-/* ---------- helper functions ---------- */
+               // add not-yet-stored extended configuration types
+               if (interfacePrivate->unsaved != NULL) {
+                       CFDictionaryApplyFunction(interfacePrivate->unsaved,
+                                                 __addExtendedConfigurationType,
+                                                 &myContext);
+               }
 
 
+               break;
+       }
 
 
-static CFIndex
-findConfiguration(CFStringRef interface_type)
-{
-       CFIndex i;
+       CFRelease(service);
+       if (sets != NULL) CFRelease(sets);
 
 
-       for (i = 0; i < sizeof(configurations)/sizeof(configurations[0]); i++) {
-               if (CFEqual(interface_type, *configurations[i].interface_type)) {
-                       return i;
-               }
-       }
+    done :
 
 
-       return kCFNotFound;
+       return myContext.types;
 }
 
 
 static CFArrayRef
 }
 
 
 static CFArrayRef
-copyConfigurationPaths(SCNetworkInterfacePrivateRef interfacePrivate)
+copyConfigurationPaths(SCNetworkInterfacePrivateRef    interfacePrivate,
+                      CFStringRef                      extendedType)
 {
 {
-       CFMutableArrayRef               array           = NULL;
+       CFMutableArrayRef               array;
+       CFIndex                         i;
        CFIndex                         interfaceIndex;
        CFIndex                         interfaceIndex;
+       CFIndex                         n;
        CFStringRef                     path;
        CFStringRef                     path;
-       SCNetworkServicePrivateRef      servicePrivate;
-
-       servicePrivate = (SCNetworkServicePrivateRef)interfacePrivate->service;
-       if (servicePrivate == NULL) {
-               // if not associated with a service (yet)
-               return NULL;
-       }
+       SCNetworkServiceRef             service;
+       CFArrayRef                      sets;
 
        array = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        interfaceIndex = findConfiguration(interfacePrivate->interface_type);
        if (interfaceIndex == kCFNotFound) {
                // unknown interface type, use per-service configuration preferences
 
        array = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        interfaceIndex = findConfiguration(interfacePrivate->interface_type);
        if (interfaceIndex == kCFNotFound) {
                // unknown interface type, use per-service configuration preferences
-               path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                                     // allocator
-                                                                     servicePrivate->serviceID,                // service
-                                                                     interfacePrivate->interface_type);        // entity
+               path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
+                                                                     interfacePrivate->serviceID,      // service
+                                                                     extendedType);                    // entity
                CFArrayAppendValue(array, path);
                CFRelease(path);
                CFArrayAppendValue(array, path);
                CFRelease(path);
-               goto done;
+               return array;
        }
 
        }
 
-       if (configurations[interfaceIndex].entity_hardware == NULL) {
-               // if no configuration information can be associated with this interface type
-               CFRelease(array);
-               array = NULL;
-               goto done;
+       if (!configurations[interfaceIndex].per_interface_config) {
+               // known interface type, per-service configuration preferences
+               path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
+                                                                     interfacePrivate->serviceID,      // service
+                                                                     extendedType);                    // entity
+               CFArrayAppendValue(array, path);
+               CFRelease(path);
+               return array;
        }
 
        }
 
-       if (configurations[interfaceIndex].per_interface_config) {
-               CFIndex         i;
-               CFIndex         n;
-               CFArrayRef      sets;
-
-               // known interface type, per-interface configuration preferences
-               //
-               // 1. look for all sets which contain the associated service
-               // 2. add a per-set path for the interface configuration for
-               //    each set.
+       // known interface type, per-interface configuration preferences
+       //
+       // 1. look for all sets which contain the associated service
+       // 2. add a per-set path for the interface configuration for
+       //    each set.
 
 
-               sets = SCNetworkSetCopyAll(servicePrivate->prefs);
-               n = (sets != NULL) ? CFArrayGetCount(sets) : 0;
+       service = (SCNetworkServiceRef)__SCNetworkServiceCreatePrivate(NULL,
+                                                                      interfacePrivate->prefs,
+                                                                      interfacePrivate->serviceID,
+                                                                      (SCNetworkInterfaceRef)interfacePrivate);
 
 
-               for (i = 0; i < n; i++) {
-                       CFArrayRef      services;
-                       SCNetworkSetRef set;
-
-                       set = CFArrayGetValueAtIndex(sets, i);
-                       services = SCNetworkSetCopyServices(set);
-                       if (CFArrayContainsValue(services,
-                                                CFRangeMake(0, CFArrayGetCount(services)),
-                                                interfacePrivate->service)) {
-                               path = SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(NULL,                                                // allocator
-                                                                                          SCNetworkSetGetSetID(set),                           // set
-                                                                                          interfacePrivate->entity_device,                     // service
-                                                                                          *configurations[interfaceIndex].entity_hardware);    // entity
-                               CFArrayAppendValue(array, path);
-                               CFRelease(path);
-                       }
-                       CFRelease(services);
-               }
+       sets = SCNetworkSetCopyAll(interfacePrivate->prefs);
+       n = (sets != NULL) ? CFArrayGetCount(sets) : 0;
 
 
-               if (CFArrayGetCount(array) == 0) {
-                       CFRelease(array);
-                       array = NULL;
+       for (i = 0; i < n; i++) {
+               CFArrayRef      services;
+               SCNetworkSetRef set;
+
+               set = CFArrayGetValueAtIndex(sets, i);
+               services = SCNetworkSetCopyServices(set);
+               if (CFArrayContainsValue(services,
+                                        CFRangeMake(0, CFArrayGetCount(services)),
+                                        service)) {
+                       path = SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(NULL,                                // allocator
+                                                                                  SCNetworkSetGetSetID(set),           // set
+                                                                                  interfacePrivate->entity_device,     // service
+                                                                                  extendedType);                       // entity
+                       CFArrayAppendValue(array, path);
+                       CFRelease(path);
                }
                }
-
-               if (sets != NULL) CFRelease(sets);
-       } else {
-               // known interface type, per-service configuration preferences
-               path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                                             // allocator
-                                                                     servicePrivate->serviceID,                        // service
-                                                                     *configurations[interfaceIndex].entity_hardware); // entity
-               CFArrayAppendValue(array, path);
-               CFRelease(path);
+               CFRelease(services);
        }
 
        }
 
-    done :
+       if (CFArrayGetCount(array) == 0) {
+               CFRelease(array);
+               array = NULL;
+       }
 
 
+       CFRelease(service);
+       if (sets != NULL) CFRelease(sets);
        return array;
 }
 
 
        return array;
 }
 
 
-/* ---------- preferences entity for interface ---------- */
+#pragma mark -
+#pragma mark SCNetworkInterface <--> preferences entity
 
 
 
 
-__private_extern__ CFDictionaryRef
+__private_extern__
+CFDictionaryRef
 __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
 {
        CFMutableDictionaryRef          entity;
 __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
 {
        CFMutableDictionaryRef          entity;
@@ -1800,6 +2262,13 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
                                     interfacePrivate->interface_type);
        }
 
                                     interfacePrivate->interface_type);
        }
 
+       // add the localized display name (which will only be used when/if the
+       // interface is removed from the system)
+       CFDictionarySetValue(entity,
+                            kSCPropUserDefinedName,
+                            SCNetworkInterfaceGetLocalizedDisplayName(interface));
+
+       // note that this is a V.92 capable modem
        if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeModem) &&
            interfacePrivate->modemIsV92) {
                int             one     = 1;
        if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeModem) &&
            interfacePrivate->modemIsV92) {
                int             one     = 1;
@@ -1816,52 +2285,138 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
 }
 
 
 }
 
 
-/* ---------- interface from preferences entity ---------- */
+static SCNetworkInterfaceRef
+findInterface(CFArrayRef interfaces, CFStringRef match_if)
+{
+       CFIndex i;
+       CFIndex n;
 
 
+       n = CFArrayGetCount(interfaces);
+       for (i = 0; i < n; i++) {
+               SCNetworkInterfaceRef   interface       = CFArrayGetValueAtIndex(interfaces, i);
+               CFStringRef             interfaceName;
 
 
-__private_extern__ SCNetworkInterfaceRef
-__SCNetworkInterfaceCreateWithEntity(CFAllocatorRef            allocator,
-                                    CFDictionaryRef            interface_entity,
-                                    SCNetworkServiceRef        service)
-{
-       SCNetworkInterfacePrivateRef    interfacePrivate        = NULL;
-       CFStringRef                     ifDevice;
-       CFStringRef                     ifSubType;
-       CFStringRef                     ifType;
-       static mach_port_t              masterPort              = MACH_PORT_NULL;
-       CFArrayRef                      matching_interfaces     = NULL;
+               interfaceName = SCNetworkInterfaceGetBSDName(interface);
+               if ((interfaceName != NULL) && CFEqual(interfaceName, match_if)) {
+                       CFRetain(interface);
+                       return interface;
+               }
+       }
 
 
-       /* initialize runtime (and kSCNetworkInterfaceIPv4) */
-       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+       return NULL;
+}
 
 
-       if (masterPort == MACH_PORT_NULL) {
-               kern_return_t   kr;
 
 
-               kr = IOMasterPort(MACH_PORT_NULL, &masterPort);
-               if (kr != KERN_SUCCESS) {
-                       return NULL;
-               }
+static SCNetworkInterfaceRef
+findBondInterface(SCPreferencesRef prefs, CFStringRef ifDevice)
+{
+       CFArrayRef              bonds;
+       SCNetworkInterfaceRef   interface       = NULL;
+
+       if (prefs == NULL) {
+               return (NULL);
        }
 
        }
 
-       ifType = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceType);
-       if (!isA_CFString(ifType)) {
-               return NULL;
+       // check if the interface is an Ethernet Bond
+       bonds = SCBondInterfaceCopyAll(prefs);
+       if (bonds != NULL) {
+               interface = findInterface(bonds, ifDevice);
+               CFRelease(bonds);
        }
        }
+       return interface;
+}
 
 
-       ifSubType = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceSubType);
-       if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
-               if (!isA_CFString(ifSubType)) {
-                       return NULL;
-               }
+static SCNetworkInterfaceRef
+findVLANInterface(SCPreferencesRef prefs, CFStringRef ifDevice)
+{
+       SCNetworkInterfaceRef   interface       = NULL;
+       CFArrayRef              vlans;
+
+       if (prefs == NULL) {
+               return (NULL);
        }
 
        }
 
-       ifDevice = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceDeviceName);
+       // check if the interface is a VLAN
+       vlans = SCVLANInterfaceCopyAll(prefs);
+       if (vlans != NULL) {
+               interface = findInterface(vlans, ifDevice);
+               CFRelease(vlans);
+       }
+       return interface;
+}
 
 
-       if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet) ||
-           CFEqual(ifType, kSCValNetInterfaceTypeFireWire) ||
-           (CFEqual(ifType, kSCValNetInterfaceTypePPP) && CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPoE))) {
-               char                    bsdName[IFNAMSIZ + 1];
-               CFMutableDictionaryRef  matching;
+
+SCNetworkInterfaceRef
+_SCNetworkInterfaceCreateWithBSDName(CFAllocatorRef            allocator,
+                                    CFStringRef                bsdName,
+                                    UInt32                     flags)
+{
+       CFMutableDictionaryRef  entity;
+       SCNetworkInterfaceRef   interface;
+
+       entity = CFDictionaryCreateMutable(NULL,
+                                          0,
+                                          &kCFTypeDictionaryKeyCallBacks,
+                                          &kCFTypeDictionaryValueCallBacks);
+       CFDictionarySetValue(entity, kSCPropNetInterfaceDeviceName, bsdName);
+       if ((flags & kIncludeVLANInterfaces) == 0) {
+               CFDictionarySetValue(entity, CFSTR("_NO_VLAN_INTERFACES_"), kCFBooleanTrue);
+       }
+       if ((flags & kIncludeBondInterfaces) == 0) {
+               CFDictionarySetValue(entity, CFSTR("_NO_BOND_INTERFACES_"), kCFBooleanTrue);
+       }
+       interface = _SCNetworkInterfaceCreateWithEntity(NULL, entity, NULL);
+       CFRelease(entity);
+
+       return interface;
+}
+
+
+SCNetworkInterfaceRef
+_SCNetworkInterfaceCreateWithEntity(CFAllocatorRef             allocator,
+                                   CFDictionaryRef             interface_entity,
+                                   SCNetworkServiceRef         service)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = NULL;
+       CFStringRef                     ifDevice;
+       CFStringRef                     ifSubType;
+       CFStringRef                     ifType;
+       CFArrayRef                      matching_interfaces     = NULL;
+
+       /* initialize runtime (and kSCNetworkInterfaceIPv4) */
+       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+
+       ifType = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceType);
+       if (ifType == NULL) {
+               /*
+                * The interface "Type" was not specified.  We'll make an
+                * assumption that this is an "Ethernet" interface.  If a
+                * real interface exists with the provided interface name
+                * then the actual type will be set accordingly. If not, we'll
+                * end up crafting an "Ethernet" SCNetworkInterface which
+                * will keep the rest of the configuration APIs happy.
+                */
+               ifType = kSCValNetInterfaceTypeEthernet;
+       }
+
+       if (!isA_CFString(ifType)) {
+               return NULL;
+       }
+
+       ifSubType = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceSubType);
+       if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
+               if (!isA_CFString(ifSubType)) {
+                       return NULL;
+               }
+       }
+
+       ifDevice = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceDeviceName);
+
+       if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet) ||
+           CFEqual(ifType, kSCValNetInterfaceTypeFireWire) ||
+           (CFEqual(ifType, kSCValNetInterfaceTypePPP) && CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPoE))) {
+               char                    bsdName[IFNAMSIZ + 1];
+               CFMutableDictionaryRef  matching;
 
                if (!isA_CFString(ifDevice)) {
                        return NULL;
 
                if (!isA_CFString(ifDevice)) {
                        return NULL;
@@ -1877,7 +2432,7 @@ __SCNetworkInterfaceCreateWithEntity(CFAllocatorRef               allocator,
                }
 
                // note: the "matching" dictionary will be consumed by the following
                }
 
                // note: the "matching" dictionary will be consumed by the following
-               matching_interfaces = findMatchingInterfaces(masterPort, matching, processNetworkInterface);
+               matching_interfaces = findMatchingInterfaces(matching, processNetworkInterface);
 
        } else if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
                if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) {
 
        } else if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
                if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) {
@@ -1903,7 +2458,7 @@ __SCNetworkInterfaceCreateWithEntity(CFAllocatorRef               allocator,
                                                      &kCFTypeDictionaryValueCallBacks);
 
                        // note: the "matching" dictionary will be consumed by the following
                                                      &kCFTypeDictionaryValueCallBacks);
 
                        // note: the "matching" dictionary will be consumed by the following
-                       matching_interfaces = findMatchingInterfaces(masterPort, matching, processSerialInterface);
+                       matching_interfaces = findMatchingInterfaces(matching, processSerialInterface);
 
                } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypeL2TP)) {
                        interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
 
                } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypeL2TP)) {
                        interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
@@ -1923,49 +2478,41 @@ __SCNetworkInterfaceCreateWithEntity(CFAllocatorRef             allocator,
 
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       kSCNetworkInterfaceType6to4);
 
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       kSCNetworkInterfaceType6to4);
-       } else if (CFStringFind(ifType, CFSTR("."), 0).location != kCFNotFound) {
+       } else if ((CFStringFind(ifType, CFSTR("."), 0).location != kCFNotFound) && (ifDevice == NULL)) {
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       ifType);
        }
 
        if (matching_interfaces != NULL) {
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       ifType);
        }
 
        if (matching_interfaces != NULL) {
-               CFIndex n;
+               CFIndex                 n;
+               SCPreferencesRef        prefs;
 
                n = CFArrayGetCount(matching_interfaces);
                switch (n) {
                        case 0 :
 
                n = CFArrayGetCount(matching_interfaces);
                switch (n) {
                        case 0 :
-                               if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) {
-                                       CFArrayRef      bonds;
-                                       CFArrayRef      vlans;
-
-                                       bonds = findBondInterfaces(ifDevice);
-                                       if (bonds != NULL) {
-                                               if (CFArrayGetCount(bonds) == 1) {
-                                                       interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(bonds, 0);
-                                                       CFRetain(interfacePrivate);
-                                               }
-                                               CFRelease(bonds);
-                                               break;
-                                       }
-
-                                       vlans = findVLANInterfaces(ifDevice);
-                                       if (vlans != NULL) {
-                                               if (CFArrayGetCount(vlans) == 1) {
-                                                       interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(vlans, 0);
-                                                       CFRetain(interfacePrivate);
-                                               }
-                                               CFRelease(vlans);
-                                               break;
-                                       }
+                               if (!CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) {
+                                       break;
+                               }
+                               prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkInterface"), NULL);
+                               if (prefs == NULL) {
+                                       break;
                                }
                                }
+                               if (!CFDictionaryContainsKey(interface_entity, CFSTR("_NO_VLAN_INTERFACES_"))) {
+                                       interfacePrivate = (SCNetworkInterfacePrivateRef)findVLANInterface(prefs, ifDevice);
+                               }
+                               if ((interfacePrivate == NULL)
+                                   && !CFDictionaryContainsKey(interface_entity, CFSTR("_NO_BOND_INTERFACES_"))) {
+                                       interfacePrivate = (SCNetworkInterfacePrivateRef)findBondInterface(prefs, ifDevice);
+                               }
+                               CFRelease(prefs);
                                break;
                        case 1 :
                                interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, 0);
                                CFRetain(interfacePrivate);
                                break;
                        default :
                                break;
                        case 1 :
                                interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, 0);
                                CFRetain(interfacePrivate);
                                break;
                        default :
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("__SCNetworkInterfaceCreateWithEntity() failed, more than one interface matches %@"), ifDevice);
-                               if (matching_interfaces != NULL) CFRelease(matching_interfaces);
+                               SCLog(TRUE, LOG_DEBUG, CFSTR("_SCNetworkInterfaceCreateWithEntity() failed, more than one interface matches %@"), ifDevice);
+                               CFRelease(matching_interfaces);
                                _SCErrorSet(kSCStatusFailed);
                                return NULL;
                }
                                _SCErrorSet(kSCStatusFailed);
                                return NULL;
                }
@@ -1975,18 +2522,18 @@ __SCNetworkInterfaceCreateWithEntity(CFAllocatorRef             allocator,
     done :
 
        if (interfacePrivate == NULL) {
     done :
 
        if (interfacePrivate == NULL) {
-               CFStringRef     entity_hardware;
-
                /*
                 * if device not present on this system
                 */
                /*
                 * if device not present on this system
                 */
-               interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL);
+               interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, NULL);
                interfacePrivate->entity_type     = ifType;
                interfacePrivate->entity_subtype  = ifSubType;
                interfacePrivate->entity_device   = (ifDevice != NULL) ? CFStringCreateCopy(NULL, ifDevice) : NULL;
 
                interfacePrivate->entity_type     = ifType;
                interfacePrivate->entity_subtype  = ifSubType;
                interfacePrivate->entity_device   = (ifDevice != NULL) ? CFStringCreateCopy(NULL, ifDevice) : NULL;
 
-               entity_hardware = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceHardware);
                if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) {
                if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) {
+                       CFStringRef     entity_hardware;
+
+                       entity_hardware = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceHardware);
                        if ((entity_hardware != NULL) &&
                            CFEqual(entity_hardware, kSCEntNetAirPort)) {
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211;
                        if ((entity_hardware != NULL) &&
                            CFEqual(entity_hardware, kSCEntNetAirPort)) {
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211;
@@ -1999,10 +2546,12 @@ __SCNetworkInterfaceCreateWithEntity(CFAllocatorRef             allocator,
                        if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPoE)) {
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet;
                        } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) {
                        if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPoE)) {
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet;
                        } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) {
-                               if        (CFStringHasPrefix(ifDevice, CFSTR("irda"))) {
-                                       interfacePrivate->interface_type = kSCNetworkInterfaceTypeIrDA;
-                               } else if (CFStringHasPrefix(ifDevice, CFSTR("Bluetooth"))) {
+                               if (CFStringHasPrefix(ifDevice, CFSTR("Bluetooth"))) {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeBluetooth;
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeBluetooth;
+                               } else if (CFStringHasPrefix(ifDevice, CFSTR("irda"))) {
+                                       interfacePrivate->interface_type = kSCNetworkInterfaceTypeIrDA;
+                               } else if (CFStringHasPrefix(ifDevice, CFSTR("wwan"))) {
+                                       interfacePrivate->interface_type = kSCNetworkInterfaceTypeWWAN;
                                } else {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeModem;
                                }
                                } else {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeModem;
                                }
@@ -2012,15 +2561,26 @@ __SCNetworkInterfaceCreateWithEntity(CFAllocatorRef             allocator,
                                interfacePrivate = (SCNetworkInterfacePrivateRef)kSCNetworkInterfaceIPv4;
                                CFRetain(interfacePrivate);
                        }
                                interfacePrivate = (SCNetworkInterfacePrivateRef)kSCNetworkInterfaceIPv4;
                                CFRetain(interfacePrivate);
                        }
+               } else if (CFStringFind(ifType, CFSTR("."), 0).location != kCFNotFound) {
+                       // if vendor interface
+                       interfacePrivate->interface_type = ifType;
                } else {
                } else {
-                       // unknown interface type
+                       // if unknown interface
                        CFRelease(interfacePrivate);
                        interfacePrivate = NULL;
                }
        }
 
        if ((interfacePrivate != NULL) && (service != NULL)) {
                        CFRelease(interfacePrivate);
                        interfacePrivate = NULL;
                }
        }
 
        if ((interfacePrivate != NULL) && (service != NULL)) {
-               interfacePrivate->service = service;
+               SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
+
+               if (interfacePrivate->prefs != NULL)
+                       CFRelease(interfacePrivate->prefs);
+               if (interfacePrivate->serviceID != NULL)
+                       CFRelease(interfacePrivate->serviceID);
+
+               interfacePrivate->prefs     = CFRetain(servicePrivate->prefs);
+               interfacePrivate->serviceID = CFRetain(servicePrivate->serviceID);
        }
 
        if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
        }
 
        if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
@@ -2036,40 +2596,34 @@ __SCNetworkInterfaceCreateWithEntity(CFAllocatorRef             allocator,
 }
 
 
 }
 
 
-/* ---------- SCNetworkInterface APIs ---------- */
+#pragma mark -
+#pragma mark SCNetworkInterface APIs
 
 
 
 
-CFArrayRef /* of SCNetworkInterfaceRef's */
-SCNetworkInterfaceCopyAll()
+__private_extern__
+CFArrayRef
+__SCNetworkInterfaceCopyAll_IONetworkInterface(void)
 {
 {
-       CFMutableArrayRef       all_interfaces;
-       static mach_port_t      masterPort      = MACH_PORT_NULL;
        CFDictionaryRef         matching;
        CFDictionaryRef         matching;
-       CFStringRef             match_keys[2];
-       CFStringRef             match_vals[2];
        CFArrayRef              new_interfaces;
 
        CFArrayRef              new_interfaces;
 
-       if (masterPort == MACH_PORT_NULL) {
-               kern_return_t   kr;
-
-               kr = IOMasterPort(MACH_PORT_NULL, &masterPort);
-               if (kr != KERN_SUCCESS) {
-                       return NULL;
-               }
-       }
-
-       all_interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
        // get Ethernet, Firewire, and AirPort interfaces
 
        matching = IOServiceMatching(kIONetworkInterfaceClass);
        // get Ethernet, Firewire, and AirPort interfaces
 
        matching = IOServiceMatching(kIONetworkInterfaceClass);
-       new_interfaces = findMatchingInterfaces(masterPort, matching, processNetworkInterface);
-       if (new_interfaces != NULL) {
-               CFArrayAppendArray(all_interfaces, new_interfaces, CFRangeMake(0, CFArrayGetCount(new_interfaces)));
-               CFRelease(new_interfaces);
-       }
+       new_interfaces = findMatchingInterfaces(matching, processNetworkInterface);
 
 
-       // get Modem interfaces
+       return new_interfaces;
+}
+
+
+static
+CFArrayRef
+__SCNetworkInterfaceCopyAll_Modem()
+{
+       CFDictionaryRef         matching;
+       CFStringRef             match_keys[2];
+       CFStringRef             match_vals[2];
+       CFArrayRef              new_interfaces;
 
        match_keys[0] = CFSTR(kIOProviderClassKey);
        match_vals[0] = CFSTR(kIOSerialBSDServiceValue);
 
        match_keys[0] = CFSTR(kIOProviderClassKey);
        match_vals[0] = CFSTR(kIOSerialBSDServiceValue);
@@ -2083,13 +2637,20 @@ SCNetworkInterfaceCopyAll()
                                      sizeof(match_keys)/sizeof(match_keys[0]),
                                      &kCFTypeDictionaryKeyCallBacks,
                                      &kCFTypeDictionaryValueCallBacks);
                                      sizeof(match_keys)/sizeof(match_keys[0]),
                                      &kCFTypeDictionaryKeyCallBacks,
                                      &kCFTypeDictionaryValueCallBacks);
-       new_interfaces = findMatchingInterfaces(masterPort, matching, processSerialInterface);
-       if (new_interfaces != NULL) {
-               CFArrayAppendArray(all_interfaces, new_interfaces, CFRangeMake(0, CFArrayGetCount(new_interfaces)));
-               CFRelease(new_interfaces);
-       }
+       new_interfaces = findMatchingInterfaces(matching, processSerialInterface);
 
 
-       // get serial (RS232) interfaces
+       return new_interfaces;
+}
+
+
+static
+CFArrayRef
+__SCNetworkInterfaceCopyAll_RS232()
+{
+       CFDictionaryRef         matching;
+       CFStringRef             match_keys[2];
+       CFStringRef             match_vals[2];
+       CFArrayRef              new_interfaces;
 
        match_keys[0] = CFSTR(kIOProviderClassKey);
        match_vals[0] = CFSTR(kIOSerialBSDServiceValue);
 
        match_keys[0] = CFSTR(kIOProviderClassKey);
        match_vals[0] = CFSTR(kIOSerialBSDServiceValue);
@@ -2103,24 +2664,146 @@ SCNetworkInterfaceCopyAll()
                                      sizeof(match_keys)/sizeof(match_keys[0]),
                                      &kCFTypeDictionaryKeyCallBacks,
                                      &kCFTypeDictionaryValueCallBacks);
                                      sizeof(match_keys)/sizeof(match_keys[0]),
                                      &kCFTypeDictionaryKeyCallBacks,
                                      &kCFTypeDictionaryValueCallBacks);
-       new_interfaces = findMatchingInterfaces(masterPort, matching, processSerialInterface);
+       new_interfaces = findMatchingInterfaces(matching, processSerialInterface);
+
+       return new_interfaces;
+}
+
+
+static void
+add_interfaces(CFMutableArrayRef all_interfaces, CFArrayRef new_interfaces)
+{
+       CFIndex i;
+       CFIndex n;
+
+       n = CFArrayGetCount(new_interfaces);
+       for (i = 0; i < n; i++) {
+               CFStringRef             bsdName;
+               SCNetworkInterfaceRef   interface;
+
+               interface = CFArrayGetValueAtIndex(new_interfaces, i);
+               bsdName = SCNetworkInterfaceGetBSDName(interface);
+               if (bsdName != NULL) {
+                       CFArrayAppendValue(all_interfaces, interface);
+               }
+       }
+
+       return;
+}
+
+
+static void
+__waitForInterfaces()
+{
+       CFStringRef             key;
+       CFArrayRef              keys;
+       Boolean                 ok;
+       SCDynamicStoreRef       store;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkInterfaceCopyAll"), NULL, NULL);
+       if (store == NULL) {
+               return;
+       }
+
+       key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@" "InterfaceNamer"), kSCDynamicStoreDomainPlugin);
+       keys = CFArrayCreate(NULL, (const void **)&key, 1, &kCFTypeArrayCallBacks);
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
+       CFRelease(keys);
+       if (!ok) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       while (TRUE) {
+               CFDictionaryRef dict;
+               Boolean         quiet   = FALSE;
+
+               // check if quiet
+               dict = SCDynamicStoreCopyValue(store, key);
+               if (dict != NULL) {
+                       if (isA_CFDictionary(dict) &&
+                           (CFDictionaryContainsKey(dict, CFSTR("*QUIET*")) ||
+                            CFDictionaryContainsKey(dict, CFSTR("*TIMEOUT*")))) {
+                               quiet = TRUE;
+                       }
+                       CFRelease(dict);
+               }
+               if (quiet) {
+                       break;
+               }
+
+               ok = SCDynamicStoreNotifyWait(store);
+               if (!ok) {
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("SCDynamicStoreNotifyWait() failed: %s"), SCErrorString(SCError()));
+                       goto done;
+               }
+       }
+
+    done :
+
+       CFRelease(key);
+       CFRelease(store);
+       return;
+}
+
+
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCNetworkInterfaceCopyAll()
+{
+       CFMutableArrayRef       all_interfaces;
+       CFArrayRef              new_interfaces;
+       SCPreferencesRef        prefs;
+
+       /* initialize runtime */
+       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+
+       /* wait for IOKit to quiesce */
+       pthread_once(&iokit_quiet, __waitForInterfaces);
+
+       all_interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       // get Ethernet, Firewire, and AirPort interfaces
+       new_interfaces = __SCNetworkInterfaceCopyAll_IONetworkInterface();
        if (new_interfaces != NULL) {
        if (new_interfaces != NULL) {
-               CFArrayAppendArray(all_interfaces, new_interfaces, CFRangeMake(0, CFArrayGetCount(new_interfaces)));
+               add_interfaces(all_interfaces, new_interfaces);
                CFRelease(new_interfaces);
        }
 
                CFRelease(new_interfaces);
        }
 
-       new_interfaces = findBondInterfaces(NULL);
+       // get Modem interfaces
+       new_interfaces = __SCNetworkInterfaceCopyAll_Modem();
        if (new_interfaces != NULL) {
        if (new_interfaces != NULL) {
-               CFArrayAppendArray(all_interfaces, new_interfaces, CFRangeMake(0, CFArrayGetCount(new_interfaces)));
+               add_interfaces(all_interfaces, new_interfaces);
                CFRelease(new_interfaces);
        }
 
                CFRelease(new_interfaces);
        }
 
-       new_interfaces = findVLANInterfaces(NULL);
+       // get serial (RS232) interfaces
+       new_interfaces = __SCNetworkInterfaceCopyAll_RS232();
        if (new_interfaces != NULL) {
        if (new_interfaces != NULL) {
-               CFArrayAppendArray(all_interfaces, new_interfaces, CFRangeMake(0, CFArrayGetCount(new_interfaces)));
+               add_interfaces(all_interfaces, new_interfaces);
                CFRelease(new_interfaces);
        }
 
                CFRelease(new_interfaces);
        }
 
+       // get virtual network interfaces (Bond, VLAN)
+       prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkInterfaceCopyAll"), NULL);
+       if (prefs != NULL) {
+               new_interfaces = SCBondInterfaceCopyAll(prefs);
+               if (new_interfaces != NULL) {
+                       add_interfaces(all_interfaces, new_interfaces);
+                       CFRelease(new_interfaces);
+               }
+
+               new_interfaces = SCVLANInterfaceCopyAll(prefs);
+               if (new_interfaces != NULL) {
+                       add_interfaces(all_interfaces, new_interfaces);
+                       CFRelease(new_interfaces);
+               }
+
+               CFRelease(prefs);
+       }
+
+       // all interfaces have been identified, order and return
        sort_interfaces(all_interfaces);
 
        return all_interfaces;
        sort_interfaces(all_interfaces);
 
        return all_interfaces;
@@ -2133,8 +2816,10 @@ SCNetworkInterfaceGetSupportedInterfaceTypes(SCNetworkInterfaceRef interface)
        CFIndex                         i;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
        CFIndex                         i;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
-       /* initialize runtime (and kSCNetworkInterfaceIPv4) */
-       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
 
        if (interfacePrivate->supported_interface_types != NULL) {
                goto done;
 
        if (interfacePrivate->supported_interface_types != NULL) {
                goto done;
@@ -2171,8 +2856,10 @@ SCNetworkInterfaceGetSupportedProtocolTypes(SCNetworkInterfaceRef interface)
        CFIndex                         i;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
        CFIndex                         i;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
-       /* initialize runtime (and kSCNetworkInterfaceIPv4) */
-       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
 
        if (interfacePrivate->supported_protocol_types != NULL) {
                goto done;
 
        if (interfacePrivate->supported_protocol_types != NULL) {
                goto done;
@@ -2197,6 +2884,9 @@ SCNetworkInterfaceGetSupportedProtocolTypes(SCNetworkInterfaceRef interface)
                        if (configurations[i].supported_protocols & doProxies) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeProxies);
                        }
                        if (configurations[i].supported_protocols & doProxies) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeProxies);
                        }
+                       if (configurations[i].supported_protocols & doSMB) {
+                               CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeSMB);
+                       }
                }
        }
 
                }
        }
 
@@ -2213,12 +2903,23 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
        CFIndex                         childIndex;
        SCNetworkInterfacePrivateRef    parentPrivate;
 
        CFIndex                         childIndex;
        SCNetworkInterfacePrivateRef    parentPrivate;
 
-       /* initialize runtime (and kSCNetworkInterfaceIPv4) */
-       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+       if (!isA_SCNetworkInterface(child)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (!isA_CFString(interfaceType)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
 
        childIndex = findConfiguration(childPrivate->interface_type);
 
 
        childIndex = findConfiguration(childPrivate->interface_type);
 
-       parentPrivate = __SCNetworkInterfaceCreatePrivate(NULL, child, childPrivate->service, NULL);
+       parentPrivate = __SCNetworkInterfaceCreatePrivate(NULL,
+                                                         child,
+                                                         childPrivate->prefs,
+                                                         childPrivate->serviceID,
+                                                         NULL);
        if (parentPrivate == NULL) {
                _SCErrorSet(kSCStatusFailed);
                return NULL;
        if (parentPrivate == NULL) {
                _SCErrorSet(kSCStatusFailed);
                return NULL;
@@ -2251,6 +2952,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                        goto fail;
                }
                parentPrivate->interface_type = kSCNetworkInterfaceTypeL2TP;
                        goto fail;
                }
                parentPrivate->interface_type = kSCNetworkInterfaceTypeL2TP;
+               parentPrivate->localized_key  = CFSTR("l2tp");
                parentPrivate->entity_type    = kSCValNetInterfaceSubTypeL2TP;  // interface config goes into "L2TP"
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) {
                if ((childIndex == kCFNotFound) ||
                parentPrivate->entity_type    = kSCValNetInterfaceSubTypeL2TP;  // interface config goes into "L2TP"
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) {
                if ((childIndex == kCFNotFound) ||
@@ -2259,6 +2961,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                        goto fail;
                }
                parentPrivate->interface_type = kSCNetworkInterfaceTypePPTP;
                        goto fail;
                }
                parentPrivate->interface_type = kSCNetworkInterfaceTypePPTP;
+               parentPrivate->localized_key  = CFSTR("pptp");
                parentPrivate->entity_type    = kSCValNetInterfaceSubTypePPTP;  // interface config goes into "PPTP"
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceType6to4)) {
                if ((childIndex == kCFNotFound) ||
                parentPrivate->entity_type    = kSCValNetInterfaceSubTypePPTP;  // interface config goes into "PPTP"
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceType6to4)) {
                if ((childIndex == kCFNotFound) ||
@@ -2268,6 +2971,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                }
 
                parentPrivate->interface_type = kSCNetworkInterfaceType6to4;
                }
 
                parentPrivate->interface_type = kSCNetworkInterfaceType6to4;
+               parentPrivate->localized_key  = CFSTR("6to4");
                parentPrivate->entity_type    = kSCEntNet6to4;
                parentPrivate->entity_device  = CFRetain(CFSTR("stf0"));
        } else if (CFStringFind(interfaceType, CFSTR("."), 0).location != kCFNotFound) {
                parentPrivate->entity_type    = kSCEntNet6to4;
                parentPrivate->entity_device  = CFRetain(CFSTR("stf0"));
        } else if (CFStringFind(interfaceType, CFSTR("."), 0).location != kCFNotFound) {
@@ -2281,6 +2985,9 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                goto fail;
        }
 
                goto fail;
        }
 
+       if (childPrivate->overrides != NULL) {
+               parentPrivate->overrides = CFDictionaryCreateMutableCopy(NULL, 0, childPrivate->overrides);
+       };
        parentPrivate->sort_order = childPrivate->sort_order;
 
        return (SCNetworkInterfaceRef)parentPrivate;
        parentPrivate->sort_order = childPrivate->sort_order;
 
        return (SCNetworkInterfaceRef)parentPrivate;
@@ -2294,7 +3001,8 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
 
 
 static CFDictionaryRef
 
 
 static CFDictionaryRef
-__SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef interface, Boolean okToHold)
+__SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef     interface,
+                                    CFStringRef                extendedType)
 {
        CFDictionaryRef                 config                  = NULL;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 {
        CFDictionaryRef                 config                  = NULL;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
@@ -2303,17 +3011,25 @@ __SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef interface, Boolean ok
        /* initialize runtime (and kSCNetworkInterfaceIPv4) */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
        /* initialize runtime (and kSCNetworkInterfaceIPv4) */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
-       paths = copyConfigurationPaths(interfacePrivate);
+       paths = copyConfigurationPaths(interfacePrivate, extendedType);
        if (paths != NULL) {
                CFStringRef                     path;
        if (paths != NULL) {
                CFStringRef                     path;
-               SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)interfacePrivate->service;
 
                path = CFArrayGetValueAtIndex(paths, 0);
 
                path = CFArrayGetValueAtIndex(paths, 0);
-               config = __getPrefsConfiguration(servicePrivate->prefs, path);
+               config = __getPrefsConfiguration(interfacePrivate->prefs, path);
 
                CFRelease(paths);
 
                CFRelease(paths);
-       } else if (okToHold) {
-               config = interfacePrivate->unsaved;
+       } else {
+               if (interfacePrivate->unsaved != NULL) {
+                       config = CFDictionaryGetValue(interfacePrivate->unsaved, extendedType);
+                       if (config == (CFDictionaryRef)kCFNull) {
+                               config = NULL;
+                       }
+               }
+       }
+
+       if (isA_CFDictionary(config) && (CFDictionaryGetCount(config) == 0)) {
+               config = NULL;
        }
 
        return config;
        }
 
        return config;
@@ -2323,7 +3039,64 @@ __SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef interface, Boolean ok
 CFDictionaryRef
 SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef interface)
 {
 CFDictionaryRef
 SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef interface)
 {
-       return __SCNetworkInterfaceGetConfiguration(interface, FALSE);
+       CFDictionaryRef config;
+       CFStringRef     defaultType;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+       if (defaultType == NULL) {
+               return NULL;
+       }
+
+       config = __SCNetworkInterfaceGetConfiguration(interface, defaultType);
+       if (config == NULL) {
+               if (CFEqual(defaultType, kSCEntNetAirPort)) {
+                       SCNetworkInterfacePrivateRef    interfacePrivate;
+                       CFStringRef                     path;
+
+                       // if AirPort interface, check for a per-service config
+                       interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
+                       path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
+                                                                             interfacePrivate->serviceID,      // service
+                                                                             kSCEntNetAirPort);                // entity
+                       config = __getPrefsConfiguration(interfacePrivate->prefs, path);
+                       CFRelease(path);
+               }
+       }
+       if (config == NULL) {
+               _SCErrorSet(kSCStatusOK);
+       }
+
+       return config;
+}
+
+
+CFDictionaryRef
+SCNetworkInterfaceGetExtendedConfiguration(SCNetworkInterfaceRef       interface,
+                                          CFStringRef                  extendedType)
+{
+       CFDictionaryRef config;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (!__SCNetworkInterfaceIsValidExtendedConfigurationType(interface, extendedType, TRUE)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       config = __SCNetworkInterfaceGetConfiguration(interface, extendedType);
+       if (config == NULL) {
+               _SCErrorSet(kSCStatusOK);
+       }
+
+       return config;
 }
 
 
 }
 
 
@@ -2332,7 +3105,14 @@ SCNetworkInterfaceGetBSDName(SCNetworkInterfaceRef interface)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
-       if (interfacePrivate->interface != NULL) {
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if ((interfacePrivate->interface != NULL) &&
+           (interfacePrivate->interface != kSCNetworkInterfaceIPv4)) {
+               _SCErrorSet(kSCStatusOK);
                return NULL;
        }
 
                return NULL;
        }
 
@@ -2345,7 +3125,35 @@ SCNetworkInterfaceGetHardwareAddressString(SCNetworkInterfaceRef interface)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
-       return interfacePrivate->address;
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if ((interfacePrivate->address != NULL) &&
+           (interfacePrivate->addressString == NULL)) {
+               uint8_t         *bp;
+               char            *cp;
+               CFIndex         n;
+               char            mac[sizeof("xx:xx:xx:xx:xx:xx:xx:xx")];
+               char            *mac_p  = mac;
+
+               bp = (uint8_t *)CFDataGetBytePtr(interfacePrivate->address);
+               n  = CFDataGetLength(interfacePrivate->address) * 3;
+
+               if (n > sizeof(mac)) {
+                       mac_p = CFAllocatorAllocate(NULL, 0, n);
+               }
+
+               for (cp = mac_p; n > 0; n -= 3) {
+                       cp += snprintf(cp, n, "%2.2x:", *bp++);
+               }
+
+               interfacePrivate->addressString = CFStringCreateWithCString(NULL, mac_p, kCFStringEncodingUTF8);
+               if (mac_p != mac)       CFAllocatorDeallocate(NULL, mac_p);
+       }
+
+       return interfacePrivate->addressString;
 }
 
 
 }
 
 
@@ -2354,6 +3162,11 @@ SCNetworkInterfaceGetInterface(SCNetworkInterfaceRef interface)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        return interfacePrivate->interface;
 }
 
        return interfacePrivate->interface;
 }
 
@@ -2363,47 +3176,97 @@ SCNetworkInterfaceGetInterfaceType(SCNetworkInterfaceRef interface)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
-       /* initialize runtime (and kSCNetworkInterfaceIPv4) */
-       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
 
        return interfacePrivate->interface_type;
 }
 
 
 
        return interfacePrivate->interface_type;
 }
 
 
-CFStringRef
-SCNetworkInterfaceGetLocalizedDisplayName(SCNetworkInterfaceRef interface)
+static CFStringRef
+copy_interface_string(CFBundleRef bundle, CFStringRef key, Boolean localized)
 {
 {
-       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+       CFStringRef     str     = NULL;
 
 
-       if (interfacePrivate->localized_name == NULL) {
-               CFStringRef             child   = NULL;
-               CFMutableStringRef      local   = NULL;
+       if (localized) {
+               str = CFBundleCopyLocalizedString(bundle,
+                                                 key,
+                                                 key,
+                                                 NETWORKINTERFACE_LOCALIZATIONS);
+       } else {
+               str = _SC_CFBundleCopyNonLocalizedString(bundle,
+                                                        key,
+                                                        key,
+                                                        NETWORKINTERFACE_LOCALIZATIONS);
+       }
+
+       return str;
+}
+
+
+static CFStringRef
+copy_display_name(SCNetworkInterfaceRef interface, Boolean localized)
+{
+       CFMutableStringRef      local;
+       CFStringRef             name;
+
+       local = CFStringCreateMutable(NULL, 0);
+
+       while (interface != NULL) {
+               Boolean                         added                   = FALSE;
+               SCNetworkInterfaceRef           child                   = NULL;
+               SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
 
-               if (interfacePrivate->interface != NULL) {
-                       child = SCNetworkInterfaceGetLocalizedDisplayName(interfacePrivate->interface);
+               if ((interfacePrivate->interface != NULL) &&
+                   (interfacePrivate->interface != kSCNetworkInterfaceIPv4)) {
+                       child = interfacePrivate->interface;
                }
 
                if ((bundle != NULL) && (interfacePrivate->localized_key != NULL)) {
                        CFStringRef     fmt;
 
                }
 
                if ((bundle != NULL) && (interfacePrivate->localized_key != NULL)) {
                        CFStringRef     fmt;
 
-                       fmt = CFBundleCopyLocalizedString(bundle,
-                                                         interfacePrivate->localized_key,
-                                                         interfacePrivate->localized_key,
-                                                         NETWORKINTERFACE_LOCALIZATIONS);
+                       fmt = copy_interface_string(bundle, interfacePrivate->localized_key, localized);
                        if (fmt != NULL) {
                        if (fmt != NULL) {
-                               local = CFStringCreateMutable(NULL, 0);
                                CFStringAppendFormat(local,
                                                     NULL,
                                                     fmt,
                                                     interfacePrivate->localized_arg1,
                                                     interfacePrivate->localized_arg2);
                                CFRelease(fmt);
                                CFStringAppendFormat(local,
                                                     NULL,
                                                     fmt,
                                                     interfacePrivate->localized_arg1,
                                                     interfacePrivate->localized_arg2);
                                CFRelease(fmt);
+                               added = TRUE;
+                       }
+               }
+
+               if (!added &&
+                   (interfacePrivate->prefs != NULL) &&
+                   (interfacePrivate->serviceID != NULL) &&
+                   (child == NULL)) {
+                       CFDictionaryRef entity;
+                       CFStringRef     path;
+
+                       // check for (and use) the name of the interface when it
+                       // was last available
+                       path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,
+                                                                             interfacePrivate->serviceID,
+                                                                             kSCEntNetInterface);
+                       entity = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+                       CFRelease(path);
+                       if (isA_CFDictionary(entity)) {
+                               CFStringRef     name;
+
+                               name = CFDictionaryGetValue(entity, kSCPropUserDefinedName);
+                               if (isA_CFString(name)) {
+                                       CFStringAppend(local, name);
+                                       added = TRUE;
+                               }
                        }
                }
 
                        }
                }
 
-               if (local == NULL) {
+               if (!added) {
                        // create (non-)localized name based on the interface type
                        // create (non-)localized name based on the interface type
-                       local = CFStringCreateMutableCopy(NULL, 0, interfacePrivate->interface_type);
+                       CFStringAppend(local, interfacePrivate->interface_type);
 
                        // ... and, if this is a leaf node, the interface device
                        if ((interfacePrivate->entity_device != NULL) && (child == NULL)) {
 
                        // ... and, if this is a leaf node, the interface device
                        if ((interfacePrivate->entity_device != NULL) && (child == NULL)) {
@@ -2411,41 +3274,70 @@ SCNetworkInterfaceGetLocalizedDisplayName(SCNetworkInterfaceRef interface)
                        }
                }
 
                        }
                }
 
-               if (child == NULL) {
-                       // no child, show just this interfaces localized name
-                       interfacePrivate->localized_name = CFStringCreateCopy(NULL, local);
-               } else {
-                       // show localized interface name layered over child
-                       interfacePrivate->localized_name = CFStringCreateWithFormat(NULL,
-                                                                                   NULL,
-                                                                                   CFSTR("%@ --> %@"),
-                                                                                   local,
-                                                                                   child);
+               if (child != NULL) {
+                       // if this interface is layered over another
+                       CFStringAppend(local, CFSTR(" --> "));
                }
                }
-               CFRelease(local);
+
+               interface = child;
        }
 
        }
 
-       return interfacePrivate->localized_name;
+       name = CFStringCreateCopy(NULL, local);
+       CFRelease(local);
+
+       return name;
 }
 
 
 __private_extern__
 CFStringRef
 }
 
 
 __private_extern__
 CFStringRef
-__SCNetworkInterfaceGetModemCCL(SCNetworkInterfaceRef interface)
+__SCNetworkInterfaceGetNonLocalizedDisplayName(SCNetworkInterfaceRef interface)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
-       return interfacePrivate->modemCCL;
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (interfacePrivate->name == NULL) {
+               interfacePrivate->name = copy_display_name(interface, FALSE);
+       }
+
+       return interfacePrivate->name;
+}
+
+
+CFStringRef
+SCNetworkInterfaceGetLocalizedDisplayName(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (interfacePrivate->localized_name == NULL) {
+               interfacePrivate->localized_name = copy_display_name(interface, TRUE);
+       }
+
+       return interfacePrivate->localized_name;
 }
 
 
 __private_extern__
 }
 
 
 __private_extern__
-Boolean
-__SCNetworkInterfaceIsModemV92(SCNetworkInterfaceRef interface)
+CFDictionaryRef
+__SCNetworkInterfaceGetTemplateOverrides(SCNetworkInterfaceRef interface, CFStringRef interfaceType)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+       CFDictionaryRef                 overrides               = NULL;
 
 
-       return interfacePrivate->modemIsV92;
+       if (interfacePrivate->overrides != NULL) {
+               overrides = CFDictionaryGetValue(interfacePrivate->overrides, interfaceType);
+       }
+
+       return overrides;
 }
 
 
 }
 
 
@@ -2457,8 +3349,12 @@ SCNetworkInterfaceGetTypeID(void)
 }
 
 
 }
 
 
-__private_extern__ Boolean
-__SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef interface, CFDictionaryRef config, Boolean okToHold)
+__private_extern__
+Boolean
+__SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef     interface,
+                                    CFStringRef                extendedType,
+                                    CFDictionaryRef            config,
+                                    Boolean                    okToHold)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
        Boolean                         ok                      = FALSE;
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
        Boolean                         ok                      = FALSE;
@@ -2467,33 +3363,63 @@ __SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef interface, CFDictiona
        /* initialize runtime (and kSCNetworkInterfaceIPv4) */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
        /* initialize runtime (and kSCNetworkInterfaceIPv4) */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
-       paths = copyConfigurationPaths(interfacePrivate);
+       if (extendedType == NULL) {
+               extendedType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+               if (extendedType == NULL) {
+                       return FALSE;
+               }
+       }
+
+       if (isA_CFDictionary(config) && (CFDictionaryGetCount(config) == 0)) {
+               config = NULL;
+       }
+
+       paths = copyConfigurationPaths(interfacePrivate, extendedType);
        if (paths != NULL) {
                CFIndex                         i;
                CFIndex                         n;
        if (paths != NULL) {
                CFIndex                         i;
                CFIndex                         n;
-               SCPreferencesRef                prefs;
-               SCNetworkServicePrivateRef      servicePrivate;
-
-               servicePrivate  = (SCNetworkServicePrivateRef)interfacePrivate->service;
-               prefs = servicePrivate->prefs;
 
                n = CFArrayGetCount(paths);
                for (i = 0; i < n; i++) {
                        CFStringRef     path;
 
                        path = CFArrayGetValueAtIndex(paths, i);
 
                n = CFArrayGetCount(paths);
                for (i = 0; i < n; i++) {
                        CFStringRef     path;
 
                        path = CFArrayGetValueAtIndex(paths, i);
-                       ok = __setPrefsConfiguration(prefs, path, config, FALSE);
+                       ok = __setPrefsConfiguration(interfacePrivate->prefs, path, config, FALSE);
                        if (!ok) {
                                break;
                        }
                }
 
                        if (!ok) {
                                break;
                        }
                }
 
+               if (ok) {
+                       // if configuration has been saved
+                       if (interfacePrivate->unsaved != NULL) {
+                               CFDictionaryRemoveValue(interfacePrivate->unsaved, extendedType);
+                               if (CFDictionaryGetCount(interfacePrivate->unsaved) == 0) {
+                                       CFRelease(interfacePrivate->unsaved);
+                                       interfacePrivate->unsaved = NULL;
+                               }
+                       }
+               }
+
                CFRelease(paths);
                CFRelease(paths);
-       } else if (okToHold) {
-               interfacePrivate->unsaved = config;
-               ok = TRUE;
        } else {
        } else {
-               _SCErrorSet(kSCStatusNoKey);
+               if (okToHold) {
+                       if (config == NULL) {
+                               // remember that we are clearing the configuration
+                               config = (CFDictionaryRef)kCFNull;
+                       }
+
+                       if (interfacePrivate->unsaved == NULL) {
+                               interfacePrivate->unsaved = CFDictionaryCreateMutable(NULL,
+                                                                                     0,
+                                                                                     &kCFTypeDictionaryKeyCallBacks,
+                                                                                     &kCFTypeDictionaryValueCallBacks);
+                       }
+                       CFDictionarySetValue(interfacePrivate->unsaved, extendedType, config);
+                       ok = TRUE;
+               } else {
+                       _SCErrorSet(kSCStatusNoKey);
+               }
        }
 
        return ok;
        }
 
        return ok;
@@ -2503,17 +3429,901 @@ __SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef interface, CFDictiona
 Boolean
 SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef interface, CFDictionaryRef config)
 {
 Boolean
 SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef interface, CFDictionaryRef config)
 {
-       return __SCNetworkInterfaceSetConfiguration(interface, config, FALSE);
+       CFStringRef     defaultType;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+       if (defaultType == NULL) {
+               return FALSE;
+       }
+
+       return __SCNetworkInterfaceSetConfiguration(interface, defaultType, config, FALSE);
 }
 
 
 }
 
 
-/* ---------- SCNetworkInterface internal SPIs ---------- */
+Boolean
+SCNetworkInterfaceSetExtendedConfiguration(SCNetworkInterfaceRef       interface,
+                                          CFStringRef                  extendedType,
+                                          CFDictionaryRef              config)
+{
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!__SCNetworkInterfaceIsValidExtendedConfigurationType(interface, extendedType, TRUE)) {
+               return FALSE;
+       }
+
+       return __SCNetworkInterfaceSetConfiguration(interface, extendedType, config, FALSE);
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkInterface [Refresh Configuration] API
+
+
+#ifndef kSCEntNetRefreshConfiguration
+#define kSCEntNetRefreshConfiguration  CFSTR("RefreshConfiguration")
+#endif // kSCEntNetRefreshConfiguration
+
+Boolean
+_SCNetworkInterfaceForceConfigurationRefresh(CFStringRef ifName)
+{
+       CFStringRef             key;
+       Boolean                 ok     = FALSE;
+       SCDynamicStoreRef       store;
+
+       if (!isA_CFString(ifName)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("_SCNetworkInterfaceForceConfigurationRefresh"), NULL, NULL);
+       if (store == NULL) {
+               return FALSE;
+       }
+
+       key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
+                                                           kSCDynamicStoreDomainState,
+                                                           ifName,
+                                                           kSCEntNetRefreshConfiguration);
+       ok = SCDynamicStoreNotifyValue(store, key);
+       CFRelease(key);
+       CFRelease(store);
+       return ok;
+}
+
+
+static Boolean
+__SCNetworkInterfaceForceConfigurationRefresh_helper(SCPreferencesRef prefs, CFStringRef ifName)
+{
+       CFDataRef               data            = NULL;
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+       CFDataRef               reply           = NULL;
+
+       if (prefsPrivate->helper == -1) {
+               ok = __SCPreferencesCreate_helper(prefs);
+               if (!ok) {
+                       return FALSE;
+               }
+       }
+
+       // serialize the interface name
+       ok = _SCSerializeString(ifName, &data, NULL, NULL);
+       if (!ok) {
+               goto fail;
+       }
+
+       // have the helper "refresh" the configuration
+       status = kSCStatusOK;
+       reply  = NULL;
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_INTERFACE_REFRESH,
+                          data,
+                          &status,
+                          NULL);
+       if (data != NULL) CFRelease(data);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       _SCErrorSet(status);
+       return FALSE;
+}
+
+
+Boolean
+SCNetworkInterfaceForceConfigurationRefresh(SCNetworkInterfaceRef interface)
+{
+       CFStringRef                     ifName;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       ifName = SCNetworkInterfaceGetBSDName(interface);
+       if (ifName == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (interfacePrivate->prefs != NULL) {
+               SCPreferencesRef                prefs           = interfacePrivate->prefs;
+               SCPreferencesPrivateRef         prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+
+               if (prefsPrivate->authorizationData != NULL) {
+                       return __SCNetworkInterfaceForceConfigurationRefresh_helper(prefs, ifName);
+               }
+       }
+
+       return _SCNetworkInterfaceForceConfigurationRefresh(ifName);
+}
+
+
+Boolean
+SCNetworkInterfaceRefreshConfiguration(CFStringRef ifName)
+{
+       return _SCNetworkInterfaceForceConfigurationRefresh(ifName);
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkInterface Password APIs
+
+
+static CFStringRef
+getPasswordID(CFDictionaryRef config, CFStringRef serviceID)
+{
+       CFStringRef     unique_id       = NULL;
+
+       if (config != NULL) {
+               CFStringRef     encryption;
+
+               encryption = CFDictionaryGetValue(config, kSCPropNetPPPAuthPasswordEncryption);
+               if (isA_CFString(encryption) &&
+                   CFEqual(encryption, kSCValNetPPPAuthPasswordEncryptionKeychain)) {
+                       unique_id = CFDictionaryGetValue(config, kSCPropNetPPPAuthPassword);
+               }
+       }
+       if (unique_id == NULL) {
+               unique_id = serviceID;
+       }
+
+       return unique_id;
+}
+
+
+static CFStringRef
+copySharedSecretID(CFDictionaryRef config, CFStringRef serviceID)
+{
+       CFMutableStringRef      sharedSecret    = NULL;
+
+       if (config != NULL) {
+               CFStringRef     encryption;
+
+               encryption = CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecretEncryption);
+               if (isA_CFString(encryption) &&
+                   CFEqual(encryption, kSCValNetIPSecSharedSecretEncryptionKeychain)) {
+                       sharedSecret = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecret);
+                       if (sharedSecret != NULL) {
+                               CFRetain(sharedSecret);
+                       }
+               }
+       }
+
+       if (sharedSecret == NULL) {
+               CFStringRef     unique_id;
+
+               unique_id = getPasswordID(config, serviceID);
+               sharedSecret = CFStringCreateMutableCopy(NULL, 0, unique_id);
+               CFStringAppend(sharedSecret, CFSTR(".SS"));
+       }
+
+       return sharedSecret;
+}
+
+
+static Boolean
+checkInterfacePassword(SCNetworkInterfaceRef           interface,
+                      SCNetworkInterfacePasswordType   passwordType,
+                      SCPreferencesRef                 *prefs,
+                      CFStringRef                      *serviceID)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       *serviceID = interfacePrivate->serviceID;
+       if (*serviceID == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       *prefs = interfacePrivate->prefs;
+       if (*prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFStringRef     interfaceType;
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFStringRef             interfaceType;
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+
+                       interface = SCNetworkInterfaceGetInterface(interface);
+                       if (interface == NULL) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeEAPOL : {
+                       break;
+               }
+
+               default :
+                       break;
+       }
+
+       return TRUE;
+}
+
+
+Boolean
+SCNetworkInterfaceCheckPassword(SCNetworkInterfaceRef          interface,
+                               SCNetworkInterfacePasswordType  passwordType)
+{
+       Boolean                 exists          = FALSE;
+       SCPreferencesRef        prefs           = NULL;
+       CFStringRef             serviceID       = NULL;
+
+       if (!checkInterfacePassword(interface, passwordType, &prefs, &serviceID)) {
+               return FALSE;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get serviceID
+                       unique_id = getPasswordID(config, serviceID);
+
+                       // check
+                       exists = __extract_password(prefs,
+                                                   config,
+                                                   kSCPropNetPPPAuthPassword,
+                                                   kSCPropNetPPPAuthPasswordEncryption,
+                                                   kSCValNetPPPAuthPasswordEncryptionKeychain,
+                                                   unique_id,
+                                                   NULL);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFDictionaryRef config;
+                       CFStringRef     shared_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+
+                       // get sharedSecret ID
+                       shared_id = copySharedSecretID(config, serviceID);
+
+                       // check
+                       exists = __extract_password(prefs,
+                                                   config,
+                                                   kSCPropNetIPSecSharedSecret,
+                                                   kSCPropNetIPSecSharedSecretEncryption,
+                                                   kSCValNetIPSecSharedSecretEncryptionKeychain,
+                                                   shared_id,
+                                                   NULL);
+                       CFRelease(shared_id);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeEAPOL : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id       = NULL;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetEAPOL);
+
+                       // get 802.1X identifier
+                       if (config != NULL) {
+                               unique_id = CFDictionaryGetValue(config, kEAPClientPropUserPasswordKeychainItemID);
+                       }
+                       if (!isA_CFString(unique_id)) {
+                               return FALSE;
+                       }
+
+                       // check password
+                       exists = _SCPreferencesSystemKeychainPasswordItemExists(prefs, unique_id);
+                       break;
+               }
+
+               default :
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+       }
+
+       return exists;
+}
+
+
+CFDataRef
+SCNetworkInterfaceCopyPassword(SCNetworkInterfaceRef           interface,
+                              SCNetworkInterfacePasswordType   passwordType)
+{
+       CFDataRef               password        = NULL;
+       SCPreferencesRef        prefs           = NULL;
+       CFStringRef             serviceID       = NULL;
+
+       if (!checkInterfacePassword(interface, passwordType, &prefs, &serviceID)) {
+               return NULL;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get serviceID
+                       unique_id = getPasswordID(config, serviceID);
+
+                       // extract
+                       (void) __extract_password(prefs,
+                                                 config,
+                                                 kSCPropNetPPPAuthPassword,
+                                                 kSCPropNetPPPAuthPasswordEncryption,
+                                                 kSCValNetPPPAuthPasswordEncryptionKeychain,
+                                                 unique_id,
+                                                 &password);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFDictionaryRef config;
+                       CFStringRef     shared_id;
 
 
+                       // get configuration
+                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
 
 
-__private_extern__ SCNetworkInterfacePrivateRef
+                       // get sharedSecret ID
+                       shared_id = copySharedSecretID(config, serviceID);
+
+                       // extract
+                       (void) __extract_password(prefs,
+                                                 config,
+                                                 kSCPropNetIPSecSharedSecret,
+                                                 kSCPropNetIPSecSharedSecretEncryption,
+                                                 kSCValNetIPSecSharedSecretEncryptionKeychain,
+                                                 shared_id,
+                                                 &password);
+
+                       CFRelease(shared_id);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeEAPOL : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id       = NULL;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetEAPOL);
+
+                       // get 802.1X identifier
+                       if (config != NULL) {
+                               unique_id = CFDictionaryGetValue(config, kEAPClientPropUserPasswordKeychainItemID);
+                       }
+                       if (!isA_CFString(unique_id)) {
+                               _SCErrorSet(kSCStatusFailed);
+                               return NULL;
+                       }
+
+                       // copy password
+                       password = _SCPreferencesSystemKeychainPasswordItemCopy(prefs, unique_id);
+                       break;
+               }
+
+               default :
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+       }
+
+       return password;
+}
+
+
+Boolean
+SCNetworkInterfaceRemovePassword(SCNetworkInterfaceRef         interface,
+                                SCNetworkInterfacePasswordType passwordType)
+{
+       Boolean                 ok              = FALSE;
+       SCPreferencesRef        prefs           = NULL;
+       CFStringRef             serviceID       = NULL;
+
+       if (!checkInterfacePassword(interface, passwordType, &prefs, &serviceID)) {
+               return FALSE;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get serviceID
+                       unique_id = getPasswordID(config, serviceID);
+
+                       // remove password
+                       ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPassword);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPasswordEncryption);
+                                       ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
+                                       CFRelease(newConfig);
+                               }
+                       }
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       CFDictionaryRef config;
+                       CFStringRef     shared_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+
+                       // get sharedSecret ID
+                       shared_id = copySharedSecretID(config, serviceID);
+
+                       // remove password
+                       ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, shared_id);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecret);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecretEncryption);
+                                       ok = SCNetworkInterfaceSetExtendedConfiguration(interface,
+                                                                                       kSCEntNetIPSec,
+                                                                                       newConfig);
+                                       CFRelease(newConfig);
+                               }
+                       }
+
+                       CFRelease(shared_id);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeEAPOL : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id       = NULL;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetEAPOL);
+
+                       // get 802.1X identifier
+                       if (config != NULL) {
+                               unique_id = CFDictionaryGetValue(config, kEAPClientPropUserPasswordKeychainItemID);
+                       }
+                       if (!isA_CFString(unique_id)) {
+                               _SCErrorSet(kSCStatusFailed);
+                               return FALSE;
+                       }
+
+                       // remove password
+                       ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
+                       break;
+               }
+
+               default :
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef            interface,
+                             SCNetworkInterfacePasswordType    passwordType,
+                             CFDataRef                         password,
+                             CFDictionaryRef                   options)
+{
+       CFStringRef             account         = NULL;
+       CFDictionaryRef         config;
+       CFStringRef             description     = NULL;
+       CFStringRef             label           = NULL;
+       Boolean                 ok              = FALSE;
+       SCPreferencesRef        prefs           = NULL;
+       CFStringRef             serviceID       = NULL;
+
+       if (!checkInterfacePassword(interface, passwordType, &prefs, &serviceID)) {
+               return FALSE;
+       }
+
+       switch (passwordType) {
+               case kSCNetworkInterfacePasswordTypePPP : {
+                       SCNetworkServiceRef     service = NULL;
+                       CFStringRef             unique_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get serviceID
+                       unique_id = getPasswordID(config, serviceID);
+
+                       // get "Account", "Name", "Kind"
+                       if (config != NULL) {
+                               // auth name --> keychain "Account"
+                               account = CFDictionaryGetValue(config, kSCPropNetPPPAuthName);
+
+                               // PPP [user defined] "name" --> keychain "Name"
+                               label = CFDictionaryGetValue(config, kSCPropUserDefinedName);
+                       }
+
+                       if (label == NULL) {
+                               // service name --> keychain "Name"
+                               service = (SCNetworkServiceRef)__SCNetworkServiceCreatePrivate(NULL,
+                                                                                              prefs,
+                                                                                              serviceID,
+                                                                                              interface);
+
+                               label = SCNetworkServiceGetName(service);
+                               if (label == NULL) {
+                                       // interface name --> keychain "Name"
+                                       label = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+                               }
+                       }
+
+                       if (bundle != NULL) {
+                               // "PPP Password" --> keychain "Kind"
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_PPP_PASSWORD"),
+                                                                         CFSTR("PPP Password"),
+                                                                         NULL);
+                       }
+
+                       // store password
+                       ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
+                                                                        unique_id,
+                                                                        (label != NULL)       ? label       : CFSTR("PPP"),
+                                                                        (description != NULL) ? description : CFSTR("PPP Password"),
+                                                                        account,
+                                                                        password,
+                                                                        options);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                               } else {
+                                       newConfig = CFDictionaryCreateMutable(NULL,
+                                                                             0,
+                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetPPPAuthPassword,
+                                                    unique_id);
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetPPPAuthPasswordEncryption,
+                                                    kSCValNetPPPAuthPasswordEncryptionKeychain);
+                               ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       if (description != NULL) CFRelease(description);
+                       if (service     != NULL) CFRelease(service);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
+                       SCNetworkServiceRef     service = NULL;
+                       CFStringRef             shared_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+
+                       // get sharedSecret ID
+                       shared_id = copySharedSecretID(config, serviceID);
+
+                       // get "Name", "Kind"
+                       if (config != NULL) {
+                               // PPP [user defined] "name" --> keychain "Name"
+                               label = CFDictionaryGetValue(config, kSCPropUserDefinedName);
+                       }
+
+                       if (label == NULL) {
+                               // service name --> keychain "Name"
+                               service = (SCNetworkServiceRef)__SCNetworkServiceCreatePrivate(NULL,
+                                                                                              prefs,
+                                                                                              serviceID,
+                                                                                              interface);
+
+                               label = SCNetworkServiceGetName(service);
+                               if (label == NULL) {
+                                       // interface name --> keychain "Name"
+                                       label = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+                               }
+                       }
+
+                       if (bundle != NULL) {
+                               // "IPSec Shared Secret" --> keychain "Kind"
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_IPSEC_SHARED_SECRET"),
+                                                                         CFSTR("IPSec Shared Secret"),
+                                                                         NULL);
+                       }
+
+                       // set password
+                       ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
+                                                                        shared_id,
+                                                                        (label != NULL)       ? label       : CFSTR("PPP"),
+                                                                        (description != NULL) ? description : CFSTR("IPSec Shared Secret"),
+                                                                        NULL,
+                                                                        password,
+                                                                        options);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig       = NULL;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                               } else {
+                                       newConfig = CFDictionaryCreateMutable(NULL,
+                                                                             0,
+                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetIPSecSharedSecret,
+                                                    shared_id);
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetIPSecSharedSecretEncryption,
+                                                    kSCValNetIPSecSharedSecretEncryptionKeychain);
+                               ok = SCNetworkInterfaceSetExtendedConfiguration(interface,
+                                                                               kSCEntNetIPSec,
+                                                                               newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       if (description != NULL) CFRelease(description);
+                       if (service     != NULL) CFRelease(service);
+                       CFRelease(shared_id);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeEAPOL : {
+                       CFStringRef     unique_id       = NULL;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetEAPOL);
+
+                       // get 802.1X identifier
+                       if (config != NULL) {
+                               unique_id = CFDictionaryGetValue(config, kEAPClientPropUserPasswordKeychainItemID);
+                       }
+                       if (isA_CFString(unique_id)) {
+                               CFRetain(unique_id);
+                       } else {
+                               CFUUIDRef       uuid;
+
+                               uuid     = CFUUIDCreate(NULL);
+                               unique_id = CFUUIDCreateString(NULL, uuid);
+                               CFRelease(uuid);
+                       }
+
+                       // get "Name", "Kind"
+                       if (bundle != NULL) {
+                               // "802.1X Password" --> keychain "Name"
+                               label = CFBundleCopyLocalizedString(bundle,
+                                                                   CFSTR("KEYCHAIN_EAPOL_PASSWORD"),
+                                                                   CFSTR("802.1X Password"),
+                                                                   NULL);
+                               // "Internet Connect" --> keychain "Kind"
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_INTERNET_CONNECT"),
+                                                                         CFSTR("Internet Connect"),
+                                                                         NULL);
+                       }
+
+                       // set password
+                       ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
+                                                                        unique_id,
+                                                                        (label != NULL)       ? label       : CFSTR("802.1X Password"),
+                                                                        (description != NULL) ? description : CFSTR("Internet Connect"),
+                                                                        NULL,
+                                                                        password,
+                                                                        options);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig       = NULL;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                               } else {
+                                       newConfig = CFDictionaryCreateMutable(NULL,
+                                                                             0,
+                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+                               CFDictionarySetValue(newConfig,
+                                                    kEAPClientPropUserPasswordKeychainItemID,
+                                                    unique_id);
+                               ok = SCNetworkInterfaceSetExtendedConfiguration(interface,
+                                                                               kSCEntNetEAPOL,
+                                                                               newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       CFRelease(unique_id);
+                       if (label       != NULL) CFRelease(label);
+                       if (description != NULL) CFRelease(description);
+                       break;
+               }
+
+               default :
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       break;
+       }
+
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkInterface [InterfaceNamer] SPIs
+
+
+SCNetworkInterfaceRef
+_SCNetworkInterfaceCreateWithIONetworkInterfaceObject(io_object_t if_obj)
+{
+       SCNetworkInterfaceRef   interface;
+
+       /* initialize runtime */
+       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+
+       interface = createInterface(if_obj, processNetworkInterface);
+       return interface;
+}
+
+
+CFDataRef
+_SCNetworkInterfaceGetHardwareAddress(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->address;
+}
+
+
+CFNumberRef
+_SCNetworkInterfaceGetIOInterfaceType(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->type;
+}
+
+
+CFNumberRef
+_SCNetworkInterfaceGetIOInterfaceUnit(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->unit;
+}
+
+
+CFStringRef
+_SCNetworkInterfaceGetIOPath(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->path;
+}
+
+
+Boolean
+_SCNetworkInterfaceIsBuiltin(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->builtin;
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkInterface SPIs
+
+Boolean
+_SCNetworkInterfaceIsModemV92(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->modemIsV92;
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkInterface [internal] SPIs
+
+
+__private_extern__
+SCNetworkInterfacePrivateRef
 __SCNetworkInterfaceCreateCopy(CFAllocatorRef          allocator,
                               SCNetworkInterfaceRef    interface,
 __SCNetworkInterfaceCreateCopy(CFAllocatorRef          allocator,
                               SCNetworkInterfaceRef    interface,
-                              SCNetworkServiceRef      service)
+                              SCPreferencesRef         prefs,
+                              CFStringRef              serviceID)
 {
        SCNetworkInterfacePrivateRef            oldPrivate      = (SCNetworkInterfacePrivateRef)interface;
        SCNetworkInterfacePrivateRef            newPrivate;
 {
        SCNetworkInterfacePrivateRef            oldPrivate      = (SCNetworkInterfacePrivateRef)interface;
        SCNetworkInterfacePrivateRef            newPrivate;
@@ -2521,17 +4331,33 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef           allocator,
        /* initialize runtime (and kSCNetworkInterfaceIPv4) */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
        /* initialize runtime (and kSCNetworkInterfaceIPv4) */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
-       newPrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL);
+       newPrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, prefs, serviceID, NULL);
        newPrivate->interface_type              = oldPrivate->interface_type;
        if (oldPrivate->interface != NULL) {
        newPrivate->interface_type              = oldPrivate->interface_type;
        if (oldPrivate->interface != NULL) {
-               newPrivate->interface = (SCNetworkInterfaceRef)__SCNetworkInterfaceCreateCopy(NULL,                     // allocator
-                                                                                             oldPrivate->interface,    // interface
-                                                                                             service);                 // [new] service
-       }
-       newPrivate->localized_name              = (oldPrivate->localized_name != NULL) ? CFRetain(oldPrivate->localized_name) : NULL;
-       newPrivate->service                     = service;
-       newPrivate->unsaved                     = (oldPrivate->unsaved != NULL) ? CFRetain(oldPrivate->unsaved) : NULL;
-       newPrivate->entity_device               = (oldPrivate->entity_device != NULL) ? CFRetain(oldPrivate->entity_device) : NULL;
+               newPrivate->interface           = (SCNetworkInterfaceRef)__SCNetworkInterfaceCreateCopy(NULL,                   // allocator
+                                                                                                       oldPrivate->interface,  // interface
+                                                                                                       prefs,                  // [new] prefs
+                                                                                                       serviceID);             // [new] serviceID
+       }
+       if (oldPrivate->name != NULL) {
+               newPrivate->name                = CFRetain(oldPrivate->name);
+       }
+       if (oldPrivate->localized_name != NULL) {
+               newPrivate->localized_name      = CFRetain(oldPrivate->localized_name);
+       }
+       newPrivate->localized_key               = oldPrivate->localized_key;
+       if (oldPrivate->localized_arg1 != NULL) {
+               newPrivate->localized_arg1      = CFRetain(oldPrivate->localized_arg1);
+       }
+       if (oldPrivate->localized_arg2 != NULL) {
+               newPrivate->localized_arg2      = CFRetain(oldPrivate->localized_arg2);
+       }
+       if (oldPrivate->unsaved != NULL) {
+               newPrivate->unsaved             = CFDictionaryCreateMutableCopy(NULL, 0, oldPrivate->unsaved);
+       }
+       if (oldPrivate->entity_device != NULL) {
+               newPrivate->entity_device       = CFRetain(oldPrivate->entity_device);
+       }
        newPrivate->entity_type                 = oldPrivate->entity_type;
        newPrivate->entity_subtype              = oldPrivate->entity_subtype;
        if (oldPrivate->supported_interface_types != NULL) {
        newPrivate->entity_type                 = oldPrivate->entity_type;
        newPrivate->entity_subtype              = oldPrivate->entity_subtype;
        if (oldPrivate->supported_interface_types != NULL) {
@@ -2540,32 +4366,104 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef          allocator,
        if (oldPrivate->supported_protocol_types != NULL) {
                newPrivate->supported_protocol_types = CFArrayCreateMutableCopy(NULL, 0, oldPrivate->supported_protocol_types);
        }
        if (oldPrivate->supported_protocol_types != NULL) {
                newPrivate->supported_protocol_types = CFArrayCreateMutableCopy(NULL, 0, oldPrivate->supported_protocol_types);
        }
-       newPrivate->address                     = (oldPrivate->address != NULL) ? CFRetain(oldPrivate->address) : NULL;
+       if (oldPrivate->address != NULL) {
+               newPrivate->address             = CFRetain(oldPrivate->address);
+       }
        newPrivate->builtin                     = oldPrivate->builtin;
        newPrivate->builtin                     = oldPrivate->builtin;
-       newPrivate->path                        = (oldPrivate->path != NULL) ? CFRetain(oldPrivate->path) : NULL;
-       newPrivate->location                    = (oldPrivate->location != NULL) ? CFRetain(oldPrivate->location) : NULL;
-       newPrivate->modemCCL                    = (oldPrivate->modemCCL != NULL) ? CFRetain(oldPrivate->modemCCL) : NULL;
+       if (oldPrivate->location != NULL) {
+               newPrivate->location            = CFRetain(oldPrivate->location);
+       }
+       if (oldPrivate->path != NULL) {
+               newPrivate->path                = CFRetain(oldPrivate->path);
+       }
+       if (oldPrivate->overrides != NULL) {
+               newPrivate->overrides           = CFDictionaryCreateMutableCopy(NULL, 0, oldPrivate->overrides);
+       }
        newPrivate->modemIsV92                  = oldPrivate->modemIsV92;
        newPrivate->supportsBond                = oldPrivate->supportsBond;
        newPrivate->supportsVLAN                = oldPrivate->supportsVLAN;
        newPrivate->modemIsV92                  = oldPrivate->modemIsV92;
        newPrivate->supportsBond                = oldPrivate->supportsBond;
        newPrivate->supportsVLAN                = oldPrivate->supportsVLAN;
+       if (oldPrivate->type != NULL) {
+               newPrivate->type                = CFRetain(oldPrivate->type);
+       }
+       if (oldPrivate->unit != NULL) {
+               newPrivate->unit                = CFRetain(oldPrivate->unit);
+       }
        newPrivate->sort_order                  = oldPrivate->sort_order;
        newPrivate->sort_order                  = oldPrivate->sort_order;
+       if (oldPrivate->bond.interfaces != NULL) {
+               newPrivate->bond.interfaces     = CFRetain(oldPrivate->bond.interfaces);
+       }
+       if (oldPrivate->bond.mode != NULL) {
+               newPrivate->bond.mode           = CFRetain(oldPrivate->bond.mode);
+       }
+       if (oldPrivate->bond.options != NULL) {
+               newPrivate->bond.options        = CFRetain(oldPrivate->bond.options);
+       }
+       if (oldPrivate->vlan.interface != NULL) {
+               newPrivate->vlan.interface      = CFRetain(oldPrivate->vlan.interface);
+       }
+       if (oldPrivate->vlan.tag != NULL) {
+               newPrivate->vlan.tag            = CFRetain(oldPrivate->vlan.tag);
+       }
+       if (oldPrivate->vlan.options != NULL) {
+               newPrivate->vlan.options        = CFRetain(oldPrivate->vlan.options);
+       }
 
        return newPrivate;
 }
 
 
 
        return newPrivate;
 }
 
 
-__private_extern__ CFArrayRef
+__private_extern__
+CFArrayRef
 __SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface)
 {
 __SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface)
 {
-       CFDictionaryRef         config;
        CFMutableArrayRef       configs;
 
        configs = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        while (interface != NULL) {
        CFMutableArrayRef       configs;
 
        configs = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
        while (interface != NULL) {
-               config = __SCNetworkInterfaceGetConfiguration(interface, TRUE);
-               CFArrayAppendValue(configs,
-                                  (config != NULL) ? config : (CFDictionaryRef)kCFNull);
+               CFStringRef             defaultType;
+               CFMutableDictionaryRef  interfaceConfiguration;
+
+               interfaceConfiguration = CFDictionaryCreateMutable(NULL,
+                                                                  0,
+                                                                  &kCFTypeDictionaryKeyCallBacks,
+                                                                  &kCFTypeDictionaryValueCallBacks);
+
+               defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+               if (defaultType != NULL) {
+                       CFDictionaryRef config;
+                       CFArrayRef      extendedTypes;
+
+                       config = __SCNetworkInterfaceGetConfiguration(interface, defaultType);
+                       if (config == NULL) {
+                               config = (CFDictionaryRef)kCFNull;
+                       }
+                       CFDictionarySetValue(interfaceConfiguration, defaultType, config);
+
+                       extendedTypes = extendedConfigurationTypes(interface);
+                       if (extendedTypes != NULL) {
+                               CFIndex i;
+                               CFIndex n;
+
+                               n = CFArrayGetCount(extendedTypes);
+                               for (i = 0; i < n; i++) {
+                                       CFStringRef     extendedType;
+
+                                       extendedType = CFArrayGetValueAtIndex(extendedTypes, i);
+                                       config = __SCNetworkInterfaceGetConfiguration(interface, extendedType);
+                                       if (config == NULL) {
+                                               config = (CFDictionaryRef)kCFNull;
+                                       }
+                                       CFDictionarySetValue(interfaceConfiguration, extendedType, config);
+                               }
+
+                               CFRelease(extendedTypes);
+                       }
+               }
+
+               CFArrayAppendValue(configs, interfaceConfiguration);
+               CFRelease(interfaceConfiguration);
+
                interface = SCNetworkInterfaceGetInterface(interface);
        }
 
                interface = SCNetworkInterfaceGetInterface(interface);
        }
 
@@ -2573,20 +4471,62 @@ __SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface)
 }
 
 
 }
 
 
-__private_extern__ void
+__private_extern__
+void
 __SCNetworkInterfaceSetDeepConfiguration(SCNetworkInterfaceRef interface, CFArrayRef configs)
 {
        CFIndex         i;
 
        for (i = 0; interface != NULL; i++) {
 __SCNetworkInterfaceSetDeepConfiguration(SCNetworkInterfaceRef interface, CFArrayRef configs)
 {
        CFIndex         i;
 
        for (i = 0; interface != NULL; i++) {
-               CFDictionaryRef config;
+               CFStringRef     defaultType;
+               CFDictionaryRef interfaceConfiguration;
+
+               interfaceConfiguration = (configs != NULL) ? CFArrayGetValueAtIndex(configs, i) : NULL;
+
+               defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+               if (defaultType != NULL) {
+                       CFDictionaryRef config;
+                       CFArrayRef      extendedTypes;
+
+                       config = (interfaceConfiguration != NULL) ? CFDictionaryGetValue(interfaceConfiguration, defaultType)
+                                                                 : NULL;
+                       if (config == (CFDictionaryRef)kCFNull) {
+                               config = NULL;
+                       }
+                       if (!__SCNetworkInterfaceSetConfiguration(interface, defaultType, config, TRUE)) {
+                               SCLog(TRUE, LOG_DEBUG,
+                                     CFSTR("__SCNetworkInterfaceSetDeepConfiguration __SCNetworkInterfaceSetConfiguration() failed, interface=%@, type=%@"),
+                                     interface,
+                                     defaultType);
+                       }
 
 
-               config = (configs != NULL) ? CFArrayGetValueAtIndex(configs, i) : NULL;
-               if (!isA_CFDictionary(config) || (CFDictionaryGetCount(config) == 0)) {
-                       config = NULL;
+                       extendedTypes = extendedConfigurationTypes(interface);
+                       if (extendedTypes != NULL) {
+                               CFIndex j;
+                               CFIndex n;
+
+                               n = CFArrayGetCount(extendedTypes);
+                               for (j = 0; j < n; j++) {
+                                       CFStringRef     extendedType;
+
+                                       extendedType = CFArrayGetValueAtIndex(extendedTypes, j);
+                                       config = (interfaceConfiguration != NULL) ? CFDictionaryGetValue(interfaceConfiguration, extendedType)
+                                       : NULL;
+                                       if (config == (CFDictionaryRef)kCFNull) {
+                                               config = NULL;
+                                       }
+                                       if (!__SCNetworkInterfaceSetConfiguration(interface, extendedType, config, TRUE)) {
+                                               SCLog(TRUE, LOG_DEBUG,
+                                                     CFSTR("__SCNetworkInterfaceSetDeepConfiguration __SCNetworkInterfaceSetConfiguration() failed, interface=%@, type=%@"),
+                                                     interface,
+                                                     defaultType);
+                                       }
+                               }
+
+                               CFRelease(extendedTypes);
+                       }
                }
 
                }
 
-               (void) __SCNetworkInterfaceSetConfiguration(interface, config, TRUE);
                interface = SCNetworkInterfaceGetInterface(interface);
        }
 
                interface = SCNetworkInterfaceGetInterface(interface);
        }
 
index 1c6c73a4cd4a8f225e35970e978eac2d2c43efc7..c0d57571f9037eaf25dbfe5677643315276c0344 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCNetworkConfigurationInternal.h>
+#include "SCNetworkConfigurationInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
-#include "SCNetworkConfiguration.h"
-#include "SCNetworkConfigurationInternal.h"
-
 #include <pthread.h>
 
 
 static CFStringRef     __SCNetworkProtocolCopyDescription      (CFTypeRef cf);
 static void            __SCNetworkProtocolDeallocate           (CFTypeRef cf);
 static Boolean         __SCNetworkProtocolEqual                (CFTypeRef cf1, CFTypeRef cf2);
 #include <pthread.h>
 
 
 static CFStringRef     __SCNetworkProtocolCopyDescription      (CFTypeRef cf);
 static void            __SCNetworkProtocolDeallocate           (CFTypeRef cf);
 static Boolean         __SCNetworkProtocolEqual                (CFTypeRef cf1, CFTypeRef cf2);
+static CFHashCode      __SCNetworkProtocolHash                 (CFTypeRef cf);
 
 
 const CFStringRef kSCNetworkProtocolTypeAppleTalk       = CFSTR("AppleTalk");
 
 
 const CFStringRef kSCNetworkProtocolTypeAppleTalk       = CFSTR("AppleTalk");
@@ -52,6 +50,7 @@ const CFStringRef kSCNetworkProtocolTypeDNS           = CFSTR("DNS");
 const CFStringRef kSCNetworkProtocolTypeIPv4           = CFSTR("IPv4");
 const CFStringRef kSCNetworkProtocolTypeIPv6           = CFSTR("IPv6");
 const CFStringRef kSCNetworkProtocolTypeProxies                = CFSTR("Proxies");
 const CFStringRef kSCNetworkProtocolTypeIPv4           = CFSTR("IPv4");
 const CFStringRef kSCNetworkProtocolTypeIPv6           = CFSTR("IPv6");
 const CFStringRef kSCNetworkProtocolTypeProxies                = CFSTR("Proxies");
+const CFStringRef kSCNetworkProtocolTypeSMB            = CFSTR("SMB");
 
 
 static CFTypeID __kSCNetworkProtocolTypeID     = _kCFRuntimeNotATypeID;
 
 
 static CFTypeID __kSCNetworkProtocolTypeID     = _kCFRuntimeNotATypeID;
@@ -64,7 +63,7 @@ static const CFRuntimeClass __SCNetworkProtocolClass = {
        NULL,                                   // copy
        __SCNetworkProtocolDeallocate,          // dealloc
        __SCNetworkProtocolEqual,               // equal
        NULL,                                   // copy
        __SCNetworkProtocolDeallocate,          // dealloc
        __SCNetworkProtocolEqual,               // equal
-       NULL,                                   // hash
+       __SCNetworkProtocolHash,                // hash
        NULL,                                   // copyFormattingDesc
        __SCNetworkProtocolCopyDescription      // copyDebugDesc
 };
        NULL,                                   // copyFormattingDesc
        __SCNetworkProtocolCopyDescription      // copyDebugDesc
 };
@@ -73,13 +72,6 @@ static const CFRuntimeClass __SCNetworkProtocolClass = {
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
 
 
-static __inline__ CFTypeRef
-isA_SCNetworkProtocol(CFTypeRef obj)
-{
-       return (isA_CFType(obj, SCNetworkProtocolGetTypeID()));
-}
-
-
 static CFStringRef
 __SCNetworkProtocolCopyDescription(CFTypeRef cf)
 {
 static CFStringRef
 __SCNetworkProtocolCopyDescription(CFTypeRef cf)
 {
@@ -88,10 +80,13 @@ __SCNetworkProtocolCopyDescription(CFTypeRef cf)
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkProtocol %p [%p]> { "), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR("id=%@"), protocolPrivate->entityID);
-       CFStringAppendFormat(result, NULL, CFSTR(", service=%@"), protocolPrivate->service);
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
+       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkProtocol %p [%p]> {"), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR("id = %@"), protocolPrivate->entityID);
+       CFStringAppendFormat(result, NULL, CFSTR(", service = %p"), protocolPrivate->service);
+       CFStringAppendFormat(result, NULL,
+                            CFSTR(", prefs = %p"),
+                            ((SCNetworkServicePrivateRef)protocolPrivate->service)->prefs);
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
        return result;
 }
@@ -104,6 +99,7 @@ __SCNetworkProtocolDeallocate(CFTypeRef cf)
 
        /* release resources */
        CFRelease(protocolPrivate->entityID);
 
        /* release resources */
        CFRelease(protocolPrivate->entityID);
+       CFRelease(protocolPrivate->service);
 
        return;
 }
 
        return;
 }
@@ -131,6 +127,15 @@ __SCNetworkProtocolEqual(CFTypeRef cf1, CFTypeRef cf2)
 }
 
 
 }
 
 
+static CFHashCode
+__SCNetworkProtocolHash(CFTypeRef cf)
+{
+       SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)cf;
+
+       return CFHash(protocolPrivate->entityID);
+}
+
+
 static void
 __SCNetworkProtocolInitialize(void)
 {
 static void
 __SCNetworkProtocolInitialize(void)
 {
@@ -161,7 +166,7 @@ __SCNetworkProtocolCreatePrivate(CFAllocatorRef             allocator,
        }
 
        protocolPrivate->entityID       = CFStringCreateCopy(NULL, entityID);
        }
 
        protocolPrivate->entityID       = CFStringCreateCopy(NULL, entityID);
-       protocolPrivate->service        = service;
+       protocolPrivate->service        = CFRetain(service);
 
        return protocolPrivate;
 }
 
        return protocolPrivate;
 }
@@ -176,7 +181,8 @@ __SCNetworkProtocolIsValidType(CFStringRef protocolType)
                &kSCNetworkProtocolTypeDNS,
                &kSCNetworkProtocolTypeIPv4,
                &kSCNetworkProtocolTypeIPv6,
                &kSCNetworkProtocolTypeDNS,
                &kSCNetworkProtocolTypeIPv4,
                &kSCNetworkProtocolTypeIPv6,
-               &kSCNetworkProtocolTypeProxies
+               &kSCNetworkProtocolTypeProxies,
+               &kSCNetworkProtocolTypeSMB
        };
 
        for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++) {
        };
 
        for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++) {
@@ -213,7 +219,8 @@ copyProtocolConfigurationPath(SCNetworkProtocolPrivateRef protocolPrivate)
 }
 
 
 }
 
 
-/* ---------- SCNetworkProtocol APIs ---------- */
+#pragma mark -
+#pragma mark SCNetworkProtocol APIs
 
 
 CFTypeID
 
 
 CFTypeID
@@ -232,6 +239,11 @@ SCNetworkProtocolGetConfiguration(SCNetworkProtocolRef protocol)
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)protocolPrivate->service;
 
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)protocolPrivate->service;
 
+       if (!isA_SCNetworkProtocol(protocol)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        path = copyProtocolConfigurationPath(protocolPrivate);
        config = __getPrefsConfiguration(servicePrivate->prefs, path);
        CFRelease(path);
        path = copyProtocolConfigurationPath(protocolPrivate);
        config = __getPrefsConfiguration(servicePrivate->prefs, path);
        CFRelease(path);
@@ -248,6 +260,11 @@ SCNetworkProtocolGetEnabled(SCNetworkProtocolRef protocol)
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)protocolPrivate->service;
 
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)protocolPrivate->service;
 
+       if (!isA_SCNetworkProtocol(protocol)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        path = copyProtocolConfigurationPath(protocolPrivate);
        enabled = __getPrefsEnabled(servicePrivate->prefs, path);
        CFRelease(path);
        path = copyProtocolConfigurationPath(protocolPrivate);
        enabled = __getPrefsEnabled(servicePrivate->prefs, path);
        CFRelease(path);
@@ -261,6 +278,11 @@ SCNetworkProtocolGetProtocolType(SCNetworkProtocolRef protocol)
 {
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
 
 {
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
 
+       if (!isA_SCNetworkProtocol(protocol)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        return protocolPrivate->entityID;
 }
 
        return protocolPrivate->entityID;
 }
 
@@ -273,6 +295,11 @@ SCNetworkProtocolSetConfiguration(SCNetworkProtocolRef protocol, CFDictionaryRef
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)protocolPrivate->service;
 
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)protocolPrivate->service;
 
+       if (!isA_SCNetworkProtocol(protocol)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        path = copyProtocolConfigurationPath(protocolPrivate);
        ok = __setPrefsConfiguration(servicePrivate->prefs, path, config, TRUE);
        CFRelease(path);
        path = copyProtocolConfigurationPath(protocolPrivate);
        ok = __setPrefsConfiguration(servicePrivate->prefs, path, config, TRUE);
        CFRelease(path);
@@ -289,6 +316,11 @@ SCNetworkProtocolSetEnabled(SCNetworkProtocolRef protocol, Boolean enabled)
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)protocolPrivate->service;
 
        SCNetworkProtocolPrivateRef     protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)protocolPrivate->service;
 
+       if (!isA_SCNetworkProtocol(protocol)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        path = copyProtocolConfigurationPath(protocolPrivate);
        ok = __setPrefsEnabled(servicePrivate->prefs, path, enabled);
        CFRelease(path);
        path = copyProtocolConfigurationPath(protocolPrivate);
        ok = __setPrefsEnabled(servicePrivate->prefs, path, enabled);
        CFRelease(path);
index e6ba37a2cdc8c89f0f3363622bf6614f6f5c6d0d..98a9f1e4955467b0529a95bd6b48201f38c82ca2 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -37,6 +37,7 @@
 
 #include <CoreFoundation/CFRuntime.h>
 #include <pthread.h>
 
 #include <CoreFoundation/CFRuntime.h>
 #include <pthread.h>
+#include <libkern/OSAtomic.h>
 
 #include <notify.h>
 #include <dnsinfo.h>
 
 #include <notify.h>
 #include <dnsinfo.h>
@@ -136,6 +137,7 @@ static const CFRuntimeClass __SCNetworkReachabilityClass = {
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
+static int                     rtm_seq         = 0;
 
 
 /*
 
 
 /*
@@ -326,6 +328,7 @@ updatePPPStatus(SCDynamicStoreRef           *storeP,
                 */
                components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
                if (CFArrayGetCount(components) != 5) {
                 */
                components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
                if (CFArrayGetCount(components) != 5) {
+                       CFRelease(components);
                        continue;
                }
                service = CFArrayGetValueAtIndex(components, 3);
                        continue;
                }
                service = CFArrayGetValueAtIndex(components, 3);
@@ -513,6 +516,7 @@ updatePPPAvailable(SCDynamicStoreRef                *storeP,
                // extract service ID
                components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
                if (CFArrayGetCount(components) != 5) {
                // extract service ID
                components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
                if (CFArrayGetCount(components) != 5) {
+                       CFRelease(components);
                        continue;
                }
                service = CFArrayGetValueAtIndex(components, 3);
                        continue;
                }
                service = CFArrayGetValueAtIndex(components, 3);
@@ -583,8 +587,8 @@ updatePPPAvailable(SCDynamicStoreRef                *storeP,
 
 #define NEXT_SA(ap) (ap) = (struct sockaddr *) \
        ((caddr_t)(ap) + ((ap)->sa_len ? ROUNDUP((ap)->sa_len,\
 
 #define NEXT_SA(ap) (ap) = (struct sockaddr *) \
        ((caddr_t)(ap) + ((ap)->sa_len ? ROUNDUP((ap)->sa_len,\
-                                                sizeof(u_long)) :\
-                                                sizeof(u_long)))
+                                                sizeof(uint32_t)) :\
+                                                sizeof(uint32_t)))
 
 static void
 get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info)
 
 static void
 get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info)
@@ -611,7 +615,7 @@ checkAddress(SCDynamicStoreRef              *storeP,
 {
        char                    buf[BUFLEN];
        struct ifreq            ifr;
 {
        char                    buf[BUFLEN];
        struct ifreq            ifr;
-       char                    if_name[IFNAMSIZ+1];
+       char                    if_name[IFNAMSIZ + 1];
        int                     isock;
        int                     n;
        pid_t                   pid             = getpid();
        int                     isock;
        int                     n;
        pid_t                   pid             = getpid();
@@ -621,7 +625,7 @@ checkAddress(SCDynamicStoreRef              *storeP,
        struct sockaddr         *sa;
        int                     sc_status       = kSCStatusReachabilityUnknown;
        struct sockaddr_dl      *sdl;
        struct sockaddr         *sa;
        int                     sc_status       = kSCStatusReachabilityUnknown;
        struct sockaddr_dl      *sdl;
-       int                     seq             = (int)pthread_self();
+       int32_t                 seq             = OSAtomicIncrement32Barrier(&rtm_seq);
        SCDynamicStoreRef       store           = (storeP != NULL) ? *storeP : NULL;
        char                    *statusMessage  = NULL;
 #ifndef        RTM_GET_SILENT
        SCDynamicStoreRef       store           = (storeP != NULL) ? *storeP : NULL;
        char                    *statusMessage  = NULL;
 #ifndef        RTM_GET_SILENT
@@ -691,13 +695,13 @@ checkAddress(SCDynamicStoreRef            *storeP,
 
        sa  = (struct sockaddr *) (rtm + 1);
        bcopy(address, sa, address->sa_len);
 
        sa  = (struct sockaddr *) (rtm + 1);
        bcopy(address, sa, address->sa_len);
-       n = ROUNDUP(sa->sa_len, sizeof(u_long));
+       n = ROUNDUP(sa->sa_len, sizeof(uint32_t));
        rtm->rtm_msglen += n;
 
        sdl = (struct sockaddr_dl *) ((void *)sa + n);
        sdl->sdl_family = AF_LINK;
        sdl->sdl_len = sizeof (struct sockaddr_dl);
        rtm->rtm_msglen += n;
 
        sdl = (struct sockaddr_dl *) ((void *)sa + n);
        sdl->sdl_family = AF_LINK;
        sdl->sdl_len = sizeof (struct sockaddr_dl);
-       n = ROUNDUP(sdl->sdl_len, sizeof(u_long));
+       n = ROUNDUP(sdl->sdl_len, sizeof(uint32_t));
        rtm->rtm_msglen += n;
 
 #ifndef        RTM_GET_SILENT
        rtm->rtm_msglen += n;
 
 #ifndef        RTM_GET_SILENT
@@ -775,6 +779,10 @@ checkAddress(SCDynamicStoreRef             *storeP,
 
        SCLog(_sc_debug, LOG_DEBUG, CFSTR("rtm_flags = 0x%8.8x"), rtm->rtm_flags);
 
 
        SCLog(_sc_debug, LOG_DEBUG, CFSTR("rtm_flags = 0x%8.8x"), rtm->rtm_flags);
 
+       if ((rti_info[RTAX_NETMASK] != NULL) && (rti_info[RTAX_DST] != NULL)) {
+               rti_info[RTAX_NETMASK]->sa_family = rti_info[RTAX_DST]->sa_family;
+       }
+
        for (i = 0; i < RTAX_MAX; i++) {
                if (rti_info[i] != NULL) {
                        _SC_sockaddr_to_string(rti_info[i], buf, sizeof(buf));
        for (i = 0; i < RTAX_MAX; i++) {
                if (rti_info[i] != NULL) {
                        _SC_sockaddr_to_string(rti_info[i], buf, sizeof(buf));
@@ -802,12 +810,12 @@ checkAddress(SCDynamicStoreRef            *storeP,
        bcopy(sdl->sdl_data, ifr.ifr_name, sdl->sdl_nlen);
 
        isock = socket(AF_INET, SOCK_DGRAM, 0);
        bcopy(sdl->sdl_data, ifr.ifr_name, sdl->sdl_nlen);
 
        isock = socket(AF_INET, SOCK_DGRAM, 0);
-       if (isock < 0) {
+       if (isock == -1) {
                SCLog(TRUE, LOG_NOTICE, CFSTR("socket() failed: %s"), strerror(errno));
                goto done;
        }
 
                SCLog(TRUE, LOG_NOTICE, CFSTR("socket() failed: %s"), strerror(errno));
                goto done;
        }
 
-       if (ioctl(isock, SIOCGIFFLAGS, (char *)&ifr) < 0) {
+       if (ioctl(isock, SIOCGIFFLAGS, (char *)&ifr) == -1) {
                SCLog(TRUE, LOG_NOTICE, CFSTR("ioctl() failed: %s"), strerror(errno));
                (void)close(isock);
                goto done;
                SCLog(TRUE, LOG_NOTICE, CFSTR("ioctl() failed: %s"), strerror(errno));
                (void)close(isock);
                goto done;
@@ -941,7 +949,7 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkReachability %p [%p]> { "), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkReachability %p [%p]> {"), cf, allocator);
        switch (targetPrivate->type) {
                case reachabilityTypeAddress :
                case reachabilityTypeAddressPair : {
        switch (targetPrivate->type) {
                case reachabilityTypeAddress :
                case reachabilityTypeAddressPair : {
@@ -949,13 +957,13 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
 
                        if (targetPrivate->localAddress != NULL) {
                                _SC_sockaddr_to_string(targetPrivate->localAddress, buf, sizeof(buf));
 
                        if (targetPrivate->localAddress != NULL) {
                                _SC_sockaddr_to_string(targetPrivate->localAddress, buf, sizeof(buf));
-                               CFStringAppendFormat(result, NULL, CFSTR("local address=%s"),
+                               CFStringAppendFormat(result, NULL, CFSTR("local address = %s"),
                                                     buf);
                        }
 
                        if (targetPrivate->remoteAddress != NULL) {
                                _SC_sockaddr_to_string(targetPrivate->remoteAddress, buf, sizeof(buf));
                                                     buf);
                        }
 
                        if (targetPrivate->remoteAddress != NULL) {
                                _SC_sockaddr_to_string(targetPrivate->remoteAddress, buf, sizeof(buf));
-                               CFStringAppendFormat(result, NULL, CFSTR("%s%saddress=%s"),
+                               CFStringAppendFormat(result, NULL, CFSTR("%s%saddress = %s"),
                                                     targetPrivate->localAddress ? ", " : "",
                                                     (targetPrivate->type == reachabilityTypeAddressPair) ? "remote " : "",
                                                     buf);
                                                     targetPrivate->localAddress ? ", " : "",
                                                     (targetPrivate->type == reachabilityTypeAddressPair) ? "remote " : "",
                                                     buf);
@@ -963,8 +971,8 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
                        break;
                }
                case reachabilityTypeName : {
                        break;
                }
                case reachabilityTypeName : {
-                       CFStringAppendFormat(result, NULL, CFSTR("name=%s"), targetPrivate->name);
-                       if (targetPrivate->resolvedAddress || (targetPrivate->resolvedAddressError != NETDB_SUCCESS)) {
+                       CFStringAppendFormat(result, NULL, CFSTR("name = %s"), targetPrivate->name);
+                       if ((targetPrivate->resolvedAddress != NULL) || (targetPrivate->resolvedAddressError != NETDB_SUCCESS)) {
                                if (targetPrivate->resolvedAddress != NULL) {
                                        if (isA_CFArray(targetPrivate->resolvedAddress)) {
                                                CFIndex i;
                                if (targetPrivate->resolvedAddress != NULL) {
                                        if (isA_CFArray(targetPrivate->resolvedAddress)) {
                                                CFIndex i;
@@ -991,7 +999,7 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
                                        CFStringAppendFormat(result, NULL, CFSTR(" (%s)"),
                                                             gai_strerror(targetPrivate->resolvedAddressError));
                                }
                                        CFStringAppendFormat(result, NULL, CFSTR(" (%s)"),
                                                             gai_strerror(targetPrivate->resolvedAddressError));
                                }
-                       } else if (targetPrivate->dnsPort) {
+                       } else if (targetPrivate->dnsPort != NULL) {
                                CFStringAppendFormat(result, NULL, CFSTR(" (DNS query active)"));
                        }
                        break;
                                CFStringAppendFormat(result, NULL, CFSTR(" (DNS query active)"));
                        }
                        break;
@@ -1000,11 +1008,11 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
        if (targetPrivate->rls != NULL) {
                CFStringAppendFormat(result,
                                     NULL,
        if (targetPrivate->rls != NULL) {
                CFStringAppendFormat(result,
                                     NULL,
-                                    CFSTR(", flags=%8.8x, if_index=%hu"),
+                                    CFSTR(", flags = %8.8x, if_index = %hu"),
                                     targetPrivate->flags,
                                     targetPrivate->if_index);
        }
                                     targetPrivate->flags,
                                     targetPrivate->if_index);
        }
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
        return result;
 }
@@ -1174,6 +1182,7 @@ SCNetworkReachabilityRef
 SCNetworkReachabilityCreateWithName(CFAllocatorRef     allocator,
                                    const char          *nodename)
 {
 SCNetworkReachabilityCreateWithName(CFAllocatorRef     allocator,
                                    const char          *nodename)
 {
+       int                             nodenameLen;
        struct sockaddr_in              sin;
        struct sockaddr_in6             sin6;
        SCNetworkReachabilityPrivateRef targetPrivate;
        struct sockaddr_in              sin;
        struct sockaddr_in6             sin6;
        SCNetworkReachabilityPrivateRef targetPrivate;
@@ -1183,6 +1192,12 @@ SCNetworkReachabilityCreateWithName(CFAllocatorRef       allocator,
                return NULL;
        }
 
                return NULL;
        }
 
+       nodenameLen = strlen(nodename);
+       if (nodenameLen == 0) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        /* check if this "nodename" is really an IP[v6] address in disguise */
 
        bzero(&sin, sizeof(sin));
        /* check if this "nodename" is really an IP[v6] address in disguise */
 
        bzero(&sin, sizeof(sin));
@@ -1202,7 +1217,7 @@ SCNetworkReachabilityCreateWithName(CFAllocatorRef        allocator,
 
                p = strchr(nodename, '%');
                if (p != NULL) {
 
                p = strchr(nodename, '%');
                if (p != NULL) {
-                       sin6.sin6_scope_id = if_nametoindex(p+1);
+                       sin6.sin6_scope_id = if_nametoindex(p + 1);
                }
 
                return SCNetworkReachabilityCreateWithAddress(allocator, (struct sockaddr *)&sin6);
                }
 
                return SCNetworkReachabilityCreateWithAddress(allocator, (struct sockaddr *)&sin6);
@@ -1217,8 +1232,8 @@ SCNetworkReachabilityCreateWithName(CFAllocatorRef        allocator,
 
        targetPrivate->flags |= kSCNetworkFlagsFirstResolvePending;
 
 
        targetPrivate->flags |= kSCNetworkFlagsFirstResolvePending;
 
-       targetPrivate->name = CFAllocatorAllocate(NULL, strlen(nodename) + 1, 0);
-       strcpy((char *)targetPrivate->name, nodename);
+       targetPrivate->name = CFAllocatorAllocate(NULL, nodenameLen + 1, 0);
+       strlcpy((char *)targetPrivate->name, nodename, nodenameLen + 1);
 
        return (SCNetworkReachabilityRef)targetPrivate;
 }
 
        return (SCNetworkReachabilityRef)targetPrivate;
 }
@@ -1252,7 +1267,7 @@ SCNetworkReachabilityCopyResolvedAddress(SCNetworkReachabilityRef target,
                *error_num = targetPrivate->resolvedAddressError;
        }
 
                *error_num = targetPrivate->resolvedAddressError;
        }
 
-       if (targetPrivate->resolvedAddress || (targetPrivate->resolvedAddressError != NETDB_SUCCESS)) {
+       if ((targetPrivate->resolvedAddress != NULL) || (targetPrivate->resolvedAddressError != NETDB_SUCCESS)) {
                if (targetPrivate->resolvedAddress != NULL) {
                        return CFRetain(targetPrivate->resolvedAddress);
                } else {
                if (targetPrivate->resolvedAddress != NULL) {
                        return CFRetain(targetPrivate->resolvedAddress);
                } else {
@@ -1305,7 +1320,7 @@ __SCNetworkReachabilitySetResolvedAddress(int32_t                 status,
                targetPrivate->resolvedAddressError = status;
        }
 
                targetPrivate->resolvedAddressError = status;
        }
 
-       if (res)        freeaddrinfo(res);
+       if (res != NULL)        freeaddrinfo(res);
 
        if (targetPrivate->rls != NULL) {
                SCLog(_sc_debug, LOG_INFO, CFSTR("DNS request completed"));
 
        if (targetPrivate->rls != NULL) {
                SCLog(_sc_debug, LOG_INFO, CFSTR("DNS request completed"));
@@ -1757,9 +1772,117 @@ _SC_checkResolverReachability(SCDynamicStoreRef         *storeP,
 }
 
 
 }
 
 
+/*
+ * _SC_checkResolverReachabilityByAddress()
+ *
+ * Given an IP address, determine whether a reverse DNS query can be issued
+ * using the current network configuration.
+ */
+Boolean
+_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef       *storeP,
+                                      SCNetworkConnectionFlags *flags,
+                                      Boolean                  *haveDNS,
+                                      struct sockaddr          *sa)
+{
+       int                             i;
+       Boolean                         ok              = FALSE;
+       char                            ptr_name[128];
+
+       /*
+        * Ideally, we would have an API that given a local IP
+        * address would return the DNS server(s) that would field
+        * a given PTR query.  Fortunately, we do have an SPI which
+        * which will provide this information given a "name" so we
+        * take the address, convert it into the inverse query name,
+        * and find out which servers should be consulted.
+        */
+
+       switch (sa->sa_family) {
+               case AF_INET : {
+                       union {
+                               in_addr_t       s_addr;
+                               unsigned char   b[4];
+                       } rev;
+                       struct sockaddr_in      *sin    = (struct sockaddr_in *)sa;
+
+                       /*
+                        * build "PTR" query name
+                        *   NNN.NNN.NNN.NNN.in-addr.arpa.
+                        */
+                       rev.s_addr = sin->sin_addr.s_addr;
+                       (void) snprintf(ptr_name, sizeof(ptr_name), "%u.%u.%u.%u.in-addr.arpa.",
+                                       rev.b[3],
+                                       rev.b[2],
+                                       rev.b[1],
+                                       rev.b[0]);
+
+                       break;
+               }
+
+               case AF_INET6 : {
+                       int                     s       = 0;
+                       struct sockaddr_in6     *sin6   = (struct sockaddr_in6 *)sa;
+                       int                     x       = sizeof(ptr_name);
+                       int                     n;
+
+                       /*
+                        * build IPv6 "nibble" PTR query name (RFC 1886, RFC 3152)
+                        *   N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.ip6.arpa.
+                        */
+                       for (i = sizeof(sin6->sin6_addr) - 1; i >= 0; i--) {
+                               n = snprintf(&ptr_name[s], x, "%x.%x.",
+                                            ( sin6->sin6_addr.s6_addr[i]       & 0xf),
+                                            ((sin6->sin6_addr.s6_addr[i] >> 4) & 0xf));
+                               if ((n == -1) || (n >= x)) {
+                                       goto done;
+                               }
+
+                               s += n;
+                               x -= n;
+                       }
+
+                       n = snprintf(&ptr_name[s], x, "ip6.arpa.");
+                       if ((n == -1) || (n >= x)) {
+                               goto done;
+                       }
+
+                       break;
+               }
+
+               default :
+                       goto done;
+       }
+
+       ok = _SC_checkResolverReachability(storeP, flags, haveDNS, ptr_name);
+
+    done :
+
+       return ok;
+}
+
+
+static CFStringRef
+replyMPCopyDescription(const void *info)
+{
+       SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)info;
+       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
+
+       return CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("<getaddrinfo_async_start reply MP> {name = %s, target = %p}"),
+                                       targetPrivate->name ? targetPrivate->name : "?",
+                                       target);
+}
+
+
 static Boolean
 startAsyncDNSQuery(SCNetworkReachabilityRef target) {
 static Boolean
 startAsyncDNSQuery(SCNetworkReachabilityRef target) {
-       CFMachPortContext               context         = { 0, (void *)target, CFRetain, CFRelease, CFCopyDescription };
+       CFMachPortContext               context         = { 0
+                                                         , (void *)target
+                                                         , CFRetain
+                                                         , CFRelease
+                                                         , replyMPCopyDescription
+                                                         };
        int                             error;
        struct addrinfo                 hints;
        CFIndex                         i;
        int                             error;
        struct addrinfo                 hints;
        CFIndex                         i;
@@ -1902,6 +2025,9 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                 * flags based on the availability of configured (but not
                                 * active) services.
                                 */
                                 * flags based on the availability of configured (but not
                                 * active) services.
                                 */
+
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("DNS server(s) not available"));
+
                                if (!checkAddress(storeP, NULL, &my_flags, &my_index)) {
                                        goto error;
                                }
                                if (!checkAddress(storeP, NULL, &my_flags, &my_index)) {
                                        goto error;
                                }
@@ -1911,7 +2037,7 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                         * return "host not found", set flags appropriately,
                                         * and schedule notification.
                                         */
                                         * return "host not found", set flags appropriately,
                                         * and schedule notification.
                                         */
-                                       __SCNetworkReachabilityCallbackSetResolvedAddress(EAI_NODATA,
+                                       __SCNetworkReachabilityCallbackSetResolvedAddress(EAI_NONAME,
                                                                                          NULL,
                                                                                          (void *)target);
                                        my_flags |= (targetPrivate->flags & kSCNetworkFlagsFirstResolvePending);
                                                                                          NULL,
                                                                                          (void *)target);
                                        my_flags |= (targetPrivate->flags & kSCNetworkFlagsFirstResolvePending);
@@ -1928,7 +2054,7 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                my_flags = targetPrivate->flags;
                                my_index = targetPrivate->if_index;
 
                                my_flags = targetPrivate->flags;
                                my_index = targetPrivate->if_index;
 
-                               if (targetPrivate->dnsPort) {
+                               if (targetPrivate->dnsPort != NULL) {
                                        /* if request already in progress */
                                        break;
                                }
                                        /* if request already in progress */
                                        break;
                                }
@@ -1943,7 +2069,7 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                        goto checkResolvedAddress;
                                }
 
                                        goto checkResolvedAddress;
                                }
 
-                               /* if request initiated */
+                               /* request initiated */
                                break;
                        }
 
                                break;
                        }
 
@@ -2010,7 +2136,11 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef                *storeP,
                                        }
                                }
                        } else {
                                        }
                                }
                        } else {
-                               if ((error == EAI_NODATA) && !targetPrivate->haveDNS) {
+                               if (((error == EAI_NONAME)
+#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
+                                    || (error == EAI_NODATA)
+#endif
+                                    ) && !targetPrivate->haveDNS) {
                                        /*
                                         * No DNS servers are defined. Set flags based on
                                         * the availability of configured (but not active)
                                        /*
                                         * No DNS servers are defined. Set flags based on
                                         * the availability of configured (but not active)
@@ -2056,7 +2186,7 @@ Boolean
 SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target,
                              SCNetworkConnectionFlags  *flags)
 {
 SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target,
                              SCNetworkConnectionFlags  *flags)
 {
-       Boolean                         ok;
+       Boolean                         ok              = TRUE;
        SCDynamicStoreRef               store           = NULL;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        SCDynamicStoreRef               store           = NULL;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
@@ -2065,16 +2195,22 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef  target,
                return FALSE;
        }
 
                return FALSE;
        }
 
+       pthread_mutex_lock(&targetPrivate->lock);
+
        if (targetPrivate->rlList != NULL) {
                // if being watched, return the last known (and what should be current) status
                *flags = targetPrivate->flags & ~kSCNetworkFlagsFirstResolvePending;
        if (targetPrivate->rlList != NULL) {
                // if being watched, return the last known (and what should be current) status
                *flags = targetPrivate->flags & ~kSCNetworkFlagsFirstResolvePending;
-               return TRUE;
+               goto done;
        }
 
 
        ok = __SCNetworkReachabilityGetFlags(&store, target, flags, NULL, FALSE);
        *flags &= ~kSCNetworkFlagsFirstResolvePending;
        }
 
 
        ok = __SCNetworkReachabilityGetFlags(&store, target, flags, NULL, FALSE);
        *flags &= ~kSCNetworkFlagsFirstResolvePending;
-       if (store != NULL)      CFRelease(store);
+       if (store != NULL) CFRelease(store);
+
+    done :
+
+       pthread_mutex_unlock(&targetPrivate->lock);
        return ok;
 }
 
        return ok;
 }
 
@@ -2082,7 +2218,6 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef    target,
 static void
 __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef  store)
 {
 static void
 __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef  store)
 {
-       CFStringRef                     dns_key;
        CFStringRef                     key;
        CFMutableArrayRef               keys;
        CFStringRef                     pattern;
        CFStringRef                     key;
        CFMutableArrayRef               keys;
        CFStringRef                     pattern;
@@ -2098,11 +2233,9 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef    store)
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
-       dns_key = CFStringCreateWithCString(NULL,
-                                           dns_configuration_notify_key(),
-                                           kCFStringEncodingASCII);
-       key = CFStringCreateWithFormat(NULL, NULL, CFSTR("Notify:%@"), dns_key);
-       CFRelease(dns_key);
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetDNS);
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
@@ -2167,7 +2300,6 @@ __SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef        store,
                                                 void                   *info)
 {
        Boolean         dnsConfigChanged        = FALSE;
                                                 void                   *info)
 {
        Boolean         dnsConfigChanged        = FALSE;
-       CFStringRef     dnsKey;
        CFIndex         i;
        CFStringRef     key;
        CFIndex         nTargets;
        CFIndex         i;
        CFStringRef     key;
        CFIndex         nTargets;
@@ -2189,16 +2321,13 @@ __SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef      store,
 
        SCLog(_sc_debug, LOG_INFO, CFSTR("process configuration change"));
 
 
        SCLog(_sc_debug, LOG_INFO, CFSTR("process configuration change"));
 
-       dnsKey = CFStringCreateWithCString(NULL,
-                                          dns_configuration_notify_key(),
-                                          kCFStringEncodingASCII);
-       key = CFStringCreateWithFormat(NULL, NULL, CFSTR("Notify:%@"), dnsKey);
-       CFRelease(dnsKey);
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetDNS);
        if (CFArrayContainsValue(changedKeys,
                                 CFRangeMake(0, CFArrayGetCount(changedKeys)),
                                 key)) {
                dnsConfigChanged = TRUE;        /* the DNS server(s) have changed */
        if (CFArrayContainsValue(changedKeys,
                                 CFRangeMake(0, CFArrayGetCount(changedKeys)),
                                 key)) {
                dnsConfigChanged = TRUE;        /* the DNS server(s) have changed */
-
        }
        CFRelease(key);
 
        }
        CFRelease(key);
 
@@ -2236,9 +2365,9 @@ __SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef        store,
                        }
 
                        if (dnsChanged) {
                        }
 
                        if (dnsChanged) {
-                               if (targetPrivate->dnsPort) {
+                               if (targetPrivate->dnsPort != NULL) {
                                        /* cancel the outstanding DNS query */
                                        /* cancel the outstanding DNS query */
-                                       lu_async_call_cancel(CFMachPortGetPort(targetPrivate->dnsPort));
+                                       getaddrinfo_async_cancel(CFMachPortGetPort(targetPrivate->dnsPort));
                                        CFRunLoopSourceInvalidate(targetPrivate->dnsRLS);
                                        CFRelease(targetPrivate->dnsRLS);
                                        targetPrivate->dnsRLS = NULL;
                                        CFRunLoopSourceInvalidate(targetPrivate->dnsRLS);
                                        CFRelease(targetPrivate->dnsRLS);
                                        targetPrivate->dnsRLS = NULL;
@@ -2371,6 +2500,18 @@ SCNetworkReachabilitySetCallback(SCNetworkReachabilityRef        target,
 }
 
 
 }
 
 
+static CFStringRef
+reachRLSCopyDescription(const void *info)
+{
+       SCNetworkReachabilityRef                target  = (SCNetworkReachabilityRef)info;
+
+       return CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("<SCNetworkReachability RLS> {target = %p}"),
+                                       target);
+}
+
+
 Boolean
 SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef      target,
                                         CFRunLoopRef                   runLoop,
 Boolean
 SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef      target,
                                         CFRunLoopRef                   runLoop,
@@ -2417,16 +2558,16 @@ SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef       target,
        }
 
        if (targetPrivate->rls == NULL) {
        }
 
        if (targetPrivate->rls == NULL) {
-               CFRunLoopSourceContext  context = { 0                   // version
-                                                 , (void *)target      // info
-                                                 , CFRetain            // retain
-                                                 , CFRelease           // release
-                                                 , CFCopyDescription   // copyDescription
-                                                 , CFEqual             // equal
-                                                 , CFHash              // hash
-                                                 , NULL                // schedule
-                                                 , NULL                // cancel
-                                                 , rlsPerform          // perform
+               CFRunLoopSourceContext  context = { 0                           // version
+                                                 , (void *)target              // info
+                                                 , CFRetain                    // retain
+                                                 , CFRelease                   // release
+                                                 , reachRLSCopyDescription     // copyDescription
+                                                 , CFEqual                     // equal
+                                                 , CFHash                      // hash
+                                                 , NULL                        // schedule
+                                                 , NULL                        // cancel
+                                                 , rlsPerform                  // perform
                                                  };
 
                targetPrivate->rls    = CFRunLoopSourceCreate(NULL, 0, &context);
                                                  };
 
                targetPrivate->rls    = CFRunLoopSourceCreate(NULL, 0, &context);
@@ -2510,7 +2651,7 @@ SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef       target,
 
        if (!isA_SCNetworkReachability(target) || runLoop == NULL || runLoopMode == NULL) {
                _SCErrorSet(kSCStatusInvalidArgument);
 
        if (!isA_SCNetworkReachability(target) || runLoop == NULL || runLoopMode == NULL) {
                _SCErrorSet(kSCStatusInvalidArgument);
-               goto done;
+               return FALSE;
        }
 
        pthread_mutex_lock(&hn_lock);
        }
 
        pthread_mutex_lock(&hn_lock);
@@ -2518,11 +2659,13 @@ SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef     target,
 
        if (targetPrivate->rls == NULL) {
                /* if not currently scheduled */
 
        if (targetPrivate->rls == NULL) {
                /* if not currently scheduled */
+               _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
 
        if (!_SC_unschedule(NULL, runLoop, runLoopMode, targetPrivate->rlList, FALSE)) {
                /* if not currently scheduled */
                goto done;
        }
 
        if (!_SC_unschedule(NULL, runLoop, runLoopMode, targetPrivate->rlList, FALSE)) {
                /* if not currently scheduled */
+               _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
 
                goto done;
        }
 
@@ -2549,9 +2692,9 @@ SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef       target,
                        targetPrivate->rlList = NULL;
                        CFSetRemoveValue(hn_targets, target);           /* cleanup notification resources */
 
                        targetPrivate->rlList = NULL;
                        CFSetRemoveValue(hn_targets, target);           /* cleanup notification resources */
 
-                       if (targetPrivate->dnsPort) {
+                       if (targetPrivate->dnsPort != NULL) {
                                /* if we have an active async DNS query too */
                                /* if we have an active async DNS query too */
-                               lu_async_call_cancel(CFMachPortGetPort(targetPrivate->dnsPort));
+                               getaddrinfo_async_cancel(CFMachPortGetPort(targetPrivate->dnsPort));
                                CFRunLoopSourceInvalidate(targetPrivate->dnsRLS);
                                CFRelease(targetPrivate->dnsRLS);
                                targetPrivate->dnsRLS = NULL;
                                CFRunLoopSourceInvalidate(targetPrivate->dnsRLS);
                                CFRelease(targetPrivate->dnsRLS);
                                targetPrivate->dnsRLS = NULL;
index 5a88d5399494e7cd13f5fe4091c16188ea27e3f5..8245e5ccebbeee60926480b67d6318b26cd53b24 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -32,7 +32,7 @@
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCNetworkConfigurationInternal.h>
+#include "SCNetworkConfigurationInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
@@ -42,6 +42,7 @@
 static CFStringRef     __SCNetworkServiceCopyDescription       (CFTypeRef cf);
 static void            __SCNetworkServiceDeallocate            (CFTypeRef cf);
 static Boolean         __SCNetworkServiceEqual                 (CFTypeRef cf1, CFTypeRef cf2);
 static CFStringRef     __SCNetworkServiceCopyDescription       (CFTypeRef cf);
 static void            __SCNetworkServiceDeallocate            (CFTypeRef cf);
 static Boolean         __SCNetworkServiceEqual                 (CFTypeRef cf1, CFTypeRef cf2);
+static CFHashCode      __SCNetworkServiceHash                  (CFTypeRef cf);
 
 
 static CFTypeID __kSCNetworkServiceTypeID      = _kCFRuntimeNotATypeID;
 
 
 static CFTypeID __kSCNetworkServiceTypeID      = _kCFRuntimeNotATypeID;
@@ -54,7 +55,7 @@ static const CFRuntimeClass __SCNetworkServiceClass = {
        NULL,                                   // copy
        __SCNetworkServiceDeallocate,           // dealloc
        __SCNetworkServiceEqual,                // equal
        NULL,                                   // copy
        __SCNetworkServiceDeallocate,           // dealloc
        __SCNetworkServiceEqual,                // equal
-       NULL,                                   // hash
+       __SCNetworkServiceHash,                 // hash
        NULL,                                   // copyFormattingDesc
        __SCNetworkServiceCopyDescription       // copyDebugDesc
 };
        NULL,                                   // copyFormattingDesc
        __SCNetworkServiceCopyDescription       // copyDebugDesc
 };
@@ -63,13 +64,6 @@ static const CFRuntimeClass __SCNetworkServiceClass = {
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
 
 
-static __inline__ CFTypeRef
-isA_SCNetworkService(CFTypeRef obj)
-{
-       return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
-}
-
-
 static CFStringRef
 __SCNetworkServiceCopyDescription(CFTypeRef cf)
 {
 static CFStringRef
 __SCNetworkServiceCopyDescription(CFTypeRef cf)
 {
@@ -78,10 +72,10 @@ __SCNetworkServiceCopyDescription(CFTypeRef cf)
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkService %p [%p]> { "), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR("id=%@"), servicePrivate->serviceID);
-//     CFStringAppendFormat(result, NULL, CFSTR(", prefs=%@"), servicePrivate->prefs);
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
+       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkService %p [%p]> {"), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR("id = %@"), servicePrivate->serviceID);
+       CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), servicePrivate->prefs);
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
        return result;
 }
@@ -121,6 +115,15 @@ __SCNetworkServiceEqual(CFTypeRef cf1, CFTypeRef cf2)
 }
 
 
 }
 
 
+static CFHashCode
+__SCNetworkServiceHash(CFTypeRef cf)
+{
+       SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)cf;
+
+       return CFHash(servicePrivate->serviceID);
+}
+
+
 static void
 __SCNetworkServiceInitialize(void)
 {
 static void
 __SCNetworkServiceInitialize(void)
 {
@@ -131,9 +134,9 @@ __SCNetworkServiceInitialize(void)
 
 __private_extern__ SCNetworkServicePrivateRef
 __SCNetworkServiceCreatePrivate(CFAllocatorRef         allocator,
 
 __private_extern__ SCNetworkServicePrivateRef
 __SCNetworkServiceCreatePrivate(CFAllocatorRef         allocator,
+                               SCPreferencesRef        prefs,
                                CFStringRef             serviceID,
                                CFStringRef             serviceID,
-                               SCNetworkInterfaceRef   interface,
-                               SCPreferencesRef        prefs)
+                               SCNetworkInterfaceRef   interface)
 {
        SCNetworkServicePrivateRef              servicePrivate;
        uint32_t                                size;
 {
        SCNetworkServicePrivateRef              servicePrivate;
        uint32_t                                size;
@@ -159,37 +162,19 @@ __SCNetworkServiceCreatePrivate(CFAllocatorRef            allocator,
 }
 
 
 }
 
 
-/* ---------- SCNetworkService APIs ---------- */
+#pragma mark -
+#pragma mark SCNetworkService APIs
 
 
 #define        N_QUICK 64
 
 
 
 
 #define        N_QUICK 64
 
 
-Boolean
-SCNetworkServiceAddProtocolType(SCNetworkServiceRef service, CFStringRef protocolType)
+static CFDictionaryRef
+_protocolTemplate(SCNetworkServiceRef service, CFStringRef protocolType)
 {
 {
-       CFDictionaryRef                 entity;
        CFDictionaryRef                 newEntity       = NULL;
        CFDictionaryRef                 newEntity       = NULL;
-       Boolean                         ok              = FALSE;
-       CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!__SCNetworkProtocolIsValidType(protocolType)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
-                                                             servicePrivate->serviceID,        // service
-                                                             protocolType);                    // entity
-
-       entity = SCPreferencesPathGetValue(servicePrivate->prefs, path);
-       if (entity != NULL) {
-               // if "protocol" already exists
-               _SCErrorSet(kSCStatusKeyExists);
-               goto done;
-       }
-
        if (servicePrivate->interface != NULL) {
                SCNetworkInterfaceRef   childInterface;
                CFStringRef             childInterfaceType      = NULL;
        if (servicePrivate->interface != NULL) {
                SCNetworkInterfaceRef   childInterface;
                CFStringRef             childInterfaceType      = NULL;
@@ -213,8 +198,58 @@ SCNetworkServiceAddProtocolType(SCNetworkServiceRef service, CFStringRef protoco
                                               &kCFTypeDictionaryValueCallBacks);
        }
 
                                               &kCFTypeDictionaryValueCallBacks);
        }
 
+       return newEntity;
+}
+
+
+Boolean
+SCNetworkServiceAddProtocolType(SCNetworkServiceRef service, CFStringRef protocolType)
+{
+       CFDictionaryRef                 entity;
+       CFDictionaryRef                 newEntity       = NULL;
+       Boolean                         ok              = FALSE;
+       CFStringRef                     path;
+       SCNetworkProtocolRef            protocol;
+       SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
+
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!__SCNetworkProtocolIsValidType(protocolType)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
+                                                             servicePrivate->serviceID,        // service
+                                                             protocolType);                    // entity
+
+       entity = SCPreferencesPathGetValue(servicePrivate->prefs, path);
+       if (entity != NULL) {
+               // if "protocol" already exists
+               _SCErrorSet(kSCStatusKeyExists);
+               goto done;
+       }
+
+       newEntity = CFDictionaryCreate(NULL,
+                                      NULL,
+                                      NULL,
+                                      0,
+                                      &kCFTypeDictionaryKeyCallBacks,
+                                      &kCFTypeDictionaryValueCallBacks);
        ok = SCPreferencesPathSetValue(servicePrivate->prefs, path, newEntity);
        CFRelease(newEntity);
        ok = SCPreferencesPathSetValue(servicePrivate->prefs, path, newEntity);
        CFRelease(newEntity);
+       if (!ok) {
+               goto done;
+       }
+
+       protocol  = SCNetworkServiceCopyProtocol(service, protocolType);
+       newEntity = _protocolTemplate(service, protocolType);
+       ok = SCNetworkProtocolSetConfiguration(protocol, newEntity);
+       CFRelease(newEntity);
+       CFRelease(protocol);
 
     done :
 
 
     done :
 
@@ -277,7 +312,7 @@ SCNetworkServiceCopyAll(SCPreferencesRef prefs)
                                continue;
                        }
 
                                continue;
                        }
 
-                       servicePrivate = __SCNetworkServiceCreatePrivate(NULL, keys[i], NULL, prefs);
+                       servicePrivate = __SCNetworkServiceCreatePrivate(NULL, prefs, keys[i], NULL);
                        CFArrayAppendValue(array, (SCNetworkServiceRef)servicePrivate);
                        CFRelease(servicePrivate);
                }
                        CFArrayAppendValue(array, (SCNetworkServiceRef)servicePrivate);
                        CFRelease(servicePrivate);
                }
@@ -346,6 +381,11 @@ SCNetworkServiceCopy(SCPreferencesRef prefs, CFStringRef serviceID)
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate;
 
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate;
 
+       if (!isA_CFString(serviceID)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                     // allocator
                                                              serviceID,                // service
                                                              kSCEntNetInterface);      // entity
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                     // allocator
                                                              serviceID,                // service
                                                              kSCEntNetInterface);      // entity
@@ -358,7 +398,7 @@ SCNetworkServiceCopy(SCPreferencesRef prefs, CFStringRef serviceID)
                return NULL;
        }
 
                return NULL;
        }
 
-       servicePrivate = __SCNetworkServiceCreatePrivate(NULL, serviceID, NULL, prefs);
+       servicePrivate = __SCNetworkServiceCreatePrivate(NULL, prefs, serviceID, NULL);
        return (SCNetworkServiceRef)servicePrivate;
 }
 
        return (SCNetworkServiceRef)servicePrivate;
 }
 
@@ -372,6 +412,16 @@ SCNetworkServiceCopyProtocol(SCNetworkServiceRef service, CFStringRef protocolTy
        SCNetworkProtocolPrivateRef     protocolPrivate = NULL;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        SCNetworkProtocolPrivateRef     protocolPrivate = NULL;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (!isA_CFString(protocolType)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
@@ -417,6 +467,11 @@ SCNetworkServiceCopyProtocols(SCNetworkServiceRef service)
        CFDictionaryRef                 protocols;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFDictionaryRef                 protocols;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
@@ -495,11 +550,22 @@ __SCNetworkServiceSetInterfaceEntity(SCNetworkServiceRef     service,
 }
 
 
 }
 
 
+static void
+mergeDict(const void *key, const void *value, void *context)
+{
+       CFMutableDictionaryRef  newDict = (CFMutableDictionaryRef)context;
+
+       CFDictionarySetValue(newDict, key, value);
+       return;
+}
+
+
 SCNetworkServiceRef
 SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
 {
        CFArrayRef                      components;
        CFArrayRef                      interface_config;
 SCNetworkServiceRef
 SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
 {
        CFArrayRef                      components;
        CFArrayRef                      interface_config;
+       CFStringRef                     interface_name;
        SCNetworkInterfaceRef           newInterface;
        CFStringRef                     path;
        CFStringRef                     prefix;
        SCNetworkInterfaceRef           newInterface;
        CFStringRef                     path;
        CFStringRef                     prefix;
@@ -507,6 +573,11 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
        SCNetworkServicePrivateRef      servicePrivate;
        CFArrayRef                      supported_protocols;
 
        SCNetworkServicePrivateRef      servicePrivate;
        CFArrayRef                      supported_protocols;
 
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        // only allow network interfaces which support one or more protocols
        // to be added to a service.  The one exception is that we allow
        // third-party interface types to be configured.
        // only allow network interfaces which support one or more protocols
        // to be added to a service.  The one exception is that we allow
        // third-party interface types to be configured.
@@ -522,7 +593,8 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
 
        // establish the service
        prefix = SCPreferencesPathKeyCreateNetworkServices(NULL);
 
        // establish the service
        prefix = SCPreferencesPathKeyCreateNetworkServices(NULL);
-       path = SCPreferencesPathCreateUniqueChild(prefs, prefix);
+       path = __SCPreferencesPathCreateUniqueChild_WithMoreSCFCompatibility(prefs, prefix);
+       if (path == NULL) path = SCPreferencesPathCreateUniqueChild(prefs, prefix);
        CFRelease(prefix);
        if (path == NULL) {
                return NULL;
        CFRelease(prefix);
        if (path == NULL) {
                return NULL;
@@ -532,13 +604,14 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
        CFRelease(path);
 
        serviceID = CFArrayGetValueAtIndex(components, 2);
        CFRelease(path);
 
        serviceID = CFArrayGetValueAtIndex(components, 2);
-       servicePrivate = __SCNetworkServiceCreatePrivate(NULL, serviceID, NULL, prefs);
+       servicePrivate = __SCNetworkServiceCreatePrivate(NULL, prefs, serviceID, NULL);
        CFRelease(components);
 
        // duplicate the interface and associate the copy with the new service
        newInterface = (SCNetworkInterfaceRef)__SCNetworkInterfaceCreateCopy(NULL,
                                                                             interface,
        CFRelease(components);
 
        // duplicate the interface and associate the copy with the new service
        newInterface = (SCNetworkInterfaceRef)__SCNetworkInterfaceCreateCopy(NULL,
                                                                             interface,
-                                                                            (SCNetworkServiceRef)servicePrivate);
+                                                                            prefs,
+                                                                            serviceID);
        servicePrivate->interface = newInterface;
 
        // establish "default" configuration(s) for the interface
        servicePrivate->interface = newInterface;
 
        // establish "default" configuration(s) for the interface
@@ -558,29 +631,78 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
 
                config = __copyInterfaceTemplate(interfaceType, childInterfaceType);
                if (config != NULL) {
 
                config = __copyInterfaceTemplate(interfaceType, childInterfaceType);
                if (config != NULL) {
-                       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeModem) ||
-                           CFEqual(interfaceType, kSCNetworkInterfaceTypeSerial)) {
-                               CFStringRef     modemCCL;
-
-                               modemCCL = __SCNetworkInterfaceGetModemCCL(interface);
-                               if (modemCCL == NULL) {
-                                       if (__SCNetworkInterfaceIsModemV92(interface)) {
-                                               modemCCL = CFSTR("Apple Internal 56K Modem (v.92)");
-                                       }
+                       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBluetooth) ||
+                           CFEqual(interfaceType, kSCNetworkInterfaceTypeIrDA     ) ||
+                           CFEqual(interfaceType, kSCNetworkInterfaceTypeModem    ) ||
+                           CFEqual(interfaceType, kSCNetworkInterfaceTypeSerial   ) ||
+                           CFEqual(interfaceType, kSCNetworkInterfaceTypeWWAN     )) {
+                               CFDictionaryRef overrides;
+                               CFStringRef     script;
+
+                               overrides = __SCNetworkInterfaceGetTemplateOverrides(interface, kSCNetworkInterfaceTypeModem);
+
+                               // a ConnectionScript (and related keys) from the interface
+                               // should trump the settings from the configuration template.
+                               if ((overrides != NULL) &&
+                                   CFDictionaryContainsKey(overrides, kSCPropNetModemConnectionScript)) {
+                                       CFMutableDictionaryRef  newConfig;
+
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetModemConnectionPersonality);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetModemConnectionScript);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetModemDeviceVendor);
+                                       CFDictionaryRemoveValue(newConfig, kSCPropNetModemDeviceModel);
+                                       CFRelease(config);
+                                       config = newConfig;
+                               }
+
+                               // update template for v.92 modems
+                               if ((overrides == NULL) &&
+                                   CFDictionaryGetValueIfPresent(config,
+                                                                 kSCPropNetModemConnectionScript,
+                                                                 (const void **)&script) &&
+                                   CFEqual(script, CFSTR("v.34 Personality")) &&
+                                   _SCNetworkInterfaceIsModemV92(interface)) {
+                                       CFMutableDictionaryRef  newConfig;
+
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                                       CFDictionarySetValue(newConfig,
+                                                            kSCPropNetModemConnectionPersonality,
+                                                            CFSTR("v.92 Personality"));
+                                       CFDictionarySetValue(newConfig,
+                                                            kSCPropNetModemDeviceModel,
+                                                            CFSTR("Apple Modem (v.92)"));
+                                       CFRelease(config);
+                                       config = newConfig;
                                }
 
                                }
 
-                               if (modemCCL != NULL) {
+                               if (overrides != NULL) {
                                        CFMutableDictionaryRef  newConfig;
 
                                        newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
                                        CFMutableDictionaryRef  newConfig;
 
                                        newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                                       CFDictionarySetValue(newConfig, kSCPropNetModemConnectionScript, modemCCL);
+                                       CFDictionaryApplyFunction(overrides, mergeDict, newConfig);
+                                       CFRelease(config);
+                                       config = newConfig;
+                               }
+                       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                               CFDictionaryRef         overrides;
+
+                               overrides = __SCNetworkInterfaceGetTemplateOverrides(interface, kSCNetworkInterfaceTypePPP);
+                               if (overrides != NULL) {
+                                       CFMutableDictionaryRef  newConfig;
 
 
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                                       CFDictionaryApplyFunction(overrides, mergeDict, newConfig);
                                        CFRelease(config);
                                        config = newConfig;
                                }
                        }
 
                                        CFRelease(config);
                                        config = newConfig;
                                }
                        }
 
-                       (void) __SCNetworkInterfaceSetConfiguration(interface, config, TRUE);
+                       if (!__SCNetworkInterfaceSetConfiguration(interface, NULL, config, TRUE)) {
+                               SCLog(TRUE, LOG_DEBUG,
+                                     CFSTR("SCNetworkService __SCNetworkInterfaceSetConfiguration failed(), interface=%@, type=NULL"),
+                                     interface);
+                       }
                        CFRelease(config);
                }
        }
                        CFRelease(config);
                }
        }
@@ -592,11 +714,88 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
        // push the [deep] interface configuration into the service.
        interface_config = __SCNetworkInterfaceCopyDeepConfiguration(servicePrivate->interface);
        __SCNetworkInterfaceSetDeepConfiguration(servicePrivate->interface, interface_config);
        // push the [deep] interface configuration into the service.
        interface_config = __SCNetworkInterfaceCopyDeepConfiguration(servicePrivate->interface);
        __SCNetworkInterfaceSetDeepConfiguration(servicePrivate->interface, interface_config);
+       if (interface_config != NULL) CFRelease(interface_config);
+
+       // set the service name to match that of the associated interface
+       //
+       // Note: It might seem a bit odd to call SCNetworkServiceGetName
+       // followed by an immediate call to SCNetworkServiceSetName.  The
+       // trick here is that if no name has previously been set, the
+       // "get" function will return the name of the associated interface.
+       //
+       // ... and we "set" a name to ensure that applications that do
+       // not use the APIs will still find a UserDefinedName property
+       // in the SCDynamicStore.
+       //
+       interface_name = SCNetworkServiceGetName((SCNetworkServiceRef)servicePrivate);
+       if (interface_name != NULL) {
+               (void) SCNetworkServiceSetName((SCNetworkServiceRef)servicePrivate,
+                                              interface_name);
+       }
 
        return (SCNetworkServiceRef)servicePrivate;
 }
 
 
 
        return (SCNetworkServiceRef)servicePrivate;
 }
 
 
+Boolean
+SCNetworkServiceEstablishDefaultConfiguration(SCNetworkServiceRef service)
+{
+       CFIndex                 i;
+       SCNetworkInterfaceRef   interface;
+       CFIndex                 n;
+       CFArrayRef              protocolTypes;
+
+       interface = SCNetworkServiceGetInterface(service);
+       if (interface == NULL) {
+               return FALSE;
+       }
+
+       protocolTypes = SCNetworkInterfaceGetSupportedProtocolTypes(interface);
+       n = (protocolTypes != NULL) ? CFArrayGetCount(protocolTypes) : 0;
+       for (i = 0; i < n; i++) {
+               Boolean                 enabled;
+               CFDictionaryRef         newEntity       = NULL;
+               Boolean                 ok;
+               SCNetworkProtocolRef    protocol        = NULL;
+               CFStringRef             protocolType;
+
+               protocolType = CFArrayGetValueAtIndex(protocolTypes, i);
+               ok = SCNetworkServiceAddProtocolType(service, protocolType);
+               if (!ok && (SCError() != kSCStatusKeyExists)) {
+                       // could not add protocol
+                       goto nextProtocol;
+               }
+
+               protocol = SCNetworkServiceCopyProtocol(service, protocolType);
+               if (protocol == NULL) {
+                       // oops, somethings wrong (should never happen)
+                       goto nextProtocol;
+               }
+
+               newEntity = _protocolTemplate(service, protocolType);
+               ok = SCNetworkProtocolSetConfiguration(protocol, newEntity);
+               if (!ok) {
+                       // could not set default configuration
+                       goto nextProtocol;
+               }
+
+               enabled = !CFDictionaryContainsKey(newEntity, kSCResvInactive);
+               ok = SCNetworkProtocolSetEnabled(protocol, enabled);
+               if (!ok) {
+                       // could not enable/disable protocol
+                       goto nextProtocol;
+               }
+
+           nextProtocol :
+
+               if (newEntity != NULL) CFRelease(newEntity);
+               if (protocol  != NULL) CFRelease(protocol);
+       }
+
+       return TRUE;
+}
+
+
 Boolean
 SCNetworkServiceGetEnabled(SCNetworkServiceRef service)
 {
 Boolean
 SCNetworkServiceGetEnabled(SCNetworkServiceRef service)
 {
@@ -604,6 +803,11 @@ SCNetworkServiceGetEnabled(SCNetworkServiceRef service)
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
@@ -619,6 +823,11 @@ SCNetworkServiceGetInterface(SCNetworkServiceRef service)
 {
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
 {
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        if (servicePrivate->interface == NULL) {
                CFDictionaryRef entity;
                CFStringRef     path;
        if (servicePrivate->interface == NULL) {
                CFDictionaryRef entity;
                CFStringRef     path;
@@ -630,7 +839,7 @@ SCNetworkServiceGetInterface(SCNetworkServiceRef service)
                CFRelease(path);
 
                if (isA_CFDictionary(entity)) {
                CFRelease(path);
 
                if (isA_CFDictionary(entity)) {
-                       servicePrivate->interface = __SCNetworkInterfaceCreateWithEntity(NULL, entity, service);
+                       servicePrivate->interface = _SCNetworkInterfaceCreateWithEntity(NULL, entity, service);
                }
        }
 
                }
        }
 
@@ -642,10 +851,16 @@ CFStringRef
 SCNetworkServiceGetName(SCNetworkServiceRef service)
 {
        CFDictionaryRef                 entity;
 SCNetworkServiceGetName(SCNetworkServiceRef service)
 {
        CFDictionaryRef                 entity;
+       SCNetworkInterfaceRef           interface;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
        CFStringRef                     name            = NULL;
        CFStringRef                     path;
 
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
        CFStringRef                     name            = NULL;
        CFStringRef                     path;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
@@ -654,9 +869,39 @@ SCNetworkServiceGetName(SCNetworkServiceRef service)
 
        if (isA_CFDictionary(entity)) {
                name = CFDictionaryGetValue(entity, kSCPropUserDefinedName);
 
        if (isA_CFDictionary(entity)) {
                name = CFDictionaryGetValue(entity, kSCPropUserDefinedName);
+               name = isA_CFString(name);
+       }
+
+       interface = SCNetworkServiceGetInterface(service);
+       while (interface != NULL) {
+               SCNetworkInterfaceRef   childInterface;
+
+               childInterface = SCNetworkInterfaceGetInterface(interface);
+               if (childInterface == NULL) {
+                       break;
+               }
+
+               interface = childInterface;
        }
 
        }
 
-       return isA_CFString(name) ? name : NULL;
+       if (interface != NULL) {
+               if (name != NULL) {
+                       CFStringRef     interface_name;
+
+                       interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface);
+                       if ((interface_name != NULL) && CFEqual(name, interface_name)) {
+                               // if service name matches the [non-]localized
+                               // interface name
+                               name = NULL;
+                       }
+               }
+
+               if (name == NULL) {
+                       name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+               }
+       }
+
+       return name;
 }
 
 
 }
 
 
@@ -665,6 +910,11 @@ SCNetworkServiceGetServiceID(SCNetworkServiceRef service)
 {
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
 {
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        return servicePrivate->serviceID;
 }
 
        return servicePrivate->serviceID;
 }
 
@@ -685,6 +935,11 @@ SCNetworkServiceRemove(SCNetworkServiceRef service)
        CFArrayRef                      sets;
        CFStringRef                     path;
 
        CFArrayRef                      sets;
        CFStringRef                     path;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        // remove service from all sets
 
        sets = SCNetworkSetCopyAll(servicePrivate->prefs);
        // remove service from all sets
 
        sets = SCNetworkSetCopyAll(servicePrivate->prefs);
@@ -726,6 +981,16 @@ SCNetworkServiceRemoveProtocolType(SCNetworkServiceRef service, CFStringRef prot
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!__SCNetworkProtocolIsValidType(protocolType)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              protocolType);                    // entity
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              protocolType);                    // entity
@@ -753,6 +1018,11 @@ SCNetworkServiceSetEnabled(SCNetworkServiceRef service, Boolean enabled)
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
@@ -771,9 +1041,49 @@ SCNetworkServiceSetName(SCNetworkServiceRef service, CFStringRef name)
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((name != NULL) && !isA_CFString(name)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (name != NULL) {
+               SCNetworkInterfaceRef   interface;
+
+               interface = SCNetworkServiceGetInterface(service);
+               while (interface != NULL) {
+                       SCNetworkInterfaceRef   childInterface;
+
+                       childInterface = SCNetworkInterfaceGetInterface(interface);
+                       if (childInterface == NULL) {
+                               break;
+                       }
+
+                       interface = childInterface;
+               }
+
+               if (interface != 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;
+                               }
+                       }
+               }
+       }
+
 #define PREVENT_DUPLICATE_SERVICE_NAMES
 #ifdef  PREVENT_DUPLICATE_SERVICE_NAMES
 #define PREVENT_DUPLICATE_SERVICE_NAMES
 #ifdef  PREVENT_DUPLICATE_SERVICE_NAMES
-       if (isA_CFString(name)) {
+       if (name != NULL) {
                CFArrayRef      sets;
 
                // ensure that each service is uniquely named within its sets
                CFArrayRef      sets;
 
                // ensure that each service is uniquely named within its sets
@@ -850,7 +1160,7 @@ SCNetworkServiceSetName(SCNetworkServiceRef service, CFStringRef name)
                CFMutableDictionaryRef  newEntity;
 
                newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
                CFMutableDictionaryRef  newEntity;
 
                newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
-               if (isA_CFString(name)) {
+               if (name != NULL) {
                        CFDictionarySetValue(newEntity, kSCPropUserDefinedName, name);
                } else {
                        CFDictionaryRemoveValue(newEntity, kSCPropUserDefinedName);
                        CFDictionarySetValue(newEntity, kSCPropUserDefinedName, name);
                } else {
                        CFDictionaryRemoveValue(newEntity, kSCPropUserDefinedName);
index 72653fac7337aa351131e6eab80ef289e1385fce..922f7e01cb6e887b1a80c7cb61cb582c3644d843 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCNetworkConfigurationInternal.h>
+#include "SCNetworkConfigurationInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
-#include "SCNetworkConfiguration.h"
-#include "SCNetworkConfigurationInternal.h"
-
 #include <pthread.h>
 
 
 static CFStringRef     __SCNetworkSetCopyDescription           (CFTypeRef cf);
 static void            __SCNetworkSetDeallocate                (CFTypeRef cf);
 static Boolean         __SCNetworkSetEqual                     (CFTypeRef cf1, CFTypeRef cf2);
 #include <pthread.h>
 
 
 static CFStringRef     __SCNetworkSetCopyDescription           (CFTypeRef cf);
 static void            __SCNetworkSetDeallocate                (CFTypeRef cf);
 static Boolean         __SCNetworkSetEqual                     (CFTypeRef cf1, CFTypeRef cf2);
+static CFHashCode      __SCNetworkSetHash                      (CFTypeRef cf);
 
 
 static CFTypeID __kSCNetworkSetTypeID  = _kCFRuntimeNotATypeID;
 
 
 static CFTypeID __kSCNetworkSetTypeID  = _kCFRuntimeNotATypeID;
@@ -57,7 +55,7 @@ static const CFRuntimeClass __SCNetworkSetClass = {
        NULL,                           // copy
        __SCNetworkSetDeallocate,       // dealloc
        __SCNetworkSetEqual,            // equal
        NULL,                           // copy
        __SCNetworkSetDeallocate,       // dealloc
        __SCNetworkSetEqual,            // equal
-       NULL,                           // hash
+       __SCNetworkSetHash,             // hash
        NULL,                           // copyFormattingDesc
        __SCNetworkSetCopyDescription   // copyDebugDesc
 };
        NULL,                           // copyFormattingDesc
        __SCNetworkSetCopyDescription   // copyDebugDesc
 };
@@ -66,13 +64,6 @@ static const CFRuntimeClass __SCNetworkSetClass = {
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
 
 
-static __inline__ CFTypeRef
-isA_SCNetworkSet(CFTypeRef obj)
-{
-       return (isA_CFType(obj, SCNetworkSetGetTypeID()));
-}
-
-
 static CFStringRef
 __SCNetworkSetCopyDescription(CFTypeRef cf)
 {
 static CFStringRef
 __SCNetworkSetCopyDescription(CFTypeRef cf)
 {
@@ -81,10 +72,13 @@ __SCNetworkSetCopyDescription(CFTypeRef cf)
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)cf;
 
        result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkSet %p [%p]> { "), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR("id=%@"), setPrivate->setID);
-//     CFStringAppendFormat(result, NULL, CFSTR(", prefs=%@"), setPrivate->prefs);
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
+       CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkSet %p [%p]> {"), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR("id = %@"), setPrivate->setID);
+       CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), setPrivate->prefs);
+       if (setPrivate->name != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", name = %@"), setPrivate->name);
+       }
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
        return result;
 }
@@ -95,12 +89,12 @@ __SCNetworkSetDeallocate(CFTypeRef cf)
 {
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)cf;
 
 {
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)cf;
 
-       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCNetworkSetDeallocate:"));
-
        /* release resources */
 
        CFRelease(setPrivate->setID);
        CFRelease(setPrivate->prefs);
        /* release resources */
 
        CFRelease(setPrivate->setID);
        CFRelease(setPrivate->prefs);
+       if (setPrivate->name != NULL)
+               CFRelease(setPrivate->name);
 
        return;
 }
 
        return;
 }
@@ -125,6 +119,15 @@ __SCNetworkSetEqual(CFTypeRef cf1, CFTypeRef cf2)
 }
 
 
 }
 
 
+static CFHashCode
+__SCNetworkSetHash(CFTypeRef cf)
+{
+       SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)cf;
+
+       return CFHash(setPrivate->setID);
+}
+
+
 static void
 __SCNetworkSetInitialize(void)
 {
 static void
 __SCNetworkSetInitialize(void)
 {
@@ -144,8 +147,6 @@ __SCNetworkSetCreatePrivate(CFAllocatorRef      allocator,
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkSetInitialize);
 
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkSetInitialize);
 
-       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCNetworkSetCreatePrivate:"));
-
        /* allocate target */
        size            = sizeof(SCNetworkSetPrivate) - sizeof(CFRuntimeBase);
        setPrivate = (SCNetworkSetPrivateRef)_CFRuntimeCreateInstance(allocator,
        /* allocate target */
        size            = sizeof(SCNetworkSetPrivate) - sizeof(CFRuntimeBase);
        setPrivate = (SCNetworkSetPrivateRef)_CFRuntimeCreateInstance(allocator,
@@ -158,11 +159,192 @@ __SCNetworkSetCreatePrivate(CFAllocatorRef      allocator,
 
        setPrivate->setID       = CFStringCreateCopy(NULL, setID);
        setPrivate->prefs       = CFRetain(prefs);
 
        setPrivate->setID       = CFStringCreateCopy(NULL, setID);
        setPrivate->prefs       = CFRetain(prefs);
+       setPrivate->name        = NULL;
 
        return setPrivate;
 }
 
 
 
        return setPrivate;
 }
 
 
+#pragma mark -
+
+
+static Boolean
+_serviceIsPPP(SCNetworkServiceRef service)
+{
+       SCNetworkInterfaceRef   interface;
+       CFStringRef             interfaceType;
+
+       interface = SCNetworkServiceGetInterface(service);
+       if (interface == NULL) {
+               return FALSE;
+       }
+
+       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+       return CFEqual(interfaceType, kSCNetworkInterfaceTypePPP);
+}
+
+
+static Boolean
+_serviceIsVPN(SCNetworkServiceRef service)
+{
+       SCNetworkInterfaceRef   interface;
+       CFStringRef             interfaceType;
+
+//     if (!_serviceIsPPP(service)) {
+//             return FALSE;
+//     }
+
+       interface = SCNetworkServiceGetInterface(service);
+//     if (interface == NULL) {
+//             return FALSE;
+//     }
+
+       interface = SCNetworkInterfaceGetInterface(interface);
+       if (interface == NULL) {
+               return FALSE;
+       }
+
+       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+       return (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP) ||
+               CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP));
+}
+
+
+static int
+_serviceOrder(SCNetworkServiceRef service)
+{
+       SCNetworkInterfaceRef   interface;
+
+       interface = SCNetworkServiceGetInterface(service);
+       if (interface == NULL) {
+               return 100000;  // sort last
+       }
+
+       return __SCNetworkInterfaceOrder(interface);
+}
+
+
+static void
+_serviceOrder_add(SCNetworkSetRef set, SCNetworkServiceRef service)
+{
+       CFIndex                 i;
+       CFIndex                 n;
+       CFMutableArrayRef       newOrder;
+       CFArrayRef              order;
+       CFStringRef             serviceID;
+       SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
+       CFIndex                 slot;
+
+       order = SCNetworkSetGetServiceOrder(set);
+       if (order != NULL) {
+               newOrder = CFArrayCreateMutableCopy(NULL, 0, order);
+       } else {
+               newOrder = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       }
+       n = CFArrayGetCount(newOrder);
+
+       serviceID = SCNetworkServiceGetServiceID(service);
+       if (CFArrayContainsValue(newOrder, CFRangeMake(0, n), serviceID)) {
+               // if serviceID already present
+               goto done;
+       }
+
+       if (_serviceIsPPP(service) && !_serviceIsVPN(service)) {
+               int     serviceOrder;
+
+               /*
+                * we add [non-VPN] PPP interfaces to the head of the
+                * service order but ensure that "modem" devices are
+                * in front of "Bluetooth" & "IrDA" devices.
+                */
+               slot = 0;
+
+               serviceOrder = _serviceOrder(service);
+
+               for (i = 0; i < n; i++) {
+                       int                     slotOrder;
+                       CFStringRef             slotServiceID;
+                       SCNetworkServiceRef     slotService;
+
+                       slotServiceID = CFArrayGetValueAtIndex(newOrder, i);
+                       if (!isA_CFString(slotServiceID)) {
+                               // if bad prefs
+                               continue;
+                       }
+
+                       slotService = SCNetworkServiceCopy(setPrivate->prefs, slotServiceID);
+                       if (slotService == NULL) {
+                               // if serviceID not valid
+                               continue;
+                       }
+
+                       if (_serviceIsPPP(slotService)) {
+                               // if  PPP service
+                               slotOrder = _serviceOrder(slotService);
+                               if (serviceOrder >= slotOrder) {
+                                       // add the service *after* this one
+                                       slot = i + 1;
+                               }
+                       }
+
+                       CFRelease(slotService);
+               }
+       } else {
+               /*
+                * non-PPP interfaces are added to the end of the list.
+                */
+               slot = n;
+       }
+
+       CFArrayInsertValueAtIndex(newOrder, slot, serviceID);
+       (void) SCNetworkSetSetServiceOrder(set, newOrder);
+
+    done :
+
+       CFRelease(newOrder);
+
+       return;
+}
+
+
+static void
+_serviceOrder_remove(SCNetworkSetRef set, SCNetworkServiceRef service)
+{
+       CFMutableArrayRef       newOrder;
+       CFArrayRef              order;
+       CFStringRef             serviceID;
+
+       order = SCNetworkSetGetServiceOrder(set);
+       if (order == NULL) {
+               return;
+       }
+
+       serviceID = SCNetworkServiceGetServiceID(service);
+
+       newOrder = CFArrayCreateMutableCopy(NULL, 0, order);
+       while (TRUE) {
+               CFIndex i;
+
+               i = CFArrayGetFirstIndexOfValue(newOrder,
+                                               CFRangeMake(0, CFArrayGetCount(newOrder)),
+                                               serviceID);
+               if (i == kCFNotFound) {
+                       break;
+               }
+
+               CFArrayRemoveValueAtIndex(newOrder, i);
+       }
+       (void) SCNetworkSetSetServiceOrder(set, newOrder);
+       CFRelease(newOrder);
+
+       return;
+}
+
+
+#pragma mark -
+#pragma mark SCNetworkSet APIs
+
+
 #define        N_QUICK 16
 
 
 #define        N_QUICK 16
 
 
@@ -177,12 +359,57 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service)
        SCNetworkServicePrivateRef      servicePrivate          = (SCNetworkServicePrivateRef)service;
        SCNetworkSetPrivateRef          setPrivate              = (SCNetworkSetPrivateRef)set;
 
        SCNetworkServicePrivateRef      servicePrivate          = (SCNetworkServicePrivateRef)service;
        SCNetworkSetPrivateRef          setPrivate              = (SCNetworkSetPrivateRef)set;
 
-#define PREVENT_DUPLICATE_SETS
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+#define PREVENT_DUPLICATE_SERVICE_NAMES
+#ifdef  PREVENT_DUPLICATE_SERVICE_NAMES
+       CFStringRef     name;
+
+       name = SCNetworkServiceGetName(service);
+       if (name != NULL) {
+               CFArrayRef      services;
+
+               services = SCNetworkSetCopyServices(set);
+               if (services != NULL) {
+                       CFIndex i;
+                       CFIndex n;
+
+                       n = CFArrayGetCount(services);
+                       for (i = 0; i < n; i++) {
+                               CFStringRef             otherName;
+                               SCNetworkServiceRef     otherService;
+
+                               otherService = CFArrayGetValueAtIndex(services, i);
+                               otherName = SCNetworkServiceGetName(otherService);
+                               if ((otherName != NULL) && CFEqual(name, otherName)) {
+                                       /*
+                                        * if a service with the same "name" is
+                                        * already a member of the set.
+                                        */
+                                       CFRelease(services);
+                                       _SCErrorSet(kSCStatusKeyExists);
+                                       return FALSE;
+                               }
+                       }
+               }
+
+               CFRelease(services);
+       }
+#endif // PREVENT_DUPLICATE_SERVICE_NAMES
+
+//#define PREVENT_DUPLICATE_SETS
 #ifdef  PREVENT_DUPLICATE_SETS
 #ifdef  PREVENT_DUPLICATE_SETS
-       CFArrayRef                      sets;
+       CFArrayRef      sets;
 
        // ensure that each service is only a member of ONE set
 
        // ensure that each service is only a member of ONE set
-
        sets = SCNetworkSetCopyAll(setPrivate->prefs);
        if (sets != NULL) {
                CFIndex         i;
        sets = SCNetworkSetCopyAll(setPrivate->prefs);
        if (sets != NULL) {
                CFIndex         i;
@@ -229,7 +456,7 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service)
        CFRelease(path);
        CFRelease(link);
        if (!ok) {
        CFRelease(path);
        CFRelease(link);
        if (!ok) {
-               return ok;
+               goto done;
        }
 
        // push the [deep] interface configuration into all sets which contain this service.
        }
 
        // push the [deep] interface configuration into all sets which contain this service.
@@ -237,6 +464,12 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service)
                __SCNetworkInterfaceSetDeepConfiguration(interface, interface_config);
        }
 
                __SCNetworkInterfaceSetDeepConfiguration(interface, interface_config);
        }
 
+       // add service to ServiceOrder
+       _serviceOrder_add(set, service);
+
+    done :
+
+       if (interface_config != NULL)   CFRelease(interface_config);
        return ok;
 }
 
        return ok;
 }
 
@@ -248,6 +481,11 @@ SCNetworkSetCopy(SCPreferencesRef prefs, CFStringRef setID)
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate;
 
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate;
 
+       if (!isA_CFString(setID)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        path = SCPreferencesPathKeyCreateSet(NULL, setID);
        entity = SCPreferencesPathGetValue(prefs, path);
        CFRelease(path);
        path = SCPreferencesPathKeyCreateSet(NULL, setID);
        entity = SCPreferencesPathGetValue(prefs, path);
        CFRelease(path);
@@ -262,7 +500,50 @@ SCNetworkSetCopy(SCPreferencesRef prefs, CFStringRef setID)
 }
 
 
 }
 
 
-CFArrayRef /* of SCNetworkServiceRef's */
+static Boolean
+_SCNetworkServiceExistsForInterface(CFArrayRef services, SCNetworkInterfaceRef interface)
+{
+       CFIndex i;
+       CFIndex n;
+
+       n = isA_CFArray(services) ? CFArrayGetCount(services) : 0;
+       for (i = 0; i < n; i++) {
+               SCNetworkServiceRef     service;
+               SCNetworkInterfaceRef   service_interface;
+
+               service = CFArrayGetValueAtIndex(services, i);
+
+               service_interface = SCNetworkServiceGetInterface(service);
+               while (service_interface != NULL) {
+                       if (CFEqual(interface, service_interface)) {
+                               return TRUE;
+                       }
+
+                       service_interface = SCNetworkInterfaceGetInterface(service_interface);
+               }
+       }
+
+       return FALSE;
+}
+
+
+Boolean
+SCNetworkSetContainsInterface(SCNetworkSetRef set, SCNetworkInterfaceRef interface)
+{
+       Boolean         found   = FALSE;
+       CFArrayRef      services;
+
+       services = SCNetworkSetCopyServices(set);
+       if (services != NULL) {
+               found = _SCNetworkServiceExistsForInterface(services, interface);
+               CFRelease(services);
+       }
+
+       return found;
+}
+
+
+CFArrayRef /* of SCNetworkSetRef's */
 SCNetworkSetCopyAll(SCPreferencesRef prefs)
 {
        CFMutableArrayRef       array;
 SCNetworkSetCopyAll(SCPreferencesRef prefs)
 {
        CFMutableArrayRef       array;
@@ -359,6 +640,11 @@ SCNetworkSetCopyServices(SCNetworkSetRef set)
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        path = SCPreferencesPathKeyCreateSetNetworkService(NULL, setPrivate->setID, NULL);
        dict = SCPreferencesPathGetValue(setPrivate->prefs, path);
        CFRelease(path);
        path = SCPreferencesPathKeyCreateSetNetworkService(NULL, setPrivate->setID, NULL);
        dict = SCPreferencesPathGetValue(setPrivate->prefs, path);
        CFRelease(path);
@@ -409,9 +695,9 @@ SCNetworkSetCopyServices(SCNetworkSetRef set)
                                        SCNetworkServicePrivateRef      servicePrivate;
 
                                        servicePrivate = __SCNetworkServiceCreatePrivate(NULL,
                                        SCNetworkServicePrivateRef      servicePrivate;
 
                                        servicePrivate = __SCNetworkServiceCreatePrivate(NULL,
+                                                                                        setPrivate->prefs,
                                                                                         serviceID,
                                                                                         serviceID,
-                                                                                        NULL,
-                                                                                        setPrivate->prefs);
+                                                                                        NULL);
                                        CFArrayAppendValue(array, (SCNetworkServiceRef)servicePrivate);
                                        CFRelease(servicePrivate);
                                }
                                        CFArrayAppendValue(array, (SCNetworkServiceRef)servicePrivate);
                                        CFRelease(servicePrivate);
                                }
@@ -438,7 +724,8 @@ SCNetworkSetCreate(SCPreferencesRef prefs)
        SCNetworkSetPrivateRef  setPrivate;
 
        prefix = SCPreferencesPathKeyCreateSets(NULL);
        SCNetworkSetPrivateRef  setPrivate;
 
        prefix = SCPreferencesPathKeyCreateSets(NULL);
-       path = SCPreferencesPathCreateUniqueChild(prefs, prefix);
+       path = __SCPreferencesPathCreateUniqueChild_WithMoreSCFCompatibility(prefs, prefix);
+       if (path == NULL) path = SCPreferencesPathCreateUniqueChild(prefs, prefix);
        CFRelease(prefix);
        if (path == NULL) {
                return NULL;
        CFRelease(prefix);
        if (path == NULL) {
                return NULL;
@@ -460,6 +747,11 @@ SCNetworkSetGetSetID(SCNetworkSetRef set)
 {
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
 {
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        return setPrivate->setID;
 }
 
        return setPrivate->setID;
 }
 
@@ -467,20 +759,63 @@ SCNetworkSetGetSetID(SCNetworkSetRef set)
 CFStringRef
 SCNetworkSetGetName(SCNetworkSetRef set)
 {
 CFStringRef
 SCNetworkSetGetName(SCNetworkSetRef set)
 {
+       CFBundleRef             bundle;
        CFDictionaryRef         entity;
        CFDictionaryRef         entity;
-       CFStringRef             name            = NULL;
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (setPrivate->name != NULL) {
+               return setPrivate->name;;
+       }
+
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        entity = SCPreferencesPathGetValue(setPrivate->prefs, path);
        CFRelease(path);
 
        if (isA_CFDictionary(entity)) {
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        entity = SCPreferencesPathGetValue(setPrivate->prefs, path);
        CFRelease(path);
 
        if (isA_CFDictionary(entity)) {
+               CFStringRef     name;
+
                name = CFDictionaryGetValue(entity, kSCPropUserDefinedName);
                name = CFDictionaryGetValue(entity, kSCPropUserDefinedName);
+               if (isA_CFString(name)) {
+                       setPrivate->name = CFRetain(name);
+               }
        }
 
        }
 
-       return isA_CFString(name) ? name : NULL;
+       bundle = _SC_CFBundleGet();
+       if (bundle != NULL) {
+               if (setPrivate->name != NULL) {
+                       CFStringRef     non_localized;
+
+                       non_localized = _SC_CFBundleCopyNonLocalizedString(bundle,
+                                                                          CFSTR("DEFAULT_SET_NAME"),
+                                                                          CFSTR("Automatic"),
+                                                                          NULL);
+                       if (non_localized != NULL) {
+                               if (CFEqual(setPrivate->name, non_localized)) {
+                                       CFStringRef     localized;
+
+                                       // if "Automatic", return localized name
+                                       localized = CFBundleCopyLocalizedString(bundle,
+                                                                               CFSTR("DEFAULT_SET_NAME"),
+                                                                               CFSTR("Automatic"),
+                                                                               NULL);
+                                       if (localized != NULL) {
+                                               CFRelease(setPrivate->name);
+                                               setPrivate->name = localized;
+                                       }
+                               }
+
+                               CFRelease(non_localized);
+                       }
+               }
+       }
+
+       return setPrivate->name;
 }
 
 
 }
 
 
@@ -492,6 +827,11 @@ SCNetworkSetGetServiceOrder(SCNetworkSetRef set)
        CFArrayRef              serviceOrder;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
        CFArrayRef              serviceOrder;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        path = SCPreferencesPathKeyCreateSetNetworkGlobalEntity(NULL, setPrivate->setID, kSCEntNetIPv4);
        if (path == NULL) {
                return NULL;
        path = SCPreferencesPathKeyCreateSetNetworkGlobalEntity(NULL, setPrivate->setID, kSCEntNetIPv4);
        if (path == NULL) {
                return NULL;
@@ -526,6 +866,11 @@ SCNetworkSetRemove(SCNetworkSetRef set)
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        currentPath = SCPreferencesGetValue(setPrivate->prefs, kSCPrefCurrentSet);
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        if (!isA_CFString(currentPath) || !CFEqual(currentPath, path)) {
        currentPath = SCPreferencesGetValue(setPrivate->prefs, kSCPrefCurrentSet);
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        if (!isA_CFString(currentPath) || !CFEqual(currentPath, path)) {
@@ -547,6 +892,19 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service)
        SCNetworkServicePrivateRef      servicePrivate          = (SCNetworkServicePrivateRef)service;
        SCNetworkSetPrivateRef          setPrivate              = (SCNetworkSetPrivateRef)set;
 
        SCNetworkServicePrivateRef      servicePrivate          = (SCNetworkServicePrivateRef)service;
        SCNetworkSetPrivateRef          setPrivate              = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // remove service from ServiceOrder
+       _serviceOrder_remove(set, service);
+
        // get the [deep] interface configuration settings
        interface = SCNetworkServiceGetInterface(service);
        if (interface != NULL) {
        // get the [deep] interface configuration settings
        interface = SCNetworkServiceGetInterface(service);
        if (interface != NULL) {
@@ -587,6 +945,11 @@ SCNetworkSetSetCurrent(SCNetworkSetRef set)
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        ok = SCPreferencesSetValue(setPrivate->prefs, kSCPrefCurrentSet, path);
        CFRelease(path);
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        ok = SCPreferencesSetValue(setPrivate->prefs, kSCPrefCurrentSet, path);
        CFRelease(path);
@@ -597,14 +960,50 @@ SCNetworkSetSetCurrent(SCNetworkSetRef set)
 Boolean
 SCNetworkSetSetName(SCNetworkSetRef set, CFStringRef name)
 {
 Boolean
 SCNetworkSetSetName(SCNetworkSetRef set, CFStringRef name)
 {
+       CFBundleRef             bundle          = NULL;
        CFDictionaryRef         entity;
        CFDictionaryRef         entity;
+       CFStringRef             localized       = NULL;
+       CFStringRef             non_localized   = NULL;
        Boolean                 ok              = FALSE;
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
        Boolean                 ok              = FALSE;
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((name != NULL) && !isA_CFString(name)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // if known, compare against localized name
+
+       if (name != NULL) {
+               bundle = _SC_CFBundleGet();
+               if (bundle != NULL) {
+                       non_localized = _SC_CFBundleCopyNonLocalizedString(bundle,
+                                                                          CFSTR("DEFAULT_SET_NAME"),
+                                                                          CFSTR("Automatic"),
+                                                                          NULL);
+                       if (non_localized != NULL) {
+                               if (CFEqual(name, non_localized)) {
+                                       localized = CFBundleCopyLocalizedString(bundle,
+                                                                               CFSTR("DEFAULT_SET_NAME"),
+                                                                               CFSTR("Automatic"),
+                                                                               NULL);
+                                       if (localized != NULL) {
+                                               name = localized;
+                                       }
+                               }
+                       }
+               }
+       }
+
 #define PREVENT_DUPLICATE_SET_NAMES
 #ifdef  PREVENT_DUPLICATE_SET_NAMES
 #define PREVENT_DUPLICATE_SET_NAMES
 #ifdef  PREVENT_DUPLICATE_SET_NAMES
-       if (isA_CFString(name)) {
+       if (name != NULL) {
                CFArrayRef      sets;
 
                // ensure that each set is uniquely named
                CFArrayRef      sets;
 
                // ensure that each set is uniquely named
@@ -630,7 +1029,7 @@ SCNetworkSetSetName(SCNetworkSetRef set, CFStringRef name)
                                        // if "name" not unique
                                        CFRelease(sets);
                                        _SCErrorSet(kSCStatusKeyExists);
                                        // if "name" not unique
                                        CFRelease(sets);
                                        _SCErrorSet(kSCStatusKeyExists);
-                                       return FALSE;
+                                       goto done;
                                }
                        }
                        CFRelease(sets);
                                }
                        }
                        CFRelease(sets);
@@ -638,6 +1037,23 @@ SCNetworkSetSetName(SCNetworkSetRef set, CFStringRef name)
        }
 #endif  /* PREVENT_DUPLICATE_SET_NAMES */
 
        }
 #endif  /* PREVENT_DUPLICATE_SET_NAMES */
 
+       // if known, store non-localized name
+
+       if ((name != NULL) && (bundle != NULL) && (non_localized != NULL)) {
+               if (localized == NULL) {
+                       localized = CFBundleCopyLocalizedString(bundle,
+                                                               CFSTR("DEFAULT_SET_NAME"),
+                                                               CFSTR("Automatic"),
+                                                               NULL);
+               }
+
+               if (localized != NULL) {
+                       if (CFEqual(name, localized)) {
+                               name = non_localized;
+                       }
+               }
+       }
+
        // update the "name"
 
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        // update the "name"
 
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
@@ -654,7 +1070,7 @@ SCNetworkSetSetName(SCNetworkSetRef set, CFStringRef name)
                CFMutableDictionaryRef  newEntity;
 
                newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
                CFMutableDictionaryRef  newEntity;
 
                newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
-               if (isA_CFString(name)) {
+               if (name != NULL) {
                        CFDictionarySetValue(newEntity, kSCPropUserDefinedName, name);
                } else {
                        CFDictionaryRemoveValue(newEntity, kSCPropUserDefinedName);
                        CFDictionarySetValue(newEntity, kSCPropUserDefinedName, name);
                } else {
                        CFDictionaryRemoveValue(newEntity, kSCPropUserDefinedName);
@@ -664,6 +1080,10 @@ SCNetworkSetSetName(SCNetworkSetRef set, CFStringRef name)
        }
        CFRelease(path);
 
        }
        CFRelease(path);
 
+    done :
+
+       if (localized != NULL)          CFRelease(localized);
+       if (non_localized != NULL)      CFRelease(non_localized);
        return ok;
 }
 
        return ok;
 }
 
@@ -677,6 +1097,29 @@ SCNetworkSetSetServiceOrder(SCNetworkSetRef set, CFArrayRef newOrder)
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
        CFStringRef             path;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
 
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (isA_CFArray(newOrder)) {
+               CFIndex i;
+               CFIndex n       = CFArrayGetCount(newOrder);
+
+               for (i = 0; i < n; i++) {
+                       CFStringRef     serviceID;
+
+                       serviceID = CFArrayGetValueAtIndex(newOrder, i);
+                       if (!isA_CFString(serviceID)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+               }
+       } else {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        path = SCPreferencesPathKeyCreateSetNetworkGlobalEntity(NULL, setPrivate->setID, kSCEntNetIPv4);
        if (path == NULL) {
                return FALSE;
        path = SCPreferencesPathKeyCreateSetNetworkGlobalEntity(NULL, setPrivate->setID, kSCEntNetIPv4);
        if (path == NULL) {
                return FALSE;
@@ -699,3 +1142,141 @@ SCNetworkSetSetServiceOrder(SCNetworkSetRef set, CFArrayRef newOrder)
 
        return ok;
 }
 
        return ok;
 }
+
+
+#pragma mark -
+#pragma mark SCNetworkSet SPIs
+
+
+static void
+add_supported_interfaces(CFMutableArrayRef interface_list, SCNetworkInterfaceRef interface)
+{
+       CFIndex         i;
+       CFArrayRef      interface_types;
+       CFIndex         n;
+
+       interface_types = SCNetworkInterfaceGetSupportedInterfaceTypes(interface);
+       n = (interface_types != NULL) ? CFArrayGetCount(interface_types) : 0;
+       for (i = 0; i < n; i++) {
+               SCNetworkInterfaceRef   parent;
+               CFStringRef             interface_type;
+
+               interface_type = CFArrayGetValueAtIndex(interface_types, i);
+               parent = SCNetworkInterfaceCreateWithInterface(interface, interface_type);
+               if (parent != NULL) {
+                       CFArrayAppendValue(interface_list, parent);
+                       CFRelease(parent);
+               }
+       }
+
+       return;
+}
+
+
+Boolean
+SCNetworkSetEstablishDefaultConfiguration(SCNetworkSetRef set)
+{
+       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;
+       }
+
+       // first, assume that we only want to add new services
+       // for those interfaces that are not represented in the
+       // current set.
+       services = SCNetworkSetCopyServices(set);
+       if ((services != NULL) && (CFArrayGetCount(services) > 0)) {
+               // but, if we are starting off with a non-empty
+               // set than we only want to add new services for
+               // those interfaces that are not represented in
+               // *any* set.
+               CFRelease(services);
+               services = SCNetworkServiceCopyAll(setPrivate->prefs);
+       }
+
+       interfaces = SCNetworkInterfaceCopyAll();
+       n = (interfaces != NULL) ? CFArrayGetCount(interfaces) : 0;
+       for (i = 0; i < n; i++) {
+               SCNetworkInterfaceRef   interface;
+               CFMutableArrayRef       interface_list;
+
+               interface = CFArrayGetValueAtIndex(interfaces, i);
+               if (_SCNetworkServiceExistsForInterface(services, interface)) {
+                       // if this is not a new interface
+                       continue;
+               }
+
+               interface_list = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               CFArrayAppendValue(interface_list, interface);
+
+               while (ok && (CFArrayGetCount(interface_list) > 0)) {
+                       CFArrayRef              protocol_types;
+
+                       interface = CFArrayGetValueAtIndex(interface_list, 0);
+
+                       protocol_types = SCNetworkInterfaceGetSupportedProtocolTypes(interface);
+                       if ((protocol_types != NULL) && (CFArrayGetCount(protocol_types) > 0)) {
+                               SCNetworkServiceRef     service;
+
+                               service = SCNetworkServiceCreate(setPrivate->prefs, interface);
+                               if (service == NULL) {
+                                       SCLog(TRUE, LOG_DEBUG,
+                                             CFSTR("could not create service for \"%@\": %s\n"),
+                                             SCNetworkInterfaceGetLocalizedDisplayName(interface),
+                                             SCErrorString(SCError()));
+                                       ok = FALSE;
+                                       goto nextInterface;
+                               }
+
+                               ok = SCNetworkServiceEstablishDefaultConfiguration(service);
+                               if (!ok) {
+                                       SCLog(TRUE, LOG_DEBUG,
+                                             CFSTR("could not estabish default configuration for \"%@\": %s\n"),
+                                             SCNetworkInterfaceGetLocalizedDisplayName(interface),
+                                             SCErrorString(SCError()));
+                                       SCNetworkServiceRemove(service);
+                                       CFRelease(service);
+                                       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;
+                               }
+
+                               CFRelease(service);
+                               setUpdated = TRUE;
+                       } else {
+                               add_supported_interfaces(interface_list, interface);
+                       }
+
+                   nextInterface :
+
+                       CFArrayRemoveValueAtIndex(interface_list, 0);
+               }
+               CFRelease(interface_list);
+       }
+       if (interfaces != NULL) CFRelease(interfaces);
+       if (services != NULL)   CFRelease(services);
+
+       if (ok && !setUpdated) {
+               // if no changes were made
+               _SCErrorSet(kSCStatusOK);
+       }
+
+       return setUpdated;
+}
diff --git a/SystemConfiguration.fproj/SCNetworkSignature.c b/SystemConfiguration.fproj/SCNetworkSignature.c
new file mode 100644 (file)
index 0000000..0c7d4c9
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2006 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@
+ */
+
+/* 
+ * SCNetworkSignature.c
+ * - implementation of SCNetworkSignatureRef API that allows access to
+     network identification information
+ *     
+ */
+/*
+ * Modification History
+ *
+ * November 6, 2006    Dieter Siegmund (dieter@apple.com)
+ * - initial revision
+ */
+
+
+#include <netinet/in.h>
+#include <CoreFoundation/CFDictionary.h>
+#include <CoreFoundation/CFString.h>
+#include <CoreFoundation/CFArray.h>
+#include <CoreFoundation/CFRuntime.h>
+#include <SystemConfiguration/SCDynamicStore.h>
+#include <SystemConfiguration/SCValidation.h>
+#include <SystemConfiguration/SCPrivate.h>
+#include "SCNetworkSignature.h"
+#include "SCNetworkSignaturePrivate.h"
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#error MAC_OS_X_VERSION_MIN_REQUIRED < 1050, Check MACOSX_DEPLOYMENT_TARGET
+#endif
+
+const char * kSCNetworkSignatureActiveChangedNotifyName = NETWORK_ID_KEY ".active";
+
+
+#pragma mark SCNetworkSignature support routines
+
+static __inline__ SCDynamicStoreRef
+store_create(CFAllocatorRef alloc)
+{
+       return (SCDynamicStoreCreate(alloc, CFSTR("SCNetworkSignature"),
+                                    NULL, NULL));
+}
+
+static CFDictionaryRef
+store_copy_id_dict(CFAllocatorRef alloc, SCDynamicStoreRef store)
+{
+       CFDictionaryRef id_dict = NULL;
+       Boolean         release_store = FALSE;
+       
+       if (store == NULL) {
+               store = store_create(alloc);
+               if (store == NULL) {
+                       goto done;
+               }
+               release_store = TRUE;
+       }
+       id_dict = SCDynamicStoreCopyValue(store, 
+                                         kSCNetworkIdentificationStoreKey);
+       if (isA_CFDictionary(id_dict) == NULL) {
+               if (id_dict != NULL) {
+                       CFRelease(id_dict);
+                       id_dict = NULL;
+               }
+               goto done;
+       }
+ done:
+       if (release_store) {
+               CFRelease(store);
+       }
+       return (id_dict);
+}
+
+#pragma - 
+
+#pragma mark SCNetworkSignature APIs
+
+CFStringRef
+SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc,
+                                                const struct sockaddr * addr)
+{
+       CFDictionaryRef         id_dict = NULL;
+       CFStringRef             ident = NULL;
+       struct sockaddr_in *    sin_p;
+
+
+       /* only accept 0.0.0.0 (i.e. default) for now */
+       sin_p = (struct sockaddr_in *)addr;
+       if (addr == NULL 
+           || addr->sa_family != AF_INET
+           || addr->sa_len != sizeof(struct sockaddr_in)
+           || sin_p->sin_addr.s_addr != 0) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               goto done;
+       }
+       id_dict = store_copy_id_dict(alloc, NULL);
+       if (id_dict == NULL) {
+               _SCErrorSet(kSCStatusFailed);
+               goto done;
+       }
+       ident = CFDictionaryGetValue(id_dict, kStoreKeyPrimaryIPv4Identifier);
+       if (isA_CFString(ident) != NULL) {
+               CFRetain(ident);
+       }
+       else {
+               _SCErrorSet(kSCStatusFailed);
+       }
+ done:
+       if (id_dict != NULL) {
+               CFRelease(id_dict);
+       }
+       return (ident);
+}
+
+CFArrayRef /* of CFStringRef's */
+SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc)
+{
+       CFArrayRef              active = NULL;
+       int                     i;
+       int                     count = 0;
+       CFDictionaryRef         id_dict = NULL;
+
+       id_dict = store_copy_id_dict(alloc, NULL);
+       if (id_dict == NULL) {
+               goto done;
+       }
+       active = CFDictionaryGetValue(id_dict, kStoreKeyActiveIdentifiers);
+       if (isA_CFArray(active) != NULL) {
+               count = CFArrayGetCount(active);
+       }
+       if (count == 0) {
+               active = NULL;
+               goto done;
+       }
+       for (i = 0; i < count; i++) {
+               CFStringRef     ident = CFArrayGetValueAtIndex(active, i);
+
+               if (isA_CFString(ident) == NULL) {
+                       active = NULL;
+                       goto done;
+               }
+       }
+       CFRetain(active);
+       
+ done:
+       if (id_dict != NULL) {
+               CFRelease(id_dict);
+       }
+       if (active == NULL) {
+               _SCErrorSet(kSCStatusFailed);
+       }
+       return (active);
+}
+
+#pragma mark -
diff --git a/SystemConfiguration.fproj/SCNetworkSignature.h b/SystemConfiguration.fproj/SCNetworkSignature.h
new file mode 100644 (file)
index 0000000..d8d7a42
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2006 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@
+ */
+
+#ifndef _SCNETWORKSIGNATURE_H
+#define _SCNETWORKSIGNATURE_H
+
+#include <AvailabilityMacros.h>
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+#include <CoreFoundation/CFString.h>
+#include <CoreFoundation/CFArray.h>
+#include <netinet/in.h>
+
+/*!
+       @header SCNetworkSignature
+       @discussion The SCNetworkSignature API provides access to the 
+               network identification information.  Each routable network
+               has an associated signature that is assigned a unique
+               identifier.  The unique identifier allows an application
+               to associate settings with a particular network
+               or set of networks.
+ */
+
+/*!
+       @const kSCNetworkSignatureActiveChangedNotifyName
+       @discussion The name to use with the notify(3) API's to monitor
+               when the list of active signatures changes.
+ */
+extern const char * kSCNetworkSignatureActiveChangedNotifyName;
+
+/*!
+       @function SCNetworkSignatureCopyActiveIdentifiers
+       @discussion Find all currently active networks and return a list of
+               (string) identifiers, one for each network.
+       @param allocator The CFAllocator that should be used to allocate
+               memory for the local dynamic store 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.
+       @result A CFArrayRef containing a list of (string) identifiers,
+               NULL if no networks are currently active.
+ */
+CFArrayRef /* of CFStringRef's */
+SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc);
+
+/*!
+       @function SCNetworkSignatureCopyActiveIdentifierForAddress
+       @discussion Find the one active network associated with the specified
+               address and return the unique (string) identifier that
+               represents it.
+       @param allocator The CFAllocator that should be used to allocate
+               memory for the local dynamic store 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 addr The address of interest.  Note: currently only AF_INET
+               0.0.0.0 is supported, passing anything else always returns
+               NULL.
+       @result The unique (string) identifier associated with the address,
+               NULL if no network is known.
+ */
+CFStringRef
+SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc,
+                                                const struct sockaddr * addr);
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
+#endif /* _SCNETWORKSIGNATURE_H */
diff --git a/SystemConfiguration.fproj/SCNetworkSignaturePrivate.h b/SystemConfiguration.fproj/SCNetworkSignaturePrivate.h
new file mode 100644 (file)
index 0000000..71fc457
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006 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@
+ */
+
+#ifndef _SCNETWORKSIGNATUREPRIVATE_H
+#define _SCNETWORKSIGNATUREPRIVATE_H
+
+#define NETWORK_ID_KEY         "com.apple.network.identification"
+#define kSCNetworkIdentificationPrefsKey CFSTR(NETWORK_ID_KEY ".plist")
+#define kSCNetworkIdentificationStoreKey CFSTR(NETWORK_ID_KEY)
+
+#define kStoreKeyServiceIdentifiers    CFSTR("ServiceIdentifiers")
+#define kStoreKeyActiveIdentifiers     CFSTR("ActiveIdentifiers")
+#define kStoreKeyPrimaryIPv4Identifier         CFSTR("PrimaryIPv4Identifier")
+
+#endif /* _SCNETWORKSIGNATUREPRIVATE_H */
index e81b75f7d95774cc7a2563606377fb4ce6d3f797..2f8d071e49ef8e42c293ba222b29db2fc442ed1e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -61,88 +61,37 @@ __SCPSignatureFromStatbuf(const struct stat *statBuf)
 __private_extern__ char *
 __SCPreferencesPath(CFAllocatorRef     allocator,
                    CFStringRef         prefsID,
 __private_extern__ char *
 __SCPreferencesPath(CFAllocatorRef     allocator,
                    CFStringRef         prefsID,
-                   Boolean             perUser,
-                   CFStringRef         user,
                    Boolean             useNewPrefs)
 {
        CFStringRef     path            = NULL;
        char            *pathStr;
 
                    Boolean             useNewPrefs)
 {
        CFStringRef     path            = NULL;
        char            *pathStr;
 
-       if (perUser) {
-               if (prefsID == NULL) {
-                       /* no user prefsID specified */
-                       return NULL;
-               } else if (CFStringHasPrefix(prefsID, CFSTR("/"))) {
-                       /* if absolute path */
-                       path = CFStringCreateCopy(allocator, prefsID);
-               } else {
-                       /*
-                        * relative (to the user's preferences) path
-                        */
-                       char            login[MAXLOGNAME+1];
-                       struct passwd   *pwd;
-
-                       bzero(&login, sizeof(login));
-                       if (user == NULL) {
-                               CFStringRef     u;
-
-                               /* get current console user */
-                               u = SCDynamicStoreCopyConsoleUser(NULL, NULL, NULL);
-                               if (!u) {
-                                       /* if could not get console user */
-                                       return NULL;
-                               }
-
-                               (void)_SC_cfstring_to_cstring(u, login, sizeof(login), kCFStringEncodingASCII);
-                               CFRelease(u);
-                       } else {
-                               /* use specified user */
-                               (void)_SC_cfstring_to_cstring(user, login, sizeof(login), kCFStringEncodingASCII);
-                       }
-
-                       /* get password entry for user */
-                       pwd = getpwnam(login);
-                       if (pwd == NULL) {
-                               /* if no home directory */
-                               return NULL;
-                       }
-
-                       /* create prefs ID */
-                       path = CFStringCreateWithFormat(allocator,
-                                                       NULL,
-                                                       CFSTR("%s/%@/%@"),
-                                                       pwd->pw_dir,
-                                                       PREFS_DEFAULT_USER_DIR,
-                                                       prefsID);
-               }
+       if (prefsID == NULL) {
+               /* default preference ID */
+               path = CFStringCreateWithFormat(allocator,
+                                               NULL,
+                                               CFSTR("%@/%@"),
+                                               useNewPrefs ? PREFS_DEFAULT_DIR    : PREFS_DEFAULT_DIR_OLD,
+                                               useNewPrefs ? PREFS_DEFAULT_CONFIG : PREFS_DEFAULT_CONFIG_OLD);
+       } else if (CFStringHasPrefix(prefsID, CFSTR("/"))) {
+               /* if absolute path */
+               path = CFStringCreateCopy(allocator, prefsID);
        } else {
        } else {
-               if (prefsID == NULL) {
-                       /* default preference ID */
-                       path = CFStringCreateWithFormat(allocator,
-                                                       NULL,
-                                                       CFSTR("%@/%@"),
-                                                       useNewPrefs ? PREFS_DEFAULT_DIR    : PREFS_DEFAULT_DIR_OLD,
-                                                       useNewPrefs ? PREFS_DEFAULT_CONFIG : PREFS_DEFAULT_CONFIG_OLD);
-               } else if (CFStringHasPrefix(prefsID, CFSTR("/"))) {
-                       /* if absolute path */
-                       path = CFStringCreateCopy(allocator, prefsID);
-               } else {
-                       /* relative path */
-                       path = CFStringCreateWithFormat(allocator,
-                                                       NULL,
-                                                       CFSTR("%@/%@"),
-                                                       useNewPrefs ? PREFS_DEFAULT_DIR : PREFS_DEFAULT_DIR_OLD,
-                                                       prefsID);
-                       if (useNewPrefs && CFStringHasSuffix(path, CFSTR(".xml"))) {
-                               CFMutableStringRef      newPath;
-
-                               newPath = CFStringCreateMutableCopy(allocator, 0, path);
-                               CFStringReplace(newPath,
-                                               CFRangeMake(CFStringGetLength(newPath)-4, 4),
-                                               CFSTR(".plist"));
-                               CFRelease(path);
-                               path = newPath;
-                       }
+               /* relative path */
+               path = CFStringCreateWithFormat(allocator,
+                                               NULL,
+                                               CFSTR("%@/%@"),
+                                               useNewPrefs ? PREFS_DEFAULT_DIR : PREFS_DEFAULT_DIR_OLD,
+                                               prefsID);
+               if (useNewPrefs && CFStringHasSuffix(path, CFSTR(".xml"))) {
+                       CFMutableStringRef      newPath;
+
+                       newPath = CFStringCreateMutableCopy(allocator, 0, path);
+                       CFStringReplace(newPath,
+                                       CFRangeMake(CFStringGetLength(newPath)-4, 4),
+                                       CFSTR(".plist"));
+                       CFRelease(path);
+                       path = newPath;
                }
        }
 
                }
        }
 
@@ -179,8 +128,6 @@ SCPreferencesGetSignature(SCPreferencesRef prefs)
 __private_extern__ CFStringRef
 _SCPNotificationKey(CFAllocatorRef     allocator,
                    CFStringRef         prefsID,
 __private_extern__ CFStringRef
 _SCPNotificationKey(CFAllocatorRef     allocator,
                    CFStringRef         prefsID,
-                   Boolean             perUser,
-                   CFStringRef         user,
                    int                 keyType)
 {
        CFStringRef     keyStr;
                    int                 keyType)
 {
        CFStringRef     keyStr;
@@ -189,9 +136,6 @@ _SCPNotificationKey(CFAllocatorRef  allocator,
        CFStringRef     storeKey;
 
        switch (keyType) {
        CFStringRef     storeKey;
 
        switch (keyType) {
-               case kSCPreferencesKeyLock :
-                       keyStr = CFSTR("lock");
-                       break;
                case kSCPreferencesKeyCommit :
                        keyStr = CFSTR("commit");
                        break;
                case kSCPreferencesKeyCommit :
                        keyStr = CFSTR("commit");
                        break;
@@ -202,7 +146,7 @@ _SCPNotificationKey(CFAllocatorRef  allocator,
                        return NULL;
        }
 
                        return NULL;
        }
 
-       path = __SCPreferencesPath(allocator, prefsID, perUser, user, TRUE);
+       path = __SCPreferencesPath(allocator, prefsID, TRUE);
        if (path == NULL) {
                return NULL;
        }
        if (path == NULL) {
                return NULL;
        }
@@ -230,15 +174,5 @@ SCDynamicStoreKeyCreatePreferences(CFAllocatorRef  allocator,
                                   CFStringRef          prefsID,
                                   SCPreferencesKeyType keyType)
 {
                                   CFStringRef          prefsID,
                                   SCPreferencesKeyType keyType)
 {
-       return _SCPNotificationKey(allocator, prefsID, FALSE, NULL, keyType);
-}
-
-
-CFStringRef
-SCDynamicStoreKeyCreateUserPreferences(CFAllocatorRef          allocator,
-                                      CFStringRef              prefsID,
-                                      CFStringRef              user,
-                                      SCPreferencesKeyType     keyType)
-{
-       return _SCPNotificationKey(allocator, prefsID, TRUE, user, keyType);
+       return _SCPNotificationKey(allocator, prefsID, keyType);
 }
 }
index 420fe3223f29a27f5b12e213439f487f067ecbb5..2168f50e42042713d15efce9ceec36de416c56ad 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 775036f3a1cbb984d9694819d2cb5f02821de4de..720ab46a612650a8ed0deb31e2ceb81c9639d887 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
+#include "SCHelper_client.h"
+
+
+static Boolean
+__SCPreferencesApplyChanges_helper(SCPreferencesRef prefs)
+{
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+
+       if (prefsPrivate->helper == -1) {
+               // if no helper
+               goto fail;
+       }
+
+       // have the helper "apply" the prefs
+//     status = kSCStatusOK;
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_PREFS_APPLY,
+                          NULL,
+                          &status,
+                          NULL);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       _SCErrorSet(status);
+       return FALSE;
+}
+
 
 Boolean
 SCPreferencesApplyChanges(SCPreferencesRef prefs)
 {
 
 Boolean
 SCPreferencesApplyChanges(SCPreferencesRef prefs)
 {
+       Boolean                 ok              = FALSE;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        Boolean                 wasLocked;
 
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        Boolean                 wasLocked;
 
@@ -59,26 +109,24 @@ SCPreferencesApplyChanges(SCPreferencesRef prefs)
                }
        }
 
                }
        }
 
-       if (!prefsPrivate->isRoot) {
-               /* CONFIGD REALLY NEEDS NON-ROOT WRITE ACCESS */
-               goto perUser;
+       if (prefsPrivate->authorizationData != NULL) {
+               ok = __SCPreferencesApplyChanges_helper(prefs);
+               goto done;
        }
 
        /* post notification */
        }
 
        /* post notification */
-       if (!SCDynamicStoreNotifyValue(prefsPrivate->session,
-                                      prefsPrivate->sessionKeyApply)) {
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCPreferencesApplyChanges SCDynamicStoreNotifyValue() failed"));
-               _SCErrorSet(kSCStatusFailed);
-               goto error;
+       if (prefsPrivate->session == NULL) {
+               ok = TRUE;
+       } else {
+               ok = SCDynamicStoreNotifyValue(prefsPrivate->session, prefsPrivate->sessionKeyApply);
+               if (!ok) {
+                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCPreferencesApplyChanges SCDynamicStoreNotifyValue() failed"));
+                       _SCErrorSet(kSCStatusFailed);
+               }
        }
 
        }
 
-    perUser :
+    done :
 
        if (!wasLocked) (void) SCPreferencesUnlock(prefs);
 
        if (!wasLocked) (void) SCPreferencesUnlock(prefs);
-       return TRUE;
-
-    error :
-
-       if (!wasLocked) (void) SCPreferencesUnlock(prefs);
-       return FALSE;
+       return ok;
 }
 }
index 0ea6dc9a53e580a98f500ad00b5a1f35b6041cac..8e73cf3c419bcb1bdb4edd2e9706a9fbbf73b50d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
+#include "SCHelper_client.h"
 
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/errno.h>
 
 
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/errno.h>
 
+static Boolean
+__SCPreferencesCommitChanges_helper(SCPreferencesRef prefs)
+{
+       CFDataRef               data            = NULL;
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+       CFDataRef               reply           = NULL;
+
+       if (prefsPrivate->helper == -1) {
+               // if no helper
+               goto fail;
+       }
+
+       if (prefsPrivate->changed) {
+               ok = _SCSerialize(prefsPrivate->prefs, &data, NULL, NULL);
+               if (!ok) {
+                       goto fail;
+               }
+       }
+
+       // have the helper "commit" the prefs
+//     status = kSCStatusOK;
+//     reply  = NULL;
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_PREFS_COMMIT,
+                          data,
+                          &status,
+                          &reply);
+       if (data != NULL) CFRelease(data);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       if (prefsPrivate->changed) {
+               if (prefsPrivate->signature != NULL) CFRelease(prefsPrivate->signature);
+               prefsPrivate->signature = reply;
+       }
+
+       prefsPrivate->changed = FALSE;
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       if (reply != NULL) CFRelease(reply);
+       _SCErrorSet(status);
+       return FALSE;
+}
+
+
 static ssize_t
 static ssize_t
-writen(int d, const void *buf, size_t nbytes)
+writen(int ref, void *data, size_t len)
 {
 {
-       size_t          left    = nbytes;
-       const void      *p      = buf;
+       size_t          left    = len;
+       ssize_t         n;
+       const void      *p      = data;
 
        while (left > 0) {
 
        while (left > 0) {
-               ssize_t n;
-
-               n = write(d, p, left);
-               if (n >= 0) {
-                       left -= n;
-                       p    += n;
-               } else {
+               if ((n = write(ref, p, left)) == -1) {
                        if (errno != EINTR) {
                                return -1;
                        }
                        if (errno != EINTR) {
                                return -1;
                        }
+                       n = 0;
                }
                }
+               left -= n;
+               p += n;
        }
        }
-       return nbytes;
+       return len;
 }
 
 
 Boolean
 SCPreferencesCommitChanges(SCPreferencesRef prefs)
 {
 }
 
 
 Boolean
 SCPreferencesCommitChanges(SCPreferencesRef prefs)
 {
+       Boolean                 ok              = FALSE;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        Boolean                 wasLocked;
 
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        Boolean                 wasLocked;
 
@@ -86,6 +151,14 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                }
        }
 
                }
        }
 
+       if (prefsPrivate->authorizationData != NULL) {
+               ok = __SCPreferencesCommitChanges_helper(prefs);
+               if (ok) {
+                       prefsPrivate->changed = FALSE;
+               }
+               goto done;
+       }
+
        /*
         * if necessary, apply changes
         */
        /*
         * if necessary, apply changes
         */
@@ -105,7 +178,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                                statBuf.st_gid  = getegid();
                        } else {
                                SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges stat() failed: %s"), strerror(errno));
                                statBuf.st_gid  = getegid();
                        } else {
                                SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges stat() failed: %s"), strerror(errno));
-                               goto error;
+                               goto done;
                        }
                }
 
                        }
                }
 
@@ -115,29 +188,12 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                thePath = CFAllocatorAllocate(NULL, pathLen, 0);
                snprintf(thePath, pathLen, "%s-new", path);
 
                thePath = CFAllocatorAllocate(NULL, pathLen, 0);
                snprintf(thePath, pathLen, "%s-new", path);
 
-               /* open the (new) preferences file */
-           reopen :
                fd = open(thePath, O_WRONLY|O_CREAT, statBuf.st_mode);
                if (fd == -1) {
                fd = open(thePath, O_WRONLY|O_CREAT, statBuf.st_mode);
                if (fd == -1) {
-                       if ((errno == ENOENT) &&
-                           ((prefsPrivate->prefsID == NULL) || !CFStringHasPrefix(prefsPrivate->prefsID, CFSTR("/")))) {
-                               char    *ch;
-
-                               ch = strrchr(thePath, '/');
-                               if (ch != NULL) {
-                                       int     status;
-
-                                       *ch = '\0';
-                                       status = mkdir(thePath, 0755);
-                                       *ch = '/';
-                                       if (status == 0) {
-                                               goto reopen;
-                                       }
-                               }
-                       }
+                       _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges open() failed: %s"), strerror(errno));
                        CFAllocatorDeallocate(NULL, thePath);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges open() failed: %s"), strerror(errno));
                        CFAllocatorDeallocate(NULL, thePath);
-                       goto error;
+                       goto done;
                }
 
                /* preserve permissions */
                }
 
                /* preserve permissions */
@@ -152,7 +208,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  prefs = %s"), path);
                        CFAllocatorDeallocate(NULL, thePath);
                        (void) close(fd);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  prefs = %s"), path);
                        CFAllocatorDeallocate(NULL, thePath);
                        (void) close(fd);
-                       goto error;
+                       goto done;
                }
                if (writen(fd, (void *)CFDataGetBytePtr(newPrefs), CFDataGetLength(newPrefs)) == -1) {
                        _SCErrorSet(errno);
                }
                if (writen(fd, (void *)CFDataGetBytePtr(newPrefs), CFDataGetLength(newPrefs)) == -1) {
                        _SCErrorSet(errno);
@@ -162,8 +218,10 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        CFAllocatorDeallocate(NULL, thePath);
                        (void) close(fd);
                        CFRelease(newPrefs);
                        CFAllocatorDeallocate(NULL, thePath);
                        (void) close(fd);
                        CFRelease(newPrefs);
-                       goto error;
+                       goto done;
                }
                }
+
+               /* synchronize the file's in-core state with that on disk */
                if (fsync(fd) == -1) {
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges fsync() failed: %s"), strerror(errno));
                if (fsync(fd) == -1) {
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges fsync() failed: %s"), strerror(errno));
@@ -172,8 +230,17 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        CFAllocatorDeallocate(NULL, thePath);
                        (void) close(fd);
                        CFRelease(newPrefs);
                        CFAllocatorDeallocate(NULL, thePath);
                        (void) close(fd);
                        CFRelease(newPrefs);
-                       goto error;
+                       goto done;
                }
                }
+
+               /*
+                * ... and ask the drive to flush to the media
+                *
+                * Note: at present, this only works on HFS filesystems
+                */
+               (void) fcntl(fd, F_FULLFSYNC, 0);
+
+               /* new preferences have been written */
                if (close(fd) == -1) {
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges close() failed: %s"), strerror(errno));
                if (close(fd) == -1) {
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges close() failed: %s"), strerror(errno));
@@ -181,7 +248,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        (void) unlink(thePath);
                        CFAllocatorDeallocate(NULL, thePath);
                        CFRelease(newPrefs);
                        (void) unlink(thePath);
                        CFAllocatorDeallocate(NULL, thePath);
                        CFRelease(newPrefs);
-                       goto error;
+                       goto done;
                }
                CFRelease(newPrefs);
 
                }
                CFRelease(newPrefs);
 
@@ -191,7 +258,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges rename() failed: %s"), strerror(errno));
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  path = %s --> %s"), thePath, path);
                        CFAllocatorDeallocate(NULL, thePath);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges rename() failed: %s"), strerror(errno));
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  path = %s --> %s"), thePath, path);
                        CFAllocatorDeallocate(NULL, thePath);
-                       goto error;
+                       goto done;
                }
                CFAllocatorDeallocate(NULL, thePath);
 
                }
                CFAllocatorDeallocate(NULL, thePath);
 
@@ -209,33 +276,28 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges stat() failed: %s"), strerror(errno));
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  path = %s"), thePath);
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges stat() failed: %s"), strerror(errno));
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  path = %s"), thePath);
-                       goto error;
+                       goto done;
                }
                }
-               CFRelease(prefsPrivate->signature);
+               if (prefsPrivate->signature != NULL) CFRelease(prefsPrivate->signature);
                prefsPrivate->signature = __SCPSignatureFromStatbuf(&statBuf);
        }
 
                prefsPrivate->signature = __SCPSignatureFromStatbuf(&statBuf);
        }
 
-       if (!prefsPrivate->isRoot) {
-               /* CONFIGD REALLY NEEDS NON-ROOT WRITE ACCESS */
-               goto perUser;
-       }
-
        /* post notification */
        /* post notification */
-       if (!SCDynamicStoreNotifyValue(prefsPrivate->session,
-                                      prefsPrivate->sessionKeyCommit)) {
-               SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges SCDynamicStoreNotifyValue() failed"));
-               _SCErrorSet(kSCStatusFailed);
-               goto error;
+       if (prefsPrivate->session == NULL) {
+               ok = TRUE;
+       } else {
+               ok = SCDynamicStoreNotifyValue(prefsPrivate->session, prefsPrivate->sessionKeyCommit);
+               if (!ok) {
+                       SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges SCDynamicStoreNotifyValue() failed"));
+                       _SCErrorSet(kSCStatusFailed);
+                       goto done;
+               }
        }
 
        }
 
-    perUser :
-
-       if (!wasLocked) (void) SCPreferencesUnlock(prefs);
        prefsPrivate->changed = FALSE;
        prefsPrivate->changed = FALSE;
-       return TRUE;
 
 
-    error :
+    done :
 
        if (!wasLocked) (void) SCPreferencesUnlock(prefs);
 
        if (!wasLocked) (void) SCPreferencesUnlock(prefs);
-       return FALSE;
+       return ok;
 }
 }
index 297107ec1871b4b41a82c40d0087641153e45885..f83471c5b857e4d307285dc8ea1050c6307776a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 8a4266f3cf17ebf4ec9eac325f3614cae26b2370..fa5437d513fbd3a965dc3c0ac59c70479ac78d63 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -38,7 +38,7 @@
 CFArrayRef
 SCPreferencesCopyKeyList(SCPreferencesRef prefs)
 {
 CFArrayRef
 SCPreferencesCopyKeyList(SCPreferencesRef prefs)
 {
-       CFAllocatorRef          allocator       = CFGetAllocator(prefs);
+       CFAllocatorRef          allocator;
        CFArrayRef              keys;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        CFIndex                 prefsCnt;
        CFArrayRef              keys;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        CFIndex                 prefsCnt;
@@ -52,6 +52,7 @@ SCPreferencesCopyKeyList(SCPreferencesRef prefs)
 
        __SCPreferencesAccess(prefs);
 
 
        __SCPreferencesAccess(prefs);
 
+       allocator = CFGetAllocator(prefs);
        prefsCnt  = CFDictionaryGetCount(prefsPrivate->prefs);
        if (prefsCnt > 0) {
                prefsKeys = CFAllocatorAllocate(allocator, prefsCnt * sizeof(CFStringRef), 0);
        prefsCnt  = CFDictionaryGetCount(prefsPrivate->prefs);
        if (prefsCnt > 0) {
                prefsKeys = CFAllocatorAllocate(allocator, prefsCnt * sizeof(CFStringRef), 0);
index 7b7af2ce914a09fedbfd1db319a392348e0e94c0..493c1ece7091e4700b0993d3b9281b05f5512504 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
+#include "SCHelper_client.h"
 
 
+#include <grp.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <pthread.h>
 #include <sys/errno.h>
 
 
 #include <fcntl.h>
 #include <unistd.h>
 #include <pthread.h>
 #include <sys/errno.h>
 
 
+
+static Boolean
+__SCPreferencesLock_helper(SCPreferencesRef prefs, Boolean wait)
+{
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+       CFDataRef               reply           = NULL;
+
+       if (prefsPrivate->helper == -1) {
+               ok = __SCPreferencesCreate_helper(prefs);
+               if (!ok) {
+                       return FALSE;
+               }
+       }
+
+       // have the helper "lock" the prefs
+       status = kSCStatusOK;
+       reply  = NULL;
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          wait ? SCHELPER_MSG_PREFS_LOCKWAIT : SCHELPER_MSG_PREFS_LOCK,
+                          prefsPrivate->signature,
+                          &status,
+                          NULL);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       prefsPrivate->locked = TRUE;
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       _SCErrorSet(status);
+       return FALSE;
+}
+
+
+static int
+createParentDirectory(const char *path)
+{
+       char    dir[PATH_MAX];
+       int     ret;
+       char    *scan;
+       char    *slash;
+
+       // get parent directory path
+       if (strlcpy(dir, path, sizeof(dir)) >= sizeof(dir)) {
+               errno = ENOENT;
+               return -1;
+       }
+
+       slash = strrchr(dir, '/');
+       if ((slash == NULL) || (slash == dir)) {
+               errno = ENOENT;
+               return -1;
+       }
+       *slash = '\0';
+
+       // create parent directories
+       for (scan = dir; TRUE; scan = slash) {
+               mode_t  mode;
+               char    sep     = '\0';
+
+               if ((slash == NULL) || (scan == dir)) {
+                       mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; // 755
+               } else {
+                       mode = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH;         // 775
+               }
+
+               if (slash != NULL) {
+                       sep = *slash;
+                       *slash = '\0';
+               }
+
+               ret = mkdir(dir, mode);
+               if (ret == 0) {
+                       static  gid_t   admin   = -1;
+
+                       // set group
+                       if (admin == -1) {
+                               char            buf[256];
+                               struct group    grp;
+                               struct group    *grpP   = NULL;
+
+                               if ((getgrnam_r("admin", &grp, buf, sizeof(buf), &grpP) == 0) &&
+                                   (grpP != NULL)) {
+                                       admin = grpP->gr_gid;
+                               } else {
+                                       SCLog(TRUE, LOG_ERR,
+                                             CFSTR("SCPreferencesLock getgrnam_r() failed: %s"),
+                                             strerror(errno));
+                                       admin = 80;
+                               }
+                       }
+
+                       if (chown(dir, -1, admin) == -1) {
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("SCPreferencesLock chown() failed: %s"),
+                                     strerror(errno));
+                       }
+
+                       // set [force] mode
+                       if (chmod(dir, mode) == -1) {
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("SCPreferencesLock chmod() failed: %s"),
+                                     strerror(errno));
+                       }
+
+                       if ((slash == NULL) || (scan == dir)) {
+                               return 0;
+                       }
+               } else if ((errno == ENOENT) && (scan == dir)) {
+                       // the initial mkdir (of the full dir path) can fail
+                       ;
+               } else if (errno == EROFS) {
+                       return -1;
+               } else if (errno != EEXIST) {
+                       break;
+               }
+
+               if (slash != NULL) {
+                       *slash = sep;
+               } else {
+                       break;
+               }
+               slash = strchr(scan + 1, '/');
+       }
+
+       SCLog(TRUE, LOG_ERR,
+             CFSTR("SCPreferencesLock mkdir() failed: %s"),
+             strerror(errno));
+       return -1;
+}
+
+
 Boolean
 SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
 {
 Boolean
 SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
 {
-       CFAllocatorRef          allocator               = CFGetAllocator(prefs);
-       CFArrayRef              changes;
-       Boolean                 haveLock                = FALSE;
-       SCPreferencesPrivateRef prefsPrivate            = (SCPreferencesPrivateRef)prefs;
-       CFDateRef               value                   = NULL;
+       char                    buf[32];
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       int                     sc_status       = kSCStatusFailed;
+       struct stat             statbuf;
 
        if (prefs == NULL) {
                /* sorry, you must provide a session */
 
        if (prefs == NULL) {
                /* sorry, you must provide a session */
@@ -62,14 +214,13 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
                return FALSE;
        }
 
                return FALSE;
        }
 
+       if (prefsPrivate->authorizationData != NULL) {
+               return __SCPreferencesLock_helper(prefs, wait);
+       }
+
        if (!prefsPrivate->isRoot) {
        if (!prefsPrivate->isRoot) {
-               if (!prefsPrivate->perUser) {
-                       _SCErrorSet(kSCStatusAccessError);
-                       return FALSE;
-               } else {
-                       /* CONFIGD REALLY NEEDS NON-ROOT WRITE ACCESS */
-                       goto perUser;
-               }
+               _SCErrorSet(kSCStatusAccessError);
+               return FALSE;
        }
 
 
        }
 
 
@@ -79,79 +230,77 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
                __SCPreferencesAddSession(prefs);
        }
 
                __SCPreferencesAddSession(prefs);
        }
 
-       if (prefsPrivate->sessionKeyLock == NULL) {
-               /* create the session "lock" key */
-               prefsPrivate->sessionKeyLock = _SCPNotificationKey(allocator,
-                                                                  prefsPrivate->prefsID,
-                                                                  prefsPrivate->perUser,
-                                                                  prefsPrivate->user,
-                                                                  kSCPreferencesKeyLock);
-       }
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
+       if (prefsPrivate->lockPath == NULL) {
+               char    *path;
+               int     pathLen;
 
 
-       if (!SCDynamicStoreAddWatchedKey(prefsPrivate->session,
-                                        prefsPrivate->sessionKeyLock,
-                                        FALSE)) {
-               SCLog(_sc_verbose, LOG_INFO, CFSTR("SCPreferencesLock SCDynamicStoreAddWatchedKey() failed"));
-               goto error;
+               path = prefsPrivate->newPath ? prefsPrivate->newPath : prefsPrivate->path;
+               pathLen = strlen(path) + sizeof("-lock");
+               prefsPrivate->lockPath = CFAllocatorAllocate(NULL, pathLen, 0);
+               snprintf(prefsPrivate->lockPath, pathLen, "%s-lock", path);
        }
 
        }
 
-       value = CFDateCreate(allocator, CFAbsoluteTimeGetCurrent());
+    retry :
 
 
-       while (TRUE) {
-               CFArrayRef      changedKeys;
+       prefsPrivate->lockFD = open(prefsPrivate->lockPath, O_WRONLY|O_CREAT, 0644);
+       if (prefsPrivate->lockFD == -1) {
+               if (errno == EROFS) {
+                       goto locked;
+               }
 
 
-               /*
-                * Attempt to acquire the lock
-                */
-               if (SCDynamicStoreAddTemporaryValue(prefsPrivate->session,
-                                                   prefsPrivate->sessionKeyLock,
-                                                   value)) {
-                       haveLock = TRUE;
-                       goto done;
-               } else {
-                       if (!wait) {
-                               _SCErrorSet(kSCStatusPrefsBusy);
-                               goto error;
+               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;
                        }
                }
 
                        }
                }
 
-               /*
-                * Wait for the lock to be released
-                */
-               if (!SCDynamicStoreNotifyWait(prefsPrivate->session)) {
-                       SCLog(_sc_verbose, LOG_INFO, CFSTR("SCPreferencesLock SCDynamicStoreNotifyWait() failed"));
-                       goto error;
-               }
-               changedKeys = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session);
-               if (!changedKeys) {
-                       SCLog(_sc_verbose, LOG_INFO, CFSTR("SCPreferencesLock SCDynamicStoreCopyNotifiedKeys() failed"));
-                       goto error;
-               }
-               CFRelease(changedKeys);
+               sc_status = errno;
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCPreferencesLock open() failed: %s"),
+                     strerror(errno));
+               goto error;
        }
 
        }
 
-    done :
-
-       CFRelease(value);
-       value = NULL;
+       if (flock(prefsPrivate->lockFD, wait ? LOCK_EX : LOCK_EX|LOCK_NB) == -1) {
+               switch (errno) {
+                       case EWOULDBLOCK :
+                               // if already locked (and we are not blocking)
+                               sc_status = kSCStatusPrefsBusy;
+                               break;
+                       default :
+                               sc_status = errno;
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("SCPreferencesLock flock() failed: %s"),
+                                     strerror(errno));
+                               break;
+               }
 
 
-       if (!SCDynamicStoreRemoveWatchedKey(prefsPrivate->session,
-                                           prefsPrivate->sessionKeyLock,
-                                           0)) {
-               SCLog(_sc_verbose, LOG_INFO, CFSTR("SCPreferencesLock SCDynamicStoreRemoveWatchedKey() failed"));
                goto error;
        }
 
                goto error;
        }
 
-       changes = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session);
-       if (!changes) {
-               SCLog(_sc_verbose, LOG_INFO, CFSTR("SCPreferencesLock SCDynamicStoreCopyNotifiedKeys() failed"));
-               goto error;
+       if (stat(prefsPrivate->lockPath, &statbuf) == -1) {
+               // if the lock file was unlinked
+               close(prefsPrivate->lockFD);
+               prefsPrivate->lockFD = -1;
+               goto retry;
        }
        }
-       CFRelease(changes);
 
 
-    perUser:
+       // we have the lock
+
+       snprintf(buf, sizeof(buf), "%d\n", getpid());
+       write(prefsPrivate->lockFD, buf, strlen(buf));
+
+    locked :
 
        if (prefsPrivate->accessed) {
                CFDataRef       currentSignature;
 
        if (prefsPrivate->accessed) {
                CFDataRef       currentSignature;
@@ -167,8 +316,11 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
                        if (errno == ENOENT) {
                                bzero(&statBuf, sizeof(statBuf));
                        } else {
                        if (errno == ENOENT) {
                                bzero(&statBuf, sizeof(statBuf));
                        } else {
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("SCPreferencesLock stat() failed: %s"), strerror(errno));
-                               _SCErrorSet(kSCStatusStale);
+                               SCLog(TRUE, LOG_DEBUG,
+                                     CFSTR("SCPreferencesLock stat() failed: %s"),
+                                     strerror(errno));
+                               sc_status = kSCStatusStale;
+                               unlink(prefsPrivate->lockPath);
                                goto error;
                        }
                }
                                goto error;
                        }
                }
@@ -182,7 +334,8 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
                         * session was accessed so we've got no choice
                         * but to deny the lock request.
                         */
                         * session was accessed so we've got no choice
                         * but to deny the lock request.
                         */
-                       _SCErrorSet(kSCStatusStale);
+                       sc_status = kSCStatusStale;
+                       unlink(prefsPrivate->lockPath);
                        goto error;
                }
 //     } else {
                        goto error;
                }
 //     } else {
@@ -194,15 +347,17 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
        }
 
        prefsPrivate->locked = TRUE;
        }
 
        prefsPrivate->locked = TRUE;
+       pthread_mutex_unlock(&prefsPrivate->lock);
        return TRUE;
 
     error :
 
        return TRUE;
 
     error :
 
-       if (haveLock) {
-               SCDynamicStoreRemoveValue(prefsPrivate->session,
-                                         prefsPrivate->sessionKeyLock);
+       if (prefsPrivate->lockFD != -1) {
+               close(prefsPrivate->lockFD);
+               prefsPrivate->lockFD = -1;
        }
        }
-       if (value)              CFRelease(value);
 
 
+       pthread_mutex_unlock(&prefsPrivate->lock);
+       _SCErrorSet(sc_status);
        return FALSE;
 }
        return FALSE;
 }
index 2c45b5783ba83ae81dc3459b79c60b8e2f0e3e1c..d8a13650027e522bed7002bcaacb8dfcdc019998 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright(c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
+#include "SCHelper_client.h"
+
+#include <Security/Security.h>
+#include "dy_framework.h"
 
 #include <fcntl.h>
 #include <pthread.h>
 
 #include <fcntl.h>
 #include <pthread.h>
@@ -55,9 +59,6 @@ __SCPreferencesCopyDescription(CFTypeRef cf) {
        CFStringAppendFormat(result, NULL, CFSTR("<SCPreferences %p [%p]> {"), cf, allocator);
        CFStringAppendFormat(result, NULL, CFSTR("name = %@"), prefsPrivate->name);
        CFStringAppendFormat(result, NULL, CFSTR(", id = %@"), prefsPrivate->prefsID);
        CFStringAppendFormat(result, NULL, CFSTR("<SCPreferences %p [%p]> {"), cf, allocator);
        CFStringAppendFormat(result, NULL, CFSTR("name = %@"), prefsPrivate->name);
        CFStringAppendFormat(result, NULL, CFSTR(", id = %@"), prefsPrivate->prefsID);
-       if (prefsPrivate->perUser) {
-               CFStringAppendFormat(result, NULL, CFSTR(" (for user %@)"), prefsPrivate->user);
-       }
        CFStringAppendFormat(result, NULL, CFSTR(", path = %s"),
                             prefsPrivate->newPath ? prefsPrivate->newPath : prefsPrivate->path);
        if (prefsPrivate->accessed) {
        CFStringAppendFormat(result, NULL, CFSTR(", path = %s"),
                             prefsPrivate->newPath ? prefsPrivate->newPath : prefsPrivate->path);
        if (prefsPrivate->accessed) {
@@ -69,6 +70,9 @@ __SCPreferencesCopyDescription(CFTypeRef cf) {
        if (prefsPrivate->locked) {
                CFStringAppendFormat(result, NULL, CFSTR(", locked"));
        }
        if (prefsPrivate->locked) {
                CFStringAppendFormat(result, NULL, CFSTR(", locked"));
        }
+       if (prefsPrivate->helper != -1) {
+               CFStringAppendFormat(result, NULL, CFSTR(", helper fd=%d"), prefsPrivate->helper);
+       }
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
@@ -86,18 +90,28 @@ __SCPreferencesDeallocate(CFTypeRef cf)
 
        if (prefsPrivate->name)                 CFRelease(prefsPrivate->name);
        if (prefsPrivate->prefsID)              CFRelease(prefsPrivate->prefsID);
 
        if (prefsPrivate->name)                 CFRelease(prefsPrivate->name);
        if (prefsPrivate->prefsID)              CFRelease(prefsPrivate->prefsID);
-       if (prefsPrivate->user)                 CFRelease(prefsPrivate->user);
        if (prefsPrivate->path)                 CFAllocatorDeallocate(NULL, prefsPrivate->path);
        if (prefsPrivate->newPath)              CFAllocatorDeallocate(NULL, prefsPrivate->newPath);
        if (prefsPrivate->path)                 CFAllocatorDeallocate(NULL, prefsPrivate->path);
        if (prefsPrivate->newPath)              CFAllocatorDeallocate(NULL, prefsPrivate->newPath);
+       if (prefsPrivate->lockFD != -1) {
+               if (prefsPrivate->lockPath != NULL) {
+                       unlink(prefsPrivate->lockPath);
+               }
+               close(prefsPrivate->lockFD);
+       }
+       if (prefsPrivate->lockPath)             CFAllocatorDeallocate(NULL, prefsPrivate->lockPath);
        if (prefsPrivate->signature)            CFRelease(prefsPrivate->signature);
        if (prefsPrivate->session)              CFRelease(prefsPrivate->session);
        if (prefsPrivate->signature)            CFRelease(prefsPrivate->signature);
        if (prefsPrivate->session)              CFRelease(prefsPrivate->session);
-       if (prefsPrivate->sessionKeyLock)       CFRelease(prefsPrivate->sessionKeyLock);
        if (prefsPrivate->sessionKeyCommit)     CFRelease(prefsPrivate->sessionKeyCommit);
        if (prefsPrivate->sessionKeyApply)      CFRelease(prefsPrivate->sessionKeyApply);
        if (prefsPrivate->rlsContext.release != NULL) {
                (*prefsPrivate->rlsContext.release)(prefsPrivate->rlsContext.info);
        }
        if (prefsPrivate->prefs)                CFRelease(prefsPrivate->prefs);
        if (prefsPrivate->sessionKeyCommit)     CFRelease(prefsPrivate->sessionKeyCommit);
        if (prefsPrivate->sessionKeyApply)      CFRelease(prefsPrivate->sessionKeyApply);
        if (prefsPrivate->rlsContext.release != NULL) {
                (*prefsPrivate->rlsContext.release)(prefsPrivate->rlsContext.info);
        }
        if (prefsPrivate->prefs)                CFRelease(prefsPrivate->prefs);
+       if (prefsPrivate->authorizationData != NULL) CFRelease(prefsPrivate->authorizationData);
+       if (prefsPrivate->helper != -1) {
+               (void) _SCHelperExec(prefsPrivate->helper, SCHELPER_MSG_PREFS_CLOSE, NULL, NULL, NULL);
+               _SCHelperClose(prefsPrivate->helper);
+       }
 
        return;
 }
 
        return;
 }
@@ -151,13 +165,13 @@ __SCPreferencesCreatePrivate(CFAllocatorRef       allocator)
 
        prefsPrivate->name                              = NULL;
        prefsPrivate->prefsID                           = NULL;
 
        prefsPrivate->name                              = NULL;
        prefsPrivate->prefsID                           = NULL;
-       prefsPrivate->perUser                           = FALSE;
-       prefsPrivate->user                              = NULL;
        prefsPrivate->path                              = NULL;
        prefsPrivate->newPath                           = NULL;         // new prefs path
        prefsPrivate->path                              = NULL;
        prefsPrivate->newPath                           = NULL;         // new prefs path
+       prefsPrivate->locked                            = FALSE;
+       prefsPrivate->lockFD                            = -1;
+       prefsPrivate->lockPath                          = NULL;
        prefsPrivate->signature                         = NULL;
        prefsPrivate->session                           = NULL;
        prefsPrivate->signature                         = NULL;
        prefsPrivate->session                           = NULL;
-       prefsPrivate->sessionKeyLock                    = NULL;
        prefsPrivate->sessionKeyCommit                  = NULL;
        prefsPrivate->sessionKeyApply                   = NULL;
        prefsPrivate->rls                               = NULL;
        prefsPrivate->sessionKeyCommit                  = NULL;
        prefsPrivate->sessionKeyApply                   = NULL;
        prefsPrivate->rls                               = NULL;
@@ -170,19 +184,158 @@ __SCPreferencesCreatePrivate(CFAllocatorRef      allocator)
        prefsPrivate->prefs                             = NULL;
        prefsPrivate->accessed                          = FALSE;
        prefsPrivate->changed                           = FALSE;
        prefsPrivate->prefs                             = NULL;
        prefsPrivate->accessed                          = FALSE;
        prefsPrivate->changed                           = FALSE;
-       prefsPrivate->locked                            = FALSE;
        prefsPrivate->isRoot                            = (geteuid() == 0);
        prefsPrivate->isRoot                            = (geteuid() == 0);
+       prefsPrivate->authorizationData                 = NULL;
+       prefsPrivate->helper                            = -1;
 
        return prefsPrivate;
 }
 
 
 
        return prefsPrivate;
 }
 
 
-__private_extern__ SCPreferencesRef
+__private_extern__ Boolean
+__SCPreferencesCreate_helper(SCPreferencesRef prefs)
+{
+       CFDataRef               data            = NULL;
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+       CFDataRef               reply           = NULL;
+
+       // start helper
+       prefsPrivate->helper = _SCHelperOpen(prefsPrivate->authorizationData);
+       if (prefsPrivate->helper == -1) {
+               goto fail;
+       }
+
+       // serialize the "prefsID"
+       if (prefsPrivate->prefsID != NULL) {
+               ok = _SCSerializeString(prefsPrivate->prefsID, &data, NULL, NULL);
+               if (!ok) {
+                       goto fail;
+               }
+       }
+
+       // have the helper "open" the prefs
+       status = kSCStatusOK;
+       reply  = NULL;
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_PREFS_OPEN,
+                          data,
+                          &status,
+                          NULL);
+       if (data != NULL) CFRelease(data);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       _SCErrorSet(status);
+       return FALSE;
+}
+
+
+static Boolean
+__SCPreferencesAccess_helper(SCPreferencesRef prefs)
+{
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       CFDictionaryRef         serverDict      = NULL;
+       CFDictionaryRef         serverPrefs     = NULL;
+       CFDictionaryRef         serverSignature = NULL;
+       uint32_t                status          = kSCStatusOK;
+       CFDataRef               reply           = NULL;
+
+       if (prefsPrivate->helper == -1) {
+               ok = __SCPreferencesCreate_helper(prefs);
+               if (!ok) {
+                       return FALSE;
+               }
+       }
+
+       // have the helper "access" the prefs
+       status = kSCStatusOK;
+       reply  = NULL;
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_PREFS_ACCESS,
+                          NULL,
+                          &status,
+                          &reply);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       if (reply == NULL) {
+               goto fail;
+       }
+
+       ok = _SCUnserialize((CFPropertyListRef *)&serverDict, reply, NULL, 0);
+       CFRelease(reply);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (isA_CFDictionary(serverDict)) {
+               serverPrefs     = CFDictionaryGetValue(serverDict, CFSTR("preferences"));
+               serverSignature = CFDictionaryGetValue(serverDict, CFSTR("signature"));
+       }
+
+       if (!isA_CFDictionary(serverPrefs) || !isA_CFData(serverSignature)) {
+               CFRelease(serverDict);
+               goto fail;
+       }
+
+       prefsPrivate->prefs     = CFDictionaryCreateMutableCopy(NULL, 0, serverPrefs);
+       prefsPrivate->signature = CFRetain(serverSignature);
+       prefsPrivate->accessed  = TRUE;
+       CFRelease(serverDict);
+
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       _SCErrorSet(status);
+       return FALSE;
+}
+
+
+static SCPreferencesPrivateRef
 __SCPreferencesCreate(CFAllocatorRef   allocator,
                      CFStringRef       name,
                      CFStringRef       prefsID,
 __SCPreferencesCreate(CFAllocatorRef   allocator,
                      CFStringRef       name,
                      CFStringRef       prefsID,
-                     Boolean           perUser,
-                     CFStringRef       user)
+                     CFDataRef         authorizationData)
 {
        int                             fd              = -1;
        SCPreferencesPrivateRef         prefsPrivate;
 {
        int                             fd              = -1;
        SCPreferencesPrivateRef         prefsPrivate;
@@ -196,6 +349,14 @@ __SCPreferencesCreate(CFAllocatorRef       allocator,
                return NULL;
        }
 
                return NULL;
        }
 
+       prefsPrivate->name = CFStringCreateCopy(allocator, name);
+       if (prefsID != NULL) {
+               prefsPrivate->prefsID = CFStringCreateCopy(allocator, prefsID);
+       }
+       if (authorizationData != NULL) {
+               prefsPrivate->authorizationData = CFRetain(authorizationData);
+       }
+
     retry :
 
        /*
     retry :
 
        /*
@@ -203,8 +364,6 @@ __SCPreferencesCreate(CFAllocatorRef        allocator,
         */
        prefsPrivate->path = __SCPreferencesPath(allocator,
                                                 prefsID,
         */
        prefsPrivate->path = __SCPreferencesPath(allocator,
                                                 prefsID,
-                                                perUser,
-                                                user,
                                                 (prefsPrivate->newPath == NULL));
        if (prefsPrivate->path == NULL) {
                sc_status = kSCStatusFailed;
                                                 (prefsPrivate->newPath == NULL));
        if (prefsPrivate->path == NULL) {
                sc_status = kSCStatusFailed;
@@ -221,8 +380,7 @@ __SCPreferencesCreate(CFAllocatorRef        allocator,
                switch (errno) {
                        case ENOENT :
                                /* no prefs file */
                switch (errno) {
                        case ENOENT :
                                /* no prefs file */
-                               if (!perUser &&
-                                   ((prefsID == NULL) || !CFStringHasPrefix(prefsID, CFSTR("/")))) {
+                               if ((prefsID == NULL) || !CFStringHasPrefix(prefsID, CFSTR("/"))) {
                                        /* if default preference ID or relative path */
                                        if (prefsPrivate->newPath == NULL) {
                                                /*
                                        /* if default preference ID or relative path */
                                        if (prefsPrivate->newPath == NULL) {
                                                /*
@@ -235,7 +393,7 @@ __SCPreferencesCreate(CFAllocatorRef        allocator,
                                        } else {
                                                /*
                                                 * we've looked in both the "new" and "old"
                                        } else {
                                                /*
                                                 * we've looked in both the "new" and "old"
-                                                * prefs directories without success.  USe
+                                                * prefs directories without success.  Use
                                                 * the "new" path.
                                                 */
                                                CFAllocatorDeallocate(NULL, prefsPrivate->path);
                                                 * the "new" path.
                                                 */
                                                CFAllocatorDeallocate(NULL, prefsPrivate->path);
@@ -245,8 +403,14 @@ __SCPreferencesCreate(CFAllocatorRef       allocator,
                                }
 
                                /* no preference data, start fresh */
                                }
 
                                /* no preference data, start fresh */
+                               sc_status = kSCStatusNoConfigFile;
                                goto done;
                        case EACCES :
                                goto done;
                        case EACCES :
+                               if (prefsPrivate->authorizationData != NULL) {
+                                       /* no problem, we'll be using the helper */
+                                       goto done;
+                               }
+
                                sc_status = kSCStatusAccessError;
                                break;
                        default :
                                sc_status = kSCStatusAccessError;
                                break;
                        default :
@@ -259,14 +423,9 @@ __SCPreferencesCreate(CFAllocatorRef       allocator,
 
     done :
 
 
     done :
 
-       /*
-        * all OK
-        */
-       prefsPrivate->name = CFStringCreateCopy(allocator, name);
-       if (prefsID != NULL) prefsPrivate->prefsID = CFStringCreateCopy(allocator, prefsID);
-       prefsPrivate->perUser = perUser;
-       if (user != NULL) prefsPrivate->user = CFStringCreateCopy(allocator, user);
-       return (SCPreferencesRef)prefsPrivate;
+       /* all OK */
+       _SCErrorSet(sc_status);
+       return prefsPrivate;
 
     error :
 
 
     error :
 
@@ -277,47 +436,50 @@ __SCPreferencesCreate(CFAllocatorRef      allocator,
 }
 
 
 }
 
 
-__private_extern__ Boolean
+__private_extern__ void
 __SCPreferencesAccess(SCPreferencesRef prefs)
 {
 __SCPreferencesAccess(SCPreferencesRef prefs)
 {
-       CFAllocatorRef                  allocator       = CFGetAllocator(prefs);
+       CFAllocatorRef                  allocator       = CFGetAllocator(prefs);
        int                             fd              = -1;
        SCPreferencesPrivateRef         prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        int                             fd              = -1;
        SCPreferencesPrivateRef         prefsPrivate    = (SCPreferencesPrivateRef)prefs;
-       int                             sc_status       = kSCStatusOK;
        struct  stat                    statBuf;
 
        if (prefsPrivate->accessed) {
                // if preference data has already been accessed
        struct  stat                    statBuf;
 
        if (prefsPrivate->accessed) {
                // if preference data has already been accessed
-               return TRUE;
+               return;
        }
 
        fd = open(prefsPrivate->path, O_RDONLY, 0644);
        if (fd != -1) {
                // create signature
                if (fstat(fd, &statBuf) == -1) {
        }
 
        fd = open(prefsPrivate->path, O_RDONLY, 0644);
        if (fd != -1) {
                // create signature
                if (fstat(fd, &statBuf) == -1) {
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess fstat() failed: %s"), strerror(errno));
-                       sc_status = kSCStatusFailed;
-                       goto error;
+                       SCLog(TRUE, LOG_ERR, CFSTR("__SCPreferencesAccess fstat() failed: %s"), strerror(errno));
+                       bzero(&statBuf, sizeof(statBuf));
                }
        } else {
                switch (errno) {
                        case ENOENT :
                                /* no preference data, start fresh */
                }
        } else {
                switch (errno) {
                        case ENOENT :
                                /* no preference data, start fresh */
-                               bzero(&statBuf, sizeof(statBuf));
-                               goto create_1;
-                       case EACCES :
-                               sc_status = kSCStatusAccessError;
                                break;
                                break;
+                       case EACCES :
+                               if (prefsPrivate->authorizationData != NULL) {
+                                       if (__SCPreferencesAccess_helper(prefs)) {
+                                               goto done;
+                                       } else {
+                                               SCLog(TRUE, LOG_ERR,
+                                                     CFSTR("__SCPreferencesAccess_helper() failed: %s"),
+                                                     SCErrorString(SCError()));
+                                       }
+                                       break;
+                               }
+                               // fall through
                        default :
                        default :
-                               sc_status = kSCStatusFailed;
+                               SCLog(TRUE, LOG_ERR, CFSTR("__SCPreferencesAccess open() failed: %s"), strerror(errno));
                                break;
                }
                                break;
                }
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess open() failed: %s"), strerror(errno));
-               goto error;
+               bzero(&statBuf, sizeof(statBuf));
        }
 
        }
 
-    create_1 :
-
        if (prefsPrivate->signature != NULL) CFRelease(prefsPrivate->signature);
        prefsPrivate->signature = __SCPSignatureFromStatbuf(&statBuf);
 
        if (prefsPrivate->signature != NULL) CFRelease(prefsPrivate->signature);
        prefsPrivate->signature = __SCPSignatureFromStatbuf(&statBuf);
 
@@ -336,7 +498,7 @@ __SCPreferencesAccess(SCPreferencesRef      prefs)
                        SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess read(): could not load preference data."));
                        CFRelease(xmlData);
                        xmlData = NULL;
                        SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess read(): could not load preference data."));
                        CFRelease(xmlData);
                        xmlData = NULL;
-                       goto create_2;
+                       goto done;
                }
 
                /*
                }
 
                /*
@@ -355,7 +517,7 @@ __SCPreferencesAccess(SCPreferencesRef      prefs)
                                      xmlError);
                                CFRelease(xmlError);
                        }
                                      xmlError);
                                CFRelease(xmlError);
                        }
-                       goto create_2;
+                       goto done;
                }
 
                /*
                }
 
                /*
@@ -365,14 +527,14 @@ __SCPreferencesAccess(SCPreferencesRef    prefs)
                        /* corrupt prefs file, start fresh */
                        SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess CFGetTypeID(): not a dictionary."));
                        CFRelease(dict);
                        /* corrupt prefs file, start fresh */
                        SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess CFGetTypeID(): not a dictionary."));
                        CFRelease(dict);
-                       goto create_2;
+                       goto done;
                }
 
                prefsPrivate->prefs = CFDictionaryCreateMutableCopy(allocator, 0, dict);
                CFRelease(dict);
        }
 
                }
 
                prefsPrivate->prefs = CFDictionaryCreateMutableCopy(allocator, 0, dict);
                CFRelease(dict);
        }
 
-    create_2 :
+    done :
 
        if (fd != -1) {
                (void) close(fd);
 
        if (fd != -1) {
                (void) close(fd);
@@ -383,7 +545,7 @@ __SCPreferencesAccess(SCPreferencesRef      prefs)
                /*
                 * new file, create empty preferences
                 */
                /*
                 * new file, create empty preferences
                 */
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess(): creating new dictionary."));
+               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess(): creating new preferences file."));
                prefsPrivate->prefs = CFDictionaryCreateMutable(allocator,
                                                                0,
                                                                &kCFTypeDictionaryKeyCallBacks,
                prefsPrivate->prefs = CFDictionaryCreateMutable(allocator,
                                                                0,
                                                                &kCFTypeDictionaryKeyCallBacks,
@@ -392,14 +554,7 @@ __SCPreferencesAccess(SCPreferencesRef     prefs)
        }
 
        prefsPrivate->accessed = TRUE;
        }
 
        prefsPrivate->accessed = TRUE;
-       return TRUE;
-
-    error :
-
-       if (fd != -1)   (void) close(fd);
-       _SCErrorSet(sc_status);
-       return FALSE;
-
+       return;
 }
 
 
 }
 
 
@@ -408,17 +563,36 @@ SCPreferencesCreate(CFAllocatorRef                allocator,
                    CFStringRef                 name,
                    CFStringRef                 prefsID)
 {
                    CFStringRef                 name,
                    CFStringRef                 prefsID)
 {
-       return __SCPreferencesCreate(allocator, name, prefsID, FALSE, NULL);
+       SCPreferencesPrivateRef prefsPrivate;
+
+       prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, NULL);
+       return (SCPreferencesRef)prefsPrivate;
 }
 
 
 SCPreferencesRef
 }
 
 
 SCPreferencesRef
-SCUserPreferencesCreate(CFAllocatorRef                 allocator,
-                       CFStringRef                     name,
-                       CFStringRef                     prefsID,
-                       CFStringRef                     user)
+SCPreferencesCreateWithAuthorization(CFAllocatorRef    allocator,
+                                    CFStringRef        name,
+                                    CFStringRef        prefsID,
+                                    AuthorizationRef   authorization)
 {
 {
-       return __SCPreferencesCreate(allocator, name, prefsID, TRUE, user);
+       CFDataRef                       authorizationData;
+       AuthorizationExternalForm       extForm;
+       OSStatus                        os_status;
+       SCPreferencesPrivateRef         prefsPrivate;
+
+       os_status = AuthorizationMakeExternalForm(authorization, &extForm);
+       if (os_status != errAuthorizationSuccess) {
+               SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen AuthorizationMakeExternalForm() failed"));
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       authorizationData = CFDataCreate(NULL, (const UInt8 *)extForm.bytes, sizeof(extForm.bytes));
+       prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, authorizationData);
+       CFRelease(authorizationData);
+
+       return (SCPreferencesRef)prefsPrivate;
 }
 
 
 }
 
 
@@ -512,16 +686,12 @@ __SCPreferencesAddSession(SCPreferencesRef prefs)
        /* create the session "commit" key */
        prefsPrivate->sessionKeyCommit = _SCPNotificationKey(NULL,
                                                             prefsPrivate->prefsID,
        /* create the session "commit" key */
        prefsPrivate->sessionKeyCommit = _SCPNotificationKey(NULL,
                                                             prefsPrivate->prefsID,
-                                                            prefsPrivate->perUser,
-                                                            prefsPrivate->user,
                                                             kSCPreferencesKeyCommit);
 
        /* create the session "apply" key */
        prefsPrivate->sessionKeyApply = _SCPNotificationKey(NULL,
                                                             kSCPreferencesKeyCommit);
 
        /* create the session "apply" key */
        prefsPrivate->sessionKeyApply = _SCPNotificationKey(NULL,
-                                                            prefsPrivate->prefsID,
-                                                            prefsPrivate->perUser,
-                                                            prefsPrivate->user,
-                                                            kSCPreferencesKeyApply);
+                                                           prefsPrivate->prefsID,
+                                                           kSCPreferencesKeyApply);
 
        return TRUE;
 }
 
        return TRUE;
 }
@@ -592,7 +762,7 @@ SCPreferencesScheduleWithRunLoop(SCPreferencesRef       prefs,
                keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
                CFArrayAppendValue(keys, prefsPrivate->sessionKeyCommit);
                CFArrayAppendValue(keys, prefsPrivate->sessionKeyApply);
                keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
                CFArrayAppendValue(keys, prefsPrivate->sessionKeyCommit);
                CFArrayAppendValue(keys, prefsPrivate->sessionKeyApply);
-               (void)SCDynamicStoreSetNotificationKeys(prefsPrivate->session, keys, NULL);
+               (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, keys, NULL);
                CFRelease(keys);
 
                prefsPrivate->rls    = SCDynamicStoreCreateRunLoopSource(NULL, prefsPrivate->session, 0);
                CFRelease(keys);
 
                prefsPrivate->rls    = SCDynamicStoreCreateRunLoopSource(NULL, prefsPrivate->session, 0);
@@ -664,7 +834,7 @@ SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef     prefs,
                        CFRelease(prefs);       // release our reference to the prefs
 
                        // no need to track changes
                        CFRelease(prefs);       // release our reference to the prefs
 
                        // no need to track changes
-                       (void)SCDynamicStoreSetNotificationKeys(prefsPrivate->session, NULL, NULL);
+                       (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, NULL, NULL);
 
                        // clear out any pending notifications
                        changedKeys = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session);
 
                        // clear out any pending notifications
                        changedKeys = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session);
index dce62a0b780dc97b4dc7903b226c360c9f23f597..5711b843959f638f67d727f3332e600c7bf967f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -343,7 +343,7 @@ SCPreferencesPathCreateUniqueChild(SCPreferencesRef prefs,
 {
        CFStringRef             child;
        CFStringRef             newPath         = NULL;
 {
        CFStringRef             child;
        CFStringRef             newPath         = NULL;
-       CFMutableDictionaryRef  newDict         = NULL;
+       CFDictionaryRef         newDict;
        CFUUIDRef               uuid;
        CFDictionaryRef         entity;
 
        CFUUIDRef               uuid;
        CFDictionaryRef         entity;
 
@@ -371,11 +371,11 @@ SCPreferencesPathCreateUniqueChild(SCPreferencesRef       prefs,
        CFRelease(child);
        CFRelease(uuid);
 
        CFRelease(child);
        CFRelease(uuid);
 
-       /* save the new dictionary */
-       newDict = CFDictionaryCreateMutable(NULL,
-                                           0,
-                                           &kCFTypeDictionaryKeyCallBacks,
-                                           &kCFTypeDictionaryValueCallBacks);
+       /* save a new/empty dictionary */
+       newDict = CFDictionaryCreate(NULL,
+                                    NULL, NULL, 0,
+                                    &kCFTypeDictionaryKeyCallBacks,
+                                    &kCFTypeDictionaryValueCallBacks);
        if (!setPath(prefs, newPath, newDict)) {
                CFRelease(newPath);
                newPath = NULL;
        if (!setPath(prefs, newPath, newDict)) {
                CFRelease(newPath);
                newPath = NULL;
@@ -459,11 +459,11 @@ SCPreferencesPathSetValue(SCPreferencesRef        prefs,
 #define        NETPREF_NEEDS_REPAIR
 #ifdef NETPREF_NEEDS_REPAIR
        if (CFEqual(path, CFSTR("/CurrentSet")) && isA_CFString(value)) {
 #define        NETPREF_NEEDS_REPAIR
 #ifdef NETPREF_NEEDS_REPAIR
        if (CFEqual(path, CFSTR("/CurrentSet")) && isA_CFString(value)) {
-//             static Boolean  warned  = FALSE;
-//             if (!warned) {
-//                     SCPrint(TRUE, stderr, CFSTR("SCPreferencesPathSetValue(, %@, ) called with non-dictionary value\n"), path);
-//                     warned = TRUE;
-//             }
+               static Boolean  warned  = FALSE;
+               if (!warned) {
+                       SCPrint(TRUE, stderr, CFSTR("SCPreferencesPathSetValue(, %@, ) called with non-dictionary value\n"), path);
+                       warned = TRUE;
+               }
                return SCPreferencesSetValue(prefs, CFSTR("CurrentSet"), value);
        }
 #endif // NETPREF_NEEDS_REPAIR
                return SCPreferencesSetValue(prefs, CFSTR("CurrentSet"), value);
        }
 #endif // NETPREF_NEEDS_REPAIR
@@ -510,7 +510,7 @@ SCPreferencesPathSetLink(SCPreferencesRef   prefs,
                                         0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
                                         0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
-       CFDictionaryAddValue(dict, kSCResvLink, link);
+       CFDictionarySetValue(dict, kSCResvLink, link);
        ok = setPath(prefs, path, dict);
        CFRelease(dict);
 
        ok = setPath(prefs, path, dict);
        CFRelease(dict);
 
index 9d7c73aec67a822def32b47f2cb3426ef2c2aea0..c2a3b583e91b267d0598fd8c15d97cd7ed509af9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index ed4befffdd5ec29d44d165eaae9be165a3d8c475..ae82d19cb1541a686ab6143baed43e04b7e57849 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 6b07676e8fc762dab6d91ae9b0e84e37d49904e9..80c47c8d8ec54958e925f869e90e0220517ce7ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
+#include "SCHelper_client.h"
+
+#include <unistd.h>
+#include <pthread.h>
+
+static Boolean
+__SCPreferencesUnlock_helper(SCPreferencesRef prefs)
+{
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+
+       if (prefsPrivate->helper == -1) {
+               // if no helper
+               goto fail;
+       }
+
+       // have the helper "unlock" the prefs
+//     status = kSCStatusOK;
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_PREFS_UNLOCK,
+                          NULL,
+                          &status,
+                          NULL);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       prefsPrivate->locked = FALSE;
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       _SCErrorSet(status);
+       return FALSE;
+}
+
 
 Boolean
 SCPreferencesUnlock(SCPreferencesRef prefs)
 
 Boolean
 SCPreferencesUnlock(SCPreferencesRef prefs)
@@ -52,18 +104,22 @@ SCPreferencesUnlock(SCPreferencesRef prefs)
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (!prefsPrivate->isRoot) {
-               /* CONFIGD REALLY NEEDS NON-ROOT WRITE ACCESS */
-               goto perUser;
+       if (prefsPrivate->authorizationData != NULL) {
+               return __SCPreferencesUnlock_helper(prefs);
        }
 
        }
 
-       if (!SCDynamicStoreRemoveValue(prefsPrivate->session, prefsPrivate->sessionKeyLock)) {
-               SCLog(_sc_verbose, LOG_INFO, CFSTR("SCPreferencesUnlock SCDynamicStoreRemoveValue() failed"));
-               return FALSE;
-       }
+       pthread_mutex_lock(&prefsPrivate->lock);
 
 
-    perUser:
+       if (prefsPrivate->lockFD != -1) {
+               if (prefsPrivate->lockPath != NULL) {
+                       unlink(prefsPrivate->lockPath);
+               }
+               close(prefsPrivate->lockFD);
+               prefsPrivate->lockFD = -1;
+       }
 
        prefsPrivate->locked = FALSE;
 
        prefsPrivate->locked = FALSE;
+
+       pthread_mutex_unlock(&prefsPrivate->lock);
        return TRUE;
 }
        return TRUE;
 }
index 1b8cdefe3c5a6e57c6df1ee64ef437dc85997ad3..20bf2df291633b483eefb24b607a32fa0e98ba93 100644 (file)
@@ -28,7 +28,7 @@
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
-
+#include <Security/Security.h>
 
 /*!
        @header SCPreferences
 
 /*!
        @header SCPreferences
@@ -158,6 +158,38 @@ SCPreferencesCreate                (
                                CFStringRef             prefsID
                                );
 
                                CFStringRef             prefsID
                                );
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+
+/*!
+       @function SCPreferencesCreateWithAuthorization
+       @discussion Initiates access to the per-system set of configuration
+               preferences.
+       @param allocator The CFAllocator that should be used to allocate
+               memory for this preferences session.
+               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 name A string that describes the name of the calling
+               process.
+       @param prefsID A string that identifies the name of the
+               group of preferences to be accessed or updated.
+       @param authorization An authorization reference that is used to
+               authorize any access to the enhanced privileges needed
+               to manage the preferences session.
+       @result Returns a reference to the new SCPreferences.
+               You must release the returned value.
+ */
+SCPreferencesRef
+SCPreferencesCreateWithAuthorization   (
+                                       CFAllocatorRef          allocator,
+                                       CFStringRef             name,
+                                       CFStringRef             prefsID,
+                                       AuthorizationRef        authorization
+                                       )                               AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+
 /*!
        @function SCPreferencesLock
        @discussion Locks access to the configuration preferences.
 /*!
        @function SCPreferencesLock
        @discussion Locks access to the configuration preferences.
index 971cae9af80255c42efb2d246a690fe500a1129b..fb95d008c6703d3ac76bd70fb97748310f3d6f2e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -57,14 +57,15 @@ typedef struct {
        /* preferences ID */
        CFStringRef             prefsID;
 
        /* preferences ID */
        CFStringRef             prefsID;
 
-       /* per-user preference info */
-       Boolean                 perUser;
-       CFStringRef             user;
-
        /* configuration file */
        char                    *path;
        char                    *newPath;
 
        /* configuration file */
        char                    *path;
        char                    *newPath;
 
+       /* preferences lock, lock file */
+       Boolean                 locked;
+       int                     lockFD;
+       char                    *lockPath;
+
        /* configuration file signature */
        CFDataRef               signature;
 
        /* configuration file signature */
        CFDataRef               signature;
 
@@ -72,7 +73,6 @@ typedef struct {
        SCDynamicStoreRef       session;
 
        /* configd session keys */
        SCDynamicStoreRef       session;
 
        /* configd session keys */
-       CFStringRef             sessionKeyLock;
        CFStringRef             sessionKeyCommit;
        CFStringRef             sessionKeyApply;
 
        CFStringRef             sessionKeyCommit;
        CFStringRef             sessionKeyApply;
 
@@ -88,9 +88,12 @@ typedef struct {
        /* flags */
        Boolean                 accessed;
        Boolean                 changed;
        /* flags */
        Boolean                 accessed;
        Boolean                 changed;
-       Boolean                 locked;
        Boolean                 isRoot;
 
        Boolean                 isRoot;
 
+       /* authorization, helper */
+       CFDataRef               authorizationData;
+       int                     helper;
+
 } SCPreferencesPrivate, *SCPreferencesPrivateRef;
 
 
 } SCPreferencesPrivate, *SCPreferencesPrivateRef;
 
 
@@ -105,14 +108,10 @@ typedef struct {
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
-SCPreferencesRef
-__SCPreferencesCreate                  (CFAllocatorRef         allocator,
-                                        CFStringRef            name,
-                                        CFStringRef            prefsID,
-                                        Boolean                perUser,
-                                        CFStringRef            user);
-
 Boolean
 Boolean
+__SCPreferencesCreate_helper           (SCPreferencesRef       prefs);
+
+void
 __SCPreferencesAccess                  (SCPreferencesRef       prefs);
 
 Boolean
 __SCPreferencesAccess                  (SCPreferencesRef       prefs);
 
 Boolean
@@ -124,15 +123,11 @@ __SCPSignatureFromStatbuf         (const struct stat      *statBuf);
 char *
 __SCPreferencesPath                    (CFAllocatorRef         allocator,
                                         CFStringRef            prefsID,
 char *
 __SCPreferencesPath                    (CFAllocatorRef         allocator,
                                         CFStringRef            prefsID,
-                                        Boolean                perUser,
-                                        CFStringRef            user,
                                         Boolean                useNewPrefs);
 
 CFStringRef
 _SCPNotificationKey                    (CFAllocatorRef         allocator,
                                         CFStringRef            prefsID,
                                         Boolean                useNewPrefs);
 
 CFStringRef
 _SCPNotificationKey                    (CFAllocatorRef         allocator,
                                         CFStringRef            prefsID,
-                                        Boolean                perUser,
-                                        CFStringRef            user,
                                         int                    keyType);
 
 __END_DECLS
                                         int                    keyType);
 
 __END_DECLS
diff --git a/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c b/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c
new file mode 100644 (file)
index 0000000..afdce88
--- /dev/null
@@ -0,0 +1,1010 @@
+/*
+ * Copyright (c) 2006 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
+ *
+ * May 24, 2006        Allan Nathanson (ajn@apple.com)
+ * - adapted (for SystemConfiguration)
+ *
+ * May 10, 2006        Dieter Siegmund (dieter@apple.com)
+ * - created (for EAP)
+ */
+
+#include <sys/param.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreFoundation/CFBundlePriv.h>       // for _CFBundleCopyMainBundleExecutableURL
+#include <SystemConfiguration/SCPrivate.h>     // for _SCErrorSet
+#include <Security/Security.h>
+#include "dy_framework.h"
+
+#include "SCPreferencesInternal.h"
+
+
+static CFDataRef
+copyMyExecutablePath(void)
+{
+       char            fspath[MAXPATHLEN];
+       Boolean         isBundle        = FALSE;
+       Boolean         ok;
+       CFDataRef       path            = NULL;
+       CFURLRef        url;
+
+       url = _CFBundleCopyMainBundleExecutableURL(&isBundle);
+       if (url == NULL) {
+               return NULL;
+       }
+
+       ok  = CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)fspath, sizeof(fspath));
+       CFRelease(url);
+       if (!ok) {
+               return NULL;
+       }
+       fspath[sizeof(fspath) - 1] = '\0';
+
+       if (isBundle) {
+               const char      *slash;
+
+               slash = strrchr(fspath, '/');
+               if (slash != NULL) {
+                       const char      *contents;
+
+                       contents = strstr(fspath, "/Contents/MacOS/");
+                       if ((contents != NULL) &&
+                           ((contents + sizeof("/Contents/MacOS/") - 1) == slash)) {
+                               path = CFDataCreate(NULL, (UInt8 *)fspath, contents - fspath);
+                               goto done;
+                       }
+               }
+       }
+
+       path = CFDataCreate(NULL, (UInt8 *)fspath, strlen(fspath));
+
+    done :
+
+       return path;
+}
+
+
+#pragma mark -
+#pragma mark Keychain helper APIs
+
+
+/*
+ * Create a SecAccessRef with a custom form.
+ *
+ * Both the owner and the ACL set allow free access to root,
+ * but nothing to anyone else.
+ *
+ * NOTE: This is not the easiest way to build up CSSM data structures
+ *       but it is a way that does not depend on any outside software
+ *       layers (other than CSSM and Security's Sec* layer, of course).
+ */
+static SecAccessRef
+_SCSecAccessCreateForUID(uid_t uid)
+{
+       SecAccessRef    access  = NULL;
+       OSStatus        status;
+
+       // make the "uid/gid" ACL subject
+       // this is a CSSM_LIST_ELEMENT chain
+
+       CSSM_ACL_PROCESS_SUBJECT_SELECTOR       selector        = {
+               CSSM_ACL_PROCESS_SELECTOR_CURRENT_VERSION,                      // version
+               CSSM_ACL_MATCH_UID,                                             // active fields mask: match uids (only)
+               uid,                                                            // effective user id to match
+               0                                                               // effective group id to match
+       };
+
+       CSSM_LIST_ELEMENT                       subject2        = {
+               NULL,                                                           // NextElement
+               0                                                               // WordID
+               // rest is defaulted
+       };
+
+       subject2.Element.Word.Data   = (UInt8 *)&selector;
+       subject2.Element.Word.Length = sizeof(selector);
+
+       CSSM_LIST_ELEMENT                       subject1        = {
+               &subject2,                                                      // NextElement
+               CSSM_ACL_SUBJECT_TYPE_PROCESS,                                  // WordID
+               CSSM_LIST_ELEMENT_WORDID                                        // ElementType
+               // rest is defaulted
+       };
+
+       // rights granted (replace with individual list if desired)
+       CSSM_ACL_AUTHORIZATION_TAG              rights[]        = {
+               CSSM_ACL_AUTHORIZATION_ANY                                      // everything
+       };
+
+       // owner component (right to change ACL)
+       CSSM_ACL_OWNER_PROTOTYPE                owner           = {
+               {                                                               // TypedSubject
+                       CSSM_LIST_TYPE_UNKNOWN,                                    // type of this list
+                       &subject1,                                                 // head of the list
+                       &subject2                                                  // tail of the list
+               },
+               FALSE                                                           // Delegate
+       };
+
+       // ACL entries (any number, just one here)
+       CSSM_ACL_ENTRY_INFO                     acls[]          = {
+               {
+                       {                                                       // EntryPublicInfo
+                               {                                                  // TypedSubject
+                                       CSSM_LIST_TYPE_UNKNOWN,                       // type of this list
+                                       &subject1,                                    // head of the list
+                                       &subject2                                     // tail of the list
+                               },
+                               FALSE,                                             // Delegate
+                               {                                                  // Authorization
+                                       sizeof(rights) / sizeof(rights[0]),           // NumberOfAuthTags
+                                       rights                                        // AuthTags
+                               },
+                               {                                                  // TimeRange
+                               },
+                               {                                                  // EntryTag
+                               }
+                       },
+                       0                                                       // EntryHandle
+               }
+       };
+
+       status = SecAccessCreateFromOwnerAndACL(&owner,
+                                               sizeof(acls) / sizeof(acls[0]),
+                                               acls,
+                                               &access);
+       if (status != noErr) {
+               _SCErrorSet(status);
+       }
+
+       return access;
+}
+
+
+// one example would be to pass a URL for "/System/Library/CoreServices/SystemUIServer.app"
+static SecAccessRef
+_SCSecAccessCreateForExecutables(CFStringRef   label,
+                                CFArrayRef     executableURLs)
+{
+       SecAccessRef                    access                  = NULL;
+       CFArrayRef                      aclList                 = NULL;
+       CFIndex                         i;
+       CFIndex                         n;
+       OSStatus                        status;
+       SecTrustedApplicationRef        trustedApplication;
+       CFMutableArrayRef               trustedApplications;
+
+       trustedApplications = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       // Use default access ("confirm access")
+
+       // Next, we make an exception list of applications you want to trust.
+       // These applications will be allowed to access the item without requiring
+       // user confirmation.
+
+       // Trust the calling application
+       status = SecTrustedApplicationCreateFromPath(NULL, &trustedApplication);
+       if (status == noErr) {
+               CFArrayAppendValue(trustedApplications, trustedApplication);
+               CFRelease(trustedApplication);
+       }
+
+       n = (executableURLs != NULL) ? CFArrayGetCount(executableURLs) : 0;
+       for (i = 0; i < n; i++) {
+               Boolean         ok;
+               char            path[MAXPATHLEN];
+               CFURLRef        url;
+
+               url = CFArrayGetValueAtIndex(executableURLs, i);
+               ok = CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)path, sizeof(path));
+               if (!ok) {
+                       continue;
+               }
+
+               status = SecTrustedApplicationCreateFromPath(path, &trustedApplication);
+               if (status == noErr) {
+                       CFArrayAppendValue(trustedApplications, trustedApplication);
+                       CFRelease(trustedApplication);
+               }
+       }
+
+       status = SecAccessCreate(label, trustedApplications, &access);
+       if (status != noErr) {
+               goto done;
+       }
+
+#ifdef NOT_NEEDED
+       // get the access control list for decryption operations (this controls access to an item's data)
+       status = SecAccessCopySelectedACLList(access, CSSM_ACL_AUTHORIZATION_DECRYPT, &aclList);
+       if (status == noErr) {
+               SecACLRef                               acl;
+               CFArrayRef                              applicationList = NULL;
+               CFStringRef                             description     = NULL;
+               CSSM_ACL_KEYCHAIN_PROMPT_SELECTOR       promptSelector;
+
+               // get the first entry in the access control list
+               acl = (SecACLRef)CFArrayGetValueAtIndex(aclList, 0);
+
+               // get the description and prompt selector
+               status = SecACLCopySimpleContents(acl, &applicationList, &description, &promptSelector);
+
+               // modify the application list
+               status = SecACLSetSimpleContents(acl, (CFArrayRef)trustedApplications, description, &promptSelector);
+
+               if (applicationList != NULL)    CFRelease(applicationList);
+               if (description != NULL)        CFRelease(description);
+       }
+#endif // NOT_NEEDED
+
+    done :
+
+       if (aclList != NULL)    CFRelease(aclList);
+       CFRelease(trustedApplications);
+
+       return  access;
+}
+
+
+SecKeychainRef
+_SCSecKeychainCopySystemKeychain(void)
+{
+       SecPreferencesDomain    domain;
+       SecKeychainRef          keychain        = NULL;
+       OSStatus                status;
+
+       status = SecKeychainGetPreferenceDomain(&domain);
+       if (status != noErr) {
+               _SCErrorSet(status);
+               return NULL;
+       }
+
+       status = SecKeychainSetPreferenceDomain(kSecPreferencesDomainSystem);
+       if (status != noErr) {
+               _SCErrorSet(status);
+               return NULL;
+       }
+
+       status = SecKeychainCopyDomainDefault(kSecPreferencesDomainSystem, &keychain);
+       if (status != noErr) {
+               _SCErrorSet(status);
+               (void) SecKeychainSetPreferenceDomain(domain);
+               if (keychain != NULL) CFRelease(keychain);
+               return NULL;
+       }
+
+       status = SecKeychainSetPreferenceDomain(domain);
+       if (status != noErr) {
+               _SCErrorSet(status);
+               if (keychain != NULL) CFRelease(keychain);
+               return NULL;
+       }
+
+       return keychain;
+}
+
+
+static OSStatus
+findKeychainItem(SecKeychainRef                keychain,
+                UInt32                 serviceNameLength,
+                void                   *serviceName,
+                SecKeychainItemRef     *item)
+{
+       SecKeychainAttribute            attributes[1];
+       SecKeychainAttributeList        attributeList   = { 1, attributes };
+       SecKeychainSearchRef            search          = NULL;
+       OSStatus                        status;
+
+       attributes[0].tag    = kSecServiceItemAttr;
+       attributes[0].data   = serviceName;
+       attributes[0].length = serviceNameLength;
+
+       status = SecKeychainSearchCreateFromAttributes(keychain,
+                                                      kSecGenericPasswordItemClass,
+                                                      &attributeList,
+                                                      &search);
+       if (status != noErr) {
+               return status;
+       }
+
+       status = SecKeychainSearchCopyNext(search, item);
+       CFRelease(search);
+
+       return status;
+}
+
+
+CFDataRef
+_SCSecKeychainPasswordItemCopy(SecKeychainRef  keychain,
+                              CFStringRef      unique_id)
+{
+       SecKeychainItemRef      item                    = NULL;
+       CFDataRef               keychain_password       = NULL;
+       const char              *keychain_serviceName;
+       OSStatus                status;
+
+       keychain_serviceName = _SC_cfstring_to_cstring(unique_id, NULL, 0, kCFStringEncodingUTF8);
+       status = findKeychainItem(keychain,
+                                 strlen(keychain_serviceName),
+                                 (void *)keychain_serviceName,
+                                 &item);
+       CFAllocatorDeallocate(NULL, (void *)keychain_serviceName);
+       if (status == noErr) {
+               void *          pw      = NULL;
+               UInt32          pw_len  = 0;
+
+               status = SecKeychainItemCopyContent(item, NULL, NULL, &pw_len, &pw);
+               if (status == noErr) {
+                       keychain_password = CFDataCreate(NULL, pw, pw_len);
+                       status = SecKeychainItemFreeContent(NULL, pw);
+               }
+       }
+       if (item != NULL) CFRelease(item);
+       if (status != noErr) {
+               _SCErrorSet(status);
+       }
+
+       return keychain_password;
+}
+
+
+Boolean
+_SCSecKeychainPasswordItemExists(SecKeychainRef keychain, CFStringRef unique_id)
+{
+       SecKeychainItemRef      item;
+       const char              *keychain_serviceName;
+       OSStatus                status;
+
+       keychain_serviceName = _SC_cfstring_to_cstring(unique_id, NULL, 0, kCFStringEncodingUTF8);
+       status = findKeychainItem(keychain,
+                                 strlen(keychain_serviceName),
+                                 (void *)keychain_serviceName,
+                                 &item);
+       CFAllocatorDeallocate(NULL, (void *)keychain_serviceName);
+       if (status != noErr) {
+               _SCErrorSet(status);
+               return FALSE;
+       }
+
+       CFRelease(item);
+       return TRUE;
+}
+
+
+Boolean
+_SCSecKeychainPasswordItemRemove(SecKeychainRef keychain, CFStringRef unique_id)
+{
+       SecKeychainItemRef      item;
+       const char              *keychain_serviceName;
+       OSStatus                status;
+
+       keychain_serviceName = _SC_cfstring_to_cstring(unique_id, NULL, 0, kCFStringEncodingUTF8);
+       status = findKeychainItem(keychain,
+                                 strlen(keychain_serviceName),
+                                 (void *)keychain_serviceName,
+                                 &item);
+       CFAllocatorDeallocate(NULL, (void *)keychain_serviceName);
+       if (status != noErr) {
+               _SCErrorSet(status);
+               return FALSE;
+       }
+
+       status = SecKeychainItemDelete(item);
+       CFRelease(item);
+       if (status != noErr) {
+               _SCErrorSet(status);
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+Boolean
+_SCSecKeychainPasswordItemSet(SecKeychainRef   keychain,
+                             CFStringRef       unique_id,
+                             CFStringRef       label,
+                             CFStringRef       description,
+                             CFStringRef       account,
+                             CFDataRef         password,
+                             CFDictionaryRef   options)
+{
+       SecAccessRef                    access                  = NULL;
+       CFBooleanRef                    allowRoot               = NULL;
+       CFArrayRef                      allowedExecutables      = NULL;
+       SecKeychainAttribute            attributes[4];
+       SecKeychainAttributeList        attributeList           = { 0, attributes };
+       CFIndex                         i;
+       SecKeychainItemRef              item                    = NULL;
+       CFIndex                         n                       = 0;
+       OSStatus                        status;
+
+       if (options != NULL) {
+               if (isA_CFDictionary(options)) {
+                       allowRoot          = CFDictionaryGetValue(options, kSCKeychainOptionsAllowRoot);
+                       allowedExecutables = CFDictionaryGetValue(options, kSCKeychainOptionsAllowedExecutables);
+               } else {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+               }
+       }
+
+       if (!isA_CFString(unique_id) ||
+           ((label              != NULL) && !isA_CFString (label             )) ||
+           ((description        != NULL) && !isA_CFString (description       )) ||
+           ((account            != NULL) && !isA_CFString (account           )) ||
+           ((password           != NULL) && !isA_CFData   (password          )) ||
+           ((allowRoot          != NULL) && !isA_CFBoolean(allowRoot         )) ||
+           ((allowedExecutables != NULL) && !isA_CFArray  (allowedExecutables)) ||
+           ((allowRoot          != NULL) && (allowedExecutables != NULL))) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((allowRoot != NULL) && CFBooleanGetValue(allowRoot)) {
+               access = _SCSecAccessCreateForUID(0);
+               if (access == NULL) {
+                       return FALSE;
+               }
+       } else if (allowedExecutables != NULL) {
+               access = _SCSecAccessCreateForExecutables(label, allowedExecutables);
+               if (access == NULL) {
+                       return FALSE;
+               }
+       }
+
+       for (i = 0; i < 4; i++) {
+               CFStringRef             str     = NULL;
+               SecKeychainAttrType     tag     = 0;
+
+               switch (i) {
+                       case 0 :
+                               str = unique_id;
+                               tag = kSecServiceItemAttr;
+                               break;
+                       case 1 :
+                               str = label;
+                               tag = kSecLabelItemAttr;
+                               break;
+                       case 2 :
+                               str = description;
+                               tag = kSecDescriptionItemAttr;
+                               break;
+                       case 3 :
+                               str = account;
+                               tag = kSecAccountItemAttr;
+                               break;
+               }
+
+               if (str == NULL) {
+                       continue;
+               }
+
+               attributes[n].tag    = tag;
+               attributes[n].data   = _SC_cfstring_to_cstring(str, NULL, 0, kCFStringEncodingUTF8);
+               attributes[n].length = strlen(attributes[n].data);
+               n++;
+       }
+
+       status = findKeychainItem(keychain,
+                                 attributes[0].length,
+                                 attributes[0].data,
+                                 &item);
+       switch (status) {
+               case noErr : {
+                       const void      *pw     = NULL;
+                       UInt32          pw_len  = 0;
+
+                       // keychain item exists
+                       if (password != NULL) {
+                               pw     = CFDataGetBytePtr(password);
+                               pw_len = CFDataGetLength(password);
+                       }
+
+                       attributeList.count = n;
+                       status = SecKeychainItemModifyContent(item,
+                                                             &attributeList,
+                                                             pw_len,
+                                                             pw);
+                       break;
+               }
+
+               case errSecItemNotFound : {
+                       // no keychain item
+                       if (password == NULL) {
+                               // creating new keychain item and password not specified
+                               status = kSCStatusInvalidArgument;
+                               goto done;
+                       }
+
+                       attributeList.count = n;
+                       status = SecKeychainItemCreateFromContent(kSecGenericPasswordItemClass,
+                                                               &attributeList,
+                                                               CFDataGetLength(password),
+                                                               CFDataGetBytePtr(password),
+                                                               keychain,
+                                                               access,
+                                                               NULL);
+                       break;
+               }
+
+               // some other error
+               default :
+                       break;
+       }
+
+    done :
+
+       if (access != NULL)     CFRelease(access);
+       if (item != NULL)       CFRelease(item);
+
+       for (i = 0; i < n; i++) {
+               CFAllocatorDeallocate(NULL, attributes[i].data);
+       }
+
+       if (status != noErr) {
+               _SCErrorSet(status);
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+#pragma mark -
+#pragma mark "System" Keychain APIs (w/SCPreferences)
+
+
+#include "SCHelper_client.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/errno.h>
+
+
+static CFDataRef
+__SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef  prefs,
+                                                    CFStringRef        unique_id)
+{
+       CFDataRef               data            = NULL;
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+       CFDataRef               reply           = NULL;
+
+       if (prefsPrivate->helper == -1) {
+               ok = __SCPreferencesCreate_helper(prefs);
+               if (!ok) {
+                       return FALSE;
+               }
+       }
+
+       ok = _SCSerializeString(unique_id, &data, NULL, NULL);
+       if (!ok) {
+               goto fail;
+       }
+
+       // have the helper set the "System" Keychain password
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_KEYCHAIN_COPY,
+                          data,
+                          &status,
+                          &reply);
+       if (data != NULL) CFRelease(data);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       return reply;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       if (reply != NULL) CFRelease(reply);
+       _SCErrorSet(status);
+       return NULL;
+}
+
+
+CFDataRef
+_SCPreferencesSystemKeychainPasswordItemCopy(SCPreferencesRef  prefs,
+                                            CFStringRef        unique_id)
+{
+       SecKeychainRef          keychain        = NULL;
+       CFDataRef               password        = NULL;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+
+       if (prefs == NULL) {
+               /* sorry, you must provide a session */
+               _SCErrorSet(kSCStatusNoPrefsSession);
+               return FALSE;
+       }
+
+       if (!isA_CFString(unique_id)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (prefsPrivate->authorizationData != NULL) {
+               password = __SCPreferencesSystemKeychainPasswordItemCopy_helper(prefs, unique_id);
+               goto done;
+       }
+
+       keychain = _SCSecKeychainCopySystemKeychain();
+       if (keychain == NULL) {
+               goto done;
+       }
+
+       password = _SCSecKeychainPasswordItemCopy(keychain, unique_id);
+
+    done :
+
+       if (keychain != NULL)   CFRelease(keychain);
+       return password;
+}
+
+
+Boolean
+_SCPreferencesSystemKeychainPasswordItemExists(SCPreferencesRef        prefs,
+                                              CFStringRef      unique_id)
+{
+       SecKeychainRef          keychain        = NULL;
+       Boolean                 ok              = FALSE;
+//     SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+
+       if (prefs == NULL) {
+               /* sorry, you must provide a session */
+               _SCErrorSet(kSCStatusNoPrefsSession);
+               return FALSE;
+       }
+
+       if (!isA_CFString(unique_id)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+//     if (prefsPrivate->authorizationData != NULL) {
+//             ok = __SCPreferencesSystemKeychainPasswordItemExists_helper(prefs, unique_id);
+//             goto done;
+//     }
+
+       keychain = _SCSecKeychainCopySystemKeychain();
+       if (keychain == NULL) {
+               goto done;
+       }
+
+       ok = _SCSecKeychainPasswordItemExists(keychain, unique_id);
+
+    done :
+
+       if (keychain != NULL)   CFRelease(keychain);
+       return ok;
+}
+
+
+static Boolean
+__SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef        prefs,
+                                                      CFStringRef      unique_id)
+{
+       CFDataRef               data            = NULL;
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+       CFDataRef               reply           = NULL;
+
+       if (prefsPrivate->helper == -1) {
+               ok = __SCPreferencesCreate_helper(prefs);
+               if (!ok) {
+                       return FALSE;
+               }
+       }
+
+       ok = _SCSerializeString(unique_id, &data, NULL, NULL);
+       if (!ok) {
+               goto fail;
+       }
+
+       // have the helper set the "System" Keychain password
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_KEYCHAIN_REMOVE,
+                          data,
+                          &status,
+                          &reply);
+       if (data != NULL) CFRelease(data);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       if (reply != NULL) CFRelease(reply);
+       _SCErrorSet(status);
+       return FALSE;
+}
+
+
+Boolean
+_SCPreferencesSystemKeychainPasswordItemRemove(SCPreferencesRef        prefs,
+                                              CFStringRef      unique_id)
+{
+       SecKeychainRef          keychain        = NULL;
+       Boolean                 ok              = FALSE;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+
+       if (prefs == NULL) {
+               /* sorry, you must provide a session */
+               _SCErrorSet(kSCStatusNoPrefsSession);
+               return FALSE;
+       }
+
+       if (!isA_CFString(unique_id)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (prefsPrivate->authorizationData != NULL) {
+               ok = __SCPreferencesSystemKeychainPasswordItemRemove_helper(prefs, unique_id);
+               goto done;
+       }
+
+       keychain = _SCSecKeychainCopySystemKeychain();
+       if (keychain == NULL) {
+               goto done;
+       }
+
+       ok = _SCSecKeychainPasswordItemRemove(keychain, unique_id);
+
+    done :
+
+       if (keychain != NULL)   CFRelease(keychain);
+       return ok;
+}
+
+
+static Boolean
+__SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef   prefs,
+                                                   CFStringRef         unique_id,
+                                                   CFStringRef         label,
+                                                   CFStringRef         description,
+                                                   CFStringRef         account,
+                                                   CFDataRef           password,
+                                                   CFDictionaryRef     options)
+{
+       CFDataRef               data            = NULL;
+       CFMutableDictionaryRef  newOptions      = NULL;
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       uint32_t                status          = kSCStatusOK;
+       CFDataRef               reply           = NULL;
+
+       if (prefsPrivate->helper == -1) {
+               ok = __SCPreferencesCreate_helper(prefs);
+               if (!ok) {
+                       return FALSE;
+               }
+       }
+
+       if (isA_CFDictionary(options)) {
+               CFArrayRef      executableURLs  = NULL;
+
+               newOptions = CFDictionaryCreateMutableCopy(NULL, 0, options);
+
+               if (CFDictionaryGetValueIfPresent(newOptions,
+                                                 kSCKeychainOptionsAllowedExecutables,
+                                                 (const void **)&executableURLs)) {
+                       CFMutableArrayRef       executablePaths;
+                       CFIndex                 i;
+                       CFIndex                 n;
+                       CFDataRef               path;
+
+                       executablePaths = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+                       path = copyMyExecutablePath();
+                       if (path != NULL) {
+                               CFArrayAppendValue(executablePaths, path);
+                               CFRelease(path);
+                       }
+
+                       n = CFArrayGetCount(executableURLs);
+                       for (i = 0; i < n; i++) {
+                               char            fspath[MAXPATHLEN];
+                               CFURLRef        url;
+
+                               url = CFArrayGetValueAtIndex(executableURLs, i);
+                               ok  = CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)fspath, sizeof(fspath));
+                               if (!ok) {
+                                       continue;
+                               }
+                               fspath[sizeof(fspath) - 1] = '\0';
+                               path = CFDataCreate(NULL, (UInt8 *)fspath, strlen(fspath));
+                               CFArrayAppendValue(executablePaths, path);
+                               CFRelease(path);
+                       }
+
+                       CFDictionarySetValue(newOptions, kSCKeychainOptionsAllowedExecutables, executablePaths);
+                       CFRelease(executablePaths);
+               }
+       } else {
+               newOptions = CFDictionaryCreateMutable(NULL,
+                                                      0,
+                                                      &kCFTypeDictionaryKeyCallBacks,
+                                                      &kCFTypeDictionaryValueCallBacks);
+       }
+
+       if (unique_id   != NULL) CFDictionarySetValue(newOptions, kSCKeychainOptionsUniqueID   , unique_id);
+       if (label       != NULL) CFDictionarySetValue(newOptions, kSCKeychainOptionsLabel      , label);
+       if (description != NULL) CFDictionarySetValue(newOptions, kSCKeychainOptionsDescription, description);
+       if (account     != NULL) CFDictionarySetValue(newOptions, kSCKeychainOptionsAccount    , account);
+       if (password    != NULL) CFDictionarySetValue(newOptions, kSCKeychainOptionsPassword   , password);
+
+       //
+       // if not AllowRoot and a list of executables was not provided than
+       // pass the current executable
+       //
+       if (!CFDictionaryContainsKey(newOptions, kSCKeychainOptionsAllowRoot) &&
+           !CFDictionaryContainsKey(newOptions, kSCKeychainOptionsAllowedExecutables)) {
+               CFDataRef       path;
+
+               path = copyMyExecutablePath();
+               if (path != NULL) {
+                       CFArrayRef      executablePaths;
+
+                       executablePaths = CFArrayCreate(NULL, (const void **)&path, 1, &kCFTypeArrayCallBacks);
+                       CFRelease(path);
+                       CFDictionarySetValue(newOptions, kSCKeychainOptionsAllowedExecutables, executablePaths);
+                       CFRelease(executablePaths);
+               }
+       }
+
+       ok = _SCSerialize(newOptions, &data, NULL, NULL);
+       CFRelease(newOptions);
+       if (!ok) {
+               goto fail;
+       }
+
+       // have the helper create the "System" Keychain password
+       ok = _SCHelperExec(prefsPrivate->helper,
+                          SCHELPER_MSG_KEYCHAIN_SET,
+                          data,
+                          &status,
+                          &reply);
+       if (data != NULL) CFRelease(data);
+       if (!ok) {
+               goto fail;
+       }
+
+       if (status != kSCStatusOK) {
+               goto error;
+       }
+
+       return TRUE;
+
+    fail :
+
+       // close helper
+       if (prefsPrivate->helper != -1) {
+               _SCHelperClose(prefsPrivate->helper);
+               prefsPrivate->helper = -1;
+       }
+
+       status = kSCStatusAccessError;
+
+    error :
+
+       // return error
+       if (reply != NULL) CFRelease(reply);
+       _SCErrorSet(status);
+       return FALSE;
+}
+
+
+Boolean
+_SCPreferencesSystemKeychainPasswordItemSet(SCPreferencesRef   prefs,
+                                           CFStringRef         unique_id,
+                                           CFStringRef         label,
+                                           CFStringRef         description,
+                                           CFStringRef         account,
+                                           CFDataRef           password,
+                                           CFDictionaryRef     options)
+{
+       SecKeychainRef          keychain                = NULL;
+       Boolean                 ok                      = FALSE;
+       SCPreferencesPrivateRef prefsPrivate            = (SCPreferencesPrivateRef)prefs;
+
+       if (prefs == NULL) {
+               /* sorry, you must provide a session */
+               _SCErrorSet(kSCStatusNoPrefsSession);
+               return FALSE;
+       }
+
+       if (!isA_CFString(unique_id) ||
+           ((label       != NULL) && !isA_CFString    (label      )) ||
+           ((description != NULL) && !isA_CFString    (description)) ||
+           ((account     != NULL) && !isA_CFString    (account    )) ||
+           ((password    != NULL) && !isA_CFData      (password   )) ||
+           ((options     != NULL) && !isA_CFDictionary(options    ))) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (prefsPrivate->authorizationData != NULL) {
+               ok = __SCPreferencesSystemKeychainPasswordItemSet_helper(prefs,
+                                                                        unique_id,
+                                                                        label,
+                                                                        description,
+                                                                        account,
+                                                                        password,
+                                                                        options);
+               goto done;
+       }
+
+       keychain = _SCSecKeychainCopySystemKeychain();
+       if (keychain == NULL) {
+               goto done;
+       }
+
+       ok = _SCSecKeychainPasswordItemSet(keychain,
+                                          unique_id,
+                                          label,
+                                          description,
+                                          account,
+                                          password,
+                                          options);
+
+    done :
+
+       if (keychain != NULL)   CFRelease(keychain);
+       return ok;
+}
diff --git a/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.h b/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.h
new file mode 100644 (file)
index 0000000..76c574b
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2006 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@
+ */
+
+#ifndef        _SCPREFERENCESKEYCHAINPRIVATE_H
+#define        _SCPREFERENCESKEYCHAINPRIVATE_H
+
+/*
+ * SCPreferencesKeychain.h
+ * - routines to deal with keychain passwords
+ */
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SCPreferences.h>
+#include <Security/Security.h>
+
+#include <AvailabilityMacros.h>
+#include <sys/cdefs.h>
+
+#pragma mark -
+#pragma mark Keychain helper APIs
+
+#define        kSCKeychainOptionsAllowRoot             CFSTR("AllowRoot")              // CFBoolean, allow uid==0 applications
+#define kSCKeychainOptionsAllowedExecutables   CFSTR("AllowedExecutables")     // CFArray[CFURL]
+
+__BEGIN_DECLS
+
+SecKeychainRef
+_SCSecKeychainCopySystemKeychain               (void);
+
+CFDataRef
+_SCSecKeychainPasswordItemCopy                 (SecKeychainRef         keychain,
+                                                CFStringRef            unique_id);
+
+Boolean
+_SCSecKeychainPasswordItemExists               (SecKeychainRef         keychain,
+                                                CFStringRef            unique_id);
+
+Boolean
+_SCSecKeychainPasswordItemRemove               (SecKeychainRef         keychain,
+                                                CFStringRef            unique_id);
+
+Boolean
+_SCSecKeychainPasswordItemSet                  (SecKeychainRef         keychain,
+                                                CFStringRef            unique_id,
+                                                CFStringRef            label,
+                                                CFStringRef            description,
+                                                CFStringRef            account,
+                                                CFDataRef              password,
+                                                CFDictionaryRef        options);
+
+
+#pragma mark -
+#pragma mark "System" Keychain APIs (w/SCPreferences)
+
+
+CFDataRef
+_SCPreferencesSystemKeychainPasswordItemCopy   (SCPreferencesRef       prefs,
+                                                CFStringRef            unique_id);
+
+Boolean
+_SCPreferencesSystemKeychainPasswordItemExists (SCPreferencesRef       prefs,
+                                                CFStringRef            unique_id);
+
+Boolean
+_SCPreferencesSystemKeychainPasswordItemRemove (SCPreferencesRef       prefs,
+                                                CFStringRef            unique_id);
+
+Boolean
+_SCPreferencesSystemKeychainPasswordItemSet    (SCPreferencesRef       prefs,
+                                                CFStringRef            unique_id,
+                                                CFStringRef            label,
+                                                CFStringRef            description,
+                                                CFStringRef            account,
+                                                CFDataRef              password,
+                                                CFDictionaryRef        options);
+
+__END_DECLS
+
+#endif // _SCPREFERENCESKEYCHAINPRIVATE_H
+
index 7db6e6a1c8ef8081f6c08c2f044c97dc16aab56e..ba887c344befba5763b0e161cdfa4be02b6f5157 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index ef4df799fb98ef9409b8a43270425d04ac70f0d3..d3a738a3c8785ec79e441fc982e99dab4d5a0ffe 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 3b687ce9aabe3f5965ea1fa25e118f71883609cd..5710af16c1b1921b4880f6b2326a8ddf4c8a099c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
        @enum SCPreferencesKeyType
        @discussion Used with the SCDynamicStoreKeyCreatePreferences() function
                to describe the resulting CFStringRef argument.
        @enum SCPreferencesKeyType
        @discussion Used with the SCDynamicStoreKeyCreatePreferences() function
                to describe the resulting CFStringRef argument.
-       @constant kSCPreferencesKeyLock Key used when exclusive access to the
-               stored preferences is obtained or released.
        @constant kSCPreferencesKeyCommit Key used when new preferences are
                committed to the store
        @constant kSCPreferencesKeyApply Key used when new preferences are
                to be applied to the active system configuration.
  */
 enum {
        @constant kSCPreferencesKeyCommit Key used when new preferences are
                committed to the store
        @constant kSCPreferencesKeyApply Key used when new preferences are
                to be applied to the active system configuration.
  */
 enum {
-       kSCPreferencesKeyLock   = 1,
        kSCPreferencesKeyCommit = 2,
        kSCPreferencesKeyApply  = 3
 };
        kSCPreferencesKeyCommit = 2,
        kSCPreferencesKeyApply  = 3
 };
@@ -75,22 +72,6 @@ SCDynamicStoreKeyCreatePreferences   (
                                        SCPreferencesKeyType    keyType
                                        )       AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
 
                                        SCPreferencesKeyType    keyType
                                        )       AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
 
-SCPreferencesRef
-SCUserPreferencesCreate                        (
-                                       CFAllocatorRef          allocator,
-                                       CFStringRef             name,
-                                       CFStringRef             prefsID,
-                                       CFStringRef             user
-                                       );
-
-CFStringRef
-SCDynamicStoreKeyCreateUserPreferences (
-                                       CFAllocatorRef          allocator,
-                                       CFStringRef             prefsID,
-                                       CFStringRef             user,
-                                       SCPreferencesKeyType    keyType
-                                       );
-
 __END_DECLS
 
 #endif /* _SCPREFERENCESPRIVATE_H */
 __END_DECLS
 
 #endif /* _SCPREFERENCESPRIVATE_H */
index 6cce489d139f5b0f1013237793dd02c996021d91..7449ee06edb9680a06b2f63e43cc0a7d94e69180 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index d20a9207d42e30998abd9f75f3105e9c6faee1c6..74a815671d53be9b70c11a551f3b3b8260161157 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 #include <CoreFoundation/CoreFoundation.h>
 
 
 #include <CoreFoundation/CoreFoundation.h>
 
+/* SCDynamicStore SPIs */
 #include <SystemConfiguration/SCDynamicStorePrivate.h>
 #include <SystemConfiguration/SCDynamicStoreCopySpecificPrivate.h>
 #include <SystemConfiguration/SCDynamicStoreSetSpecificPrivate.h>
 
 #include <SystemConfiguration/SCDynamicStorePrivate.h>
 #include <SystemConfiguration/SCDynamicStoreCopySpecificPrivate.h>
 #include <SystemConfiguration/SCDynamicStoreSetSpecificPrivate.h>
 
+/* SCPreferences SPIs */
 #include <SystemConfiguration/SCPreferencesPrivate.h>
 #include <SystemConfiguration/SCPreferencesGetSpecificPrivate.h>
 #include <SystemConfiguration/SCPreferencesSetSpecificPrivate.h>
 
 #include <SystemConfiguration/SCPreferencesPrivate.h>
 #include <SystemConfiguration/SCPreferencesGetSpecificPrivate.h>
 #include <SystemConfiguration/SCPreferencesSetSpecificPrivate.h>
 
+/* [private] Schema Definitions (for SCDynamicStore and SCPreferences) */
+#include <SystemConfiguration/SCSchemaDefinitionsPrivate.h>
+
+/* SCNetworkConfiguration SPIs */
+#include <SystemConfiguration/SCNetworkConfigurationPrivate.h>
+
+/* SCNetworkConnection SPIs */
+#include <SystemConfiguration/SCNetworkConnectionPrivate.h>
+
+/* Keychain SPIs */
+#include <SystemConfiguration/SCPreferencesKeychainPrivate.h>
+
 /*!
        @header SCPrivate
  */
 /*!
        @header SCPrivate
  */
@@ -110,7 +124,7 @@ Boolean             _SCSerializeString              (CFStringRef            str,
        @function _SCUnserializeString
        @discussion Unserialize a stream of bytes passed from/to configd
                into a CFString object.
        @function _SCUnserializeString
        @discussion Unserialize a stream of bytes passed from/to configd
                into a CFString object.
-       @param str A pointer to memory that will be filled with the CFPropertyList
+       @param str A pointer to memory that will be filled with the CFString
                associated with the stream of bytes.
        @param utf8 CFDataRef with the serialized data
        @param dataRef A pointer to the serialized data
                associated with the stream of bytes.
        @param utf8 CFDataRef with the serialized data
        @param dataRef A pointer to the serialized data
@@ -140,7 +154,7 @@ Boolean             _SCSerializeData                (CFDataRef              data,
        @function _SCUnserializeData
        @discussion Unserialize a stream of bytes passed from/to configd
                into a CFData object.
        @function _SCUnserializeData
        @discussion Unserialize a stream of bytes passed from/to configd
                into a CFData object.
-       @param data A pointer to memory that will be filled with the CFPropertyList
+       @param data A pointer to memory that will be filled with the CFData
                associated with the stream of bytes.
        @param dataRef A pointer to the serialized data
        @param dataLen A pointer to the length of the serialized data
                associated with the stream of bytes.
        @param dataRef A pointer to the serialized data
        @param dataLen A pointer to the length of the serialized data
@@ -163,7 +177,7 @@ CFDictionaryRef     _SCSerializeMultiple            (CFDictionaryRef        dict);
        @function _SCUnserializeMultiple
        @discussion Convert a CFDictionary containing a set of CFData
                values into a CFDictionary containing a set of serialized
        @function _SCUnserializeMultiple
        @discussion Convert a CFDictionary containing a set of CFData
                values into a CFDictionary containing a set of serialized
-               CFPropertlyList  values.
+               CFPropertlyList values.
        @param dict The CFDictionary with CFData values.
        @result The serialized CFDictionary with CFPropertyList values
  */
        @param dict The CFDictionary with CFData values.
        @result The serialized CFDictionary with CFPropertyList values
  */
@@ -185,7 +199,7 @@ CFDictionaryRef     _SCUnserializeMultiple          (CFDictionaryRef        dict);
  */
 char *         _SC_cfstring_to_cstring         (CFStringRef            cfstr,
                                                 char                   *buf,
  */
 char *         _SC_cfstring_to_cstring         (CFStringRef            cfstr,
                                                 char                   *buf,
-                                                int                    bufLen,
+                                                CFIndex                bufLen,
                                                 CFStringEncoding       encoding);
 
 /*!
                                                 CFStringEncoding       encoding);
 
 /*!
@@ -199,6 +213,17 @@ void               _SC_sockaddr_to_string          (const struct sockaddr  *address,
                                                 char                   *buf,
                                                 size_t                 bufLen);
 
                                                 char                   *buf,
                                                 size_t                 bufLen);
 
+/*!
+       @function _SC_sendMachMessage
+       @discussion Sends a trivial mach message (one with just a
+               message ID) to the specified port.
+       @param port The mach port.
+       @param msg_id The message id.
+ */
+void           _SC_sendMachMessage             (mach_port_t            port,
+                                                mach_msg_id_t          msg_id);
+
+
 /*!
        @function SCLog
        @discussion Conditionally issue a log message.
 /*!
        @function SCLog
        @discussion Conditionally issue a log message.
@@ -241,6 +266,20 @@ void               SCTrace                         (Boolean                condition,
                                                 CFStringRef            formatString,
                                                 ...);
 
                                                 CFStringRef            formatString,
                                                 ...);
 
+/*
+ * DOS encoding/codepage
+ */
+void
+_SC_dos_encoding_and_codepage                  (CFStringEncoding       macEncoding,
+                                                UInt32                 macRegion,
+                                                CFStringEncoding       *dosEncoding,
+                                                UInt32                 *dosCodepage);
+
+CFDataRef
+_SC_dos_copy_string                            (CFStringRef            str,
+                                                CFStringEncoding       dosEncoding,
+                                                UInt32                 dosCodepage);
+
 /*
  * object / CFRunLoop  management
  */
 /*
  * object / CFRunLoop  management
  */
@@ -268,6 +307,33 @@ _SC_unschedule                                     (CFTypeRef              obj,
                                                 CFMutableArrayRef      rlList,
                                                 Boolean                all);
 
                                                 CFMutableArrayRef      rlList,
                                                 Boolean                all);
 
+/*
+ * bundle access
+ */
+CFBundleRef
+_SC_CFBundleGet                                        (void);
+
+CFStringRef
+_SC_CFBundleCopyNonLocalizedString             (CFBundleRef            bundle,
+                                                CFStringRef            key,
+                                                CFStringRef            value,
+                                                CFStringRef            tableName);
+
+/*
+ * misc
+ */
+static __inline__ Boolean
+_SC_CFEqual(CFTypeRef val1, CFTypeRef val2)
+{
+       if (val1 == val2) {
+           return TRUE;
+       }
+       if (val1 != NULL && val2 != NULL) {
+               return CFEqual(val1, val2);
+       }
+       return FALSE;
+}
+
 __END_DECLS
 
 #endif /* _SCPRIVATE_H */
 __END_DECLS
 
 #endif /* _SCPRIVATE_H */
index e15f541ed41211bf78690494b6a4933fa2d19dde..6dbd370d70729229492630bd1575151998f25b46 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -85,11 +85,15 @@ validate_proxy_content(CFMutableDictionaryRef       proxies,
 
                if ((enabled != 0) && (port == NULL)) {
                        struct servent  *service;
 
                if ((enabled != 0) && (port == NULL)) {
                        struct servent  *service;
+                       int             s_port;
 
                        service = getservbyname(proxy_service, "tcp");
 
                        service = getservbyname(proxy_service, "tcp");
-                       num = CFNumberCreate(NULL,
-                                            kCFNumberIntType,
-                                            (service != NULL) ? &service->s_port : &proxy_defaultport);
+                       if (service != NULL) {
+                               s_port = ntohs(service->s_port);
+                       } else {
+                               s_port = proxy_defaultport;
+                       }
+                       num = CFNumberCreate(NULL, kCFNumberIntType, &s_port);
                        CFDictionarySetValue(proxies, proxy_port, num);
                        CFRelease(num);
                }
                        CFDictionarySetValue(proxies, proxy_port, num);
                        CFRelease(num);
                }
@@ -201,6 +205,23 @@ SCDynamicStoreCopyProxies(SCDynamicStoreRef store)
                               NULL,
                               0);
 
                               NULL,
                               0);
 
+       // validate FTP passive setting
+       num = CFDictionaryGetValue(newProxies, kSCPropNetProxiesFTPPassive);
+       if (num != NULL) {
+               int     enabled;
+
+               if (!isA_CFNumber(num) ||
+                   !CFNumberGetValue(num, kCFNumberIntType, &enabled)) {
+                       // if we don't like the enabled key/value
+                       enabled = 1;
+                       num = CFNumberCreate(NULL, kCFNumberIntType, &enabled);
+                       CFDictionarySetValue(newProxies,
+                                            kSCPropNetProxiesFTPPassive,
+                                            num);
+                       CFRelease(num);
+               }
+       }
+
        // validate WPAD setting
        num = CFDictionaryGetValue(newProxies, kSCPropNetProxiesProxyAutoDiscoveryEnable);
        if (num != NULL) {
        // validate WPAD setting
        num = CFDictionaryGetValue(newProxies, kSCPropNetProxiesProxyAutoDiscoveryEnable);
        if (num != NULL) {
index f7d2d40851118b2179eac4cc5a6ff03ec580643a..177a5c93555016fb0aa4ad65f90b1cd8045289f4 100644 (file)
@@ -15,6 +15,7 @@ const CFStringRef kSCPrefCurrentSet                                = CFSTR("Curr
 const CFStringRef kSCPrefNetworkServices                           = CFSTR("NetworkServices");
 const CFStringRef kSCPrefSets                                      = CFSTR("Sets");
 const CFStringRef kSCPrefSystem                                    = CFSTR("System");
 const CFStringRef kSCPrefNetworkServices                           = CFSTR("NetworkServices");
 const CFStringRef kSCPrefSets                                      = CFSTR("Sets");
 const CFStringRef kSCPrefSystem                                    = CFSTR("System");
+const CFStringRef kSCPrefVirtualNetworkInterfaces                  = CFSTR("VirtualNetworkInterfaces");
 const CFStringRef kSCCompNetwork                                   = CFSTR("Network");
 const CFStringRef kSCCompService                                   = CFSTR("Service");
 const CFStringRef kSCCompGlobal                                    = CFSTR("Global");
 const CFStringRef kSCCompNetwork                                   = CFSTR("Network");
 const CFStringRef kSCCompService                                   = CFSTR("Service");
 const CFStringRef kSCCompGlobal                                    = CFSTR("Global");
@@ -30,6 +31,7 @@ const CFStringRef kSCEntNetDNS                                     = CFSTR("DNS"
 const CFStringRef kSCEntNetEthernet                                = CFSTR("Ethernet");
 const CFStringRef kSCEntNetFireWire                                = CFSTR("FireWire");
 const CFStringRef kSCEntNetInterface                               = CFSTR("Interface");
 const CFStringRef kSCEntNetEthernet                                = CFSTR("Ethernet");
 const CFStringRef kSCEntNetFireWire                                = CFSTR("FireWire");
 const CFStringRef kSCEntNetInterface                               = CFSTR("Interface");
+const CFStringRef kSCEntNetIPSec                                   = CFSTR("IPSec");
 const CFStringRef kSCEntNetIPv4                                    = CFSTR("IPv4");
 const CFStringRef kSCEntNetIPv6                                    = CFSTR("IPv6");
 const CFStringRef kSCEntNetL2TP                                    = CFSTR("L2TP");
 const CFStringRef kSCEntNetIPv4                                    = CFSTR("IPv4");
 const CFStringRef kSCEntNetIPv6                                    = CFSTR("IPv6");
 const CFStringRef kSCEntNetL2TP                                    = CFSTR("L2TP");
@@ -41,10 +43,13 @@ const CFStringRef kSCEntNetPPPoE                                   = CFSTR("PPPo
 const CFStringRef kSCEntNetPPPSerial                               = CFSTR("PPPSerial");
 const CFStringRef kSCEntNetPPTP                                    = CFSTR("PPTP");
 const CFStringRef kSCEntNetProxies                                 = CFSTR("Proxies");
 const CFStringRef kSCEntNetPPPSerial                               = CFSTR("PPPSerial");
 const CFStringRef kSCEntNetPPTP                                    = CFSTR("PPTP");
 const CFStringRef kSCEntNetProxies                                 = CFSTR("Proxies");
+const CFStringRef kSCEntNetSMB                                     = CFSTR("SMB");
 const CFStringRef kSCEntNet6to4                                    = CFSTR("6to4");
 const CFStringRef kSCEntNet6to4                                    = CFSTR("6to4");
+const CFStringRef kSCEntNetEAPOL                                   = CFSTR("EAPOL");
 const CFStringRef kSCPropNetOverridePrimary                        = CFSTR("OverridePrimary");
 const CFStringRef kSCPropNetServiceOrder                           = CFSTR("ServiceOrder");
 const CFStringRef kSCPropNetPPPOverridePrimary                     = CFSTR("PPPOverridePrimary");
 const CFStringRef kSCPropNetOverridePrimary                        = CFSTR("OverridePrimary");
 const CFStringRef kSCPropNetServiceOrder                           = CFSTR("ServiceOrder");
 const CFStringRef kSCPropNetPPPOverridePrimary                     = CFSTR("PPPOverridePrimary");
+const CFStringRef kSCPropNetIgnoreLinkStatus                       = CFSTR("IgnoreLinkStatus");
 const CFStringRef kSCPropNetInterfaces                             = CFSTR("Interfaces");
 const CFStringRef kSCPropNetLocalHostName                          = CFSTR("LocalHostName");
 const CFStringRef kSCPropNetAirPortAllowNetCreation                = CFSTR("AllowNetCreation");
 const CFStringRef kSCPropNetInterfaces                             = CFSTR("Interfaces");
 const CFStringRef kSCPropNetLocalHostName                          = CFSTR("LocalHostName");
 const CFStringRef kSCPropNetAirPortAllowNetCreation                = CFSTR("AllowNetCreation");
@@ -56,6 +61,7 @@ const CFStringRef kSCPropNetAirPortPreferredNetwork                = CFSTR("Pref
 const CFStringRef kSCPropNetAirPortSavePasswords                   = CFSTR("SavePasswords");
 const CFStringRef kSCValNetAirPortJoinModeAutomatic                = CFSTR("Automatic");
 const CFStringRef kSCValNetAirPortJoinModePreferred                = CFSTR("Preferred");
 const CFStringRef kSCPropNetAirPortSavePasswords                   = CFSTR("SavePasswords");
 const CFStringRef kSCValNetAirPortJoinModeAutomatic                = CFSTR("Automatic");
 const CFStringRef kSCValNetAirPortJoinModePreferred                = CFSTR("Preferred");
+const CFStringRef kSCValNetAirPortJoinModeRanked                   = CFSTR("Ranked");
 const CFStringRef kSCValNetAirPortJoinModeRecent                   = CFSTR("Recent");
 const CFStringRef kSCValNetAirPortJoinModeStrongest                = CFSTR("Strongest");
 const CFStringRef kSCValNetAirPortAuthPasswordEncryptionKeychain   = CFSTR("Keychain");
 const CFStringRef kSCValNetAirPortJoinModeRecent                   = CFSTR("Recent");
 const CFStringRef kSCValNetAirPortJoinModeStrongest                = CFSTR("Strongest");
 const CFStringRef kSCValNetAirPortAuthPasswordEncryptionKeychain   = CFSTR("Keychain");
@@ -97,6 +103,16 @@ const CFStringRef kSCValNetInterfaceSubTypePPPoE                   = CFSTR("PPPo
 const CFStringRef kSCValNetInterfaceSubTypePPPSerial               = CFSTR("PPPSerial");
 const CFStringRef kSCValNetInterfaceSubTypePPTP                    = CFSTR("PPTP");
 const CFStringRef kSCValNetInterfaceSubTypeL2TP                    = CFSTR("L2TP");
 const CFStringRef kSCValNetInterfaceSubTypePPPSerial               = CFSTR("PPPSerial");
 const CFStringRef kSCValNetInterfaceSubTypePPTP                    = CFSTR("PPTP");
 const CFStringRef kSCValNetInterfaceSubTypeL2TP                    = CFSTR("L2TP");
+const CFStringRef kSCPropNetIPSecLocalIdentifier                   = CFSTR("LocalIdentifier");
+const CFStringRef kSCPropNetIPSecLocalIdentifierType               = CFSTR("LocalIdentifierType");
+const CFStringRef kSCPropNetIPSecAuthenticationMethod              = CFSTR("AuthenticationMethod");
+const CFStringRef kSCPropNetIPSecSharedSecret                      = CFSTR("SharedSecret");
+const CFStringRef kSCPropNetIPSecSharedSecretEncryption            = CFSTR("SharedSecretEncryption");
+const CFStringRef kSCPropNetIPSecLocalCertificate                  = CFSTR("LocalCertificate");
+const CFStringRef kSCValNetIPSecAuthenticationMethodSharedSecret   = CFSTR("SharedSecret");
+const CFStringRef kSCValNetIPSecAuthenticationMethodCertificate    = CFSTR("Certificate");
+const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain     = CFSTR("Keychain");
+const CFStringRef kSCValNetIPSecLocalIdentifierTypeKeyID           = CFSTR("KeyID");
 const CFStringRef kSCPropNetIPv4Addresses                          = CFSTR("Addresses");
 const CFStringRef kSCPropNetIPv4ConfigMethod                       = CFSTR("ConfigMethod");
 const CFStringRef kSCPropNetIPv4DHCPClientID                       = CFSTR("DHCPClientID");
 const CFStringRef kSCPropNetIPv4Addresses                          = CFSTR("Addresses");
 const CFStringRef kSCPropNetIPv4ConfigMethod                       = CFSTR("ConfigMethod");
 const CFStringRef kSCPropNetIPv4DHCPClientID                       = CFSTR("DHCPClientID");
@@ -110,6 +126,7 @@ const CFStringRef kSCValNetIPv4ConfigMethodINFORM                  = CFSTR("INFO
 const CFStringRef kSCValNetIPv4ConfigMethodLinkLocal               = CFSTR("LinkLocal");
 const CFStringRef kSCValNetIPv4ConfigMethodManual                  = CFSTR("Manual");
 const CFStringRef kSCValNetIPv4ConfigMethodPPP                     = CFSTR("PPP");
 const CFStringRef kSCValNetIPv4ConfigMethodLinkLocal               = CFSTR("LinkLocal");
 const CFStringRef kSCValNetIPv4ConfigMethodManual                  = CFSTR("Manual");
 const CFStringRef kSCValNetIPv4ConfigMethodPPP                     = CFSTR("PPP");
+const CFStringRef kSCValNetIPv4ConfigMethodFailover                = CFSTR("Failover");
 const CFStringRef kSCPropNetIPv6Addresses                          = CFSTR("Addresses");
 const CFStringRef kSCPropNetIPv6ConfigMethod                       = CFSTR("ConfigMethod");
 const CFStringRef kSCPropNetIPv6DestAddresses                      = CFSTR("DestAddresses");
 const CFStringRef kSCPropNetIPv6Addresses                          = CFSTR("Addresses");
 const CFStringRef kSCPropNetIPv6ConfigMethod                       = CFSTR("ConfigMethod");
 const CFStringRef kSCPropNetIPv6DestAddresses                      = CFSTR("DestAddresses");
@@ -123,9 +140,14 @@ const CFStringRef kSCValNetIPv6ConfigMethod6to4                    = CFSTR("6to4
 const CFStringRef kSCPropNet6to4Relay                              = CFSTR("Relay");
 const CFStringRef kSCPropNetLinkActive                             = CFSTR("Active");
 const CFStringRef kSCPropNetLinkDetaching                          = CFSTR("Detaching");
 const CFStringRef kSCPropNet6to4Relay                              = CFSTR("Relay");
 const CFStringRef kSCPropNetLinkActive                             = CFSTR("Active");
 const CFStringRef kSCPropNetLinkDetaching                          = CFSTR("Detaching");
+const CFStringRef kSCPropNetModemAccessPointName                   = CFSTR("AccessPointName");
+const CFStringRef kSCPropNetModemConnectionPersonality             = CFSTR("ConnectionPersonality");
 const CFStringRef kSCPropNetModemConnectionScript                  = CFSTR("ConnectionScript");
 const CFStringRef kSCPropNetModemConnectSpeed                      = CFSTR("ConnectSpeed");
 const CFStringRef kSCPropNetModemDataCompression                   = CFSTR("DataCompression");
 const CFStringRef kSCPropNetModemConnectionScript                  = CFSTR("ConnectionScript");
 const CFStringRef kSCPropNetModemConnectSpeed                      = CFSTR("ConnectSpeed");
 const CFStringRef kSCPropNetModemDataCompression                   = CFSTR("DataCompression");
+const CFStringRef kSCPropNetModemDeviceContextID                   = CFSTR("DeviceContextID");
+const CFStringRef kSCPropNetModemDeviceModel                       = CFSTR("DeviceModel");
+const CFStringRef kSCPropNetModemDeviceVendor                      = CFSTR("DeviceVendor");
 const CFStringRef kSCPropNetModemDialMode                          = CFSTR("DialMode");
 const CFStringRef kSCPropNetModemErrorCorrection                   = CFSTR("ErrorCorrection");
 const CFStringRef kSCPropNetModemHoldCallWaitingAudibleAlert       = CFSTR("HoldCallWaitingAudibleAlert");
 const CFStringRef kSCPropNetModemDialMode                          = CFSTR("DialMode");
 const CFStringRef kSCPropNetModemErrorCorrection                   = CFSTR("ErrorCorrection");
 const CFStringRef kSCPropNetModemHoldCallWaitingAudibleAlert       = CFSTR("HoldCallWaitingAudibleAlert");
@@ -175,6 +197,7 @@ const CFStringRef kSCPropNetPPPAuthPasswordEncryption              = CFSTR("Auth
 const CFStringRef kSCPropNetPPPAuthPrompt                          = CFSTR("AuthPrompt");
 const CFStringRef kSCPropNetPPPAuthProtocol                        = CFSTR("AuthProtocol");
 const CFStringRef kSCValNetPPPAuthPasswordEncryptionKeychain       = CFSTR("Keychain");
 const CFStringRef kSCPropNetPPPAuthPrompt                          = CFSTR("AuthPrompt");
 const CFStringRef kSCPropNetPPPAuthProtocol                        = CFSTR("AuthProtocol");
 const CFStringRef kSCValNetPPPAuthPasswordEncryptionKeychain       = CFSTR("Keychain");
+const CFStringRef kSCValNetPPPAuthPasswordEncryptionToken          = CFSTR("Token");
 const CFStringRef kSCValNetPPPAuthPromptBefore                     = CFSTR("Before");
 const CFStringRef kSCValNetPPPAuthPromptAfter                      = CFSTR("After");
 const CFStringRef kSCValNetPPPAuthProtocolCHAP                     = CFSTR("CHAP");
 const CFStringRef kSCValNetPPPAuthPromptBefore                     = CFSTR("Before");
 const CFStringRef kSCValNetPPPAuthPromptAfter                      = CFSTR("After");
 const CFStringRef kSCValNetPPPAuthProtocolCHAP                     = CFSTR("CHAP");
@@ -205,6 +228,17 @@ const CFStringRef kSCPropNetPPPLCPMRU                              = CFSTR("LCPM
 const CFStringRef kSCPropNetPPPLCPMTU                              = CFSTR("LCPMTU");
 const CFStringRef kSCPropNetPPPLCPReceiveACCM                      = CFSTR("LCPReceiveACCM");
 const CFStringRef kSCPropNetPPPLCPTransmitACCM                     = CFSTR("LCPTransmitACCM");
 const CFStringRef kSCPropNetPPPLCPMTU                              = CFSTR("LCPMTU");
 const CFStringRef kSCPropNetPPPLCPReceiveACCM                      = CFSTR("LCPReceiveACCM");
 const CFStringRef kSCPropNetPPPLCPTransmitACCM                     = CFSTR("LCPTransmitACCM");
+const CFStringRef kSCPropNetPPPOnDemandDomains                     = CFSTR("OnDemandDomains");
+const CFStringRef kSCPropNetPPPOnDemandEnabled                     = CFSTR("OnDemandEnabled");
+const CFStringRef kSCPropNetPPPOnDemandHostName                    = CFSTR("OnDemandHostName");
+const CFStringRef kSCPropNetPPPOnDemandMode                        = CFSTR("OnDemandMode");
+const CFStringRef kSCPropNetPPPOnDemandPriority                    = CFSTR("OnDemandPriority");
+const CFStringRef kSCValNetPPPOnDemandModeAggressive               = CFSTR("Aggressive");
+const CFStringRef kSCValNetPPPOnDemandModeConservative             = CFSTR("Conservative");
+const CFStringRef kSCValNetPPPOnDemandModeCompatible               = CFSTR("Compatible");
+const CFStringRef kSCValNetPPPOnDemandPriorityDefault              = CFSTR("Default");
+const CFStringRef kSCValNetPPPOnDemandPriorityHigh                 = CFSTR("High");
+const CFStringRef kSCValNetPPPOnDemandPriorityLow                  = CFSTR("Low");
 const CFStringRef kSCPropNetL2TPIPSecSharedSecret                  = CFSTR("IPSecSharedSecret");
 const CFStringRef kSCPropNetL2TPIPSecSharedSecretEncryption        = CFSTR("IPSecSharedSecretEncryption");
 const CFStringRef kSCPropNetL2TPTransport                          = CFSTR("Transport");
 const CFStringRef kSCPropNetL2TPIPSecSharedSecret                  = CFSTR("IPSecSharedSecret");
 const CFStringRef kSCPropNetL2TPIPSecSharedSecretEncryption        = CFSTR("IPSecSharedSecretEncryption");
 const CFStringRef kSCPropNetL2TPTransport                          = CFSTR("Transport");
@@ -235,9 +269,20 @@ const CFStringRef kSCPropNetProxiesSOCKSProxy                      = CFSTR("SOCK
 const CFStringRef kSCPropNetProxiesProxyAutoConfigEnable           = CFSTR("ProxyAutoConfigEnable");
 const CFStringRef kSCPropNetProxiesProxyAutoConfigURLString        = CFSTR("ProxyAutoConfigURLString");
 const CFStringRef kSCPropNetProxiesProxyAutoDiscoveryEnable        = CFSTR("ProxyAutoDiscoveryEnable");
 const CFStringRef kSCPropNetProxiesProxyAutoConfigEnable           = CFSTR("ProxyAutoConfigEnable");
 const CFStringRef kSCPropNetProxiesProxyAutoConfigURLString        = CFSTR("ProxyAutoConfigURLString");
 const CFStringRef kSCPropNetProxiesProxyAutoDiscoveryEnable        = CFSTR("ProxyAutoDiscoveryEnable");
+const CFStringRef kSCPropNetSMBNetBIOSName                         = CFSTR("NetBIOSName");
+const CFStringRef kSCPropNetSMBNetBIOSNodeType                     = CFSTR("NetBIOSNodeType");
+const CFStringRef kSCPropNetSMBNetBIOSScope                        = CFSTR("NetBIOSScope");
+const CFStringRef kSCPropNetSMBWINSAddresses                       = CFSTR("WINSAddresses");
+const CFStringRef kSCPropNetSMBWorkgroup                           = CFSTR("Workgroup");
+const CFStringRef kSCValNetSMBNetBIOSNodeTypeBroadcast             = CFSTR("Broadcast");
+const CFStringRef kSCValNetSMBNetBIOSNodeTypePeer                  = CFSTR("Peer");
+const CFStringRef kSCValNetSMBNetBIOSNodeTypeMixed                 = CFSTR("Mixed");
+const CFStringRef kSCValNetSMBNetBIOSNodeTypeHybrid                = CFSTR("Hybrid");
 const CFStringRef kSCEntUsersConsoleUser                           = CFSTR("ConsoleUser");
 const CFStringRef kSCPropSystemComputerName                        = CFSTR("ComputerName");
 const CFStringRef kSCPropSystemComputerNameEncoding                = CFSTR("ComputerNameEncoding");
 const CFStringRef kSCEntUsersConsoleUser                           = CFSTR("ConsoleUser");
 const CFStringRef kSCPropSystemComputerName                        = CFSTR("ComputerName");
 const CFStringRef kSCPropSystemComputerNameEncoding                = CFSTR("ComputerNameEncoding");
+const CFStringRef kSCPropSystemComputerNameRegion                  = CFSTR("ComputerNameRegion");
+const CFStringRef kSCPropSystemHostName                            = CFSTR("HostName");
 const CFStringRef kSCDynamicStoreDomainFile                        = CFSTR("File:");
 const CFStringRef kSCDynamicStoreDomainPlugin                      = CFSTR("Plugin:");
 const CFStringRef kSCDynamicStoreDomainSetup                       = CFSTR("Setup:");
 const CFStringRef kSCDynamicStoreDomainFile                        = CFSTR("File:");
 const CFStringRef kSCDynamicStoreDomainPlugin                      = CFSTR("Plugin:");
 const CFStringRef kSCDynamicStoreDomainSetup                       = CFSTR("Setup:");
@@ -249,6 +294,12 @@ const CFStringRef kSCDynamicStorePropNetInterfaces                 = CFSTR("Inte
 const CFStringRef kSCDynamicStorePropNetPrimaryInterface           = CFSTR("PrimaryInterface");
 const CFStringRef kSCDynamicStorePropNetPrimaryService             = CFSTR("PrimaryService");
 const CFStringRef kSCDynamicStorePropNetServiceIDs                 = CFSTR("ServiceIDs");
 const CFStringRef kSCDynamicStorePropNetPrimaryInterface           = CFSTR("PrimaryInterface");
 const CFStringRef kSCDynamicStorePropNetPrimaryService             = CFSTR("PrimaryService");
 const CFStringRef kSCDynamicStorePropNetServiceIDs                 = CFSTR("ServiceIDs");
+const CFStringRef kSCPropVirtualNetworkInterfacesBondInterfaces    = CFSTR("Interfaces");
+const CFStringRef kSCPropVirtualNetworkInterfacesBondMode          = CFSTR("Mode");
+const CFStringRef kSCPropVirtualNetworkInterfacesBondOptions       = CFSTR("Options");
+const CFStringRef kSCPropVirtualNetworkInterfacesVLANInterface     = CFSTR("Interface");
+const CFStringRef kSCPropVirtualNetworkInterfacesVLANTag           = CFSTR("Tag");
+const CFStringRef kSCPropVirtualNetworkInterfacesVLANOptions       = CFSTR("Options");
 const CFStringRef kSCPropUsersConsoleUserName                      = CFSTR("Name");
 const CFStringRef kSCPropUsersConsoleUserUID                       = CFSTR("UID");
 const CFStringRef kSCPropUsersConsoleUserGID                       = CFSTR("GID");
 const CFStringRef kSCPropUsersConsoleUserName                      = CFSTR("Name");
 const CFStringRef kSCPropUsersConsoleUserUID                       = CFSTR("UID");
 const CFStringRef kSCPropUsersConsoleUserGID                       = CFSTR("GID");
index 5895d476499c94c6254cddb4d5ede69a2777e8db..24fd3a789b86c8789272ea0fa9dbab5da9d8f4c3 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  *   kSCResvLink                                        "__LINK__"                     CFString
  *   kSCResvInactive                                    "__INACTIVE__"
  *
  *   kSCResvLink                                        "__LINK__"                     CFString
  *   kSCResvInactive                                    "__INACTIVE__"
- *   
+ *
  * Generic Keys
  *
  *   kSCPropInterfaceName                               "InterfaceName"                CFString
  *   kSCPropMACAddress                                  "MACAddress"                   CFString
  *   kSCPropUserDefinedName                             "UserDefinedName"              CFString
  *   kSCPropVersion                                     "Version"                      CFString
  * Generic Keys
  *
  *   kSCPropInterfaceName                               "InterfaceName"                CFString
  *   kSCPropMACAddress                                  "MACAddress"                   CFString
  *   kSCPropUserDefinedName                             "UserDefinedName"              CFString
  *   kSCPropVersion                                     "Version"                      CFString
- *   
+ *
  * Preference Keys
  *
  *   kSCPrefCurrentSet                                  "CurrentSet"                   CFString
  *   kSCPrefNetworkServices                             "NetworkServices"              CFDictionary
  *   kSCPrefSets                                        "Sets"                         CFDictionary
  *   kSCPrefSystem                                      "System"                       CFDictionary
  * Preference Keys
  *
  *   kSCPrefCurrentSet                                  "CurrentSet"                   CFString
  *   kSCPrefNetworkServices                             "NetworkServices"              CFDictionary
  *   kSCPrefSets                                        "Sets"                         CFDictionary
  *   kSCPrefSystem                                      "System"                       CFDictionary
- *   
+ *
  * Component Keys
  *
  *   kSCCompNetwork                                     "Network"
  * Component Keys
  *
  *   kSCCompNetwork                                     "Network"
  *   kSCCompInterface                                   "Interface"
  *   kSCCompSystem                                      "System"
  *   kSCCompUsers                                       "Users"
  *   kSCCompInterface                                   "Interface"
  *   kSCCompSystem                                      "System"
  *   kSCCompUsers                                       "Users"
- *   
+ *
  *   --- Regex pattern which matches any component ---
  *   kSCCompAnyRegex                                    "[^/]+"
  *   --- Regex pattern which matches any component ---
  *   kSCCompAnyRegex                                    "[^/]+"
- *   
+ *
  * Network Entity Keys
  *
  *   kSCEntNetAirPort                                   "AirPort"                      CFDictionary
  * Network Entity Keys
  *
  *   kSCEntNetAirPort                                   "AirPort"                      CFDictionary
  *   kSCEntNetEthernet                                  "Ethernet"                     CFDictionary
  *   kSCEntNetFireWire                                  "FireWire"                     CFDictionary
  *   kSCEntNetInterface                                 "Interface"                    CFDictionary
  *   kSCEntNetEthernet                                  "Ethernet"                     CFDictionary
  *   kSCEntNetFireWire                                  "FireWire"                     CFDictionary
  *   kSCEntNetInterface                                 "Interface"                    CFDictionary
+ *   kSCEntNetIPSec                                     "IPSec"                        CFDictionary
  *   kSCEntNetIPv4                                      "IPv4"                         CFDictionary
  *   kSCEntNetIPv6                                      "IPv6"                         CFDictionary
  *   kSCEntNetL2TP                                      "L2TP"                         CFDictionary
  *   kSCEntNetLink                                      "Link"                         CFDictionary
  *   kSCEntNetModem                                     "Modem"                        CFDictionary
  *   kSCEntNetIPv4                                      "IPv4"                         CFDictionary
  *   kSCEntNetIPv6                                      "IPv6"                         CFDictionary
  *   kSCEntNetL2TP                                      "L2TP"                         CFDictionary
  *   kSCEntNetLink                                      "Link"                         CFDictionary
  *   kSCEntNetModem                                     "Modem"                        CFDictionary
- *   kSCEntNetNetInfo                                   "NetInfo"                      CFDictionary
  *   kSCEntNetPPP                                       "PPP"                          CFDictionary
  *   kSCEntNetPPPoE                                     "PPPoE"                        CFDictionary
  *   kSCEntNetPPPSerial                                 "PPPSerial"                    CFDictionary
  *   kSCEntNetPPTP                                      "PPTP"                         CFDictionary
  *   kSCEntNetProxies                                   "Proxies"                      CFDictionary
  *   kSCEntNetPPP                                       "PPP"                          CFDictionary
  *   kSCEntNetPPPoE                                     "PPPoE"                        CFDictionary
  *   kSCEntNetPPPSerial                                 "PPPSerial"                    CFDictionary
  *   kSCEntNetPPTP                                      "PPTP"                         CFDictionary
  *   kSCEntNetProxies                                   "Proxies"                      CFDictionary
+ *   kSCEntNetSMB                                       "SMB"                          CFDictionary
  *   kSCEntNet6to4                                      "6to4"                         CFDictionary
  *   kSCEntNet6to4                                      "6to4"                         CFDictionary
- *   
+ *
  * kSCCompNetwork Properties
  *
  *   kSCPropNetOverridePrimary                          "OverridePrimary"              CFNumber (0 or 1)
  *   kSCPropNetServiceOrder                             "ServiceOrder"                 CFArray[CFString]
  *   kSCPropNetPPPOverridePrimary                       "PPPOverridePrimary"           CFNumber (0 or 1)
  * kSCCompNetwork Properties
  *
  *   kSCPropNetOverridePrimary                          "OverridePrimary"              CFNumber (0 or 1)
  *   kSCPropNetServiceOrder                             "ServiceOrder"                 CFArray[CFString]
  *   kSCPropNetPPPOverridePrimary                       "PPPOverridePrimary"           CFNumber (0 or 1)
- *   
+ *
  * kSCCompNetworkInterface Properties
  *
  *   kSCPropNetInterfaces                               "Interfaces"                   CFArray[CFString]
  * kSCCompNetworkInterface Properties
  *
  *   kSCPropNetInterfaces                               "Interfaces"                   CFArray[CFString]
- *   
+ *
  * kSCCompNetworkHostNames Properties
  *
  *   kSCPropNetLocalHostName                            "LocalHostName"                CFString
  * kSCCompNetworkHostNames Properties
  *
  *   kSCPropNetLocalHostName                            "LocalHostName"                CFString
- *   
+ *
  * kSCEntNetAirPort (Hardware) Entity Keys
  *
  *   kSCPropNetAirPortAllowNetCreation                  "AllowNetCreation"             CFNumber (0 or 1)
  * kSCEntNetAirPort (Hardware) Entity Keys
  *
  *   kSCPropNetAirPortAllowNetCreation                  "AllowNetCreation"             CFNumber (0 or 1)
  *   kSCPropNetAirPortPowerEnabled                      "PowerEnabled"                 CFNumber (0 or 1)
  *   kSCPropNetAirPortPreferredNetwork                  "PreferredNetwork"             CFString
  *   kSCPropNetAirPortSavePasswords                     "SavePasswords"                CFNumber (0 or 1)
  *   kSCPropNetAirPortPowerEnabled                      "PowerEnabled"                 CFNumber (0 or 1)
  *   kSCPropNetAirPortPreferredNetwork                  "PreferredNetwork"             CFString
  *   kSCPropNetAirPortSavePasswords                     "SavePasswords"                CFNumber (0 or 1)
- *   
+ *
  *   --- kSCPropNetAirPortJoinMode values ---
  *   kSCValNetAirPortJoinModeAutomatic                  "Automatic"
  *   kSCValNetAirPortJoinModePreferred                  "Preferred"
  *   --- kSCPropNetAirPortJoinMode values ---
  *   kSCValNetAirPortJoinModeAutomatic                  "Automatic"
  *   kSCValNetAirPortJoinModePreferred                  "Preferred"
+ *   kSCValNetAirPortJoinModeRanked                     "Ranked"
  *   kSCValNetAirPortJoinModeRecent                     "Recent"
  *   kSCValNetAirPortJoinModeStrongest                  "Strongest"
  *   kSCValNetAirPortJoinModeRecent                     "Recent"
  *   kSCValNetAirPortJoinModeStrongest                  "Strongest"
- *   
+ *
  *   --- kSCPropNetAirPortPasswordEncryption values ---
  *   kSCValNetAirPortAuthPasswordEncryptionKeychain     "Keychain"
  *   --- kSCPropNetAirPortPasswordEncryption values ---
  *   kSCValNetAirPortAuthPasswordEncryptionKeychain     "Keychain"
- *   
+ *
  * kSCEntNetAppleTalk Entity Keys
  *
  *   kSCPropNetAppleTalkComputerName                    "ComputerName"                 CFString
  * kSCEntNetAppleTalk Entity Keys
  *
  *   kSCPropNetAppleTalkComputerName                    "ComputerName"                 CFString
  *   kSCPropNetAppleTalkNodeID                          "NodeID"                       CFNumber
  *   kSCPropNetAppleTalkSeedNetworkRange                "SeedNetworkRange"             CFArray[CFNumber]
  *   kSCPropNetAppleTalkSeedZones                       "SeedZones"                    CFArray[CFString]
  *   kSCPropNetAppleTalkNodeID                          "NodeID"                       CFNumber
  *   kSCPropNetAppleTalkSeedNetworkRange                "SeedNetworkRange"             CFArray[CFNumber]
  *   kSCPropNetAppleTalkSeedZones                       "SeedZones"                    CFArray[CFString]
- *   
+ *
  *   --- kSCPropNetAppleTalkConfigMethod values ---
  *   kSCValNetAppleTalkConfigMethodNode                 "Node"
  *   kSCValNetAppleTalkConfigMethodRouter               "Router"
  *   kSCValNetAppleTalkConfigMethodSeedRouter           "SeedRouter"
  *   --- kSCPropNetAppleTalkConfigMethod values ---
  *   kSCValNetAppleTalkConfigMethodNode                 "Node"
  *   kSCValNetAppleTalkConfigMethodRouter               "Router"
  *   kSCValNetAppleTalkConfigMethodSeedRouter           "SeedRouter"
- *   
+ *
  * kSCEntNetDNS Entity Keys
  *
  *   kSCPropNetDNSDomainName                            "DomainName"                   CFString
  * kSCEntNetDNS Entity Keys
  *
  *   kSCPropNetDNSDomainName                            "DomainName"                   CFString
  *   kSCPropNetDNSSortList                              "SortList"                     CFArray[CFString]
  *   kSCPropNetDNSSupplementalMatchDomains              "SupplementalMatchDomains"     CFArray[CFString]
  *   kSCPropNetDNSSupplementalMatchOrders               "SupplementalMatchOrders"      CFArray[CFNumber]
  *   kSCPropNetDNSSortList                              "SortList"                     CFArray[CFString]
  *   kSCPropNetDNSSupplementalMatchDomains              "SupplementalMatchDomains"     CFArray[CFString]
  *   kSCPropNetDNSSupplementalMatchOrders               "SupplementalMatchOrders"      CFArray[CFNumber]
- *   
+ *
  * kSCEntNetEthernet (Hardware) Entity Keys
  *
  *   kSCPropNetEthernetMediaSubType                     "MediaSubType"                 CFString
  *   kSCPropNetEthernetMediaOptions                     "MediaOptions"                 CFArray[CFString]
  *   kSCPropNetEthernetMTU                              "MTU"                          CFNumber
  * kSCEntNetEthernet (Hardware) Entity Keys
  *
  *   kSCPropNetEthernetMediaSubType                     "MediaSubType"                 CFString
  *   kSCPropNetEthernetMediaOptions                     "MediaOptions"                 CFArray[CFString]
  *   kSCPropNetEthernetMTU                              "MTU"                          CFNumber
- *   
+ *
  * kSCEntNetFireWire (Hardware) Entity Keys
  *
  *   * RESERVED FOR FUTURE USE *
  * kSCEntNetFireWire (Hardware) Entity Keys
  *
  *   * RESERVED FOR FUTURE USE *
- *   
+ *
  * kSCEntNetInterface Entity Keys
  *
  *   kSCPropNetInterfaceDeviceName                      "DeviceName"                   CFString
  * kSCEntNetInterface Entity Keys
  *
  *   kSCPropNetInterfaceDeviceName                      "DeviceName"                   CFString
  *   kSCPropNetInterfaceType                            "Type"                         CFString
  *   kSCPropNetInterfaceSubType                         "SubType"                      CFString
  *   kSCPropNetInterfaceSupportsModemOnHold             "SupportsModemOnHold"          CFNumber (0 or 1)
  *   kSCPropNetInterfaceType                            "Type"                         CFString
  *   kSCPropNetInterfaceSubType                         "SubType"                      CFString
  *   kSCPropNetInterfaceSupportsModemOnHold             "SupportsModemOnHold"          CFNumber (0 or 1)
- *   
+ *
  *   --- kSCPropNetInterfaceType values ---
  *   kSCValNetInterfaceTypeEthernet                     "Ethernet"
  *   kSCValNetInterfaceTypeFireWire                     "FireWire"
  *   kSCValNetInterfaceTypePPP                          "PPP"
  *   kSCValNetInterfaceType6to4                         "6to4"
  *   --- kSCPropNetInterfaceType values ---
  *   kSCValNetInterfaceTypeEthernet                     "Ethernet"
  *   kSCValNetInterfaceTypeFireWire                     "FireWire"
  *   kSCValNetInterfaceTypePPP                          "PPP"
  *   kSCValNetInterfaceType6to4                         "6to4"
- *   
+ *
  *   --- kSCPropNetServiceSubType values (for PPP) ---
  *   kSCValNetInterfaceSubTypePPPoE                     "PPPoE"
  *   kSCValNetInterfaceSubTypePPPSerial                 "PPPSerial"
  *   kSCValNetInterfaceSubTypePPTP                      "PPTP"
  *   kSCValNetInterfaceSubTypeL2TP                      "L2TP"
  *   --- kSCPropNetServiceSubType values (for PPP) ---
  *   kSCValNetInterfaceSubTypePPPoE                     "PPPoE"
  *   kSCValNetInterfaceSubTypePPPSerial                 "PPPSerial"
  *   kSCValNetInterfaceSubTypePPTP                      "PPTP"
  *   kSCValNetInterfaceSubTypeL2TP                      "L2TP"
- *   
+ *
+ * kSCEntNetIPSec Entity Keys
+ *
+ *   kSCPropNetIPSecLocalIdentifier                     "LocalIdentifier"              CFString
+ *   kSCPropNetIPSecLocalIdentifierType                 "LocalIdentifierType"          CFString
+ *   kSCPropNetIPSecAuthenticationMethod                "AuthenticationMethod"         CFString
+ *   kSCPropNetIPSecSharedSecret                        "SharedSecret"                 CFString
+ *   kSCPropNetIPSecSharedSecretEncryption              "SharedSecretEncryption"       CFString
+ *   kSCPropNetIPSecLocalCertificate                    "LocalCertificate"             CFData
+ *
+ *   --- kSCPropNetIPSecAuthenticationMethod values ---
+ *   kSCValNetIPSecAuthenticationMethodSharedSecret     "SharedSecret"
+ *   kSCValNetIPSecAuthenticationMethodCertificate      "Certificate"
+ *
+ *   --- kSCPropNetIPSecSharedSecretEncryption values ---
+ *   kSCValNetIPSecSharedSecretEncryptionKeychain       "Keychain"
+ *
+ *   --- kSCPropNetIPSecLocalIdentifierType values ---
+ *   kSCValNetIPSecLocalIdentifierTypeKeyID             "KeyID"
+ *
  * kSCEntNetIPv4 Entity Keys
  *
  *   kSCPropNetIPv4Addresses                            "Addresses"                    CFArray[CFString]
  * kSCEntNetIPv4 Entity Keys
  *
  *   kSCPropNetIPv4Addresses                            "Addresses"                    CFArray[CFString]
  *   kSCPropNetIPv4SubnetMasks                          "SubnetMasks"                  CFArray[CFString]
  *   kSCPropNetIPv4DestAddresses                        "DestAddresses"                CFArray[CFString]
  *   kSCPropNetIPv4BroadcastAddresses                   "BroadcastAddresses"           CFArray[CFString]
  *   kSCPropNetIPv4SubnetMasks                          "SubnetMasks"                  CFArray[CFString]
  *   kSCPropNetIPv4DestAddresses                        "DestAddresses"                CFArray[CFString]
  *   kSCPropNetIPv4BroadcastAddresses                   "BroadcastAddresses"           CFArray[CFString]
- *   
+ *
  *   --- kSCPropNetIPv4ConfigMethod values ---
  *   kSCValNetIPv4ConfigMethodBOOTP                     "BOOTP"
  *   kSCValNetIPv4ConfigMethodDHCP                      "DHCP"
  *   --- kSCPropNetIPv4ConfigMethod values ---
  *   kSCValNetIPv4ConfigMethodBOOTP                     "BOOTP"
  *   kSCValNetIPv4ConfigMethodDHCP                      "DHCP"
  *   kSCValNetIPv4ConfigMethodLinkLocal                 "LinkLocal"
  *   kSCValNetIPv4ConfigMethodManual                    "Manual"
  *   kSCValNetIPv4ConfigMethodPPP                       "PPP"
  *   kSCValNetIPv4ConfigMethodLinkLocal                 "LinkLocal"
  *   kSCValNetIPv4ConfigMethodManual                    "Manual"
  *   kSCValNetIPv4ConfigMethodPPP                       "PPP"
- *   
+ *
  * kSCEntNetIPv6 Entity Keys
  *
  *   kSCPropNetIPv6Addresses                            "Addresses"                    CFArray[CFString]
  * kSCEntNetIPv6 Entity Keys
  *
  *   kSCPropNetIPv6Addresses                            "Addresses"                    CFArray[CFString]
  *   kSCPropNetIPv6Flags                                "Flags"                        CFNumber
  *   kSCPropNetIPv6PrefixLength                         "PrefixLength"                 CFArray[CFNumber]
  *   kSCPropNetIPv6Router                               "Router"                       CFString
  *   kSCPropNetIPv6Flags                                "Flags"                        CFNumber
  *   kSCPropNetIPv6PrefixLength                         "PrefixLength"                 CFArray[CFNumber]
  *   kSCPropNetIPv6Router                               "Router"                       CFString
- *   
+ *
  *   --- kSCPropNetIPv6ConfigMethod values ---
  *   kSCValNetIPv6ConfigMethodAutomatic                 "Automatic"
  *   kSCValNetIPv6ConfigMethodManual                    "Manual"
  *   kSCValNetIPv6ConfigMethodRouterAdvertisement       "RouterAdvertisement"
  *   kSCValNetIPv6ConfigMethod6to4                      "6to4"
  *   --- kSCPropNetIPv6ConfigMethod values ---
  *   kSCValNetIPv6ConfigMethodAutomatic                 "Automatic"
  *   kSCValNetIPv6ConfigMethodManual                    "Manual"
  *   kSCValNetIPv6ConfigMethodRouterAdvertisement       "RouterAdvertisement"
  *   kSCValNetIPv6ConfigMethod6to4                      "6to4"
- *   
+ *
  * kSCEntNet6to4 Entity Keys
  *
  *   kSCPropNet6to4Relay                                "Relay"                        CFString
  * kSCEntNet6to4 Entity Keys
  *
  *   kSCPropNet6to4Relay                                "Relay"                        CFString
- *   
+ *
  * kSCEntNetLink Entity Keys
  *
  *   kSCPropNetLinkActive                               "Active"                       CFBoolean
  *   kSCPropNetLinkDetaching                            "Detaching"                    CFBoolean
  * kSCEntNetLink Entity Keys
  *
  *   kSCPropNetLinkActive                               "Active"                       CFBoolean
  *   kSCPropNetLinkDetaching                            "Detaching"                    CFBoolean
- *   
+ *
  * kSCEntNetModem (Hardware) Entity Keys
  *
  * kSCEntNetModem (Hardware) Entity Keys
  *
+ *   kSCPropNetModemAccessPointName                     "AccessPointName"              CFString
+ *   kSCPropNetModemConnectionPersonality               "ConnectionPersonality"        CFString
  *   kSCPropNetModemConnectionScript                    "ConnectionScript"             CFString
  *   kSCPropNetModemConnectSpeed                        "ConnectSpeed"                 CFNumber
  *   kSCPropNetModemDataCompression                     "DataCompression"              CFNumber (0 or 1)
  *   kSCPropNetModemConnectionScript                    "ConnectionScript"             CFString
  *   kSCPropNetModemConnectSpeed                        "ConnectSpeed"                 CFNumber
  *   kSCPropNetModemDataCompression                     "DataCompression"              CFNumber (0 or 1)
+ *   kSCPropNetModemDeviceContextID                     "DeviceContextID"              CFString
+ *   kSCPropNetModemDeviceModel                         "DeviceModel"                  CFString
+ *   kSCPropNetModemDeviceVendor                        "DeviceVendor"                 CFString
  *   kSCPropNetModemDialMode                            "DialMode"                     CFString
  *   kSCPropNetModemErrorCorrection                     "ErrorCorrection"              CFNumber (0 or 1)
  *   kSCPropNetModemHoldCallWaitingAudibleAlert         "HoldCallWaitingAudibleAlert"  CFNumber (0 or 1)
  *   kSCPropNetModemDialMode                            "DialMode"                     CFString
  *   kSCPropNetModemErrorCorrection                     "ErrorCorrection"              CFNumber (0 or 1)
  *   kSCPropNetModemHoldCallWaitingAudibleAlert         "HoldCallWaitingAudibleAlert"  CFNumber (0 or 1)
  *   kSCPropNetModemPulseDial                           "PulseDial"                    CFNumber (0 or 1)
  *   kSCPropNetModemSpeaker                             "Speaker"                      CFNumber (0 or 1)
  *   kSCPropNetModemSpeed                               "Speed"                        CFNumber
  *   kSCPropNetModemPulseDial                           "PulseDial"                    CFNumber (0 or 1)
  *   kSCPropNetModemSpeaker                             "Speaker"                      CFNumber (0 or 1)
  *   kSCPropNetModemSpeed                               "Speed"                        CFNumber
- *   
+ *
  *   --- kSCPropNetModemDialMode values ---
  *   kSCValNetModemDialModeIgnoreDialTone               "IgnoreDialTone"
  *   kSCValNetModemDialModeManual                       "Manual"
  *   kSCValNetModemDialModeWaitForDialTone              "WaitForDialTone"
  *   --- kSCPropNetModemDialMode values ---
  *   kSCValNetModemDialModeIgnoreDialTone               "IgnoreDialTone"
  *   kSCValNetModemDialModeManual                       "Manual"
  *   kSCValNetModemDialModeWaitForDialTone              "WaitForDialTone"
- *   
- * kSCEntNetNetInfo Entity Keys
  *
  *
- *   kSCPropNetNetInfoBindingMethods                    "BindingMethods"               CFString
- *   kSCPropNetNetInfoServerAddresses                   "ServerAddresses"              CFArray[CFString]
- *   kSCPropNetNetInfoServerTags                        "ServerTags"                   CFArray[CFString]
- *   kSCPropNetNetInfoBroadcastServerTag                "BroadcastServerTag"           CFString
- *   
- *   --- kSCPropNetNetInfoBindingMethods values ---
- *   kSCValNetNetInfoBindingMethodsBroadcast            "Broadcast"
- *   kSCValNetNetInfoBindingMethodsDHCP                 "DHCP"
- *   kSCValNetNetInfoBindingMethodsManual               "Manual"
- *   
- *   --- kSCPropNetNetInfoBroadcastServerTag default value ---
- *   kSCValNetNetInfoDefaultServerTag                   "network"
- *   
  * kSCEntNetPPP Entity Keys
  *
  *   kSCPropNetPPPACSPEnabled                           "ACSPEnabled"                  CFNumber (0 or 1)
  * kSCEntNetPPP Entity Keys
  *
  *   kSCPropNetPPPACSPEnabled                           "ACSPEnabled"                  CFNumber (0 or 1)
  *   kSCPropNetPPPStatus                                "Status"                       CFNumber
  *   kSCPropNetPPPUseSessionTimer                       "UseSessionTimer"              CFNumber (0 or 1)
  *   kSCPropNetPPPVerboseLogging                        "VerboseLogging"               CFNumber (0 or 1)
  *   kSCPropNetPPPStatus                                "Status"                       CFNumber
  *   kSCPropNetPPPUseSessionTimer                       "UseSessionTimer"              CFNumber (0 or 1)
  *   kSCPropNetPPPVerboseLogging                        "VerboseLogging"               CFNumber (0 or 1)
- *   
+ *
  *   --- Auth: ---
  *   kSCPropNetPPPAuthEAPPlugins                        "AuthEAPPlugins"               CFArray[CFString]
  *   kSCPropNetPPPAuthName                              "AuthName"                     CFString
  *   --- Auth: ---
  *   kSCPropNetPPPAuthEAPPlugins                        "AuthEAPPlugins"               CFArray[CFString]
  *   kSCPropNetPPPAuthName                              "AuthName"                     CFString
  *   kSCPropNetPPPAuthPasswordEncryption                "AuthPasswordEncryption"       CFString
  *   kSCPropNetPPPAuthPrompt                            "AuthPrompt"                   CFString
  *   kSCPropNetPPPAuthProtocol                          "AuthProtocol"                 CFArray[CFString]
  *   kSCPropNetPPPAuthPasswordEncryption                "AuthPasswordEncryption"       CFString
  *   kSCPropNetPPPAuthPrompt                            "AuthPrompt"                   CFString
  *   kSCPropNetPPPAuthProtocol                          "AuthProtocol"                 CFArray[CFString]
- *   
+ *
  *   --- kSCPropNetPPPAuthPasswordEncryption values ---
  *   kSCValNetPPPAuthPasswordEncryptionKeychain         "Keychain"
  *   --- kSCPropNetPPPAuthPasswordEncryption values ---
  *   kSCValNetPPPAuthPasswordEncryptionKeychain         "Keychain"
- *   
+ *   kSCValNetPPPAuthPasswordEncryptionToken            "Token"
+ *
  *   --- kSCPropNetPPPAuthPrompt values ---
  *   kSCValNetPPPAuthPromptBefore                       "Before"                       CFString
  *   kSCValNetPPPAuthPromptAfter                        "After"                        CFString
  *   --- kSCPropNetPPPAuthPrompt values ---
  *   kSCValNetPPPAuthPromptBefore                       "Before"                       CFString
  *   kSCValNetPPPAuthPromptAfter                        "After"                        CFString
- *   
+ *
  *   --- kSCPropNetPPPAuthProtocol values ---
  *   kSCValNetPPPAuthProtocolCHAP                       "CHAP"                         CFString
  *   kSCValNetPPPAuthProtocolEAP                        "EAP"                          CFString
  *   kSCValNetPPPAuthProtocolMSCHAP1                    "MSCHAP1"                      CFString
  *   kSCValNetPPPAuthProtocolMSCHAP2                    "MSCHAP2"                      CFString
  *   kSCValNetPPPAuthProtocolPAP                        "PAP"                          CFString
  *   --- kSCPropNetPPPAuthProtocol values ---
  *   kSCValNetPPPAuthProtocolCHAP                       "CHAP"                         CFString
  *   kSCValNetPPPAuthProtocolEAP                        "EAP"                          CFString
  *   kSCValNetPPPAuthProtocolMSCHAP1                    "MSCHAP1"                      CFString
  *   kSCValNetPPPAuthProtocolMSCHAP2                    "MSCHAP2"                      CFString
  *   kSCValNetPPPAuthProtocolPAP                        "PAP"                          CFString
- *   
+ *
  *   --- Comm: ---
  *   kSCPropNetPPPCommAlternateRemoteAddress            "CommAlternateRemoteAddress"   CFString
  *   kSCPropNetPPPCommConnectDelay                      "CommConnectDelay"             CFNumber
  *   --- Comm: ---
  *   kSCPropNetPPPCommAlternateRemoteAddress            "CommAlternateRemoteAddress"   CFString
  *   kSCPropNetPPPCommConnectDelay                      "CommConnectDelay"             CFNumber
  *   kSCPropNetPPPCommRemoteAddress                     "CommRemoteAddress"            CFString
  *   kSCPropNetPPPCommTerminalScript                    "CommTerminalScript"           CFString
  *   kSCPropNetPPPCommUseTerminalScript                 "CommUseTerminalScript"        CFNumber (0 or 1)
  *   kSCPropNetPPPCommRemoteAddress                     "CommRemoteAddress"            CFString
  *   kSCPropNetPPPCommTerminalScript                    "CommTerminalScript"           CFString
  *   kSCPropNetPPPCommUseTerminalScript                 "CommUseTerminalScript"        CFNumber (0 or 1)
- *   
+ *
  *   --- CCP: ---
  *   kSCPropNetPPPCCPEnabled                            "CCPEnabled"                   CFNumber (0 or 1)
  *   kSCPropNetPPPCCPMPPE40Enabled                      "CCPMPPE40Enabled"             CFNumber (0 or 1)
  *   kSCPropNetPPPCCPMPPE128Enabled                     "CCPMPPE128Enabled"            CFNumber (0 or 1)
  *   --- CCP: ---
  *   kSCPropNetPPPCCPEnabled                            "CCPEnabled"                   CFNumber (0 or 1)
  *   kSCPropNetPPPCCPMPPE40Enabled                      "CCPMPPE40Enabled"             CFNumber (0 or 1)
  *   kSCPropNetPPPCCPMPPE128Enabled                     "CCPMPPE128Enabled"            CFNumber (0 or 1)
- *   
+ *
  *   --- IPCP: ---
  *   kSCPropNetPPPIPCPCompressionVJ                     "IPCPCompressionVJ"            CFNumber (0 or 1)
  *   kSCPropNetPPPIPCPUsePeerDNS                        "IPCPUsePeerDNS"               CFNumber (0 or 1)
  *   --- IPCP: ---
  *   kSCPropNetPPPIPCPCompressionVJ                     "IPCPCompressionVJ"            CFNumber (0 or 1)
  *   kSCPropNetPPPIPCPUsePeerDNS                        "IPCPUsePeerDNS"               CFNumber (0 or 1)
- *   
+ *
  *   --- LCP: ---
  *   kSCPropNetPPPLCPEchoEnabled                        "LCPEchoEnabled"               CFNumber (0 or 1)
  *   kSCPropNetPPPLCPEchoFailure                        "LCPEchoFailure"               CFNumber
  *   --- LCP: ---
  *   kSCPropNetPPPLCPEchoEnabled                        "LCPEchoEnabled"               CFNumber (0 or 1)
  *   kSCPropNetPPPLCPEchoFailure                        "LCPEchoFailure"               CFNumber
  *   kSCPropNetPPPLCPMTU                                "LCPMTU"                       CFNumber
  *   kSCPropNetPPPLCPReceiveACCM                        "LCPReceiveACCM"               CFNumber
  *   kSCPropNetPPPLCPTransmitACCM                       "LCPTransmitACCM"              CFNumber
  *   kSCPropNetPPPLCPMTU                                "LCPMTU"                       CFNumber
  *   kSCPropNetPPPLCPReceiveACCM                        "LCPReceiveACCM"               CFNumber
  *   kSCPropNetPPPLCPTransmitACCM                       "LCPTransmitACCM"              CFNumber
- *   
+ *
  * kSCEntNetPPPoE Entity Keys
  *
  *   * RESERVED FOR FUTURE USE *
  * kSCEntNetPPPoE Entity Keys
  *
  *   * RESERVED FOR FUTURE USE *
- *   
+ *
  * kSCEntNetPPPSerial Entity Keys
  *
  *   * RESERVED FOR FUTURE USE *
  * kSCEntNetPPPSerial Entity Keys
  *
  *   * RESERVED FOR FUTURE USE *
- *   
+ *
  * kSCEntNetPPTP Entity Keys
  *
  *   * RESERVED FOR FUTURE USE *
  * kSCEntNetPPTP Entity Keys
  *
  *   * RESERVED FOR FUTURE USE *
- *   
+ *
  * kSCEntNetL2TP Entity Keys
  *
  *   kSCPropNetL2TPIPSecSharedSecret                    "IPSecSharedSecret"            CFString
  *   kSCPropNetL2TPIPSecSharedSecretEncryption          "IPSecSharedSecretEncryption"  CFString
  *   kSCPropNetL2TPTransport                            "Transport"                    CFString
  * kSCEntNetL2TP Entity Keys
  *
  *   kSCPropNetL2TPIPSecSharedSecret                    "IPSecSharedSecret"            CFString
  *   kSCPropNetL2TPIPSecSharedSecretEncryption          "IPSecSharedSecretEncryption"  CFString
  *   kSCPropNetL2TPTransport                            "Transport"                    CFString
- *   
+ *
  *   --- kSCPropNetL2TPIPSecSharedSecretEncryption values ---
  *   kSCValNetL2TPIPSecSharedSecretEncryptionKeychain   "Keychain"
  *   --- kSCPropNetL2TPIPSecSharedSecretEncryption values ---
  *   kSCValNetL2TPIPSecSharedSecretEncryptionKeychain   "Keychain"
- *   
+ *
  *   --- kSCPropNetL2TPTransport values ---
  *   kSCValNetL2TPTransportIP                           "IP"
  *   kSCValNetL2TPTransportIPSec                        "IPSec"
  *   --- kSCPropNetL2TPTransport values ---
  *   kSCValNetL2TPTransportIP                           "IP"
  *   kSCValNetL2TPTransportIPSec                        "IPSec"
- *   
+ *
  * kSCEntNetProxies Entity Keys
  *
  *   kSCPropNetProxiesExceptionsList                    "ExceptionsList"               CFArray[CFString]
  * kSCEntNetProxies Entity Keys
  *
  *   kSCPropNetProxiesExceptionsList                    "ExceptionsList"               CFArray[CFString]
  *   kSCPropNetProxiesProxyAutoConfigEnable             "ProxyAutoConfigEnable"        CFNumber (0 or 1)
  *   kSCPropNetProxiesProxyAutoConfigURLString          "ProxyAutoConfigURLString"     CFString
  *   kSCPropNetProxiesProxyAutoDiscoveryEnable          "ProxyAutoDiscoveryEnable"     CFNumber (0 or 1)
  *   kSCPropNetProxiesProxyAutoConfigEnable             "ProxyAutoConfigEnable"        CFNumber (0 or 1)
  *   kSCPropNetProxiesProxyAutoConfigURLString          "ProxyAutoConfigURLString"     CFString
  *   kSCPropNetProxiesProxyAutoDiscoveryEnable          "ProxyAutoDiscoveryEnable"     CFNumber (0 or 1)
- *   
+ *
+ * kSCEntNetSMB Entity Keys
+ *
+ *   kSCPropNetSMBNetBIOSName                           "NetBIOSName"                  CFString
+ *   kSCPropNetSMBNetBIOSNodeType                       "NetBIOSNodeType"              CFString
+ *   kSCPropNetSMBNetBIOSScope                          "NetBIOSScope"                 CFString
+ *   kSCPropNetSMBWINSAddresses                         "WINSAddresses"                CFArray[CFString]
+ *   kSCPropNetSMBWorkgroup                             "Workgroup"                    CFString
+ *
+ *   --- kSCPropNetSMBNetBIOSNodeType values ---
+ *   kSCValNetSMBNetBIOSNodeTypeBroadcast               "Broadcast"
+ *   kSCValNetSMBNetBIOSNodeTypePeer                    "Peer"
+ *   kSCValNetSMBNetBIOSNodeTypeMixed                   "Mixed"
+ *   kSCValNetSMBNetBIOSNodeTypeHybrid                  "Hybrid"
+ *
  * kSCCompUsers Entity Keys
  *
  *   kSCEntUsersConsoleUser                             "ConsoleUser"
  * kSCCompUsers Entity Keys
  *
  *   kSCEntUsersConsoleUser                             "ConsoleUser"
- *   
+ *
  * kSCCompSystem Properties
  *
  *   kSCPropSystemComputerName                          "ComputerName"                 CFString
  *   kSCPropSystemComputerNameEncoding                  "ComputerNameEncoding"         CFNumber
  * kSCCompSystem Properties
  *
  *   kSCPropSystemComputerName                          "ComputerName"                 CFString
  *   kSCPropSystemComputerNameEncoding                  "ComputerNameEncoding"         CFNumber
- *   
+ *
  * SCDynamicStore "domain" prefixes
  *
  *   kSCDynamicStoreDomainFile                          "File:"
  * SCDynamicStore "domain" prefixes
  *
  *   kSCDynamicStoreDomainFile                          "File:"
  *   kSCDynamicStoreDomainSetup                         "Setup:"
  *   kSCDynamicStoreDomainState                         "State:"
  *   kSCDynamicStoreDomainPrefs                         "Prefs:"
  *   kSCDynamicStoreDomainSetup                         "Setup:"
  *   kSCDynamicStoreDomainState                         "State:"
  *   kSCDynamicStoreDomainPrefs                         "Prefs:"
- *   
+ *
  * Preference ("location") Keys
  *
  *   kSCDynamicStorePropSetupCurrentSet                 "CurrentSet"                   CFString
  *   kSCDynamicStorePropSetupLastUpdated                "LastUpdated"
  * Preference ("location") Keys
  *
  *   kSCDynamicStorePropSetupCurrentSet                 "CurrentSet"                   CFString
  *   kSCDynamicStorePropSetupLastUpdated                "LastUpdated"
- *   
+ *
  * Common/shared Keys
  *
  *   kSCDynamicStorePropNetInterfaces                   "Interfaces"                   CFArray[CFString]
  * Common/shared Keys
  *
  *   kSCDynamicStorePropNetInterfaces                   "Interfaces"                   CFArray[CFString]
  * Mac OS X 10.1.0 ... 10.2.x
  */
 #if MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  * Mac OS X 10.1.0 ... 10.2.x
  */
 #if MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
-    #ifndef SCSTR
-      #include <CoreFoundation/CFString.h>
-      #define SCSTR(s) CFSTR(s)
-    #endif
+  #ifndef SCSTR
+    #include <CoreFoundation/CFString.h>
+    #define SCSTR(s) CFSTR(s)
+  #endif
   #ifndef SC_SCHEMA_DECLARATION
     #define SC_SCHEMA_DECLARATION(k,q) extern const CFStringRef k q;
   #ifndef SC_SCHEMA_DECLARATION
     #define SC_SCHEMA_DECLARATION(k,q) extern const CFStringRef k q;
-    #endif
+  #endif
   #ifndef SC_SCHEMA_KV
     #define SC_SCHEMA_KV(k,v,t)        SCSTR( v )
   #endif
   #ifndef SC_SCHEMA_KV
     #define SC_SCHEMA_KV(k,v,t)        SCSTR( v )
   #endif
   #endif
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)
   #endif
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)
-    #ifndef SCSTR
-      #include <CoreFoundation/CFString.h>
-      #define SCSTR(s) CFSTR(s)
-    #endif
+  #ifndef SCSTR
+    #include <CoreFoundation/CFString.h>
+    #define SCSTR(s) CFSTR(s)
+  #endif
 #endif
 
 
 #endif
 
 
@@ -671,6 +697,12 @@ extern const CFStringRef kSCEntNetFireWire;
  */
 extern const CFStringRef kSCEntNetInterface;
 
  */
 extern const CFStringRef kSCEntNetInterface;
 
+/*!
+  @const kSCEntNetIPSec
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCEntNetIPSec;
+
 /*!
   @const kSCEntNetIPv4
   @availability Introduced in Mac OS X 10.1.
 /*!
   @const kSCEntNetIPv4
   @availability Introduced in Mac OS X 10.1.
@@ -703,7 +735,7 @@ extern const CFStringRef kSCEntNetModem;
 
 /*!
   @const kSCEntNetNetInfo
 
 /*!
   @const kSCEntNetNetInfo
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCEntNetNetInfo;
 
  */
 extern const CFStringRef kSCEntNetNetInfo;
 
@@ -737,6 +769,12 @@ extern const CFStringRef kSCEntNetPPTP;
  */
 extern const CFStringRef kSCEntNetProxies;
 
  */
 extern const CFStringRef kSCEntNetProxies;
 
+/*!
+  @const kSCEntNetSMB
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCEntNetSMB;
+
 /*!
   @const kSCEntNet6to4
   @availability Introduced in Mac OS X 10.3.
 /*!
   @const kSCEntNet6to4
   @availability Introduced in Mac OS X 10.3.
@@ -843,6 +881,12 @@ extern const CFStringRef kSCValNetAirPortJoinModeAutomatic;
  */
 extern const CFStringRef kSCValNetAirPortJoinModePreferred;
 
  */
 extern const CFStringRef kSCValNetAirPortJoinModePreferred;
 
+/*!
+  @const kSCValNetAirPortJoinModeRanked
+  @availability Introduced in Mac OS X 10.4.
+ */
+extern const CFStringRef kSCValNetAirPortJoinModeRanked;
+
 /*!
   @const kSCValNetAirPortJoinModeRecent
   @availability Introduced in Mac OS X 10.2.
 /*!
   @const kSCValNetAirPortJoinModeRecent
   @availability Introduced in Mac OS X 10.2.
@@ -1109,6 +1153,70 @@ extern const CFStringRef kSCValNetInterfaceSubTypePPTP;
  */
 extern const CFStringRef kSCValNetInterfaceSubTypeL2TP;
 
  */
 extern const CFStringRef kSCValNetInterfaceSubTypeL2TP;
 
+/*!
+  @group kSCEntNetIPSec Entity Keys
+ */
+
+/*!
+  @const kSCPropNetIPSecLocalIdentifier
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetIPSecLocalIdentifier;
+
+/*!
+  @const kSCPropNetIPSecLocalIdentifierType
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetIPSecLocalIdentifierType;
+
+/*!
+  @const kSCPropNetIPSecAuthenticationMethod
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetIPSecAuthenticationMethod;
+
+/*!
+  @const kSCPropNetIPSecSharedSecret
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetIPSecSharedSecret;
+
+/*!
+  @const kSCPropNetIPSecSharedSecretEncryption
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetIPSecSharedSecretEncryption;
+
+/*!
+  @const kSCPropNetIPSecLocalCertificate
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetIPSecLocalCertificate;
+
+/*!
+  @const kSCValNetIPSecAuthenticationMethodSharedSecret
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetIPSecAuthenticationMethodSharedSecret;
+
+/*!
+  @const kSCValNetIPSecAuthenticationMethodCertificate
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetIPSecAuthenticationMethodCertificate;
+
+/*!
+  @const kSCValNetIPSecSharedSecretEncryptionKeychain
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain;
+
+/*!
+  @const kSCValNetIPSecLocalIdentifierTypeKeyID
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetIPSecLocalIdentifierTypeKeyID;
+
 /*!
   @group kSCEntNetIPv4 Entity Keys
  */
 /*!
   @group kSCEntNetIPv4 Entity Keys
  */
@@ -1285,6 +1393,18 @@ extern const CFStringRef kSCPropNetLinkDetaching;
   @group kSCEntNetModem (Hardware) Entity Keys
  */
 
   @group kSCEntNetModem (Hardware) Entity Keys
  */
 
+/*!
+  @const kSCPropNetModemAccessPointName
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetModemAccessPointName;
+
+/*!
+  @const kSCPropNetModemConnectionPersonality
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetModemConnectionPersonality;
+
 /*!
   @const kSCPropNetModemConnectionScript
   @availability Introduced in Mac OS X 10.1.
 /*!
   @const kSCPropNetModemConnectionScript
   @availability Introduced in Mac OS X 10.1.
@@ -1303,6 +1423,24 @@ extern const CFStringRef kSCPropNetModemConnectSpeed;
  */
 extern const CFStringRef kSCPropNetModemDataCompression;
 
  */
 extern const CFStringRef kSCPropNetModemDataCompression;
 
+/*!
+  @const kSCPropNetModemDeviceContextID
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetModemDeviceContextID;
+
+/*!
+  @const kSCPropNetModemDeviceModel
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetModemDeviceModel;
+
+/*!
+  @const kSCPropNetModemDeviceVendor
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetModemDeviceVendor;
+
 /*!
   @const kSCPropNetModemDialMode
   @availability Introduced in Mac OS X 10.1.
 /*!
   @const kSCPropNetModemDialMode
   @availability Introduced in Mac OS X 10.1.
@@ -1393,49 +1531,49 @@ extern const CFStringRef kSCValNetModemDialModeWaitForDialTone;
 
 /*!
   @const kSCPropNetNetInfoBindingMethods
 
 /*!
   @const kSCPropNetNetInfoBindingMethods
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCPropNetNetInfoBindingMethods;
 
 /*!
   @const kSCPropNetNetInfoServerAddresses
  */
 extern const CFStringRef kSCPropNetNetInfoBindingMethods;
 
 /*!
   @const kSCPropNetNetInfoServerAddresses
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCPropNetNetInfoServerAddresses;
 
 /*!
   @const kSCPropNetNetInfoServerTags
  */
 extern const CFStringRef kSCPropNetNetInfoServerAddresses;
 
 /*!
   @const kSCPropNetNetInfoServerTags
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCPropNetNetInfoServerTags;
 
 /*!
   @const kSCPropNetNetInfoBroadcastServerTag
  */
 extern const CFStringRef kSCPropNetNetInfoServerTags;
 
 /*!
   @const kSCPropNetNetInfoBroadcastServerTag
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCPropNetNetInfoBroadcastServerTag;
 
 /*!
   @const kSCValNetNetInfoBindingMethodsBroadcast
  */
 extern const CFStringRef kSCPropNetNetInfoBroadcastServerTag;
 
 /*!
   @const kSCValNetNetInfoBindingMethodsBroadcast
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCValNetNetInfoBindingMethodsBroadcast;
 
 /*!
   @const kSCValNetNetInfoBindingMethodsDHCP
  */
 extern const CFStringRef kSCValNetNetInfoBindingMethodsBroadcast;
 
 /*!
   @const kSCValNetNetInfoBindingMethodsDHCP
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCValNetNetInfoBindingMethodsDHCP;
 
 /*!
   @const kSCValNetNetInfoBindingMethodsManual
  */
 extern const CFStringRef kSCValNetNetInfoBindingMethodsDHCP;
 
 /*!
   @const kSCValNetNetInfoBindingMethodsManual
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCValNetNetInfoBindingMethodsManual;
 
 /*!
   @const kSCValNetNetInfoDefaultServerTag
  */
 extern const CFStringRef kSCValNetNetInfoBindingMethodsManual;
 
 /*!
   @const kSCValNetNetInfoDefaultServerTag
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.
  */
 extern const CFStringRef kSCValNetNetInfoDefaultServerTag;
 
  */
 extern const CFStringRef kSCValNetNetInfoDefaultServerTag;
 
@@ -1605,6 +1743,12 @@ extern const CFStringRef kSCPropNetPPPAuthProtocol;
  */
 extern const CFStringRef kSCValNetPPPAuthPasswordEncryptionKeychain;
 
  */
 extern const CFStringRef kSCValNetPPPAuthPasswordEncryptionKeychain;
 
+/*!
+  @const kSCValNetPPPAuthPasswordEncryptionToken
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetPPPAuthPasswordEncryptionToken;
+
 /*!
   @const kSCValNetPPPAuthPromptBefore
   @availability Introduced in Mac OS X 10.3.
 /*!
   @const kSCValNetPPPAuthPromptBefore
   @availability Introduced in Mac OS X 10.3.
@@ -1985,6 +2129,64 @@ extern const CFStringRef kSCPropNetProxiesProxyAutoConfigURLString;
  */
 extern const CFStringRef kSCPropNetProxiesProxyAutoDiscoveryEnable;
 
  */
 extern const CFStringRef kSCPropNetProxiesProxyAutoDiscoveryEnable;
 
+/*!
+  @group kSCEntNetSMB Entity Keys
+ */
+
+/*!
+  @const kSCPropNetSMBNetBIOSName
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetSMBNetBIOSName;
+
+/*!
+  @const kSCPropNetSMBNetBIOSNodeType
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetSMBNetBIOSNodeType;
+
+/*!
+  @const kSCPropNetSMBNetBIOSScope
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetSMBNetBIOSScope;
+
+/*!
+  @const kSCPropNetSMBWINSAddresses
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetSMBWINSAddresses;
+
+/*!
+  @const kSCPropNetSMBWorkgroup
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetSMBWorkgroup;
+
+/*!
+  @const kSCValNetSMBNetBIOSNodeTypeBroadcast
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetSMBNetBIOSNodeTypeBroadcast;
+
+/*!
+  @const kSCValNetSMBNetBIOSNodeTypePeer
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetSMBNetBIOSNodeTypePeer;
+
+/*!
+  @const kSCValNetSMBNetBIOSNodeTypeMixed
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetSMBNetBIOSNodeTypeMixed;
+
+/*!
+  @const kSCValNetSMBNetBIOSNodeTypeHybrid
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetSMBNetBIOSNodeTypeHybrid;
+
 /*!
   @group kSCCompUsers Entity Keys
  */
 /*!
   @group kSCCompUsers Entity Keys
  */
@@ -2118,9 +2320,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCResvLink                                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCResvLink                                                   \
-          SC_SCHEMA_KV(kSCResvLink                                      \
-                      ,"__LINK__"                                       \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCResvLink                                      \
+                     ,"__LINK__"                                       \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2128,9 +2330,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCResvInactive                                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCResvInactive                                               \
-          SC_SCHEMA_KV(kSCResvInactive                                  \
-                      ,"__INACTIVE__"                                   \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCResvInactive                                  \
+                     ,"__INACTIVE__"                                   \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2138,9 +2340,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropInterfaceName                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropInterfaceName                                          \
-          SC_SCHEMA_KV(kSCPropInterfaceName                             \
-                      ,"InterfaceName"                                  \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropInterfaceName                             \
+                     ,"InterfaceName"                                  \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2148,9 +2350,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropMACAddress                                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropMACAddress                                             \
-          SC_SCHEMA_KV(kSCPropMACAddress                                \
-                      ,"MACAddress"                                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropMACAddress                                \
+                     ,"MACAddress"                                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2158,9 +2360,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropUserDefinedName                                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropUserDefinedName                                        \
-          SC_SCHEMA_KV(kSCPropUserDefinedName                           \
-                      ,"UserDefinedName"                                \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropUserDefinedName                           \
+                     ,"UserDefinedName"                                \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2168,9 +2370,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropVersion                                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropVersion                                                \
-          SC_SCHEMA_KV(kSCPropVersion                                   \
-                      ,"Version"                                        \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropVersion                                   \
+                     ,"Version"                                        \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2178,9 +2380,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPrefCurrentSet                                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPrefCurrentSet                                             \
-          SC_SCHEMA_KV(kSCPrefCurrentSet                                \
-                      ,"CurrentSet"                                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPrefCurrentSet                                \
+                     ,"CurrentSet"                                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2188,9 +2390,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPrefNetworkServices                                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPrefNetworkServices                                        \
-          SC_SCHEMA_KV(kSCPrefNetworkServices                           \
-                      ,"NetworkServices"                                \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCPrefNetworkServices                           \
+                     ,"NetworkServices"                                \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2198,9 +2400,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPrefSets                                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPrefSets                                                   \
-          SC_SCHEMA_KV(kSCPrefSets                                      \
-                      ,"Sets"                                           \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCPrefSets                                      \
+                     ,"Sets"                                           \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2208,9 +2410,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPrefSystem                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPrefSystem                                                 \
-          SC_SCHEMA_KV(kSCPrefSystem                                    \
-                      ,"System"                                         \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCPrefSystem                                    \
+                     ,"System"                                         \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2218,9 +2420,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompNetwork                                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompNetwork                                                \
-          SC_SCHEMA_KV(kSCCompNetwork                                   \
-                      ,"Network"                                        \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCCompNetwork                                   \
+                     ,"Network"                                        \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2228,9 +2430,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompService                                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompService                                                \
-          SC_SCHEMA_KV(kSCCompService                                   \
-                      ,"Service"                                        \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCCompService                                   \
+                     ,"Service"                                        \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2238,9 +2440,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompGlobal                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompGlobal                                                 \
-          SC_SCHEMA_KV(kSCCompGlobal                                    \
-                      ,"Global"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCCompGlobal                                    \
+                     ,"Global"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2248,9 +2450,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCCompHostNames                                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCCompHostNames                                              \
-          SC_SCHEMA_KV(kSCCompHostNames                                 \
-                      ,"HostNames"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCCompHostNames                                 \
+                     ,"HostNames"                                      \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2258,9 +2460,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompInterface                                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompInterface                                              \
-          SC_SCHEMA_KV(kSCCompInterface                                 \
-                      ,"Interface"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCCompInterface                                 \
+                     ,"Interface"                                      \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2268,9 +2470,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompSystem                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompSystem                                                 \
-          SC_SCHEMA_KV(kSCCompSystem                                    \
-                      ,"System"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCCompSystem                                    \
+                     ,"System"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2278,9 +2480,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompUsers                                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompUsers                                                  \
-          SC_SCHEMA_KV(kSCCompUsers                                     \
-                      ,"Users"                                          \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCCompUsers                                     \
+                     ,"Users"                                          \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2288,9 +2490,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompAnyRegex                                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCCompAnyRegex                                               \
-          SC_SCHEMA_KV(kSCCompAnyRegex                                  \
-                      ,"[^/]+"                                          \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCCompAnyRegex                                  \
+                     ,"[^/]+"                                          \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2298,9 +2500,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetAirPort                                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetAirPort                                              \
-          SC_SCHEMA_KV(kSCEntNetAirPort                                 \
-                      ,"AirPort"                                        \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetAirPort                                 \
+                     ,"AirPort"                                        \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2308,9 +2510,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetAppleTalk                                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetAppleTalk                                            \
-          SC_SCHEMA_KV(kSCEntNetAppleTalk                               \
-                      ,"AppleTalk"                                      \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetAppleTalk                               \
+                     ,"AppleTalk"                                      \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2318,9 +2520,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetDHCP                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetDHCP                                                 \
-          SC_SCHEMA_KV(kSCEntNetDHCP                                    \
-                      ,"DHCP"                                           \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetDHCP                                    \
+                     ,"DHCP"                                           \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2328,9 +2530,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetDNS                                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetDNS                                                  \
-          SC_SCHEMA_KV(kSCEntNetDNS                                     \
-                      ,"DNS"                                            \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetDNS                                     \
+                     ,"DNS"                                            \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2338,9 +2540,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetEthernet                                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetEthernet                                             \
-          SC_SCHEMA_KV(kSCEntNetEthernet                                \
-                      ,"Ethernet"                                       \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetEthernet                                \
+                     ,"Ethernet"                                       \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2348,9 +2550,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNetFireWire                                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNetFireWire                                             \
-          SC_SCHEMA_KV(kSCEntNetFireWire                                \
-                      ,"FireWire"                                       \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetFireWire                                \
+                     ,"FireWire"                                       \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2358,9 +2560,19 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetInterface                                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetInterface                                            \
-          SC_SCHEMA_KV(kSCEntNetInterface                               \
-                      ,"Interface"                                      \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetInterface                               \
+                     ,"Interface"                                      \
+                     ,CFDictionary                                     )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCEntNetIPSec, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCEntNetIPSec                                                \
+         SC_SCHEMA_KV(kSCEntNetIPSec                                   \
+                     ,"IPSec"                                          \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2368,9 +2580,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetIPv4                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetIPv4                                                 \
-          SC_SCHEMA_KV(kSCEntNetIPv4                                    \
-                      ,"IPv4"                                           \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetIPv4                                    \
+                     ,"IPv4"                                           \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2378,9 +2590,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetIPv6                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetIPv6                                                 \
-          SC_SCHEMA_KV(kSCEntNetIPv6                                    \
-                      ,"IPv6"                                           \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetIPv6                                    \
+                     ,"IPv6"                                           \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2388,9 +2600,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNetL2TP                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNetL2TP                                                 \
-          SC_SCHEMA_KV(kSCEntNetL2TP                                    \
-                      ,"L2TP"                                           \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetL2TP                                    \
+                     ,"L2TP"                                           \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2398,9 +2610,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetLink                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetLink                                                 \
-          SC_SCHEMA_KV(kSCEntNetLink                                    \
-                      ,"Link"                                           \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetLink                                    \
+                     ,"Link"                                           \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2408,19 +2620,19 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetModem                                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetModem                                                \
-          SC_SCHEMA_KV(kSCEntNetModem                                   \
-                      ,"Modem"                                          \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetModem                                   \
+                     ,"Modem"                                          \
+                     ,CFDictionary                                     )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetNetInfo, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCEntNetNetInfo, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetNetInfo                                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetNetInfo                                              \
-          SC_SCHEMA_KV(kSCEntNetNetInfo                                 \
-                      ,"NetInfo"                                        \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetNetInfo                                 \
+                     ,"NetInfo"                                        \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2428,9 +2640,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetPPP                                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetPPP                                                  \
-          SC_SCHEMA_KV(kSCEntNetPPP                                     \
-                      ,"PPP"                                            \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetPPP                                     \
+                     ,"PPP"                                            \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2438,9 +2650,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetPPPoE                                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetPPPoE                                                \
-          SC_SCHEMA_KV(kSCEntNetPPPoE                                   \
-                      ,"PPPoE"                                          \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetPPPoE                                   \
+                     ,"PPPoE"                                          \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2448,9 +2660,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNetPPPSerial                                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNetPPPSerial                                            \
-          SC_SCHEMA_KV(kSCEntNetPPPSerial                               \
-                      ,"PPPSerial"                                      \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetPPPSerial                               \
+                     ,"PPPSerial"                                      \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2458,9 +2670,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNetPPTP                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNetPPTP                                                 \
-          SC_SCHEMA_KV(kSCEntNetPPTP                                    \
-                      ,"PPTP"                                           \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetPPTP                                    \
+                     ,"PPTP"                                           \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2468,9 +2680,19 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetProxies                                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntNetProxies                                              \
-          SC_SCHEMA_KV(kSCEntNetProxies                                 \
-                      ,"Proxies"                                        \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNetProxies                                 \
+                     ,"Proxies"                                        \
+                     ,CFDictionary                                     )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCEntNetSMB, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCEntNetSMB                                                  \
+         SC_SCHEMA_KV(kSCEntNetSMB                                     \
+                     ,"SMB"                                            \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2478,9 +2700,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNet6to4                                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCEntNet6to4                                                 \
-          SC_SCHEMA_KV(kSCEntNet6to4                                    \
-                      ,"6to4"                                           \
-                      ,CFDictionary                                     )
+         SC_SCHEMA_KV(kSCEntNet6to4                                    \
+                     ,"6to4"                                           \
+                     ,CFDictionary                                     )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2488,9 +2710,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetOverridePrimary                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetOverridePrimary                                     \
-          SC_SCHEMA_KV(kSCPropNetOverridePrimary                        \
-                      ,"OverridePrimary"                                \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetOverridePrimary                        \
+                     ,"OverridePrimary"                                \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2498,9 +2720,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetServiceOrder                                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetServiceOrder                                        \
-          SC_SCHEMA_KV(kSCPropNetServiceOrder                           \
-                      ,"ServiceOrder"                                   \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetServiceOrder                           \
+                     ,"ServiceOrder"                                   \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2508,9 +2730,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPOverridePrimary                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPOverridePrimary                                  \
-          SC_SCHEMA_KV(kSCPropNetPPPOverridePrimary                     \
-                      ,"PPPOverridePrimary"                             \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPOverridePrimary                     \
+                     ,"PPPOverridePrimary"                             \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2518,9 +2740,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetInterfaces                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetInterfaces                                          \
-          SC_SCHEMA_KV(kSCPropNetInterfaces                             \
-                      ,"Interfaces"                                     \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetInterfaces                             \
+                     ,"Interfaces"                                     \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2528,9 +2750,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetLocalHostName                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetLocalHostName                                       \
-          SC_SCHEMA_KV(kSCPropNetLocalHostName                          \
-                      ,"LocalHostName"                                  \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetLocalHostName                          \
+                     ,"LocalHostName"                                  \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2538,9 +2760,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetAirPortAllowNetCreation                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetAirPortAllowNetCreation                             \
-          SC_SCHEMA_KV(kSCPropNetAirPortAllowNetCreation                \
-                      ,"AllowNetCreation"                               \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetAirPortAllowNetCreation                \
+                     ,"AllowNetCreation"                               \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2548,9 +2770,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAirPortAuthPassword                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAirPortAuthPassword                                 \
-          SC_SCHEMA_KV(kSCPropNetAirPortAuthPassword                    \
-                      ,"AuthPassword"                                   \
-                      ,CFData                                           )
+         SC_SCHEMA_KV(kSCPropNetAirPortAuthPassword                    \
+                     ,"AuthPassword"                                   \
+                     ,CFData                                           )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2558,9 +2780,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAirPortAuthPasswordEncryption                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAirPortAuthPasswordEncryption                       \
-          SC_SCHEMA_KV(kSCPropNetAirPortAuthPasswordEncryption          \
-                      ,"AuthPasswordEncryption"                         \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetAirPortAuthPasswordEncryption          \
+                     ,"AuthPasswordEncryption"                         \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2568,9 +2790,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetAirPortJoinMode                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetAirPortJoinMode                                     \
-          SC_SCHEMA_KV(kSCPropNetAirPortJoinMode                        \
-                      ,"JoinMode"                                       \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetAirPortJoinMode                        \
+                     ,"JoinMode"                                       \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2578,9 +2800,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAirPortPowerEnabled                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAirPortPowerEnabled                                 \
-          SC_SCHEMA_KV(kSCPropNetAirPortPowerEnabled                    \
-                      ,"PowerEnabled"                                   \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetAirPortPowerEnabled                    \
+                     ,"PowerEnabled"                                   \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2588,9 +2810,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAirPortPreferredNetwork                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAirPortPreferredNetwork                             \
-          SC_SCHEMA_KV(kSCPropNetAirPortPreferredNetwork                \
-                      ,"PreferredNetwork"                               \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetAirPortPreferredNetwork                \
+                     ,"PreferredNetwork"                               \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2598,9 +2820,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetAirPortSavePasswords                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetAirPortSavePasswords                                \
-          SC_SCHEMA_KV(kSCPropNetAirPortSavePasswords                   \
-                      ,"SavePasswords"                                  \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetAirPortSavePasswords                   \
+                     ,"SavePasswords"                                  \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2608,9 +2830,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetAirPortJoinModeAutomatic                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetAirPortJoinModeAutomatic                             \
-          SC_SCHEMA_KV(kSCValNetAirPortJoinModeAutomatic                \
-                      ,"Automatic"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetAirPortJoinModeAutomatic                \
+                     ,"Automatic"                                      \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2618,9 +2840,19 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetAirPortJoinModePreferred                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetAirPortJoinModePreferred                             \
-          SC_SCHEMA_KV(kSCValNetAirPortJoinModePreferred                \
-                      ,"Preferred"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetAirPortJoinModePreferred                \
+                     ,"Preferred"                                      \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRanked, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  #define kSCValNetAirPortJoinModeRanked                                \
+         SC_SCHEMA_KV(kSCValNetAirPortJoinModeRanked                   \
+                     ,"Ranked"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2628,9 +2860,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetAirPortJoinModeRecent                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetAirPortJoinModeRecent                                \
-          SC_SCHEMA_KV(kSCValNetAirPortJoinModeRecent                   \
-                      ,"Recent"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetAirPortJoinModeRecent                   \
+                     ,"Recent"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2638,9 +2870,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetAirPortJoinModeStrongest                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetAirPortJoinModeStrongest                             \
-          SC_SCHEMA_KV(kSCValNetAirPortJoinModeStrongest                \
-                      ,"Strongest"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetAirPortJoinModeStrongest                \
+                     ,"Strongest"                                      \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2648,9 +2880,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetAirPortAuthPasswordEncryptionKeychain                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetAirPortAuthPasswordEncryptionKeychain                \
-          SC_SCHEMA_KV(kSCValNetAirPortAuthPasswordEncryptionKeychain   \
-                      ,"Keychain"                                       \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetAirPortAuthPasswordEncryptionKeychain   \
+                     ,"Keychain"                                       \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2658,9 +2890,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkComputerName                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkComputerName                               \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkComputerName                  \
-                      ,"ComputerName"                                   \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkComputerName                  \
+                     ,"ComputerName"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2668,9 +2900,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkComputerNameEncoding                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkComputerNameEncoding                       \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkComputerNameEncoding          \
-                      ,"ComputerNameEncoding"                           \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkComputerNameEncoding          \
+                     ,"ComputerNameEncoding"                           \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2678,9 +2910,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkConfigMethod                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkConfigMethod                               \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkConfigMethod                  \
-                      ,"ConfigMethod"                                   \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkConfigMethod                  \
+                     ,"ConfigMethod"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2688,9 +2920,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkDefaultZone                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkDefaultZone                                \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkDefaultZone                   \
-                      ,"DefaultZone"                                    \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkDefaultZone                   \
+                     ,"DefaultZone"                                    \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2698,9 +2930,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkNetworkID                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkNetworkID                                  \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkID                     \
-                      ,"NetworkID"                                      \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkID                     \
+                     ,"NetworkID"                                      \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2708,9 +2940,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetAppleTalkNetworkRange                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetAppleTalkNetworkRange                               \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkRange                  \
-                      ,"NetworkRange"                                   \
-                      ,CFArray[CFNumber]                                )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkRange                  \
+                     ,"NetworkRange"                                   \
+                     ,CFArray[CFNumber]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2718,9 +2950,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkNodeID                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkNodeID                                     \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkNodeID                        \
-                      ,"NodeID"                                         \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkNodeID                        \
+                     ,"NodeID"                                         \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2728,9 +2960,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkSeedNetworkRange                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkSeedNetworkRange                           \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkSeedNetworkRange              \
-                      ,"SeedNetworkRange"                               \
-                      ,CFArray[CFNumber]                                )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkSeedNetworkRange              \
+                     ,"SeedNetworkRange"                               \
+                     ,CFArray[CFNumber]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2738,9 +2970,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkSeedZones                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetAppleTalkSeedZones                                  \
-          SC_SCHEMA_KV(kSCPropNetAppleTalkSeedZones                     \
-                      ,"SeedZones"                                      \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetAppleTalkSeedZones                     \
+                     ,"SeedZones"                                      \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2748,9 +2980,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetAppleTalkConfigMethodNode                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetAppleTalkConfigMethodNode                            \
-          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodNode               \
-                      ,"Node"                                           \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodNode               \
+                     ,"Node"                                           \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2758,9 +2990,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetAppleTalkConfigMethodRouter                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetAppleTalkConfigMethodRouter                          \
-          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodRouter             \
-                      ,"Router"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodRouter             \
+                     ,"Router"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2768,9 +3000,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetAppleTalkConfigMethodSeedRouter                      \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetAppleTalkConfigMethodSeedRouter                      \
-          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodSeedRouter         \
-                      ,"SeedRouter"                                     \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodSeedRouter         \
+                     ,"SeedRouter"                                     \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2778,9 +3010,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetDNSDomainName                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetDNSDomainName                                       \
-          SC_SCHEMA_KV(kSCPropNetDNSDomainName                          \
-                      ,"DomainName"                                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetDNSDomainName                          \
+                     ,"DomainName"                                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -2788,9 +3020,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSOptions                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSOptions                                          \
-          SC_SCHEMA_KV(kSCPropNetDNSOptions                             \
-                      ,"Options"                                        \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetDNSOptions                             \
+                     ,"Options"                                        \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2798,9 +3030,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetDNSSearchDomains                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetDNSSearchDomains                                    \
-          SC_SCHEMA_KV(kSCPropNetDNSSearchDomains                       \
-                      ,"SearchDomains"                                  \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetDNSSearchDomains                       \
+                     ,"SearchDomains"                                  \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -2808,9 +3040,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSSearchOrder                                      \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSSearchOrder                                      \
-          SC_SCHEMA_KV(kSCPropNetDNSSearchOrder                         \
-                      ,"SearchOrder"                                    \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetDNSSearchOrder                         \
+                     ,"SearchOrder"                                    \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2818,9 +3050,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetDNSServerAddresses                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetDNSServerAddresses                                  \
-          SC_SCHEMA_KV(kSCPropNetDNSServerAddresses                     \
-                      ,"ServerAddresses"                                \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetDNSServerAddresses                     \
+                     ,"ServerAddresses"                                \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -2828,9 +3060,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSServerPort                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSServerPort                                       \
-          SC_SCHEMA_KV(kSCPropNetDNSServerPort                          \
-                      ,"ServerPort"                                     \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetDNSServerPort                          \
+                     ,"ServerPort"                                     \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -2838,9 +3070,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSServerTimeout                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSServerTimeout                                    \
-          SC_SCHEMA_KV(kSCPropNetDNSServerTimeout                       \
-                      ,"ServerTimeout"                                  \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetDNSServerTimeout                       \
+                     ,"ServerTimeout"                                  \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2848,9 +3080,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetDNSSortList                                         \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetDNSSortList                                         \
-          SC_SCHEMA_KV(kSCPropNetDNSSortList                            \
-                      ,"SortList"                                       \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetDNSSortList                            \
+                     ,"SortList"                                       \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -2858,9 +3090,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSSupplementalMatchDomains                         \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSSupplementalMatchDomains                         \
-          SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchDomains            \
-                      ,"SupplementalMatchDomains"                       \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchDomains            \
+                     ,"SupplementalMatchDomains"                       \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -2868,9 +3100,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSSupplementalMatchOrders                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetDNSSupplementalMatchOrders                          \
-          SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchOrders             \
-                      ,"SupplementalMatchOrders"                        \
-                      ,CFArray[CFNumber]                                )
+         SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchOrders             \
+                     ,"SupplementalMatchOrders"                        \
+                     ,CFArray[CFNumber]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2878,9 +3110,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetEthernetMediaSubType                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetEthernetMediaSubType                                \
-          SC_SCHEMA_KV(kSCPropNetEthernetMediaSubType                   \
-                      ,"MediaSubType"                                   \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetEthernetMediaSubType                   \
+                     ,"MediaSubType"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2888,9 +3120,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetEthernetMediaOptions                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetEthernetMediaOptions                                \
-          SC_SCHEMA_KV(kSCPropNetEthernetMediaOptions                   \
-                      ,"MediaOptions"                                   \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetEthernetMediaOptions                   \
+                     ,"MediaOptions"                                   \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2898,9 +3130,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetEthernetMTU                                         \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetEthernetMTU                                         \
-          SC_SCHEMA_KV(kSCPropNetEthernetMTU                            \
-                      ,"MTU"                                            \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetEthernetMTU                            \
+                     ,"MTU"                                            \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2908,9 +3140,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetInterfaceDeviceName                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetInterfaceDeviceName                                 \
-          SC_SCHEMA_KV(kSCPropNetInterfaceDeviceName                    \
-                      ,"DeviceName"                                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetInterfaceDeviceName                    \
+                     ,"DeviceName"                                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2918,9 +3150,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetInterfaceHardware                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetInterfaceHardware                                   \
-          SC_SCHEMA_KV(kSCPropNetInterfaceHardware                      \
-                      ,"Hardware"                                       \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetInterfaceHardware                      \
+                     ,"Hardware"                                       \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2928,9 +3160,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetInterfaceType                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetInterfaceType                                       \
-          SC_SCHEMA_KV(kSCPropNetInterfaceType                          \
-                      ,"Type"                                           \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetInterfaceType                          \
+                     ,"Type"                                           \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2938,9 +3170,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetInterfaceSubType                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetInterfaceSubType                                    \
-          SC_SCHEMA_KV(kSCPropNetInterfaceSubType                       \
-                      ,"SubType"                                        \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetInterfaceSubType                       \
+                     ,"SubType"                                        \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2948,9 +3180,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetInterfaceSupportsModemOnHold                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetInterfaceSupportsModemOnHold                        \
-          SC_SCHEMA_KV(kSCPropNetInterfaceSupportsModemOnHold           \
-                      ,"SupportsModemOnHold"                            \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetInterfaceSupportsModemOnHold           \
+                     ,"SupportsModemOnHold"                            \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2958,9 +3190,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetInterfaceTypeEthernet                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetInterfaceTypeEthernet                                \
-          SC_SCHEMA_KV(kSCValNetInterfaceTypeEthernet                   \
-                      ,"Ethernet"                                       \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetInterfaceTypeEthernet                   \
+                     ,"Ethernet"                                       \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2968,9 +3200,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetInterfaceTypeFireWire                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetInterfaceTypeFireWire                                \
-          SC_SCHEMA_KV(kSCValNetInterfaceTypeFireWire                   \
-                      ,"FireWire"                                       \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetInterfaceTypeFireWire                   \
+                     ,"FireWire"                                       \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2978,9 +3210,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetInterfaceTypePPP                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetInterfaceTypePPP                                     \
-          SC_SCHEMA_KV(kSCValNetInterfaceTypePPP                        \
-                      ,"PPP"                                            \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetInterfaceTypePPP                        \
+                     ,"PPP"                                            \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2988,9 +3220,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetInterfaceType6to4                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetInterfaceType6to4                                    \
-          SC_SCHEMA_KV(kSCValNetInterfaceType6to4                       \
-                      ,"6to4"                                           \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetInterfaceType6to4                       \
+                     ,"6to4"                                           \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -2998,9 +3230,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetInterfaceSubTypePPPoE                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetInterfaceSubTypePPPoE                                \
-          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPoE                   \
-                      ,"PPPoE"                                          \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPoE                   \
+                     ,"PPPoE"                                          \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3008,9 +3240,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetInterfaceSubTypePPPSerial                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetInterfaceSubTypePPPSerial                            \
-          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPSerial               \
-                      ,"PPPSerial"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPSerial               \
+                     ,"PPPSerial"                                      \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3018,9 +3250,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetInterfaceSubTypePPTP                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetInterfaceSubTypePPTP                                 \
-          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPTP                    \
-                      ,"PPTP"                                           \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPTP                    \
+                     ,"PPTP"                                           \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3028,9 +3260,109 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetInterfaceSubTypeL2TP                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetInterfaceSubTypeL2TP                                 \
-          SC_SCHEMA_KV(kSCValNetInterfaceSubTypeL2TP                    \
-                      ,"L2TP"                                           \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetInterfaceSubTypeL2TP                    \
+                     ,"L2TP"                                           \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifier, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetIPSecLocalIdentifier                                \
+         SC_SCHEMA_KV(kSCPropNetIPSecLocalIdentifier                   \
+                     ,"LocalIdentifier"                                \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifierType, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetIPSecLocalIdentifierType                            \
+         SC_SCHEMA_KV(kSCPropNetIPSecLocalIdentifierType               \
+                     ,"LocalIdentifierType"                            \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecAuthenticationMethod, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetIPSecAuthenticationMethod                           \
+         SC_SCHEMA_KV(kSCPropNetIPSecAuthenticationMethod              \
+                     ,"AuthenticationMethod"                           \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecret, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetIPSecSharedSecret                                   \
+         SC_SCHEMA_KV(kSCPropNetIPSecSharedSecret                      \
+                     ,"SharedSecret"                                   \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecretEncryption, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetIPSecSharedSecretEncryption                         \
+         SC_SCHEMA_KV(kSCPropNetIPSecSharedSecretEncryption            \
+                     ,"SharedSecretEncryption"                         \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalCertificate, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetIPSecLocalCertificate                               \
+         SC_SCHEMA_KV(kSCPropNetIPSecLocalCertificate                  \
+                     ,"LocalCertificate"                               \
+                     ,CFData                                           )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodSharedSecret, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetIPSecAuthenticationMethodSharedSecret                \
+         SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodSharedSecret   \
+                     ,"SharedSecret"                                   \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodCertificate, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetIPSecAuthenticationMethodCertificate                 \
+         SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodCertificate    \
+                     ,"Certificate"                                    \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecSharedSecretEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetIPSecSharedSecretEncryptionKeychain                  \
+         SC_SCHEMA_KV(kSCValNetIPSecSharedSecretEncryptionKeychain     \
+                     ,"Keychain"                                       \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecLocalIdentifierTypeKeyID, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetIPSecLocalIdentifierTypeKeyID                        \
+         SC_SCHEMA_KV(kSCValNetIPSecLocalIdentifierTypeKeyID           \
+                     ,"KeyID"                                          \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3038,9 +3370,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4Addresses                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4Addresses                                       \
-          SC_SCHEMA_KV(kSCPropNetIPv4Addresses                          \
-                      ,"Addresses"                                      \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetIPv4Addresses                          \
+                     ,"Addresses"                                      \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3048,9 +3380,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4ConfigMethod                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4ConfigMethod                                    \
-          SC_SCHEMA_KV(kSCPropNetIPv4ConfigMethod                       \
-                      ,"ConfigMethod"                                   \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetIPv4ConfigMethod                       \
+                     ,"ConfigMethod"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3058,9 +3390,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4DHCPClientID                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4DHCPClientID                                    \
-          SC_SCHEMA_KV(kSCPropNetIPv4DHCPClientID                       \
-                      ,"DHCPClientID"                                   \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetIPv4DHCPClientID                       \
+                     ,"DHCPClientID"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3068,9 +3400,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4Router                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4Router                                          \
-          SC_SCHEMA_KV(kSCPropNetIPv4Router                             \
-                      ,"Router"                                         \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetIPv4Router                             \
+                     ,"Router"                                         \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3078,9 +3410,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4SubnetMasks                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4SubnetMasks                                     \
-          SC_SCHEMA_KV(kSCPropNetIPv4SubnetMasks                        \
-                      ,"SubnetMasks"                                    \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetIPv4SubnetMasks                        \
+                     ,"SubnetMasks"                                    \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3088,9 +3420,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4DestAddresses                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4DestAddresses                                   \
-          SC_SCHEMA_KV(kSCPropNetIPv4DestAddresses                      \
-                      ,"DestAddresses"                                  \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetIPv4DestAddresses                      \
+                     ,"DestAddresses"                                  \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3098,9 +3430,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4BroadcastAddresses                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv4BroadcastAddresses                              \
-          SC_SCHEMA_KV(kSCPropNetIPv4BroadcastAddresses                 \
-                      ,"BroadcastAddresses"                             \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetIPv4BroadcastAddresses                 \
+                     ,"BroadcastAddresses"                             \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3108,9 +3440,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodBOOTP                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodBOOTP                                \
-          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodBOOTP                   \
-                      ,"BOOTP"                                          \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodBOOTP                   \
+                     ,"BOOTP"                                          \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3118,9 +3450,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodDHCP                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodDHCP                                 \
-          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodDHCP                    \
-                      ,"DHCP"                                           \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodDHCP                    \
+                     ,"DHCP"                                           \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3128,9 +3460,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodINFORM                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodINFORM                               \
-          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodINFORM                  \
-                      ,"INFORM"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodINFORM                  \
+                     ,"INFORM"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3138,9 +3470,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetIPv4ConfigMethodLinkLocal                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCValNetIPv4ConfigMethodLinkLocal                            \
-          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodLinkLocal               \
-                      ,"LinkLocal"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodLinkLocal               \
+                     ,"LinkLocal"                                      \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3148,9 +3480,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodManual                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodManual                               \
-          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodManual                  \
-                      ,"Manual"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodManual                  \
+                     ,"Manual"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3158,9 +3490,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodPPP                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetIPv4ConfigMethodPPP                                  \
-          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodPPP                     \
-                      ,"PPP"                                            \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodPPP                     \
+                     ,"PPP"                                            \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3168,9 +3500,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv6Addresses                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv6Addresses                                       \
-          SC_SCHEMA_KV(kSCPropNetIPv6Addresses                          \
-                      ,"Addresses"                                      \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetIPv6Addresses                          \
+                     ,"Addresses"                                      \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3178,9 +3510,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv6ConfigMethod                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetIPv6ConfigMethod                                    \
-          SC_SCHEMA_KV(kSCPropNetIPv6ConfigMethod                       \
-                      ,"ConfigMethod"                                   \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetIPv6ConfigMethod                       \
+                     ,"ConfigMethod"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3188,9 +3520,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetIPv6DestAddresses                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetIPv6DestAddresses                                   \
-          SC_SCHEMA_KV(kSCPropNetIPv6DestAddresses                      \
-                      ,"DestAddresses"                                  \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetIPv6DestAddresses                      \
+                     ,"DestAddresses"                                  \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3198,9 +3530,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetIPv6Flags                                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetIPv6Flags                                           \
-          SC_SCHEMA_KV(kSCPropNetIPv6Flags                              \
-                      ,"Flags"                                          \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetIPv6Flags                              \
+                     ,"Flags"                                          \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3208,9 +3540,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetIPv6PrefixLength                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetIPv6PrefixLength                                    \
-          SC_SCHEMA_KV(kSCPropNetIPv6PrefixLength                       \
-                      ,"PrefixLength"                                   \
-                      ,CFArray[CFNumber]                                )
+         SC_SCHEMA_KV(kSCPropNetIPv6PrefixLength                       \
+                     ,"PrefixLength"                                   \
+                     ,CFArray[CFNumber]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3218,9 +3550,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetIPv6Router                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetIPv6Router                                          \
-          SC_SCHEMA_KV(kSCPropNetIPv6Router                             \
-                      ,"Router"                                         \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetIPv6Router                             \
+                     ,"Router"                                         \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3228,9 +3560,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetIPv6ConfigMethodAutomatic                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetIPv6ConfigMethodAutomatic                            \
-          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodAutomatic               \
-                      ,"Automatic"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodAutomatic               \
+                     ,"Automatic"                                      \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3238,9 +3570,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetIPv6ConfigMethodManual                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetIPv6ConfigMethodManual                               \
-          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodManual                  \
-                      ,"Manual"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodManual                  \
+                     ,"Manual"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3248,9 +3580,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetIPv6ConfigMethodRouterAdvertisement                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetIPv6ConfigMethodRouterAdvertisement                  \
-          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodRouterAdvertisement     \
-                      ,"RouterAdvertisement"                            \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodRouterAdvertisement     \
+                     ,"RouterAdvertisement"                            \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3258,9 +3590,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetIPv6ConfigMethod6to4                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetIPv6ConfigMethod6to4                                 \
-          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethod6to4                    \
-                      ,"6to4"                                           \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetIPv6ConfigMethod6to4                    \
+                     ,"6to4"                                           \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3268,9 +3600,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNet6to4Relay                                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNet6to4Relay                                           \
-          SC_SCHEMA_KV(kSCPropNet6to4Relay                              \
-                      ,"Relay"                                          \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNet6to4Relay                              \
+                     ,"Relay"                                          \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3278,9 +3610,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetLinkActive                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetLinkActive                                          \
-          SC_SCHEMA_KV(kSCPropNetLinkActive                             \
-                      ,"Active"                                         \
-                      ,CFBoolean                                        )
+         SC_SCHEMA_KV(kSCPropNetLinkActive                             \
+                     ,"Active"                                         \
+                     ,CFBoolean                                        )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3288,9 +3620,29 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetLinkDetaching                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetLinkDetaching                                       \
-          SC_SCHEMA_KV(kSCPropNetLinkDetaching                          \
-                      ,"Detaching"                                      \
-                      ,CFBoolean                                        )
+         SC_SCHEMA_KV(kSCPropNetLinkDetaching                          \
+                     ,"Detaching"                                      \
+                     ,CFBoolean                                        )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetModemAccessPointName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetModemAccessPointName                                \
+         SC_SCHEMA_KV(kSCPropNetModemAccessPointName                   \
+                     ,"AccessPointName"                                \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionPersonality, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetModemConnectionPersonality                          \
+         SC_SCHEMA_KV(kSCPropNetModemConnectionPersonality             \
+                     ,"ConnectionPersonality"                          \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3298,9 +3650,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemConnectionScript                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemConnectionScript                               \
-          SC_SCHEMA_KV(kSCPropNetModemConnectionScript                  \
-                      ,"ConnectionScript"                               \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetModemConnectionScript                  \
+                     ,"ConnectionScript"                               \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3308,9 +3660,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemConnectSpeed                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemConnectSpeed                                   \
-          SC_SCHEMA_KV(kSCPropNetModemConnectSpeed                      \
-                      ,"ConnectSpeed"                                   \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetModemConnectSpeed                      \
+                     ,"ConnectSpeed"                                   \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3318,9 +3670,39 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemDataCompression                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemDataCompression                                \
-          SC_SCHEMA_KV(kSCPropNetModemDataCompression                   \
-                      ,"DataCompression"                                \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetModemDataCompression                   \
+                     ,"DataCompression"                                \
+                     ,CFNumber (0 or 1)                                )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceContextID, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetModemDeviceContextID                                \
+         SC_SCHEMA_KV(kSCPropNetModemDeviceContextID                   \
+                     ,"DeviceContextID"                                \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceModel, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetModemDeviceModel                                    \
+         SC_SCHEMA_KV(kSCPropNetModemDeviceModel                       \
+                     ,"DeviceModel"                                    \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceVendor, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetModemDeviceVendor                                   \
+         SC_SCHEMA_KV(kSCPropNetModemDeviceVendor                      \
+                     ,"DeviceVendor"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3328,9 +3710,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemDialMode                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemDialMode                                       \
-          SC_SCHEMA_KV(kSCPropNetModemDialMode                          \
-                      ,"DialMode"                                       \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetModemDialMode                          \
+                     ,"DialMode"                                       \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3338,9 +3720,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemErrorCorrection                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemErrorCorrection                                \
-          SC_SCHEMA_KV(kSCPropNetModemErrorCorrection                   \
-                      ,"ErrorCorrection"                                \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetModemErrorCorrection                   \
+                     ,"ErrorCorrection"                                \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3348,9 +3730,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldCallWaitingAudibleAlert                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldCallWaitingAudibleAlert                    \
-          SC_SCHEMA_KV(kSCPropNetModemHoldCallWaitingAudibleAlert       \
-                      ,"HoldCallWaitingAudibleAlert"                    \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetModemHoldCallWaitingAudibleAlert       \
+                     ,"HoldCallWaitingAudibleAlert"                    \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3358,9 +3740,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldDisconnectOnAnswer                         \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldDisconnectOnAnswer                         \
-          SC_SCHEMA_KV(kSCPropNetModemHoldDisconnectOnAnswer            \
-                      ,"HoldDisconnectOnAnswer"                         \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetModemHoldDisconnectOnAnswer            \
+                     ,"HoldDisconnectOnAnswer"                         \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3368,9 +3750,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldEnabled                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldEnabled                                    \
-          SC_SCHEMA_KV(kSCPropNetModemHoldEnabled                       \
-                      ,"HoldEnabled"                                    \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetModemHoldEnabled                       \
+                     ,"HoldEnabled"                                    \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3378,9 +3760,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldReminder                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldReminder                                   \
-          SC_SCHEMA_KV(kSCPropNetModemHoldReminder                      \
-                      ,"HoldReminder"                                   \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetModemHoldReminder                      \
+                     ,"HoldReminder"                                   \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3388,9 +3770,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldReminderTime                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemHoldReminderTime                               \
-          SC_SCHEMA_KV(kSCPropNetModemHoldReminderTime                  \
-                      ,"HoldReminderTime"                               \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetModemHoldReminderTime                  \
+                     ,"HoldReminderTime"                               \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3398,9 +3780,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemNote                                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetModemNote                                           \
-          SC_SCHEMA_KV(kSCPropNetModemNote                              \
-                      ,"Note"                                           \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetModemNote                              \
+                     ,"Note"                                           \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3408,9 +3790,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemPulseDial                                      \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemPulseDial                                      \
-          SC_SCHEMA_KV(kSCPropNetModemPulseDial                         \
-                      ,"PulseDial"                                      \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetModemPulseDial                         \
+                     ,"PulseDial"                                      \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3418,9 +3800,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemSpeaker                                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemSpeaker                                        \
-          SC_SCHEMA_KV(kSCPropNetModemSpeaker                           \
-                      ,"Speaker"                                        \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetModemSpeaker                           \
+                     ,"Speaker"                                        \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3428,9 +3810,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemSpeed                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetModemSpeed                                          \
-          SC_SCHEMA_KV(kSCPropNetModemSpeed                             \
-                      ,"Speed"                                          \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetModemSpeed                             \
+                     ,"Speed"                                          \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3438,9 +3820,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetModemDialModeIgnoreDialTone                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetModemDialModeIgnoreDialTone                          \
-          SC_SCHEMA_KV(kSCValNetModemDialModeIgnoreDialTone             \
-                      ,"IgnoreDialTone"                                 \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetModemDialModeIgnoreDialTone             \
+                     ,"IgnoreDialTone"                                 \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3448,9 +3830,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetModemDialModeManual                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetModemDialModeManual                                  \
-          SC_SCHEMA_KV(kSCValNetModemDialModeManual                     \
-                      ,"Manual"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetModemDialModeManual                     \
+                     ,"Manual"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3458,89 +3840,89 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetModemDialModeWaitForDialTone                         \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetModemDialModeWaitForDialTone                         \
-          SC_SCHEMA_KV(kSCValNetModemDialModeWaitForDialTone            \
-                      ,"WaitForDialTone"                                \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetModemDialModeWaitForDialTone            \
+                     ,"WaitForDialTone"                                \
+                     ,                                                 )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBindingMethods, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBindingMethods, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetNetInfoBindingMethods                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetNetInfoBindingMethods                               \
-          SC_SCHEMA_KV(kSCPropNetNetInfoBindingMethods                  \
-                      ,"BindingMethods"                                 \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetNetInfoBindingMethods                  \
+                     ,"BindingMethods"                                 \
+                     ,CFString                                         )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetNetInfoServerAddresses                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetNetInfoServerAddresses                              \
-          SC_SCHEMA_KV(kSCPropNetNetInfoServerAddresses                 \
-                      ,"ServerAddresses"                                \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetNetInfoServerAddresses                 \
+                     ,"ServerAddresses"                                \
+                     ,CFArray[CFString]                                )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerTags, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerTags, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetNetInfoServerTags                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetNetInfoServerTags                                   \
-          SC_SCHEMA_KV(kSCPropNetNetInfoServerTags                      \
-                      ,"ServerTags"                                     \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetNetInfoServerTags                      \
+                     ,"ServerTags"                                     \
+                     ,CFArray[CFString]                                )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBroadcastServerTag, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBroadcastServerTag, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetNetInfoBroadcastServerTag                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetNetInfoBroadcastServerTag                           \
-          SC_SCHEMA_KV(kSCPropNetNetInfoBroadcastServerTag              \
-                      ,"BroadcastServerTag"                             \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetNetInfoBroadcastServerTag              \
+                     ,"BroadcastServerTag"                             \
+                     ,CFString                                         )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsBroadcast, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsBroadcast, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetNetInfoBindingMethodsBroadcast                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetNetInfoBindingMethodsBroadcast                       \
-          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsBroadcast          \
-                      ,"Broadcast"                                      \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsBroadcast          \
+                     ,"Broadcast"                                      \
+                     ,                                                 )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsDHCP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsDHCP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetNetInfoBindingMethodsDHCP                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetNetInfoBindingMethodsDHCP                            \
-          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsDHCP               \
-                      ,"DHCP"                                           \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsDHCP               \
+                     ,"DHCP"                                           \
+                     ,                                                 )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsManual, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsManual, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetNetInfoBindingMethodsManual                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetNetInfoBindingMethodsManual                          \
-          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsManual             \
-                      ,"Manual"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsManual             \
+                     ,"Manual"                                         \
+                     ,                                                 )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetNetInfoDefaultServerTag, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  SC_SCHEMA_DECLARATION(kSCValNetNetInfoDefaultServerTag, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetNetInfoDefaultServerTag                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetNetInfoDefaultServerTag                              \
-          SC_SCHEMA_KV(kSCValNetNetInfoDefaultServerTag                 \
-                      ,"network"                                        \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetNetInfoDefaultServerTag                 \
+                     ,"network"                                        \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3548,9 +3930,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPACSPEnabled                                      \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPACSPEnabled                                      \
-          SC_SCHEMA_KV(kSCPropNetPPPACSPEnabled                         \
-                      ,"ACSPEnabled"                                    \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPACSPEnabled                         \
+                     ,"ACSPEnabled"                                    \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3558,9 +3940,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPConnectTime                                      \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPConnectTime                                      \
-          SC_SCHEMA_KV(kSCPropNetPPPConnectTime                         \
-                      ,"ConnectTime"                                    \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPConnectTime                         \
+                     ,"ConnectTime"                                    \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3568,9 +3950,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPDeviceLastCause                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPDeviceLastCause                                  \
-          SC_SCHEMA_KV(kSCPropNetPPPDeviceLastCause                     \
-                      ,"DeviceLastCause"                                \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPDeviceLastCause                     \
+                     ,"DeviceLastCause"                                \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3578,9 +3960,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPDialOnDemand                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPDialOnDemand                                     \
-          SC_SCHEMA_KV(kSCPropNetPPPDialOnDemand                        \
-                      ,"DialOnDemand"                                   \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPDialOnDemand                        \
+                     ,"DialOnDemand"                                   \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -3588,9 +3970,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetPPPDisconnectOnFastUserSwitch                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetPPPDisconnectOnFastUserSwitch                       \
-          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnFastUserSwitch          \
-                      ,"DisconnectOnFastUserSwitch"                     \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnFastUserSwitch          \
+                     ,"DisconnectOnFastUserSwitch"                     \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3598,9 +3980,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPDisconnectOnIdle                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPDisconnectOnIdle                                 \
-          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdle                    \
-                      ,"DisconnectOnIdle"                               \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdle                    \
+                     ,"DisconnectOnIdle"                               \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3608,9 +3990,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPDisconnectOnIdleTimer                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPDisconnectOnIdleTimer                            \
-          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdleTimer               \
-                      ,"DisconnectOnIdleTimer"                          \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdleTimer               \
+                     ,"DisconnectOnIdleTimer"                          \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3618,9 +4000,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPDisconnectOnLogout                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPDisconnectOnLogout                               \
-          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnLogout                  \
-                      ,"DisconnectOnLogout"                             \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnLogout                  \
+                     ,"DisconnectOnLogout"                             \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3628,9 +4010,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPDisconnectOnSleep                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPDisconnectOnSleep                                \
-          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnSleep                   \
-                      ,"DisconnectOnSleep"                              \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnSleep                   \
+                     ,"DisconnectOnSleep"                              \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3638,9 +4020,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPDisconnectTime                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPDisconnectTime                                   \
-          SC_SCHEMA_KV(kSCPropNetPPPDisconnectTime                      \
-                      ,"DisconnectTime"                                 \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPDisconnectTime                      \
+                     ,"DisconnectTime"                                 \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3648,9 +4030,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPIdleReminderTimer                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPIdleReminderTimer                                \
-          SC_SCHEMA_KV(kSCPropNetPPPIdleReminderTimer                   \
-                      ,"IdleReminderTimer"                              \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPIdleReminderTimer                   \
+                     ,"IdleReminderTimer"                              \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3658,9 +4040,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPIdleReminder                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPIdleReminder                                     \
-          SC_SCHEMA_KV(kSCPropNetPPPIdleReminder                        \
-                      ,"IdleReminder"                                   \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPIdleReminder                        \
+                     ,"IdleReminder"                                   \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3668,9 +4050,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPLastCause                                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPLastCause                                        \
-          SC_SCHEMA_KV(kSCPropNetPPPLastCause                           \
-                      ,"LastCause"                                      \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPLastCause                           \
+                     ,"LastCause"                                      \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3678,9 +4060,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLogfile                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLogfile                                          \
-          SC_SCHEMA_KV(kSCPropNetPPPLogfile                             \
-                      ,"Logfile"                                        \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPLogfile                             \
+                     ,"Logfile"                                        \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3688,9 +4070,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPPlugins                                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPPlugins                                          \
-          SC_SCHEMA_KV(kSCPropNetPPPPlugins                             \
-                      ,"Plugins"                                        \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetPPPPlugins                             \
+                     ,"Plugins"                                        \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3698,9 +4080,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPRetryConnectTime                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPRetryConnectTime                                 \
-          SC_SCHEMA_KV(kSCPropNetPPPRetryConnectTime                    \
-                      ,"RetryConnectTime"                               \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPRetryConnectTime                    \
+                     ,"RetryConnectTime"                               \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3708,9 +4090,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPSessionTimer                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPSessionTimer                                     \
-          SC_SCHEMA_KV(kSCPropNetPPPSessionTimer                        \
-                      ,"SessionTimer"                                   \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPSessionTimer                        \
+                     ,"SessionTimer"                                   \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3718,9 +4100,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPStatus                                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPStatus                                           \
-          SC_SCHEMA_KV(kSCPropNetPPPStatus                              \
-                      ,"Status"                                         \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPStatus                              \
+                     ,"Status"                                         \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3728,9 +4110,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPUseSessionTimer                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPUseSessionTimer                                  \
-          SC_SCHEMA_KV(kSCPropNetPPPUseSessionTimer                     \
-                      ,"UseSessionTimer"                                \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPUseSessionTimer                     \
+                     ,"UseSessionTimer"                                \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3738,9 +4120,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPVerboseLogging                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPVerboseLogging                                   \
-          SC_SCHEMA_KV(kSCPropNetPPPVerboseLogging                      \
-                      ,"VerboseLogging"                                 \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPVerboseLogging                      \
+                     ,"VerboseLogging"                                 \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3748,9 +4130,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPAuthEAPPlugins                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPAuthEAPPlugins                                   \
-          SC_SCHEMA_KV(kSCPropNetPPPAuthEAPPlugins                      \
-                      ,"AuthEAPPlugins"                                 \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetPPPAuthEAPPlugins                      \
+                     ,"AuthEAPPlugins"                                 \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3758,9 +4140,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPAuthName                                         \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPAuthName                                         \
-          SC_SCHEMA_KV(kSCPropNetPPPAuthName                            \
-                      ,"AuthName"                                       \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPAuthName                            \
+                     ,"AuthName"                                       \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3768,9 +4150,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPAuthPassword                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPAuthPassword                                     \
-          SC_SCHEMA_KV(kSCPropNetPPPAuthPassword                        \
-                      ,"AuthPassword"                                   \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPAuthPassword                        \
+                     ,"AuthPassword"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3778,9 +4160,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPAuthPasswordEncryption                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPAuthPasswordEncryption                           \
-          SC_SCHEMA_KV(kSCPropNetPPPAuthPasswordEncryption              \
-                      ,"AuthPasswordEncryption"                         \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPAuthPasswordEncryption              \
+                     ,"AuthPasswordEncryption"                         \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3788,9 +4170,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPAuthPrompt                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetPPPAuthPrompt                                       \
-          SC_SCHEMA_KV(kSCPropNetPPPAuthPrompt                          \
-                      ,"AuthPrompt"                                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPAuthPrompt                          \
+                     ,"AuthPrompt"                                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3798,9 +4180,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPAuthProtocol                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPAuthProtocol                                     \
-          SC_SCHEMA_KV(kSCPropNetPPPAuthProtocol                        \
-                      ,"AuthProtocol"                                   \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetPPPAuthProtocol                        \
+                     ,"AuthProtocol"                                   \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3808,9 +4190,19 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthPasswordEncryptionKeychain                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthPasswordEncryptionKeychain                    \
-          SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionKeychain       \
-                      ,"Keychain"                                       \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionKeychain       \
+                     ,"Keychain"                                       \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionToken, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetPPPAuthPasswordEncryptionToken                       \
+         SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionToken          \
+                     ,"Token"                                          \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3818,9 +4210,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthPromptBefore                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthPromptBefore                                  \
-          SC_SCHEMA_KV(kSCValNetPPPAuthPromptBefore                     \
-                      ,"Before"                                         \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCValNetPPPAuthPromptBefore                     \
+                     ,"Before"                                         \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3828,9 +4220,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthPromptAfter                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthPromptAfter                                   \
-          SC_SCHEMA_KV(kSCValNetPPPAuthPromptAfter                      \
-                      ,"After"                                          \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCValNetPPPAuthPromptAfter                      \
+                     ,"After"                                          \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3838,9 +4230,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetPPPAuthProtocolCHAP                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetPPPAuthProtocolCHAP                                  \
-          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolCHAP                     \
-                      ,"CHAP"                                           \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCValNetPPPAuthProtocolCHAP                     \
+                     ,"CHAP"                                           \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3848,9 +4240,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthProtocolEAP                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthProtocolEAP                                   \
-          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolEAP                      \
-                      ,"EAP"                                            \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCValNetPPPAuthProtocolEAP                      \
+                     ,"EAP"                                            \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3858,9 +4250,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthProtocolMSCHAP1                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthProtocolMSCHAP1                               \
-          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP1                  \
-                      ,"MSCHAP1"                                        \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP1                  \
+                     ,"MSCHAP1"                                        \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3868,9 +4260,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthProtocolMSCHAP2                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetPPPAuthProtocolMSCHAP2                               \
-          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP2                  \
-                      ,"MSCHAP2"                                        \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP2                  \
+                     ,"MSCHAP2"                                        \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3878,9 +4270,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetPPPAuthProtocolPAP                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCValNetPPPAuthProtocolPAP                                   \
-          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolPAP                      \
-                      ,"PAP"                                            \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCValNetPPPAuthProtocolPAP                      \
+                     ,"PAP"                                            \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3888,9 +4280,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommAlternateRemoteAddress                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommAlternateRemoteAddress                       \
-          SC_SCHEMA_KV(kSCPropNetPPPCommAlternateRemoteAddress          \
-                      ,"CommAlternateRemoteAddress"                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPCommAlternateRemoteAddress          \
+                     ,"CommAlternateRemoteAddress"                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3898,9 +4290,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommConnectDelay                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommConnectDelay                                 \
-          SC_SCHEMA_KV(kSCPropNetPPPCommConnectDelay                    \
-                      ,"CommConnectDelay"                               \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPCommConnectDelay                    \
+                     ,"CommConnectDelay"                               \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3908,9 +4300,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommDisplayTerminalWindow                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommDisplayTerminalWindow                        \
-          SC_SCHEMA_KV(kSCPropNetPPPCommDisplayTerminalWindow           \
-                      ,"CommDisplayTerminalWindow"                      \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPCommDisplayTerminalWindow           \
+                     ,"CommDisplayTerminalWindow"                      \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3918,9 +4310,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommRedialCount                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommRedialCount                                  \
-          SC_SCHEMA_KV(kSCPropNetPPPCommRedialCount                     \
-                      ,"CommRedialCount"                                \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPCommRedialCount                     \
+                     ,"CommRedialCount"                                \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3928,9 +4320,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommRedialEnabled                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommRedialEnabled                                \
-          SC_SCHEMA_KV(kSCPropNetPPPCommRedialEnabled                   \
-                      ,"CommRedialEnabled"                              \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPCommRedialEnabled                   \
+                     ,"CommRedialEnabled"                              \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3938,9 +4330,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommRedialInterval                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommRedialInterval                               \
-          SC_SCHEMA_KV(kSCPropNetPPPCommRedialInterval                  \
-                      ,"CommRedialInterval"                             \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPCommRedialInterval                  \
+                     ,"CommRedialInterval"                             \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3948,9 +4340,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommRemoteAddress                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommRemoteAddress                                \
-          SC_SCHEMA_KV(kSCPropNetPPPCommRemoteAddress                   \
-                      ,"CommRemoteAddress"                              \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPCommRemoteAddress                   \
+                     ,"CommRemoteAddress"                              \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3958,9 +4350,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommTerminalScript                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPCommTerminalScript                               \
-          SC_SCHEMA_KV(kSCPropNetPPPCommTerminalScript                  \
-                      ,"CommTerminalScript"                             \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPCommTerminalScript                  \
+                     ,"CommTerminalScript"                             \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3968,9 +4360,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPCommUseTerminalScript                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPCommUseTerminalScript                            \
-          SC_SCHEMA_KV(kSCPropNetPPPCommUseTerminalScript               \
-                      ,"CommUseTerminalScript"                          \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPCommUseTerminalScript               \
+                     ,"CommUseTerminalScript"                          \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -3978,9 +4370,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPCCPEnabled                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
   #define kSCPropNetPPPCCPEnabled                                       \
-          SC_SCHEMA_KV(kSCPropNetPPPCCPEnabled                          \
-                      ,"CCPEnabled"                                     \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPCCPEnabled                          \
+                     ,"CCPEnabled"                                     \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -3988,9 +4380,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetPPPCCPMPPE40Enabled                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetPPPCCPMPPE40Enabled                                 \
-          SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE40Enabled                    \
-                      ,"CCPMPPE40Enabled"                               \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE40Enabled                    \
+                     ,"CCPMPPE40Enabled"                               \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -3998,9 +4390,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetPPPCCPMPPE128Enabled                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetPPPCCPMPPE128Enabled                                \
-          SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE128Enabled                   \
-                      ,"CCPMPPE128Enabled"                              \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE128Enabled                   \
+                     ,"CCPMPPE128Enabled"                              \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4008,9 +4400,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPIPCPCompressionVJ                                \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPIPCPCompressionVJ                                \
-          SC_SCHEMA_KV(kSCPropNetPPPIPCPCompressionVJ                   \
-                      ,"IPCPCompressionVJ"                              \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPIPCPCompressionVJ                   \
+                     ,"IPCPCompressionVJ"                              \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -4018,9 +4410,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetPPPIPCPUsePeerDNS                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetPPPIPCPUsePeerDNS                                   \
-          SC_SCHEMA_KV(kSCPropNetPPPIPCPUsePeerDNS                      \
-                      ,"IPCPUsePeerDNS"                                 \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPIPCPUsePeerDNS                      \
+                     ,"IPCPUsePeerDNS"                                 \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4028,9 +4420,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPEchoEnabled                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPEchoEnabled                                   \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoEnabled                      \
-                      ,"LCPEchoEnabled"                                 \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPEchoEnabled                      \
+                     ,"LCPEchoEnabled"                                 \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4038,9 +4430,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPEchoFailure                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPEchoFailure                                   \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoFailure                      \
-                      ,"LCPEchoFailure"                                 \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPEchoFailure                      \
+                     ,"LCPEchoFailure"                                 \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4048,9 +4440,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPEchoInterval                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPEchoInterval                                  \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoInterval                     \
-                      ,"LCPEchoInterval"                                \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPEchoInterval                     \
+                     ,"LCPEchoInterval"                                \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4058,9 +4450,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPCompressionACField                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPCompressionACField                            \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionACField               \
-                      ,"LCPCompressionACField"                          \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionACField               \
+                     ,"LCPCompressionACField"                          \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4068,9 +4460,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPCompressionPField                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPCompressionPField                             \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionPField                \
-                      ,"LCPCompressionPField"                           \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionPField                \
+                     ,"LCPCompressionPField"                           \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4078,9 +4470,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPMRU                                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPMRU                                           \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPMRU                              \
-                      ,"LCPMRU"                                         \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPMRU                              \
+                     ,"LCPMRU"                                         \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4088,9 +4480,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPMTU                                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPMTU                                           \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPMTU                              \
-                      ,"LCPMTU"                                         \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPMTU                              \
+                     ,"LCPMTU"                                         \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4098,9 +4490,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPReceiveACCM                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPReceiveACCM                                   \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPReceiveACCM                      \
-                      ,"LCPReceiveACCM"                                 \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPReceiveACCM                      \
+                     ,"LCPReceiveACCM"                                 \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4108,9 +4500,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPTransmitACCM                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetPPPLCPTransmitACCM                                  \
-          SC_SCHEMA_KV(kSCPropNetPPPLCPTransmitACCM                     \
-                      ,"LCPTransmitACCM"                                \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetPPPLCPTransmitACCM                     \
+                     ,"LCPTransmitACCM"                                \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4118,9 +4510,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetL2TPIPSecSharedSecret                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetL2TPIPSecSharedSecret                               \
-          SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecret                  \
-                      ,"IPSecSharedSecret"                              \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecret                  \
+                     ,"IPSecSharedSecret"                              \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4128,9 +4520,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetL2TPIPSecSharedSecretEncryption                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetL2TPIPSecSharedSecretEncryption                     \
-          SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecretEncryption        \
-                      ,"IPSecSharedSecretEncryption"                    \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecretEncryption        \
+                     ,"IPSecSharedSecretEncryption"                    \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4138,9 +4530,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetL2TPTransport                                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCPropNetL2TPTransport                                       \
-          SC_SCHEMA_KV(kSCPropNetL2TPTransport                          \
-                      ,"Transport"                                      \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetL2TPTransport                          \
+                     ,"Transport"                                      \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4148,9 +4540,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetL2TPIPSecSharedSecretEncryptionKeychain              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetL2TPIPSecSharedSecretEncryptionKeychain              \
-          SC_SCHEMA_KV(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain \
-                      ,"Keychain"                                       \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain \
+                     ,"Keychain"                                       \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4158,9 +4550,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetL2TPTransportIP                                      \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetL2TPTransportIP                                      \
-          SC_SCHEMA_KV(kSCValNetL2TPTransportIP                         \
-                      ,"IP"                                             \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetL2TPTransportIP                         \
+                     ,"IP"                                             \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4168,9 +4560,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetL2TPTransportIPSec                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
   #define kSCValNetL2TPTransportIPSec                                   \
-          SC_SCHEMA_KV(kSCValNetL2TPTransportIPSec                      \
-                      ,"IPSec"                                          \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCValNetL2TPTransportIPSec                      \
+                     ,"IPSec"                                          \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4178,9 +4570,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesExceptionsList                               \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesExceptionsList                               \
-          SC_SCHEMA_KV(kSCPropNetProxiesExceptionsList                  \
-                      ,"ExceptionsList"                                 \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesExceptionsList                  \
+                     ,"ExceptionsList"                                 \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -4188,9 +4580,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetProxiesExcludeSimpleHostnames                       \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetProxiesExcludeSimpleHostnames                       \
-          SC_SCHEMA_KV(kSCPropNetProxiesExcludeSimpleHostnames          \
-                      ,"ExcludeSimpleHostnames"                         \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesExcludeSimpleHostnames          \
+                     ,"ExcludeSimpleHostnames"                         \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4198,9 +4590,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesFTPEnable                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesFTPEnable                                    \
-          SC_SCHEMA_KV(kSCPropNetProxiesFTPEnable                       \
-                      ,"FTPEnable"                                      \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesFTPEnable                       \
+                     ,"FTPEnable"                                      \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4208,9 +4600,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesFTPPassive                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesFTPPassive                                   \
-          SC_SCHEMA_KV(kSCPropNetProxiesFTPPassive                      \
-                      ,"FTPPassive"                                     \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesFTPPassive                      \
+                     ,"FTPPassive"                                     \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4218,9 +4610,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesFTPPort                                      \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesFTPPort                                      \
-          SC_SCHEMA_KV(kSCPropNetProxiesFTPPort                         \
-                      ,"FTPPort"                                        \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesFTPPort                         \
+                     ,"FTPPort"                                        \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4228,9 +4620,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesFTPProxy                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesFTPProxy                                     \
-          SC_SCHEMA_KV(kSCPropNetProxiesFTPProxy                        \
-                      ,"FTPProxy"                                       \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesFTPProxy                        \
+                     ,"FTPProxy"                                       \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4238,9 +4630,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesGopherEnable                                 \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesGopherEnable                                 \
-          SC_SCHEMA_KV(kSCPropNetProxiesGopherEnable                    \
-                      ,"GopherEnable"                                   \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesGopherEnable                    \
+                     ,"GopherEnable"                                   \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4248,9 +4640,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesGopherPort                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesGopherPort                                   \
-          SC_SCHEMA_KV(kSCPropNetProxiesGopherPort                      \
-                      ,"GopherPort"                                     \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesGopherPort                      \
+                     ,"GopherPort"                                     \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4258,9 +4650,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesGopherProxy                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesGopherProxy                                  \
-          SC_SCHEMA_KV(kSCPropNetProxiesGopherProxy                     \
-                      ,"GopherProxy"                                    \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesGopherProxy                     \
+                     ,"GopherProxy"                                    \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4268,9 +4660,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPEnable                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPEnable                                   \
-          SC_SCHEMA_KV(kSCPropNetProxiesHTTPEnable                      \
-                      ,"HTTPEnable"                                     \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesHTTPEnable                      \
+                     ,"HTTPEnable"                                     \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4278,9 +4670,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPPort                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPPort                                     \
-          SC_SCHEMA_KV(kSCPropNetProxiesHTTPPort                        \
-                      ,"HTTPPort"                                       \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesHTTPPort                        \
+                     ,"HTTPPort"                                       \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4288,9 +4680,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPProxy                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPProxy                                    \
-          SC_SCHEMA_KV(kSCPropNetProxiesHTTPProxy                       \
-                      ,"HTTPProxy"                                      \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesHTTPProxy                       \
+                     ,"HTTPProxy"                                      \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4298,9 +4690,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPSEnable                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPSEnable                                  \
-          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSEnable                     \
-                      ,"HTTPSEnable"                                    \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesHTTPSEnable                     \
+                     ,"HTTPSEnable"                                    \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4308,9 +4700,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPSPort                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPSPort                                    \
-          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSPort                       \
-                      ,"HTTPSPort"                                      \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesHTTPSPort                       \
+                     ,"HTTPSPort"                                      \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4318,9 +4710,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPSProxy                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesHTTPSProxy                                   \
-          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSProxy                      \
-                      ,"HTTPSProxy"                                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesHTTPSProxy                      \
+                     ,"HTTPSProxy"                                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4328,9 +4720,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesRTSPEnable                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesRTSPEnable                                   \
-          SC_SCHEMA_KV(kSCPropNetProxiesRTSPEnable                      \
-                      ,"RTSPEnable"                                     \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesRTSPEnable                      \
+                     ,"RTSPEnable"                                     \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4338,9 +4730,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesRTSPPort                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesRTSPPort                                     \
-          SC_SCHEMA_KV(kSCPropNetProxiesRTSPPort                        \
-                      ,"RTSPPort"                                       \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesRTSPPort                        \
+                     ,"RTSPPort"                                       \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4348,9 +4740,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesRTSPProxy                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesRTSPProxy                                    \
-          SC_SCHEMA_KV(kSCPropNetProxiesRTSPProxy                       \
-                      ,"RTSPProxy"                                      \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesRTSPProxy                       \
+                     ,"RTSPProxy"                                      \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4358,9 +4750,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesSOCKSEnable                                  \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesSOCKSEnable                                  \
-          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSEnable                     \
-                      ,"SOCKSEnable"                                    \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesSOCKSEnable                     \
+                     ,"SOCKSEnable"                                    \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4368,9 +4760,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesSOCKSPort                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesSOCKSPort                                    \
-          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSPort                       \
-                      ,"SOCKSPort"                                      \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesSOCKSPort                       \
+                     ,"SOCKSPort"                                      \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4378,9 +4770,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesSOCKSProxy                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropNetProxiesSOCKSProxy                                   \
-          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSProxy                      \
-                      ,"SOCKSProxy"                                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesSOCKSProxy                      \
+                     ,"SOCKSProxy"                                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -4388,9 +4780,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetProxiesProxyAutoConfigEnable                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetProxiesProxyAutoConfigEnable                        \
-          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigEnable           \
-                      ,"ProxyAutoConfigEnable"                          \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigEnable           \
+                     ,"ProxyAutoConfigEnable"                          \
+                     ,CFNumber (0 or 1)                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -4398,9 +4790,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetProxiesProxyAutoConfigURLString                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetProxiesProxyAutoConfigURLString                     \
-          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigURLString        \
-                      ,"ProxyAutoConfigURLString"                       \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigURLString        \
+                     ,"ProxyAutoConfigURLString"                       \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
@@ -4408,9 +4800,99 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetProxiesProxyAutoDiscoveryEnable                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
   #define kSCPropNetProxiesProxyAutoDiscoveryEnable                     \
-          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoDiscoveryEnable        \
-                      ,"ProxyAutoDiscoveryEnable"                       \
-                      ,CFNumber (0 or 1)                                )
+         SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoDiscoveryEnable        \
+                     ,"ProxyAutoDiscoveryEnable"                       \
+                     ,CFNumber (0 or 1)                                )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetSMBNetBIOSName                                      \
+         SC_SCHEMA_KV(kSCPropNetSMBNetBIOSName                         \
+                     ,"NetBIOSName"                                    \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSNodeType, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetSMBNetBIOSNodeType                                  \
+         SC_SCHEMA_KV(kSCPropNetSMBNetBIOSNodeType                     \
+                     ,"NetBIOSNodeType"                                \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSScope, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetSMBNetBIOSScope                                     \
+         SC_SCHEMA_KV(kSCPropNetSMBNetBIOSScope                        \
+                     ,"NetBIOSScope"                                   \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBWINSAddresses, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetSMBWINSAddresses                                    \
+         SC_SCHEMA_KV(kSCPropNetSMBWINSAddresses                       \
+                     ,"WINSAddresses"                                  \
+                     ,CFArray[CFString]                                )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBWorkgroup, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetSMBWorkgroup                                        \
+         SC_SCHEMA_KV(kSCPropNetSMBWorkgroup                           \
+                     ,"Workgroup"                                      \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeBroadcast, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetSMBNetBIOSNodeTypeBroadcast                          \
+         SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeBroadcast             \
+                     ,"Broadcast"                                      \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypePeer, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetSMBNetBIOSNodeTypePeer                               \
+         SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypePeer                  \
+                     ,"Peer"                                           \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeMixed, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetSMBNetBIOSNodeTypeMixed                              \
+         SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeMixed                 \
+                     ,"Mixed"                                          \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeHybrid, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetSMBNetBIOSNodeTypeHybrid                             \
+         SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeHybrid                \
+                     ,"Hybrid"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4418,9 +4900,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntUsersConsoleUser                                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCEntUsersConsoleUser                                        \
-          SC_SCHEMA_KV(kSCEntUsersConsoleUser                           \
-                      ,"ConsoleUser"                                    \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCEntUsersConsoleUser                           \
+                     ,"ConsoleUser"                                    \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4428,9 +4910,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropSystemComputerName                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropSystemComputerName                                     \
-          SC_SCHEMA_KV(kSCPropSystemComputerName                        \
-                      ,"ComputerName"                                   \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropSystemComputerName                        \
+                     ,"ComputerName"                                   \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4438,9 +4920,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropSystemComputerNameEncoding                             \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropSystemComputerNameEncoding                             \
-          SC_SCHEMA_KV(kSCPropSystemComputerNameEncoding                \
-                      ,"ComputerNameEncoding"                           \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropSystemComputerNameEncoding                \
+                     ,"ComputerNameEncoding"                           \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4448,9 +4930,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainFile                                     \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainFile                                     \
-          SC_SCHEMA_KV(kSCDynamicStoreDomainFile                        \
-                      ,"File:"                                          \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCDynamicStoreDomainFile                        \
+                     ,"File:"                                          \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4458,9 +4940,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainPlugin                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainPlugin                                   \
-          SC_SCHEMA_KV(kSCDynamicStoreDomainPlugin                      \
-                      ,"Plugin:"                                        \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCDynamicStoreDomainPlugin                      \
+                     ,"Plugin:"                                        \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4468,9 +4950,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainSetup                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainSetup                                    \
-          SC_SCHEMA_KV(kSCDynamicStoreDomainSetup                       \
-                      ,"Setup:"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCDynamicStoreDomainSetup                       \
+                     ,"Setup:"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4478,9 +4960,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainState                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainState                                    \
-          SC_SCHEMA_KV(kSCDynamicStoreDomainState                       \
-                      ,"State:"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCDynamicStoreDomainState                       \
+                     ,"State:"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4488,9 +4970,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainPrefs                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStoreDomainPrefs                                    \
-          SC_SCHEMA_KV(kSCDynamicStoreDomainPrefs                       \
-                      ,"Prefs:"                                         \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCDynamicStoreDomainPrefs                       \
+                     ,"Prefs:"                                         \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4498,9 +4980,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropSetupCurrentSet                            \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropSetupCurrentSet                            \
-          SC_SCHEMA_KV(kSCDynamicStorePropSetupCurrentSet               \
-                      ,"CurrentSet"                                     \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCDynamicStorePropSetupCurrentSet               \
+                     ,"CurrentSet"                                     \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4508,9 +4990,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropSetupLastUpdated                           \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropSetupLastUpdated                           \
-          SC_SCHEMA_KV(kSCDynamicStorePropSetupLastUpdated              \
-                      ,"LastUpdated"                                    \
-                      ,                                                 )
+         SC_SCHEMA_KV(kSCDynamicStorePropSetupLastUpdated              \
+                     ,"LastUpdated"                                    \
+                     ,                                                 )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4518,9 +5000,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropNetInterfaces                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropNetInterfaces                              \
-          SC_SCHEMA_KV(kSCDynamicStorePropNetInterfaces                 \
-                      ,"Interfaces"                                     \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCDynamicStorePropNetInterfaces                 \
+                     ,"Interfaces"                                     \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4528,9 +5010,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropNetPrimaryInterface                        \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropNetPrimaryInterface                        \
-          SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryInterface           \
-                      ,"PrimaryInterface"                               \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryInterface           \
+                     ,"PrimaryInterface"                               \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4538,9 +5020,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropNetPrimaryService                          \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropNetPrimaryService                          \
-          SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryService             \
-                      ,"PrimaryService"                                 \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryService             \
+                     ,"PrimaryService"                                 \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4548,9 +5030,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropNetServiceIDs                              \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCDynamicStorePropNetServiceIDs                              \
-          SC_SCHEMA_KV(kSCDynamicStorePropNetServiceIDs                 \
-                      ,"ServiceIDs"                                     \
-                      ,CFArray[CFString]                                )
+         SC_SCHEMA_KV(kSCDynamicStorePropNetServiceIDs                 \
+                     ,"ServiceIDs"                                     \
+                     ,CFArray[CFString]                                )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4558,9 +5040,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropUsersConsoleUserName                                   \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropUsersConsoleUserName                                   \
-          SC_SCHEMA_KV(kSCPropUsersConsoleUserName                      \
-                      ,"Name"                                           \
-                      ,CFString                                         )
+         SC_SCHEMA_KV(kSCPropUsersConsoleUserName                      \
+                     ,"Name"                                           \
+                     ,CFString                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4568,9 +5050,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropUsersConsoleUserUID                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropUsersConsoleUserUID                                    \
-          SC_SCHEMA_KV(kSCPropUsersConsoleUserUID                       \
-                      ,"UID"                                            \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropUsersConsoleUserUID                       \
+                     ,"UID"                                            \
+                     ,CFNumber                                         )
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
@@ -4578,9 +5060,9 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropUsersConsoleUserGID                                    \
 #endif
 #if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
   #define kSCPropUsersConsoleUserGID                                    \
-          SC_SCHEMA_KV(kSCPropUsersConsoleUserGID                       \
-                      ,"GID"                                            \
-                      ,CFNumber                                         )
+         SC_SCHEMA_KV(kSCPropUsersConsoleUserGID                       \
+                     ,"GID"                                            \
+                     ,CFNumber                                         )
 #endif
 
 #endif /* _SCSCHEMADEFINITIONS_H */
 #endif
 
 #endif /* _SCSCHEMADEFINITIONS_H */
diff --git a/SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h b/SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h
new file mode 100644 (file)
index 0000000..0f60ba3
--- /dev/null
@@ -0,0 +1,500 @@
+/*
+ * Copyright (c) 2000-2007 Apple 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@
+ */
+
+/*
+ * This file is automatically generated
+ * DO NOT EDIT!
+ */
+
+/*
+ * Preference Keys
+ *
+ *   kSCPrefVirtualNetworkInterfaces                    "VirtualNetworkInterfaces"     CFDictionary
+ *
+ * Network Entity Keys
+ *
+ *   kSCEntNetEAPOL                                     "EAPOL"                        CFDictionary
+ *
+ * kSCCompNetwork Properties
+ *
+ *   kSCPropNetIgnoreLinkStatus                         "IgnoreLinkStatus"             CFBoolean
+ *
+ * kSCEntNetIPv4 Entity Keys
+ *
+ *   --- kSCPropNetIPv4ConfigMethod values ---
+ *   kSCValNetIPv4ConfigMethodFailover                  "Failover"
+ *
+ * kSCEntNetPPP Entity Keys
+ *
+ *   --- OnDemand: ---
+ *   kSCPropNetPPPOnDemandDomains                       "OnDemandDomains"              CFArray[CFString]
+ *   kSCPropNetPPPOnDemandEnabled                       "OnDemandEnabled"              CFNumber (0 or 1)
+ *   kSCPropNetPPPOnDemandHostName                      "OnDemandHostName"             CFString
+ *   kSCPropNetPPPOnDemandMode                          "OnDemandMode"                 CFString
+ *   kSCPropNetPPPOnDemandPriority                      "OnDemandPriority"             CFString
+ *
+ *   --- kSCPropNetPPPOnDemandMode values ---
+ *   kSCValNetPPPOnDemandModeAggressive                 "Aggressive"
+ *   kSCValNetPPPOnDemandModeConservative               "Conservative"
+ *   kSCValNetPPPOnDemandModeCompatible                 "Compatible"
+ *
+ *   --- kSCPropNetPPPOnDemandPriority values ---
+ *   kSCValNetPPPOnDemandPriorityDefault                "Default"
+ *   kSCValNetPPPOnDemandPriorityHigh                   "High"
+ *   kSCValNetPPPOnDemandPriorityLow                    "Low"
+ *
+ * kSCCompSystem Properties
+ *
+ *   kSCPropSystemComputerNameRegion                    "ComputerNameRegion"           CFNumber
+ *   kSCPropSystemHostName                              "HostName"                     CFString
+ *
+ * Virtual Network Interface Keys
+ *
+ *   kSCPropVirtualNetworkInterfacesBondInterfaces      "Interfaces"                   CFArray[CFString]
+ *   kSCPropVirtualNetworkInterfacesBondMode            "Mode"                         CFNumber
+ *   kSCPropVirtualNetworkInterfacesBondOptions         "Options"                      CFDictionary
+ *
+ *   kSCPropVirtualNetworkInterfacesVLANInterface       "Interface"                    CFString
+ *   kSCPropVirtualNetworkInterfacesVLANTag             "Tag"                          CFNumber
+ *   kSCPropVirtualNetworkInterfacesVLANOptions         "Options"                      CFDictionary
+ */
+
+
+#ifndef _SCSCHEMADEFINITIONSPRIVATE_H
+#define _SCSCHEMADEFINITIONSPRIVATE_H
+
+/* -------------------- Macro declarations -------------------- */
+
+#include <SystemConfiguration/SCSchemaDefinitions.h>
+
+/* -------------------- HeaderDoc comments -------------------- */
+
+
+#if    0
+/*!
+ *     @header SCSchemaDefinitionsPrivate
+ */
+
+/*!
+  @group Preference Keys
+ */
+
+/*!
+  @const kSCPrefVirtualNetworkInterfaces
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPrefVirtualNetworkInterfaces;
+
+/*!
+  @group Network Entity Keys
+ */
+
+/*!
+  @const kSCEntNetEAPOL
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCEntNetEAPOL;
+
+/*!
+  @group kSCCompNetwork Properties
+ */
+
+/*!
+  @const kSCPropNetIgnoreLinkStatus
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetIgnoreLinkStatus;
+
+/*!
+  @group kSCEntNetIPv4 Entity Keys
+ */
+
+/*!
+  @const kSCValNetIPv4ConfigMethodFailover
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetIPv4ConfigMethodFailover;
+
+/*!
+  @group kSCEntNetPPP Entity Keys
+ */
+
+/*!
+  @const kSCPropNetPPPOnDemandDomains
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetPPPOnDemandDomains;
+
+/*!
+  @const kSCPropNetPPPOnDemandEnabled
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetPPPOnDemandEnabled;
+
+/*!
+  @const kSCPropNetPPPOnDemandHostName
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetPPPOnDemandHostName;
+
+/*!
+  @const kSCPropNetPPPOnDemandMode
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetPPPOnDemandMode;
+
+/*!
+  @const kSCPropNetPPPOnDemandPriority
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetPPPOnDemandPriority;
+
+/*!
+  @const kSCValNetPPPOnDemandModeAggressive
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetPPPOnDemandModeAggressive;
+
+/*!
+  @const kSCValNetPPPOnDemandModeConservative
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetPPPOnDemandModeConservative;
+
+/*!
+  @const kSCValNetPPPOnDemandModeCompatible
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetPPPOnDemandModeCompatible;
+
+/*!
+  @const kSCValNetPPPOnDemandPriorityDefault
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetPPPOnDemandPriorityDefault;
+
+/*!
+  @const kSCValNetPPPOnDemandPriorityHigh
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetPPPOnDemandPriorityHigh;
+
+/*!
+  @const kSCValNetPPPOnDemandPriorityLow
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetPPPOnDemandPriorityLow;
+
+/*!
+  @group kSCCompSystem Properties
+ */
+
+/*!
+  @const kSCPropSystemComputerNameRegion
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropSystemComputerNameRegion;
+
+/*!
+  @const kSCPropSystemHostName
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropSystemHostName;
+
+/*!
+  @group Virtual Network Interface Keys
+ */
+
+/*!
+  @const kSCPropVirtualNetworkInterfacesBondInterfaces
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropVirtualNetworkInterfacesBondInterfaces;
+
+/*!
+  @const kSCPropVirtualNetworkInterfacesBondMode
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropVirtualNetworkInterfacesBondMode;
+
+/*!
+  @const kSCPropVirtualNetworkInterfacesBondOptions
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropVirtualNetworkInterfacesBondOptions;
+
+/*!
+  @const kSCPropVirtualNetworkInterfacesVLANInterface
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropVirtualNetworkInterfacesVLANInterface;
+
+/*!
+  @const kSCPropVirtualNetworkInterfacesVLANTag
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropVirtualNetworkInterfacesVLANTag;
+
+/*!
+  @const kSCPropVirtualNetworkInterfacesVLANOptions
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropVirtualNetworkInterfacesVLANOptions;
+
+#endif /* 0 */
+
+
+/* -------------------- Schema declarations -------------------- */
+
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPrefVirtualNetworkInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPrefVirtualNetworkInterfaces                               \
+         SC_SCHEMA_KV(kSCPrefVirtualNetworkInterfaces                  \
+                     ,"VirtualNetworkInterfaces"                       \
+                     ,CFDictionary                                     )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCEntNetEAPOL, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCEntNetEAPOL                                                \
+         SC_SCHEMA_KV(kSCEntNetEAPOL                                   \
+                     ,"EAPOL"                                          \
+                     ,CFDictionary                                     )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetIgnoreLinkStatus, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetIgnoreLinkStatus                                    \
+         SC_SCHEMA_KV(kSCPropNetIgnoreLinkStatus                       \
+                     ,"IgnoreLinkStatus"                               \
+                     ,CFBoolean                                        )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodFailover, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetIPv4ConfigMethodFailover                             \
+         SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodFailover                \
+                     ,"Failover"                                       \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandDomains, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetPPPOnDemandDomains                                  \
+         SC_SCHEMA_KV(kSCPropNetPPPOnDemandDomains                     \
+                     ,"OnDemandDomains"                                \
+                     ,CFArray[CFString]                                )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandEnabled, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetPPPOnDemandEnabled                                  \
+         SC_SCHEMA_KV(kSCPropNetPPPOnDemandEnabled                     \
+                     ,"OnDemandEnabled"                                \
+                     ,CFNumber (0 or 1)                                )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandHostName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetPPPOnDemandHostName                                 \
+         SC_SCHEMA_KV(kSCPropNetPPPOnDemandHostName                    \
+                     ,"OnDemandHostName"                               \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandMode, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetPPPOnDemandMode                                     \
+         SC_SCHEMA_KV(kSCPropNetPPPOnDemandMode                        \
+                     ,"OnDemandMode"                                   \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandPriority, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropNetPPPOnDemandPriority                                 \
+         SC_SCHEMA_KV(kSCPropNetPPPOnDemandPriority                    \
+                     ,"OnDemandPriority"                               \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeAggressive, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetPPPOnDemandModeAggressive                            \
+         SC_SCHEMA_KV(kSCValNetPPPOnDemandModeAggressive               \
+                     ,"Aggressive"                                     \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeConservative, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetPPPOnDemandModeConservative                          \
+         SC_SCHEMA_KV(kSCValNetPPPOnDemandModeConservative             \
+                     ,"Conservative"                                   \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeCompatible, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetPPPOnDemandModeCompatible                            \
+         SC_SCHEMA_KV(kSCValNetPPPOnDemandModeCompatible               \
+                     ,"Compatible"                                     \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityDefault, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetPPPOnDemandPriorityDefault                           \
+         SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityDefault              \
+                     ,"Default"                                        \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityHigh, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetPPPOnDemandPriorityHigh                              \
+         SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityHigh                 \
+                     ,"High"                                           \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityLow, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCValNetPPPOnDemandPriorityLow                               \
+         SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityLow                  \
+                     ,"Low"                                            \
+                     ,                                                 )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameRegion, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropSystemComputerNameRegion                               \
+         SC_SCHEMA_KV(kSCPropSystemComputerNameRegion                  \
+                     ,"ComputerNameRegion"                             \
+                     ,CFNumber                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropSystemHostName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropSystemHostName                                         \
+         SC_SCHEMA_KV(kSCPropSystemHostName                            \
+                     ,"HostName"                                       \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropVirtualNetworkInterfacesBondInterfaces                 \
+         SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondInterfaces    \
+                     ,"Interfaces"                                     \
+                     ,CFArray[CFString]                                )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondMode, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropVirtualNetworkInterfacesBondMode                       \
+         SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondMode          \
+                     ,"Mode"                                           \
+                     ,CFNumber                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondOptions, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropVirtualNetworkInterfacesBondOptions                    \
+         SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondOptions       \
+                     ,"Options"                                        \
+                     ,CFDictionary                                     )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANInterface, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropVirtualNetworkInterfacesVLANInterface                  \
+         SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANInterface     \
+                     ,"Interface"                                      \
+                     ,CFString                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANTag, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropVirtualNetworkInterfacesVLANTag                        \
+         SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANTag           \
+                     ,"Tag"                                            \
+                     ,CFNumber                                         )
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANOptions, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+#endif
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  #define kSCPropVirtualNetworkInterfacesVLANOptions                    \
+         SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANOptions       \
+                     ,"Options"                                        \
+                     ,CFDictionary                                     )
+#endif
+
+#endif /* _SCSCHEMADEFINITIONSPRIVATE_H */
index 2ff0f04be018ca3c9c0bb385930683f2d4dc8c6e..1a1c56269515558acf3c41ac3716cd2257dcfe00 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2002, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -114,6 +114,10 @@ Boolean
 _SC_CFStringIsValidDNSName     (CFStringRef name);
 
 
 _SC_CFStringIsValidDNSName     (CFStringRef name);
 
 
+Boolean
+_SC_CFStringIsValidNetBIOSName (CFStringRef name);
+
+
 __END_DECLS
 
 #endif /* _SCVALIDATION_H */
 __END_DECLS
 
 #endif /* _SCVALIDATION_H */
index 5ea4d25707057f8f4be5f1a4c0c4819d94b6fe81..74cbf3b9e1ceaeba7931af1d4f6af656d2992aff 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -104,35 +104,51 @@ enum {
 };
 
 
 };
 
 
-/* store access APIs */
+/* SCDynamicStore APIs */
 #include <SystemConfiguration/SCDynamicStore.h>
 #include <SystemConfiguration/SCDynamicStoreKey.h>
 #include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
 
 #include <SystemConfiguration/SCDynamicStore.h>
 #include <SystemConfiguration/SCDynamicStoreKey.h>
 #include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
 
-/* preference access APIs */
+/* SCPreferences APIs */
 #include <SystemConfiguration/SCPreferences.h>
 #include <SystemConfiguration/SCPreferencesPath.h>
 #include <SystemConfiguration/SCPreferences.h>
 #include <SystemConfiguration/SCPreferencesPath.h>
+#include <SystemConfiguration/SCPreferencesSetSpecific.h>
 
 
-/* network configuration */
-#include <SystemConfiguration/SCNetworkConfiguration.h>
-
-/* store and preference scheme definitions */
+/* Schema Definitions (for SCDynamicStore and SCPreferences) */
 #include <SystemConfiguration/SCSchemaDefinitions.h>
 
 #include <SystemConfiguration/SCSchemaDefinitions.h>
 
-/* network reachability / connection APIs */
+/* SCNetworkConfiguration APIs */
+#include <SystemConfiguration/SCNetworkConfiguration.h>
+
+/* SCNetworkReachability and SCNetworkConnection APIs */
 #include <SystemConfiguration/SCNetwork.h>
 #include <SystemConfiguration/SCNetworkReachability.h>
 #include <SystemConfiguration/SCNetworkConnection.h>
 
 #include <SystemConfiguration/SCNetwork.h>
 #include <SystemConfiguration/SCNetworkReachability.h>
 #include <SystemConfiguration/SCNetworkConnection.h>
 
+/*!
+       @const kCFErrorDomainSystemConfiguration
+       @discussion CFError domain associated with errors reported by
+               the SystemConfiguration.framework.
+ */
+extern const CFStringRef       kCFErrorDomainSystemConfiguration       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
 __BEGIN_DECLS
 
 __BEGIN_DECLS
 
+/*!
+       @function SCCopyLastError
+       @discussion Returns the most recent status or error code generated
+               as the result of calling a System Configuration framework API.
+       @result Returns the last error encountered.
+ */
+CFErrorRef     SCCopyLastError         (void);
+
 /*!
        @function SCError
        @discussion Returns the most recent status or error code generated
                as the result of calling a System Configuration framework API.
        @result Returns the last error encountered.
  */
 /*!
        @function SCError
        @discussion Returns the most recent status or error code generated
                as the result of calling a System Configuration framework API.
        @result Returns the last error encountered.
  */
-int    SCError                         ();
+int            SCError                 (void);
 
 /*!
        @function SCErrorString
 
 /*!
        @function SCErrorString
index 97367ce8e681ac0aca7f9bb9bccba578e1cc3609..564458944d83a877b09a01a6f472235749bac9b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -24,6 +24,9 @@
 /*
  * Modification History
  *
 /*
  * Modification History
  *
+ * November 28, 2005           Allan Nathanson <ajn@apple.com>
+ * - public API
+ *
  * November 14, 2003           Allan Nathanson <ajn@apple.com>
  * - initial revision
  */
  * November 14, 2003           Allan Nathanson <ajn@apple.com>
  * - initial revision
  */
@@ -33,7 +36,7 @@
 #include <CoreFoundation/CFRuntime.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CFRuntime.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCNetworkConfigurationInternal.h>
+#include "SCNetworkConfigurationInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
@@ -43,7 +46,6 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
-#include <sys/sysctl.h>
 #include <net/ethernet.h>
 #define        KERNEL_PRIVATE
 #include <net/if.h>
 #include <net/ethernet.h>
 #define        KERNEL_PRIVATE
 #include <net/if.h>
 #undef KERNEL_PRIVATE
 #include <net/if_vlan_var.h>
 #include <net/if_types.h>
 #undef KERNEL_PRIVATE
 #include <net/if_vlan_var.h>
 #include <net/if_types.h>
-#include <net/route.h>
 
 #include <SystemConfiguration/VLANConfiguration.h>
 
 #include <SystemConfiguration/VLANConfiguration.h>
-#include <SystemConfiguration/VLANConfigurationPrivate.h>
 
 /* ---------- VLAN support ---------- */
 
 
 /* ---------- VLAN support ---------- */
 
@@ -66,15 +66,832 @@ inet_dgram_socket()
        s = socket(AF_INET, SOCK_DGRAM, 0);
        if (s == -1) {
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
        s = socket(AF_INET, SOCK_DGRAM, 0);
        if (s == -1) {
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
        }
 
        return s;
 }
 
 
        }
 
        return s;
 }
 
 
+typedef struct {
+       CFMutableArrayRef       vlans;
+       SCPreferencesRef        prefs;
+} addContext, *addContextRef;
+
+
+static void
+add_configured_interface(const void *key, const void *value, void *context)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       addContextRef                   myContext       = (addContextRef)context;
+       SCVLANInterfaceRef              vlan;
+       CFStringRef                     vlan_if         = (CFStringRef)key;
+       CFDictionaryRef                 vlan_info       = (CFDictionaryRef)value;
+       CFStringRef                     vlan_name;
+       CFDictionaryRef                 vlan_options;
+       SCNetworkInterfaceRef           vlan_physical;
+       CFStringRef                     vlan_physical_if;
+       CFNumberRef                     vlan_tag;
+
+       vlan_physical_if = CFDictionaryGetValue(vlan_info, kSCPropVirtualNetworkInterfacesVLANInterface);
+       if (!isA_CFString(vlan_physical_if)) {
+               // if prefs are confused
+               return;
+       }
+
+       vlan_tag = CFDictionaryGetValue(vlan_info, kSCPropVirtualNetworkInterfacesVLANTag);
+       if (!isA_CFNumber(vlan_tag)) {
+               // if prefs are confused
+               return;
+       }
+
+       // create the VLAN interface
+       vlan = (SCVLANInterfaceRef)_SCVLANInterfaceCreatePrivate(NULL, vlan_if);
+
+       // set physical interface and tag
+       vlan_physical = _SCNetworkInterfaceCreateWithBSDName(NULL, vlan_physical_if,
+                                                            kIncludeBondInterfaces);
+       SCVLANInterfaceSetPhysicalInterfaceAndTag(vlan, vlan_physical, vlan_tag);
+       CFRelease(vlan_physical);
+
+       // set display name
+       vlan_name = CFDictionaryGetValue(vlan_info, kSCPropUserDefinedName);
+       if (isA_CFString(vlan_name)) {
+               SCVLANInterfaceSetLocalizedDisplayName(vlan, vlan_name);
+       }
+
+       // set options
+       vlan_options = CFDictionaryGetValue(vlan_info, kSCPropVirtualNetworkInterfacesVLANOptions);
+       if (isA_CFDictionary(vlan_options)) {
+               SCVLANInterfaceSetOptions(vlan, vlan_options);
+       }
+
+       // estabish link to the stored configuration
+       interfacePrivate = (SCNetworkInterfacePrivateRef)vlan;
+       interfacePrivate->prefs = CFRetain(myContext->prefs);
+
+       CFArrayAppendValue(myContext->vlans, vlan);
+       CFRelease(vlan);
+
+       return;
+}
+
+
+static void
+add_legacy_configuration(addContextRef myContext)
+{
+       CFIndex                         i;
+       CFIndex                         n;
+       SCPreferencesRef                prefs;
+       CFArrayRef                      vlans;
+
+#define VLAN_PREFERENCES_ID            CFSTR("VirtualNetworkInterfaces.plist")
+#define        VLAN_PREFERENCES_VLANS          CFSTR("VLANs")
+#define        __kVLANInterface_interface      CFSTR("interface")      // e.g. vlan0, vlan1, ...
+#define        __kVLANInterface_device         CFSTR("device")         // e.g. en0, en1, ...
+#define __kVLANInterface_tag           CFSTR("tag")            // e.g. 1 <= tag <= 4094
+#define __kVLANInterface_options       CFSTR("options")        // e.g. UserDefinedName
+
+       prefs = SCPreferencesCreate(NULL, CFSTR("SCVLANInterfaceCopyAll"), VLAN_PREFERENCES_ID);
+       if (prefs == NULL) {
+               return;
+       }
+
+       vlans = SCPreferencesGetValue(prefs, VLAN_PREFERENCES_VLANS);
+       if ((vlans != NULL) && !isA_CFArray(vlans)) {
+               CFRelease(prefs);       // if the prefs are confused
+               return;
+       }
+
+       n = (vlans != NULL) ? CFArrayGetCount(vlans) : 0;
+       for (i = 0; i < n; i++) {
+               CFDictionaryRef                 dict;
+               SCNetworkInterfacePrivateRef    interfacePrivate;
+               Boolean                         ok;
+               CFDictionaryRef                 options;
+               CFStringRef                     path;
+               SCVLANInterfaceRef              vlan;
+               CFStringRef                     vlan_if;
+               CFDictionaryRef                 vlan_dict;
+               SCNetworkInterfaceRef           vlan_physical;
+               CFStringRef                     vlan_physical_if;
+               CFNumberRef                     vlan_tag;
+
+               vlan_dict = CFArrayGetValueAtIndex(vlans, i);
+               if (!isA_CFDictionary(vlan_dict)) {
+                       continue;       // if the prefs are confused
+               }
+
+               vlan_if = CFDictionaryGetValue(vlan_dict, __kVLANInterface_interface);
+               if (!isA_CFString(vlan_if)) {
+                       continue;       // if the prefs are confused
+               }
+
+               vlan_physical_if = CFDictionaryGetValue(vlan_dict, __kVLANInterface_device);
+               if (!isA_CFString(vlan_physical_if)) {
+                       continue;       // if the prefs are confused
+               }
+
+               vlan_tag = CFDictionaryGetValue(vlan_dict, __kVLANInterface_tag);
+               if (!isA_CFNumber(vlan_tag)) {
+                       continue;       // if the prefs are confused
+               }
+
+               // check if this VLAN interface has already been allocated
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeVLAN,
+                                               vlan_if);
+               dict = SCPreferencesPathGetValue(myContext->prefs, path);
+               if (dict != NULL) {
+                       // if VLAN interface name not available
+                       CFRelease(path);
+                       continue;
+               }
+
+               // add a placeholder for the VLAN in the stored preferences
+               dict = CFDictionaryCreate(NULL,
+                                         NULL, NULL, 0,
+                                         &kCFTypeDictionaryKeyCallBacks,
+                                         &kCFTypeDictionaryValueCallBacks);
+               ok = SCPreferencesPathSetValue(myContext->prefs, path, dict);
+               CFRelease(dict);
+               CFRelease(path);
+               if (!ok) {
+                       // if the VLAN could not be saved
+                       continue;
+               }
+
+               // create the VLAN interface
+               vlan = (SCVLANInterfaceRef)_SCVLANInterfaceCreatePrivate(NULL, vlan_if);
+
+               // estabish link to the stored configuration
+               interfacePrivate = (SCNetworkInterfacePrivateRef)vlan;
+               interfacePrivate->prefs = CFRetain(myContext->prefs);
+
+               // set the interface and tag (which updates the stored preferences)
+               vlan_physical = _SCNetworkInterfaceCreateWithBSDName(NULL, vlan_physical_if,
+                                                                    kIncludeBondInterfaces);
+               SCVLANInterfaceSetPhysicalInterfaceAndTag(vlan, vlan_physical, vlan_tag);
+               CFRelease(vlan_physical);
+
+               // set display name (which updates the stored preferences)
+               options = CFDictionaryGetValue(vlan_dict, __kVLANInterface_options);
+               if (isA_CFDictionary(options)) {
+                       CFStringRef     vlan_name;
+
+                       vlan_name = CFDictionaryGetValue(options, CFSTR("VLAN Name"));
+                       if (isA_CFString(vlan_name)) {
+                               SCVLANInterfaceSetLocalizedDisplayName(vlan, vlan_name);
+                       }
+               }
+
+               CFArrayAppendValue(myContext->vlans, vlan);
+               CFRelease(vlan);
+       }
+
+       CFRelease(prefs);
+       return;
+}
+
+
+static SCVLANInterfaceRef
+findVLANInterfaceAndTag(SCPreferencesRef prefs, SCNetworkInterfaceRef physical, CFNumberRef tag)
+{
+       CFIndex                 i;
+       CFIndex                 n;
+       SCVLANInterfaceRef      vlan    = NULL;
+       CFArrayRef              vlans;
+
+       vlans = SCVLANInterfaceCopyAll(prefs);
+
+       n = CFArrayGetCount(vlans);
+       for (i = 0; i < n; i++) {
+               SCVLANInterfaceRef      config_vlan;
+               SCNetworkInterfaceRef   config_physical;
+               CFNumberRef             config_tag;
+
+               config_vlan     = CFArrayGetValueAtIndex(vlans, i);
+               config_physical = SCVLANInterfaceGetPhysicalInterface(config_vlan);
+               config_tag      = SCVLANInterfaceGetTag(config_vlan);
+
+               if ((config_physical != NULL) && (config_tag != NULL)) {
+                       if (!CFEqual(physical, config_physical)) {
+                               // if this VLAN has a different physical interface
+                               continue;
+                       }
+
+                       if (!CFEqual(tag, config_tag)) {
+                               // if this VLAN has a different tag
+                               continue;
+                       }
+
+                       vlan = CFRetain(config_vlan);
+                       break;
+               }
+       }
+       CFRelease(vlans);
+
+       return vlan;
+}
+
+
+#pragma mark -
+#pragma mark SCVLANInterface APIs
+
+
+CFArrayRef
+SCVLANInterfaceCopyAll(SCPreferencesRef prefs)
+{
+       addContext              context;
+       CFDictionaryRef         dict;
+       CFStringRef             path;
+
+       context.vlans = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       context.prefs = prefs;
+
+       path = CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("/%@/%@"),
+                                       kSCPrefVirtualNetworkInterfaces,
+                                       kSCNetworkInterfaceTypeVLAN);
+       dict = SCPreferencesPathGetValue(prefs, path);
+       if (isA_CFDictionary(dict)) {
+               CFDictionaryApplyFunction(dict, add_configured_interface, &context);
+       } else {
+               // no VLAN configuration, upgrade from legacy configuration
+               dict = CFDictionaryCreate(NULL,
+                                         NULL, NULL, 0,
+                                         &kCFTypeDictionaryKeyCallBacks,
+                                         &kCFTypeDictionaryValueCallBacks);
+               (void) SCPreferencesPathSetValue(prefs, path, dict);
+               CFRelease(dict);
+
+               add_legacy_configuration(&context);
+       }
+       CFRelease(path);
+
+       return context.vlans;
+}
+
+
+static void
+addAvailableInterfaces(CFMutableArrayRef available, CFArrayRef interfaces,
+                      CFSetRef exclude)
+{
+       CFIndex i;
+       CFIndex n;
+
+       n = CFArrayGetCount(interfaces);
+       for (i = 0; i < n; i++) {
+               SCNetworkInterfaceRef           interface;
+               SCNetworkInterfacePrivateRef    interfacePrivate;
+
+               interface = CFArrayGetValueAtIndex(interfaces, i);
+               interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
+
+               if (exclude != NULL
+                   && CFSetContainsValue(exclude, interface)) {
+                       // exclude this interface
+                       continue;
+               }
+               if (interfacePrivate->supportsVLAN) {
+                       // if this interface is available
+                       CFArrayAppendValue(available, interface);
+               }
+       }
+
+       return;
+}
+
+
+CFArrayRef
+SCVLANInterfaceCopyAvailablePhysicalInterfaces()
+{
+       CFMutableArrayRef       available;
+       CFArrayRef              bond_interfaces = NULL;
+       CFMutableSetRef         exclude = NULL;
+       CFArrayRef              interfaces;
+       SCPreferencesRef        prefs;
+
+       available = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       prefs = SCPreferencesCreate(NULL, CFSTR("SCVLANInterfaceCopyAvailablePhysicalInterfaces"), NULL);
+       if (prefs != NULL) {
+               bond_interfaces = SCBondInterfaceCopyAll(prefs);
+               CFRelease(prefs);
+               if (bond_interfaces != NULL) {
+                       exclude = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+                       __SCBondInterfaceListCopyMembers(bond_interfaces, exclude);
+               }
+       }
+
+       // add real interfaces that aren't part of a bond
+       interfaces = __SCNetworkInterfaceCopyAll_IONetworkInterface();
+       if (interfaces != NULL) {
+               addAvailableInterfaces(available, interfaces, exclude);
+               CFRelease(interfaces);
+       }
+
+       // add bond interfaces
+       if (bond_interfaces != NULL) {
+               addAvailableInterfaces(available, bond_interfaces, NULL);
+               CFRelease(bond_interfaces);
+       }
+       if (exclude != NULL) {
+               CFRelease(exclude);
+       }
+
+       return available;
+}
+
+
+CFArrayRef
+_SCVLANInterfaceCopyActive(void)
+{
+       struct ifaddrs          *ifap;
+       struct ifaddrs          *ifp;
+       int                     s;
+       CFMutableArrayRef       vlans   = NULL;
+
+       if (getifaddrs(&ifap) == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
+               _SCErrorSet(kSCStatusFailed);
+               return NULL;
+       }
+
+       s = inet_dgram_socket();
+       if (s == -1) {
+               _SCErrorSet(errno);
+               goto done;
+       }
+
+       vlans = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       for (ifp = ifap; ifp != NULL; ifp = ifp->ifa_next) {
+               struct if_data          *if_data;
+               struct ifreq            ifr;
+               SCVLANInterfaceRef      vlan;
+               CFStringRef             vlan_if;
+               SCNetworkInterfaceRef   vlan_physical;
+               CFStringRef             vlan_physical_if;
+               CFNumberRef             vlan_tag;
+               char                    vlr_parent[IFNAMSIZ + 1];
+               int                     vlr_tag;
+               struct vlanreq          vreq;
+
+               if_data = (struct if_data *)ifp->ifa_data;
+               if (if_data == NULL
+                   || ifp->ifa_addr->sa_family != AF_LINK
+                   || if_data->ifi_type != IFT_L2VLAN) {
+                       continue;
+               }
+
+               bzero(&ifr, sizeof(ifr));
+               bzero(&vreq, sizeof(vreq));
+               strncpy(ifr.ifr_name, ifp->ifa_name, sizeof(ifr.ifr_name));
+               ifr.ifr_data = (caddr_t)&vreq;
+
+               if (ioctl(s, SIOCGIFVLAN, (caddr_t)&ifr) == -1) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("ioctl() failed: %s"), strerror(errno));
+                       CFRelease(vlans);
+                       vlans = NULL;
+                       _SCErrorSet(kSCStatusFailed);
+                       goto done;
+               }
+
+               // create the VLAN interface
+               vlan_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII);
+               vlan    = (SCVLANInterfaceRef)_SCVLANInterfaceCreatePrivate(NULL, vlan_if);
+               CFRelease(vlan_if);
+
+               // set the physical interface and tag
+               bzero(&vlr_parent, sizeof(vlr_parent));
+               bcopy(vreq.vlr_parent, vlr_parent, IFNAMSIZ);
+               vlan_physical_if = CFStringCreateWithCString(NULL, vlr_parent, kCFStringEncodingASCII);
+               vlan_physical = _SCNetworkInterfaceCreateWithBSDName(NULL, vlan_physical_if,
+                                                                    kIncludeBondInterfaces);
+               CFRelease(vlan_physical_if);
+
+               vlr_tag  = vreq.vlr_tag;
+               vlan_tag = CFNumberCreate(NULL, kCFNumberIntType, &vlr_tag);
+
+               SCVLANInterfaceSetPhysicalInterfaceAndTag(vlan, vlan_physical, vlan_tag);
+               CFRelease(vlan_physical);
+               CFRelease(vlan_tag);
+
+               // add VLAN
+               CFArrayAppendValue(vlans, vlan);
+               CFRelease(vlan);
+       }
+
+    done :
+
+       (void) close(s);
+       freeifaddrs(ifap);
+       return vlans;
+}
+
+
+SCVLANInterfaceRef
+SCVLANInterfaceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef physical, CFNumberRef tag)
+{
+       CFAllocatorRef                  allocator;
+       CFIndex                         i;
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       SCVLANInterfaceRef              vlan;
+
+       if (prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (!isA_SCNetworkInterface(physical)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       interfacePrivate = (SCNetworkInterfacePrivateRef)physical;
+       if (!interfacePrivate->supportsVLAN) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (isA_CFNumber(tag)) {
+               int     tag_val;
+
+               CFNumberGetValue(tag, kCFNumberIntType, &tag_val);
+               if ((tag_val < 1) || (tag_val > 4094)) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+       } else {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       // make sure that physical interface and tag are not used
+       vlan = findVLANInterfaceAndTag(prefs, physical, tag);
+       if (vlan != NULL) {
+               CFRelease(vlan);
+               _SCErrorSet(kSCStatusKeyExists);
+               return NULL;
+       }
+
+       allocator = CFGetAllocator(prefs);
+
+       // create a new VLAN using an unused interface name
+       for (i = 0; vlan == NULL; i++) {
+               CFDictionaryRef                 dict;
+               CFStringRef                     vlan_if;
+               Boolean                         ok;
+               CFStringRef                     path;
+
+               vlan_if = CFStringCreateWithFormat(allocator, NULL, CFSTR("vlan%d"), i);
+               path    = CFStringCreateWithFormat(allocator,
+                                                  NULL,
+                                                  CFSTR("/%@/%@/%@"),
+                                                  kSCPrefVirtualNetworkInterfaces,
+                                                  kSCNetworkInterfaceTypeVLAN,
+                                                  vlan_if);
+               dict = SCPreferencesPathGetValue(prefs, path);
+               if (dict != NULL) {
+                       // if VLAN interface name not available
+                       CFRelease(path);
+                       CFRelease(vlan_if);
+                       continue;
+               }
+
+               // add the VLAN to the stored preferences
+               dict = CFDictionaryCreate(allocator,
+                                         NULL, NULL, 0,
+                                         &kCFTypeDictionaryKeyCallBacks,
+                                         &kCFTypeDictionaryValueCallBacks);
+               ok = SCPreferencesPathSetValue(prefs, path, dict);
+               CFRelease(dict);
+               CFRelease(path);
+               if (!ok) {
+                       // if the VLAN could not be saved
+                       CFRelease(vlan_if);
+                       _SCErrorSet(kSCStatusFailed);
+                       break;
+               }
+
+               // create the SCVLANInterfaceRef
+               vlan = (SCVLANInterfaceRef)_SCVLANInterfaceCreatePrivate(allocator, vlan_if);
+               CFRelease(vlan_if);
+
+               // estabish link to the stored configuration
+               interfacePrivate = (SCNetworkInterfacePrivateRef)vlan;
+               interfacePrivate->prefs = CFRetain(prefs);
+
+               // set physical interface and tag
+               SCVLANInterfaceSetPhysicalInterfaceAndTag(vlan, physical, tag);
+       }
+
+       return vlan;
+}
+
+
+Boolean
+SCVLANInterfaceRemove(SCVLANInterfaceRef vlan)
+{
+       CFStringRef                     vlan_if;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)vlan;
+       Boolean                         ok;
+       CFStringRef                     path;
+
+       if (!isA_SCVLANInterface(vlan)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (interfacePrivate->prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       vlan_if = SCNetworkInterfaceGetBSDName(vlan);
+       path    = CFStringCreateWithFormat(NULL,
+                                          NULL,
+                                          CFSTR("/%@/%@/%@"),
+                                          kSCPrefVirtualNetworkInterfaces,
+                                          kSCNetworkInterfaceTypeVLAN,
+                                          vlan_if);
+       ok = SCPreferencesPathRemoveValue(interfacePrivate->prefs, path);
+       CFRelease(path);
+
+       return ok;
+}
+
+
+SCNetworkInterfaceRef
+SCVLANInterfaceGetPhysicalInterface(SCVLANInterfaceRef vlan)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)vlan;
+
+       if (!isA_SCVLANInterface(vlan)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       return interfacePrivate->vlan.interface;
+}
+
+
+CFNumberRef
+SCVLANInterfaceGetTag(SCVLANInterfaceRef vlan)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)vlan;
+
+       if (!isA_SCVLANInterface(vlan)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       return interfacePrivate->vlan.tag;
+}
+
+
+CFDictionaryRef
+SCVLANInterfaceGetOptions(SCVLANInterfaceRef vlan)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)vlan;
+
+       if (!isA_SCVLANInterface(vlan)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       return interfacePrivate->vlan.options;
+}
+
+
+Boolean
+SCVLANInterfaceSetPhysicalInterfaceAndTag(SCVLANInterfaceRef vlan, SCNetworkInterfaceRef physical, CFNumberRef tag)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       Boolean                         ok                      = TRUE;
+
+       if (!isA_SCVLANInterface(vlan)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!isA_SCNetworkInterface(physical)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       interfacePrivate = (SCNetworkInterfacePrivateRef)physical;
+       if (!interfacePrivate->supportsVLAN) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (isA_CFNumber(tag)) {
+               int     tag_val;
+
+               CFNumberGetValue(tag, kCFNumberIntType, &tag_val);
+               if ((tag_val < 1) || (tag_val > 4094)) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+               }
+       } else {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       interfacePrivate = (SCNetworkInterfacePrivateRef)vlan;
+       if (interfacePrivate->prefs != NULL) {
+               SCVLANInterfaceRef      config_vlan;
+               CFDictionaryRef         dict;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               // make sure that physical interface and tag are not used
+               config_vlan = findVLANInterfaceAndTag(interfacePrivate->prefs, physical, tag);
+               if (config_vlan != NULL) {
+                       if (!CFEqual(vlan, config_vlan)) {
+                               CFRelease(config_vlan);
+                               _SCErrorSet(kSCStatusKeyExists);
+                               return FALSE;
+                       }
+                       CFRelease(config_vlan);
+               }
+
+               // set interface/tag in the stored preferences
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeVLAN,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               CFDictionarySetValue(newDict,
+                                    kSCPropVirtualNetworkInterfacesVLANInterface,
+                                    SCNetworkInterfaceGetBSDName(physical));
+               CFDictionarySetValue(newDict, kSCPropVirtualNetworkInterfacesVLANTag, tag);
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       if (ok) {
+               // set physical interface
+               if (interfacePrivate->vlan.interface != NULL)
+                       CFRelease(interfacePrivate->vlan.interface);
+               interfacePrivate->vlan.interface = CFRetain(physical);
+
+               // set tag
+               if (interfacePrivate->vlan.tag != NULL)
+                       CFRelease(interfacePrivate->vlan.tag);
+               interfacePrivate->vlan.tag = CFRetain(tag);
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCVLANInterfaceSetLocalizedDisplayName(SCVLANInterfaceRef vlan, CFStringRef newName)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)vlan;
+       Boolean                         ok                      = TRUE;
+
+       if (!isA_SCVLANInterface(vlan)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((newName != NULL) && !isA_CFString(newName)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // set name in the stored preferences
+       if (interfacePrivate->prefs != NULL) {
+               CFDictionaryRef         dict;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeVLAN,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               if (newName != NULL) {
+                       CFDictionarySetValue(newDict, kSCPropUserDefinedName, newName);
+               } else {
+                       CFDictionaryRemoveValue(newDict, kSCPropUserDefinedName);
+               }
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       // set name in the SCVLANInterfaceRef
+       if (ok) {
+               if (interfacePrivate->localized_name != NULL) {
+                       CFRelease(interfacePrivate->localized_name);
+                       interfacePrivate->localized_name = NULL;
+               }
+               if (newName != NULL) {
+                       interfacePrivate->localized_name = CFStringCreateCopy(NULL, newName);
+               }
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCVLANInterfaceSetOptions(SCVLANInterfaceRef vlan, CFDictionaryRef newOptions)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)vlan;
+       Boolean                         ok                      = TRUE;
+
+       if (!isA_SCVLANInterface(vlan)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((newOptions != NULL) && !isA_CFDictionary(newOptions)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // set options in the stored preferences
+       if (interfacePrivate->prefs != NULL) {
+               CFDictionaryRef         dict;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeVLAN,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               if (newOptions != NULL) {
+                       CFDictionarySetValue(newDict, kSCPropVirtualNetworkInterfacesVLANOptions, newOptions);
+               } else {
+                       CFDictionaryRemoveValue(newDict, kSCPropVirtualNetworkInterfacesVLANOptions);
+               }
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       // set options in the SCVLANInterfaceRef
+       if (ok) {
+               if (interfacePrivate->vlan.options != NULL) {
+                       CFRelease(interfacePrivate->vlan.options);
+                       interfacePrivate->vlan.options = NULL;
+               }
+               if (newOptions != NULL) {
+                       interfacePrivate->vlan.options = CFDictionaryCreateCopy(NULL, newOptions);
+               }
+       }
+
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark SCVLANInterface management
+
+
 static Boolean
 static Boolean
-_VLANDevice_set(int s, CFStringRef interface, CFStringRef device, CFNumberRef tag)
+__vlan_set(int s, CFStringRef interface_if, CFStringRef physical_if, CFNumberRef tag)
 {
        struct ifreq    ifr;
        int             tag_val;
 {
        struct ifreq    ifr;
        int             tag_val;
@@ -84,31 +901,25 @@ _VLANDevice_set(int s, CFStringRef interface, CFStringRef device, CFNumberRef ta
        bzero(&vreq, sizeof(vreq));
 
        // interface
        bzero(&vreq, sizeof(vreq));
 
        // interface
-       (void) _SC_cfstring_to_cstring(interface,
+       (void) _SC_cfstring_to_cstring(interface_if,
                                       ifr.ifr_name,
                                       sizeof(ifr.ifr_name),
                                       kCFStringEncodingASCII);
        ifr.ifr_data = (caddr_t)&vreq;
 
                                       ifr.ifr_name,
                                       sizeof(ifr.ifr_name),
                                       kCFStringEncodingASCII);
        ifr.ifr_data = (caddr_t)&vreq;
 
-       // parent device
-       (void) _SC_cfstring_to_cstring(device,
+       // physical interface
+       (void) _SC_cfstring_to_cstring(physical_if,
                                       vreq.vlr_parent,
                                       sizeof(vreq.vlr_parent),
                                       kCFStringEncodingASCII);
 
        // tag
        CFNumberGetValue(tag, kCFNumberIntType, &tag_val);
                                       vreq.vlr_parent,
                                       sizeof(vreq.vlr_parent),
                                       kCFStringEncodingASCII);
 
        // tag
        CFNumberGetValue(tag, kCFNumberIntType, &tag_val);
-       vreq.vlr_tag = tag_val;
-
-       // update parent device and tag
-       if (ioctl(s, SIOCSIFVLAN, (caddr_t)&ifr) == -1) {
-               SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCSIFVLAN) failed: %s"), strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
-               return FALSE;
-       }
+       vreq.vlr_tag = tag_val;
 
 
-       // mark the parent device "up"
-       if (!__markInterfaceUp(s, device)) {
+       // update physical interface and tag
+       if (ioctl(s, SIOCSIFVLAN, (caddr_t)&ifr) == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCSIFVLAN) failed: %s"), strerror(errno));
                _SCErrorSet(kSCStatusFailed);
                return FALSE;
        }
                _SCErrorSet(kSCStatusFailed);
                return FALSE;
        }
@@ -118,7 +929,7 @@ _VLANDevice_set(int s, CFStringRef interface, CFStringRef device, CFNumberRef ta
 
 
 static Boolean
 
 
 static Boolean
-_VLANDevice_unset(int s, CFStringRef interface)
+__vlan_clear(int s, CFStringRef interface_if)
 {
        struct ifreq    ifr;
        struct vlanreq  vreq;
 {
        struct ifreq    ifr;
        struct vlanreq  vreq;
@@ -127,19 +938,19 @@ _VLANDevice_unset(int s, CFStringRef interface)
        bzero(&vreq, sizeof(vreq));
 
        // interface
        bzero(&vreq, sizeof(vreq));
 
        // interface
-       (void) _SC_cfstring_to_cstring(interface,
+       (void) _SC_cfstring_to_cstring(interface_if,
                                       ifr.ifr_name,
                                       sizeof(ifr.ifr_name),
                                       kCFStringEncodingASCII);
        ifr.ifr_data = (caddr_t)&vreq;
 
                                       ifr.ifr_name,
                                       sizeof(ifr.ifr_name),
                                       kCFStringEncodingASCII);
        ifr.ifr_data = (caddr_t)&vreq;
 
-       // clear parent device
+       // clear physical interface
        bzero(&vreq.vlr_parent, sizeof(vreq.vlr_parent));
 
        // clear tag
        vreq.vlr_tag = 0;
 
        bzero(&vreq.vlr_parent, sizeof(vreq.vlr_parent));
 
        // clear tag
        vreq.vlr_tag = 0;
 
-       // update parent device and tag
+       // update physical interface and tag
        if (ioctl(s, SIOCSIFVLAN, (caddr_t)&ifr) == -1) {
                SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCSIFVLAN) failed: %s"), strerror(errno));
                _SCErrorSet(kSCStatusFailed);
        if (ioctl(s, SIOCSIFVLAN, (caddr_t)&ifr) == -1) {
                SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCSIFVLAN) failed: %s"), strerror(errno));
                _SCErrorSet(kSCStatusFailed);
@@ -150,71 +961,193 @@ _VLANDevice_unset(int s, CFStringRef interface)
 }
 
 
 }
 
 
-/* ---------- VLAN "device" ---------- */
-
 Boolean
 Boolean
-IsVLANSupported(CFStringRef device)
+_SCVLANInterfaceUpdateConfiguration(SCPreferencesRef prefs)
 {
 {
-       char *                  buf     = NULL;
-       size_t                  buf_len = 0;
-       struct if_msghdr *      ifm;
-       char *                  if_name = NULL;
-       unsigned int            if_index;
-       Boolean                 isVlan  = FALSE;
-       int                     mib[6];
-
-       /* get the interface index */
+       CFArrayRef                      active          = NULL;
+       CFArrayRef                      config          = NULL;
+       CFMutableDictionaryRef          devices         = NULL;
+       CFIndex                         i;
+       CFIndex                         nActive;
+       CFIndex                         nConfig;
+       Boolean                         ok              = TRUE;
+       int                             s               = -1;
 
 
-       if_name = _SC_cfstring_to_cstring(device, NULL, 0, kCFStringEncodingASCII);
-       if (if_name == NULL) {
-               return FALSE;   // if conversion error
-       }
-       if_index = if_nametoindex(if_name);
-       if (if_index == 0) {
-               goto done;      // if unknown interface
+       if (prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
        }
 
        }
 
-       /* get information for the specified device */
+       /* configured VLANs */
+       config = SCVLANInterfaceCopyAll(prefs);
+       nConfig = CFArrayGetCount(config);
 
 
-       mib[0] = CTL_NET;
-       mib[1] = PF_ROUTE;
-       mib[2] = 0;
-       mib[3] = AF_LINK;
-       mib[4] = NET_RT_IFLIST;
-       mib[5] = if_index;      /* ask for exactly one interface */
+       /* physical interfaces */
+       devices = CFDictionaryCreateMutable(NULL,
+                                           0,
+                                           &kCFTypeDictionaryKeyCallBacks,
+                                           &kCFTypeDictionaryValueCallBacks);
 
 
-       if (sysctl(mib, 6, NULL, &buf_len, NULL, 0) < 0) {
-               SCLog(TRUE, LOG_ERR, CFSTR("sysctl() size failed: %s"), strerror(errno));
-               goto done;
-       }
-       buf = CFAllocatorAllocate(NULL, buf_len, 0);
-       if (sysctl(mib, 6, buf, &buf_len, NULL, 0) < 0) {
-               SCLog(TRUE, LOG_ERR, CFSTR("sysctl() failed: %s"), strerror(errno));
-               goto done;
+       /* active VLANs */
+       active  = _SCVLANInterfaceCopyActive();
+       nActive = CFArrayGetCount(active);
+
+       /* remove any no-longer-configured VLAN interfaces */
+       for (i = 0; i < nActive; i++) {
+               SCVLANInterfaceRef      a_vlan;
+               CFStringRef             a_vlan_if;
+               CFIndex                 j;
+               Boolean                 found   = FALSE;
+
+               a_vlan    = CFArrayGetValueAtIndex(active, i);
+               a_vlan_if = SCNetworkInterfaceGetBSDName(a_vlan);
+
+               for (j = 0; j < nConfig; j++) {
+                       SCVLANInterfaceRef      c_vlan;
+                       CFStringRef             c_vlan_if;
+
+                       c_vlan    = CFArrayGetValueAtIndex(config, j);
+                       c_vlan_if = SCNetworkInterfaceGetBSDName(c_vlan);
+
+                       if (CFEqual(a_vlan_if, c_vlan_if)) {
+                               found = TRUE;
+                               break;
+                       }
+               }
+
+               if (!found) {
+                       // remove VLAN interface
+                       if (s == -1) {
+                               s = inet_dgram_socket();
+                               if (s == -1) {
+                                       _SCErrorSet(errno);
+                                       ok = FALSE;
+                                       goto done;
+                               }
+                       }
+                       if (!__destroyInterface(s, a_vlan_if)) {
+                               ok = FALSE;
+                               _SCErrorSet(errno);
+                       }
+               }
        }
 
        }
 
-       /* check the link type and hwassist flags */
+       /* create (and update) configured VLAN interfaces */
+       for (i = 0; i < nConfig; i++) {
+               SCVLANInterfaceRef      c_vlan;
+               CFStringRef             c_vlan_if;
+               SCNetworkInterfaceRef   c_vlan_physical;
+               Boolean                 found           = FALSE;
+               CFIndex                 j;
+               CFBooleanRef            supported;
+
+               c_vlan          = CFArrayGetValueAtIndex(config, i);
+               c_vlan_if       = SCNetworkInterfaceGetBSDName(c_vlan);
+               c_vlan_physical = SCVLANInterfaceGetPhysicalInterface(c_vlan);
 
 
-       ifm = (struct if_msghdr *)buf;
-       switch (ifm->ifm_type) {
-               case RTM_IFINFO : {
-#if    defined(IF_HWASSIST_VLAN_TAGGING) && defined(IF_HWASSIST_VLAN_MTU)
-                       struct if_data  *if_data = &ifm->ifm_data;
+               if (c_vlan_physical == NULL) {
+                       continue;
+               }
+               // determine if the physical interface supports VLANs
+               supported = CFDictionaryGetValue(devices, c_vlan_physical);
+               if (supported == NULL) {
+                       SCNetworkInterfacePrivateRef    c_vlan_physicalPrivate  = (SCNetworkInterfacePrivateRef)c_vlan_physical;
+
+                       supported = c_vlan_physicalPrivate->supportsVLAN ? kCFBooleanTrue
+                                                                        : kCFBooleanFalse;
+                       CFDictionaryAddValue(devices, c_vlan_physical, supported);
+               }
+
+               for (j = 0; j < nActive; j++) {
+                       SCVLANInterfaceRef      a_vlan;
+                       CFStringRef             a_vlan_if;
+
+                       a_vlan    = CFArrayGetValueAtIndex(active, j);
+                       a_vlan_if = SCNetworkInterfaceGetBSDName(a_vlan);
+
+                       if (CFEqual(c_vlan_if, a_vlan_if)) {
+                               if (!CFEqual(c_vlan, a_vlan)) {
+                                       // update VLAN interface
+                                       if (s == -1) {
+                                               s = inet_dgram_socket();
+                                               if (s == -1) {
+                                                       _SCErrorSet(errno);
+                                                       ok = FALSE;
+                                                       goto done;
+                                               }
+                                       }
 
 
-                       if (if_data->ifi_hwassist & (IF_HWASSIST_VLAN_TAGGING | IF_HWASSIST_VLAN_MTU)) {
-                               isVlan = TRUE;
+                                       if (!CFBooleanGetValue(supported)
+                                           || !__vlan_clear(s, c_vlan_if)
+                                           || !__vlan_set(s, c_vlan_if,
+                                                          SCNetworkInterfaceGetBSDName(c_vlan_physical),
+                                                          SCVLANInterfaceGetTag(c_vlan))) {
+                                               // something went wrong, try to blow the VLAN away
+                                               if (!CFBooleanGetValue(supported)) {
+                                                       _SCErrorSet(kSCStatusFailed);
+                                               }
+                                               (void)__destroyInterface(s, c_vlan_if);
+                                               ok = FALSE;
+                                       }
+                               }
+
+                               found = TRUE;
+                               break;
+                       }
+               }
+
+               if (!found && CFBooleanGetValue(supported)) {
+                       // if the physical interface supports VLANs, add new interface
+                       Boolean         created;
+
+                       if (s == -1) {
+                               s = inet_dgram_socket();
+                               if (s == -1) {
+                                       _SCErrorSet(errno);
+                                       ok = FALSE;
+                                       goto done;
+                               }
+                       }
+
+                       created = __createInterface(s, c_vlan_if);
+                       if (!created
+                           || !__vlan_set(s,
+                                          c_vlan_if,
+                                          SCNetworkInterfaceGetBSDName(c_vlan_physical),
+                                          SCVLANInterfaceGetTag(c_vlan))) {
+                               if (created) {
+                                       // something went wrong, try to blow the VLAN away
+                                       (void)__destroyInterface(s, c_vlan_if);
+                               } else {
+                                       _SCErrorSet(errno);
+                               }
+                               ok = FALSE;
                        }
                        }
-#endif
-                       break;
                }
                }
+
        }
 
     done :
 
        }
 
     done :
 
-       if (if_name != NULL)    CFAllocatorDeallocate(NULL, if_name);
-       if (buf != NULL)        CFAllocatorDeallocate(NULL, buf);
+       if (active)     CFRelease(active);
+       if (config)     CFRelease(config);
+       if (devices)    CFRelease(devices);
+       if (s != -1)    (void) close(s);
+
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark Deprecated SPIs (remove when no longer referenced)
+
+
+/* ---------- VLAN "device" ---------- */
 
 
-       return isVlan;
+Boolean
+IsVLANSupported(CFStringRef device)
+{
+       return __SCNetworkInterfaceSupportsVLAN(device);
 }
 
 /* ---------- VLANInterface ---------- */
 }
 
 /* ---------- VLANInterface ---------- */
@@ -266,13 +1199,13 @@ __VLANInterfaceCopyDescription(CFTypeRef cf)
 
        result = CFStringCreateMutable(allocator, 0);
        CFStringAppendFormat(result, NULL, CFSTR("<VLANInterface %p [%p]> {"), cf, allocator);
 
        result = CFStringCreateMutable(allocator, 0);
        CFStringAppendFormat(result, NULL, CFSTR("<VLANInterface %p [%p]> {"), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR(" if = %@"), vlanPrivate->ifname);
+       CFStringAppendFormat(result, NULL, CFSTR("if = %@"), vlanPrivate->ifname);
        CFStringAppendFormat(result, NULL, CFSTR(", device = %@"), vlanPrivate->device);
        CFStringAppendFormat(result, NULL, CFSTR(", tag = %@"), vlanPrivate->tag);
        if (vlanPrivate->options != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), vlanPrivate->options);
        }
        CFStringAppendFormat(result, NULL, CFSTR(", device = %@"), vlanPrivate->device);
        CFStringAppendFormat(result, NULL, CFSTR(", tag = %@"), vlanPrivate->tag);
        if (vlanPrivate->options != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), vlanPrivate->options);
        }
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
 }
 
        return result;
 }
@@ -512,13 +1445,6 @@ VLANInterfaceSetOptions(VLANInterfaceRef vlan, CFDictionaryRef newOptions)
 
 /* ---------- VLANPreferences ---------- */
 
 
 /* ---------- VLANPreferences ---------- */
 
-#define        VLAN_PREFERENCES_VLANS          CFSTR("VLANs")
-
-#define        __kVLANInterface_interface      CFSTR("interface")      // e.g. vlan0, vlan1, ...
-#define        __kVLANInterface_device         CFSTR("device")         // e.g. en0, en1, ...
-#define __kVLANInterface_tag           CFSTR("tag")            // e.g. 1 <= tag <= 4094
-#define __kVLANInterface_options       CFSTR("options")        // e.g. UserDefinedName
-
 typedef struct {
 
        /* base CFType information */
 typedef struct {
 
        /* base CFType information */
@@ -642,8 +1568,7 @@ _VLANPreferencesCopyActiveInterfaces()
 
        s = inet_dgram_socket();
        if (s == -1) {
 
        s = inet_dgram_socket();
        if (s == -1) {
-               SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
+               _SCErrorSet(errno);
                goto done;
        }
 
                goto done;
        }
 
@@ -660,7 +1585,7 @@ _VLANPreferencesCopyActiveInterfaces()
                                CFNumberRef             tag;
                                VLANInterfaceRef        vlan;
                                CFStringRef             vlan_if;
                                CFNumberRef             tag;
                                VLANInterfaceRef        vlan;
                                CFStringRef             vlan_if;
-                               char                    vlr_parent[IFNAMSIZ+1];
+                               char                    vlr_parent[IFNAMSIZ + 1];
                                int                     vlr_tag;
                                struct vlanreq          vreq;
 
                                int                     vlr_tag;
                                struct vlanreq          vreq;
 
@@ -680,12 +1605,14 @@ _VLANPreferencesCopyActiveInterfaces()
 
                                if (ioctl(s, SIOCGIFVLAN, (caddr_t)&ifr) == -1) {
                                        SCLog(TRUE, LOG_ERR, CFSTR("ioctl() failed: %s"), strerror(errno));
 
                                if (ioctl(s, SIOCGIFVLAN, (caddr_t)&ifr) == -1) {
                                        SCLog(TRUE, LOG_ERR, CFSTR("ioctl() failed: %s"), strerror(errno));
-                                       _SCErrorSet(kSCStatusFailed);
                                        CFRelease(vlans);
                                        CFRelease(vlans);
+                                       vlans = NULL;
+                                       _SCErrorSet(kSCStatusFailed);
                                        goto done;
                                }
                                vlr_tag = vreq.vlr_tag;
                                        goto done;
                                }
                                vlr_tag = vreq.vlr_tag;
-                               strlcpy(vlr_parent, vreq.vlr_parent, sizeof(vlr_parent));
+                               bzero(&vlr_parent, sizeof(vlr_parent));
+                               bcopy(vreq.vlr_parent, vlr_parent, IFNAMSIZ);
 
                                vlan_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII);
                                device  = CFStringCreateWithCString(NULL, vlr_parent, kCFStringEncodingASCII);
 
                                vlan_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII);
                                device  = CFStringCreateWithCString(NULL, vlr_parent, kCFStringEncodingASCII);
@@ -1302,187 +2229,14 @@ VLANPreferencesCommitChanges(VLANPreferencesRef        prefs)
 Boolean
 _VLANPreferencesUpdateConfiguration(VLANPreferencesRef prefs)
 {
 Boolean
 _VLANPreferencesUpdateConfiguration(VLANPreferencesRef prefs)
 {
-       CFArrayRef                      active          = NULL;
-       CFArrayRef                      config          = NULL;
-       CFMutableDictionaryRef          devices         = NULL;
-       CFIndex                         i;
-       CFIndex                         nActive;
-       CFIndex                         nConfig;
-       Boolean                         ok              = FALSE;
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
-       int                             s               = -1;
-
-       if (!isA_VLANPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       /* configured VLANs */
-       if (prefsPrivate->vlBase != NULL) {
-               /*
-                * updated VLAN preferences have not been committed
-                * so we ignore any in-progress changes and apply the
-                * saved preferences.
-                */
-               config = CFRetain(prefsPrivate->vlBase);
-       } else {
-               /*
-                * apply the saved preferences
-                */
-               config = VLANPreferencesCopyInterfaces(prefs);
-       }
-       nConfig = CFArrayGetCount(config);
-
-       /* [parent] devices */
-       devices = CFDictionaryCreateMutable(NULL,
-                                           0,
-                                           &kCFTypeDictionaryKeyCallBacks,
-                                           &kCFTypeDictionaryValueCallBacks);
-
-       /* active VLANs */
-       active  = _VLANPreferencesCopyActiveInterfaces();
-       nActive = CFArrayGetCount(active);
-
-       /* remove any no-longer-configured VLAN interfaces */
-       for (i = 0; i < nActive; i++) {
-               VLANInterfaceRef        a_vlan;
-               CFStringRef             a_vlan_if;
-               CFIndex                 j;
-               Boolean                 found   = FALSE;
-
-               a_vlan    = CFArrayGetValueAtIndex(active, i);
-               a_vlan_if = VLANInterfaceGetInterface(a_vlan);
-
-               for (j = 0; j < nConfig; j++) {
-                       VLANInterfaceRef        c_vlan;
-                       CFStringRef             c_vlan_if;
-
-                       c_vlan    = CFArrayGetValueAtIndex(config, j);
-                       c_vlan_if = VLANInterfaceGetInterface(c_vlan);
-
-                       if (CFEqual(a_vlan_if, c_vlan_if)) {
-                               found = TRUE;
-                               break;
-                       }
-               }
-
-               if (!found) {
-                       // remove VLAN interface
-                       if (s == -1) {
-                               s = inet_dgram_socket();
-                       }
-
-                       ok = __destroyInterface(s, a_vlan_if);
-                       if (!ok) {
-                               _SCErrorSet(kSCStatusFailed);
-                               goto done;
-                       }
-               }
-       }
-
-       /* create (and update) configured VLAN interfaces */
-       for (i = 0; i < nConfig; i++) {
-               VLANInterfaceRef        c_vlan;
-               CFStringRef             c_vlan_device;
-               CFStringRef             c_vlan_if;
-               Boolean                 found           = FALSE;
-               CFIndex                 j;
-               CFBooleanRef            supported;
-
-               c_vlan        = CFArrayGetValueAtIndex(config, i);
-               c_vlan_device = VLANInterfaceGetDevice(c_vlan);
-               c_vlan_if     = VLANInterfaceGetInterface(c_vlan);
-
-               // determine if the [parent] device supports VLANs
-               supported = CFDictionaryGetValue(devices, c_vlan_device);
-               if (supported == NULL) {
-                       supported = IsVLANSupported(c_vlan_device) ? kCFBooleanTrue
-                                                                  : kCFBooleanFalse;
-                       CFDictionaryAddValue(devices, c_vlan_device, supported);
-               }
-
-               for (j = 0; j < nActive; j++) {
-                       VLANInterfaceRef        a_vlan;
-                       CFStringRef             a_vlan_if;
-
-                       a_vlan    = CFArrayGetValueAtIndex(active, j);
-                       a_vlan_if = VLANInterfaceGetInterface(a_vlan);
-
-                       if (CFEqual(c_vlan_if, a_vlan_if)) {
-                               if (!__VLANInterfaceEquiv(c_vlan, a_vlan)) {
-                                       // update VLAN interface;
-                                       if (s == -1) {
-                                               s = inet_dgram_socket();
-                                       }
-
-                                       if (CFBooleanGetValue(supported)) {
-                                               // if the new [parent] device supports VLANs
-                                               ok = _VLANDevice_unset(s, c_vlan_if);
-                                               if (!ok) {
-                                                       goto done;
-                                               }
-
-                                               ok = _VLANDevice_set(s,
-                                                                    c_vlan_if,
-                                                                    c_vlan_device,
-                                                                    VLANInterfaceGetTag(c_vlan));
-                                               if (!ok) {
-                                                       goto done;
-                                               }
-                                       } else {
-                                               // if the new [parent] device does not support VLANs
-                                               ok = __destroyInterface(s, c_vlan_if);
-                                               if (!ok) {
-                                                       _SCErrorSet(kSCStatusFailed);
-                                                       goto done;
-                                               }
-                                       }
-                               }
-
-                               found = TRUE;
-                               break;
-                       }
-               }
-
-               if (!found && CFBooleanGetValue(supported)) {
-                       // if the [parent] device supports VLANs, add new interface
-                       if (s == -1) {
-                               s = inet_dgram_socket();
-                       }
-
-                       ok = __createInterface(s, c_vlan_if);
-                       if (!ok) {
-                               _SCErrorSet(kSCStatusFailed);
-                               goto done;
-                       }
-
-                       ok = _VLANDevice_set(s,
-                                            c_vlan_if,
-                                            c_vlan_device,
-                                            VLANInterfaceGetTag(c_vlan));
-                       if (!ok) {
-                               goto done;
-                       }
-               }
-
-       }
-
-       ok = TRUE;
-
-    done :
-
-       if (active)     CFRelease(active);
-       if (config)     CFRelease(config);
-       if (devices)    CFRelease(devices);
-       if (s != -1)    (void) close(s);
-
-       return ok;
+       return TRUE;
 }
 
 
 Boolean
 VLANPreferencesApplyChanges(VLANPreferencesRef prefs)
 {
 }
 
 
 Boolean
 VLANPreferencesApplyChanges(VLANPreferencesRef prefs)
 {
+       SCPreferencesRef                defaultPrefs;
        Boolean                         ok              = FALSE;
        VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
 
        Boolean                         ok              = FALSE;
        VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
 
@@ -1500,7 +2254,28 @@ VLANPreferencesApplyChanges(VLANPreferencesRef prefs)
        }
 
        /* apply the VLAN configuration */
        }
 
        /* apply the VLAN configuration */
-       ok = _VLANPreferencesUpdateConfiguration(prefs);
+       defaultPrefs = SCPreferencesCreate(NULL, CFSTR("VLANPreferencesApplyChanges"), NULL);
+       {
+               /*
+                * Note: In an ideal world, we'd simply call SCPreferencesApplyChanges()
+                *       Unfortunately, it's possible that the caller (e.g NetworkCfgTool)
+                *       is holding the lock on the default prefs and since "Apply" attempts
+                *       to grab the lock we could end up in a deadlock situation.
+                */
+#include "SCPreferencesInternal.h"
+               SCPreferencesPrivateRef         defaultPrefsPrivate;
+
+               defaultPrefsPrivate = (SCPreferencesPrivateRef)defaultPrefs;
+
+               pthread_mutex_lock(&defaultPrefsPrivate->lock);
+               if (defaultPrefsPrivate->session == NULL) {
+                       __SCPreferencesAddSession(defaultPrefs);
+               }
+               pthread_mutex_unlock(&defaultPrefsPrivate->lock);
+
+               ok = SCDynamicStoreNotifyValue(defaultPrefsPrivate->session, defaultPrefsPrivate->sessionKeyApply);
+       }
+       CFRelease(defaultPrefs);
        if (!ok) {
                goto done;
        }
        if (!ok) {
                goto done;
        }
index a4892853b27f1e5d4f53cc19d5b2d3e2b7461ba4..00890a15274dc48c20437837ab2355e49f72bba9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -44,58 +44,58 @@ __BEGIN_DECLS
 // ----------
 
 Boolean
 // ----------
 
 Boolean
-IsVLANSupported                        (CFStringRef            device);        // e.g. "en0", "en1", ...
+IsVLANSupported                        (CFStringRef            device)         AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. "en0", "en1", ...
 
 // ----------
 
 CFTypeID
 
 // ----------
 
 CFTypeID
-VLANInterfaceGetTypeID         (void);
+VLANInterfaceGetTypeID         (void)                                  AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 CFStringRef
 
 CFStringRef
-VLANInterfaceGetInterface      (VLANInterfaceRef       vlan);  // returns "vlan0", "vlan1", ...
+VLANInterfaceGetInterface      (VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // returns "vlan0", "vlan1", ...
 
 CFStringRef
 
 CFStringRef
-VLANInterfaceGetDevice         (VLANInterfaceRef       vlan);  // returns "en0", "en1, ...
+VLANInterfaceGetDevice         (VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // returns "en0", "en1, ...
 
 CFNumberRef
 
 CFNumberRef
-VLANInterfaceGetTag            (VLANInterfaceRef       vlan);  // returns 1 <= tag <= 4094
+VLANInterfaceGetTag            (VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // returns 1 <= tag <= 4094
 
 CFDictionaryRef
 
 CFDictionaryRef
-VLANInterfaceGetOptions                (VLANInterfaceRef       vlan);  // e.g. UserDefinedName, ...
+VLANInterfaceGetOptions                (VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. UserDefinedName, ...
 
 // ----------
 
 CFTypeID
 
 // ----------
 
 CFTypeID
-VLANPreferencesGetTypeID       (void);
+VLANPreferencesGetTypeID       (void)                                  AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 VLANPreferencesRef
 
 VLANPreferencesRef
-VLANPreferencesCreate          (CFAllocatorRef         allocator);
+VLANPreferencesCreate          (CFAllocatorRef         allocator)      AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 CFArrayRef /* of VLANInterfaceRef's */
 
 CFArrayRef /* of VLANInterfaceRef's */
-VLANPreferencesCopyInterfaces  (VLANPreferencesRef     prefs);
+VLANPreferencesCopyInterfaces  (VLANPreferencesRef     prefs)          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 VLANInterfaceRef
 VLANPreferencesAddInterface    (VLANPreferencesRef     prefs,
                                 CFStringRef            device,         // e.g. "en0", "en1", ...
                                 CFNumberRef            tag,            // e.g. 1 <= tag <= 4094
 
 VLANInterfaceRef
 VLANPreferencesAddInterface    (VLANPreferencesRef     prefs,
                                 CFStringRef            device,         // e.g. "en0", "en1", ...
                                 CFNumberRef            tag,            // e.g. 1 <= tag <= 4094
-                                CFDictionaryRef        options)      // e.g. UserDefinedName, ...
+                                CFDictionaryRef        options)        AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. UserDefinedName, ...
 
 Boolean
 VLANPreferencesUpdateInterface (VLANPreferencesRef     prefs,
                                 VLANInterfaceRef       vlan,
                                 CFStringRef            newDevice,
                                 CFNumberRef            newTag,
 
 Boolean
 VLANPreferencesUpdateInterface (VLANPreferencesRef     prefs,
                                 VLANInterfaceRef       vlan,
                                 CFStringRef            newDevice,
                                 CFNumberRef            newTag,
-                                CFDictionaryRef        newOptions);
+                                CFDictionaryRef        newOptions)     AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 Boolean
 VLANPreferencesRemoveInterface (VLANPreferencesRef     prefs,
 
 Boolean
 VLANPreferencesRemoveInterface (VLANPreferencesRef     prefs,
-                                VLANInterfaceRef       vlan);
+                                VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 Boolean
 
 Boolean
-VLANPreferencesCommitChanges   (VLANPreferencesRef     prefs);
+VLANPreferencesCommitChanges   (VLANPreferencesRef     prefs)          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 Boolean
 
 Boolean
-VLANPreferencesApplyChanges    (VLANPreferencesRef     prefs);
+VLANPreferencesApplyChanges    (VLANPreferencesRef     prefs)          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
 
 // ----------
 
 
 // ----------
 
diff --git a/SystemConfiguration.fproj/VLANConfigurationPrivate.h b/SystemConfiguration.fproj/VLANConfigurationPrivate.h
deleted file mode 100644 (file)
index 98928fa..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2003-2005 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@
- */
-
-#ifndef _VLANCONFIGURATIONPRIVATE_H
-#define _VLANCONFIGURATIONPRIVATE_H
-
-#include <AvailabilityMacros.h>
-#include <sys/cdefs.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/VLANConfiguration.h>
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-
-/*!
-       @header VLANConfigurationPrivate
- */
-
-
-#define VLAN_PREFERENCES_ID    CFSTR("VirtualNetworkInterfaces.plist")
-
-
-__BEGIN_DECLS
-
-CFArrayRef
-_VLANPreferencesCopyActiveInterfaces   ();
-
-Boolean
-_VLANPreferencesUpdateConfiguration    (VLANPreferencesRef     prefs);
-
-__END_DECLS
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
-
-#endif /* _VLANCONFIGURATIONPRIVATE_H */
index fc9f340e5011ac61487f0c78ace87b3c6669db48..4b09c0a458fc91b2492d43c1be8536183d4827ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -68,7 +68,8 @@ routine configopen    (       server          : mach_port_t;
                                name            : xmlData;
                                options         : xmlData;
                         out    session         : mach_port_move_send_t;
                                name            : xmlData;
                                options         : xmlData;
                         out    session         : mach_port_move_send_t;
-                        out    status          : int);
+                        out    status          : int;
+           ServerAuditToken    audit_token     : audit_token_t);
 
 routine configclose    (       server          : mach_port_t;
                         out    status          : int);
 
 routine configclose    (       server          : mach_port_t;
                         out    status          : int);
index 2cfa849dbbb0d82085748df57d5c4554ffc75414..a9f67a21cab8351890dc462a5e7801801a48aa3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -32,6 +32,9 @@
 #endif
 #define mig_external __private_extern__
 
 #endif
 #define mig_external __private_extern__
 
+/* Turn MIG type checking on by default */
+#define __MigTypeCheck 1
+
 /*
  * Mach server port name
  */
 /*
  * Mach server port name
  */
index f31634d3ed26140c1f6ba6bb88c277567fa4f645..421361dcfe8519717fe31d078e7151694072b69b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/stat.h>
-#include <mach-o/dyld.h>
+#include <dlfcn.h>
 
 #include "dy_framework.h"
 
 
 static void *
 __loadIOKit(void) {
 
 #include "dy_framework.h"
 
 
 static void *
 __loadIOKit(void) {
-       static const void *image = NULL;
+       static void *image = NULL;
        if (NULL == image) {
        if (NULL == image) {
-               const char      *framework              = "/System/Library/Frameworks/IOKit.framework/IOKit";
+               const char      *framework              = "/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit";
                struct stat     statbuf;
                const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
                char            path[MAXPATHLEN];
 
                struct stat     statbuf;
                const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
                char            path[MAXPATHLEN];
 
-               strcpy(path, framework);
-               if (suffix) strcat(path, suffix);
+               strlcpy(path, framework, sizeof(path));
+               if (suffix) strlcat(path, suffix, sizeof(path));
                if (0 <= stat(path, &statbuf)) {
                if (0 <= stat(path, &statbuf)) {
-                       image = NSAddImage(path, NSADDIMAGE_OPTION_NONE);
+                       image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
                } else {
                } else {
-                       image = NSAddImage(framework, NSADDIMAGE_OPTION_NONE);
+                       image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
                }
        }
        return (void *)image;
                }
        }
        return (void *)image;
@@ -65,7 +65,7 @@ _IOBSDNameMatching(mach_port_t masterPort, unsigned int options, const char *bsd
        static typeof (IOBSDNameMatching) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IOBSDNameMatching) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IOBSDNameMatching", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IOBSDNameMatching");
        }
        return dyfunc ? dyfunc(masterPort, options, bsdName) : NULL;
 }
        }
        return dyfunc ? dyfunc(masterPort, options, bsdName) : NULL;
 }
@@ -78,7 +78,7 @@ _IOIteratorNext(io_iterator_t iterator)
        static typeof (IOIteratorNext) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IOIteratorNext) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IOIteratorNext", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IOIteratorNext");
        }
        return dyfunc ? dyfunc(iterator) : 0;
 }
        }
        return dyfunc ? dyfunc(iterator) : 0;
 }
@@ -91,7 +91,7 @@ _IOMasterPort(mach_port_t bootstrapPort, mach_port_t *masterPort)
        static typeof (IOMasterPort) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IOMasterPort) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IOMasterPort", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IOMasterPort");
        }
        return dyfunc ? dyfunc(bootstrapPort, masterPort) : KERN_FAILURE;
 }
        }
        return dyfunc ? dyfunc(bootstrapPort, masterPort) : KERN_FAILURE;
 }
@@ -104,7 +104,7 @@ _IOObjectConformsTo(io_object_t object, const io_name_t className)
        static typeof (IOObjectConformsTo) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IOObjectConformsTo) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IOObjectConformsTo", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IOObjectConformsTo");
        }
        return dyfunc ? dyfunc(object, className) : FALSE;
 }
        }
        return dyfunc ? dyfunc(object, className) : FALSE;
 }
@@ -117,7 +117,7 @@ _IOObjectGetClass(io_object_t object, io_name_t className)
        static typeof (IOObjectGetClass) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IOObjectGetClass) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IOObjectGetClass", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IOObjectGetClass");
        }
        return dyfunc ? dyfunc(object, className) : FALSE;
 }
        }
        return dyfunc ? dyfunc(object, className) : FALSE;
 }
@@ -130,7 +130,7 @@ _IOObjectRelease(io_object_t object)
        static typeof (IOObjectRelease) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IOObjectRelease) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IOObjectRelease", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IOObjectRelease");
        }
        return dyfunc ? dyfunc(object) : KERN_FAILURE;
 }
        }
        return dyfunc ? dyfunc(object) : KERN_FAILURE;
 }
@@ -143,7 +143,7 @@ _IORegistryEntryCreateCFProperty(io_registry_entry_t entry, CFStringRef key, CFA
        static typeof (IORegistryEntryCreateCFProperty) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IORegistryEntryCreateCFProperty) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IORegistryEntryCreateCFProperty", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IORegistryEntryCreateCFProperty");
        }
        return dyfunc ? dyfunc(entry, key, allocator, options) : NULL;
 }
        }
        return dyfunc ? dyfunc(entry, key, allocator, options) : NULL;
 }
@@ -156,7 +156,7 @@ _IORegistryEntryCreateCFProperties(io_registry_entry_t entry, CFMutableDictionar
        static typeof (IORegistryEntryCreateCFProperties) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IORegistryEntryCreateCFProperties) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IORegistryEntryCreateCFProperties", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IORegistryEntryCreateCFProperties");
        }
        return dyfunc ? dyfunc(entry, properties, allocator, options) : KERN_FAILURE;
 }
        }
        return dyfunc ? dyfunc(entry, properties, allocator, options) : KERN_FAILURE;
 }
@@ -169,7 +169,7 @@ _IORegistryEntryCreateIterator(mach_port_t masterPort, const io_name_t plane, IO
        static typeof (IORegistryEntryCreateIterator) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IORegistryEntryCreateIterator) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IORegistryEntryCreateIterator", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IORegistryEntryCreateIterator");
        }
        return dyfunc ? dyfunc(masterPort, plane, options, iterator) : KERN_FAILURE;
 }
        }
        return dyfunc ? dyfunc(masterPort, plane, options, iterator) : KERN_FAILURE;
 }
@@ -182,7 +182,7 @@ _IORegistryEntryGetName(io_registry_entry_t entry, io_name_t name)
        static typeof (IORegistryEntryGetName) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IORegistryEntryGetName) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IORegistryEntryGetName", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IORegistryEntryGetName");
        }
        return dyfunc ? dyfunc(entry, name) : KERN_FAILURE;
 }
        }
        return dyfunc ? dyfunc(entry, name) : KERN_FAILURE;
 }
@@ -195,7 +195,7 @@ _IORegistryEntryGetParentEntry(io_registry_entry_t entry, const io_name_t plane,
        static typeof (IORegistryEntryGetParentEntry) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IORegistryEntryGetParentEntry) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IORegistryEntryGetParentEntry", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IORegistryEntryGetParentEntry");
        }
        return dyfunc ? dyfunc(entry, plane, parent) : KERN_FAILURE;
 }
        }
        return dyfunc ? dyfunc(entry, plane, parent) : KERN_FAILURE;
 }
@@ -208,7 +208,7 @@ _IORegistryEntryGetPath(io_registry_entry_t entry, const io_name_t plane, io_str
        static typeof (IORegistryEntryGetPath) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IORegistryEntryGetPath) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IORegistryEntryGetPath", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IORegistryEntryGetPath");
        }
        return dyfunc ? dyfunc(entry, plane, path) : KERN_FAILURE;
 }
        }
        return dyfunc ? dyfunc(entry, plane, path) : KERN_FAILURE;
 }
@@ -221,7 +221,7 @@ _IORegistryEntrySearchCFProperty(io_registry_entry_t entry, const io_name_t plan
        static typeof (IORegistryEntrySearchCFProperty) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IORegistryEntrySearchCFProperty) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IORegistryEntrySearchCFProperty", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IORegistryEntrySearchCFProperty");
        }
        return dyfunc ? dyfunc(entry, plane, key, allocator, options) : NULL;
 }
        }
        return dyfunc ? dyfunc(entry, plane, key, allocator, options) : NULL;
 }
@@ -234,7 +234,7 @@ _IOServiceGetMatchingServices(mach_port_t masterPort, CFDictionaryRef matching,
        static typeof (IOServiceGetMatchingServices) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IOServiceGetMatchingServices) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IOServiceGetMatchingServices", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IOServiceGetMatchingServices");
        }
        return dyfunc ? dyfunc(masterPort, matching, existing) : KERN_FAILURE;
 }
        }
        return dyfunc ? dyfunc(masterPort, matching, existing) : KERN_FAILURE;
 }
@@ -247,32 +247,140 @@ _IOServiceMatching(const char *name)
        static typeof (IOServiceMatching) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
        static typeof (IOServiceMatching) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadIOKit();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_IOServiceMatching", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "IOServiceMatching");
        }
        return dyfunc ? dyfunc(name) : NULL;
 }
 
 static void *
 __loadSecurity(void) {
        }
        return dyfunc ? dyfunc(name) : NULL;
 }
 
 static void *
 __loadSecurity(void) {
-       static const void *image = NULL;
+       static void *image = NULL;
        if (NULL == image) {
        if (NULL == image) {
-               const char      *framework              = "/System/Library/Frameworks/Security.framework/Security";
+               const char      *framework              = "/System/Library/Frameworks/Security.framework/Versions/A/Security";
                struct stat     statbuf;
                const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
                char            path[MAXPATHLEN];
 
                struct stat     statbuf;
                const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
                char            path[MAXPATHLEN];
 
-               strcpy(path, framework);
-               if (suffix) strcat(path, suffix);
+               strlcpy(path, framework, sizeof(path));
+               if (suffix) strlcat(path, suffix, sizeof(path));
                if (0 <= stat(path, &statbuf)) {
                if (0 <= stat(path, &statbuf)) {
-                       image = NSAddImage(path, NSADDIMAGE_OPTION_NONE);
+                       image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
                } else {
                } else {
-                       image = NSAddImage(framework, NSADDIMAGE_OPTION_NONE);
+                       image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
                }
        }
        return (void *)image;
 }
 
 
                }
        }
        return (void *)image;
 }
 
 
+__private_extern__ OSStatus
+_AuthorizationMakeExternalForm(AuthorizationRef authorization, AuthorizationExternalForm *extForm)
+{
+       #undef AuthorizationMakeExternalForm
+       static typeof (AuthorizationMakeExternalForm) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "AuthorizationMakeExternalForm");
+       }
+       return dyfunc ? dyfunc(authorization, extForm) : -1;
+}
+
+__private_extern__ OSStatus
+_SecAccessCopySelectedACLList(SecAccessRef accessRef, CSSM_ACL_AUTHORIZATION_TAG action, CFArrayRef *aclList)
+{
+       #undef SecAccessCopySelectedACLList
+       static typeof (SecAccessCopySelectedACLList) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecAccessCopySelectedACLList");
+       }
+       return dyfunc ? dyfunc(accessRef, action, aclList) : -1;
+}
+
+__private_extern__ OSStatus
+_SecAccessCreate(CFStringRef descriptor, CFArrayRef trustedlist, SecAccessRef *accessRef)
+{
+       #undef SecAccessCreate
+       static typeof (SecAccessCreate) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecAccessCreate");
+       }
+       return dyfunc ? dyfunc(descriptor, trustedlist, accessRef) : -1;
+}
+
+__private_extern__ OSStatus
+_SecAccessCreateFromOwnerAndACL(const CSSM_ACL_OWNER_PROTOTYPE *owner, uint32 aclCount, const CSSM_ACL_ENTRY_INFO *acls, SecAccessRef *accessRef)
+{
+       #undef SecAccessCreateFromOwnerAndACL
+       static typeof (SecAccessCreateFromOwnerAndACL) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecAccessCreateFromOwnerAndACL");
+       }
+       return dyfunc ? dyfunc(owner, aclCount, acls, accessRef) : -1;
+}
+
+__private_extern__ OSStatus
+_SecKeychainCopyDomainDefault(SecPreferencesDomain domain, SecKeychainRef *keychain)
+{
+       #undef SecKeychainCopyDomainDefault
+       static typeof (SecKeychainCopyDomainDefault) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainCopyDomainDefault");
+       }
+       return dyfunc ? dyfunc(domain, keychain) : -1;
+}
+
+__private_extern__ OSStatus
+_SecKeychainGetPreferenceDomain(SecPreferencesDomain *domain)
+{
+       #undef SecKeychainGetPreferenceDomain
+       static typeof (SecKeychainGetPreferenceDomain) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainGetPreferenceDomain");
+       }
+       return dyfunc ? dyfunc(domain) : -1;
+}
+
+__private_extern__ OSStatus
+_SecKeychainOpen(const char *pathName, SecKeychainRef *keychain)
+{
+       #undef SecKeychainOpen
+       static typeof (SecKeychainOpen) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainOpen");
+       }
+       return dyfunc ? dyfunc(pathName, keychain) : -1;
+}
+
+__private_extern__ OSStatus
+_SecKeychainSetDomainDefault(SecPreferencesDomain domain, SecKeychainRef keychain)
+{
+       #undef SecKeychainSetDomainDefault
+       static typeof (SecKeychainSetDomainDefault) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainSetDomainDefault");
+       }
+       return dyfunc ? dyfunc(domain, keychain) : -1;
+}
+
+__private_extern__ OSStatus
+_SecKeychainSetPreferenceDomain(SecPreferencesDomain domain)
+{
+       #undef SecKeychainSetPreferenceDomain
+       static typeof (SecKeychainSetPreferenceDomain) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainSetPreferenceDomain");
+       }
+       return dyfunc ? dyfunc(domain) : -1;
+}
+
 __private_extern__ OSStatus
 _SecKeychainItemCopyContent(SecKeychainItemRef itemRef, SecItemClass *itemClass, SecKeychainAttributeList *attrList, UInt32 *length, void **outData)
 {
 __private_extern__ OSStatus
 _SecKeychainItemCopyContent(SecKeychainItemRef itemRef, SecItemClass *itemClass, SecKeychainAttributeList *attrList, UInt32 *length, void **outData)
 {
@@ -280,11 +388,59 @@ _SecKeychainItemCopyContent(SecKeychainItemRef itemRef, SecItemClass *itemClass,
        static typeof (SecKeychainItemCopyContent) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
        static typeof (SecKeychainItemCopyContent) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_SecKeychainItemCopyContent", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "SecKeychainItemCopyContent");
        }
        return dyfunc ? dyfunc(itemRef, itemClass, attrList, length, outData) : -1;
 }
 
        }
        return dyfunc ? dyfunc(itemRef, itemClass, attrList, length, outData) : -1;
 }
 
+__private_extern__ OSStatus
+_SecKeychainItemCreateFromContent(SecItemClass itemClass, SecKeychainAttributeList *attrList, UInt32 length, const void *data, SecKeychainRef keychainRef, SecAccessRef initialAccess, SecKeychainItemRef *itemRef)
+{
+       #undef SecKeychainItemCreateFromContent
+       static typeof (SecKeychainItemCreateFromContent) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainItemCreateFromContent");
+       }
+       return dyfunc ? dyfunc(itemClass, attrList, length, data, keychainRef, initialAccess, itemRef) : -1;
+}
+
+__private_extern__ OSStatus
+_SecKeychainItemDelete(SecKeychainItemRef itemRef)
+{
+       #undef SecKeychainItemDelete
+       static typeof (SecKeychainItemDelete) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainItemDelete");
+       }
+       return dyfunc ? dyfunc(itemRef) : -1;
+}
+
+__private_extern__ OSStatus
+_SecKeychainItemFreeContent(SecKeychainAttributeList *attrList, void *data)
+{
+       #undef SecKeychainItemFreeContent
+       static typeof (SecKeychainItemFreeContent) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainItemFreeContent");
+       }
+       return dyfunc ? dyfunc(attrList, data) : -1;
+}
+
+__private_extern__ OSStatus
+_SecKeychainItemModifyContent(SecKeychainItemRef itemRef, const SecKeychainAttributeList *attrList, UInt32 length, const void *data)
+{
+       #undef SecKeychainItemModifyContent
+       static typeof (SecKeychainItemModifyContent) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecKeychainItemModifyContent");
+       }
+       return dyfunc ? dyfunc(itemRef, attrList, length, data) : -1;
+}
+
 __private_extern__ OSStatus
 _SecKeychainSearchCopyNext(SecKeychainSearchRef searchRef, SecKeychainItemRef *itemRef)
 {
 __private_extern__ OSStatus
 _SecKeychainSearchCopyNext(SecKeychainSearchRef searchRef, SecKeychainItemRef *itemRef)
 {
@@ -292,7 +448,7 @@ _SecKeychainSearchCopyNext(SecKeychainSearchRef searchRef, SecKeychainItemRef *i
        static typeof (SecKeychainSearchCopyNext) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
        static typeof (SecKeychainSearchCopyNext) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_SecKeychainSearchCopyNext", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "SecKeychainSearchCopyNext");
        }
        return dyfunc ? dyfunc(searchRef, itemRef) : -1;
 }
        }
        return dyfunc ? dyfunc(searchRef, itemRef) : -1;
 }
@@ -304,7 +460,20 @@ _SecKeychainSearchCreateFromAttributes(CFTypeRef keychainOrArray, SecItemClass i
        static typeof (SecKeychainSearchCreateFromAttributes) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
        static typeof (SecKeychainSearchCreateFromAttributes) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_SecKeychainSearchCreateFromAttributes", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "SecKeychainSearchCreateFromAttributes");
        }
        return dyfunc ? dyfunc(keychainOrArray, itemClass, attrList, searchRef) : -1;
 }
        }
        return dyfunc ? dyfunc(keychainOrArray, itemClass, attrList, searchRef) : -1;
 }
+
+__private_extern__ OSStatus
+_SecTrustedApplicationCreateFromPath(const char *path, SecTrustedApplicationRef *app)
+{
+       #undef SecTrustedApplicationCreateFromPath
+       static typeof (SecTrustedApplicationCreateFromPath) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecTrustedApplicationCreateFromPath");
+       }
+       return dyfunc ? dyfunc(path, app) : -1;
+}
+
index e21bcb8ce73939c347a6243f3a8b47f6e2586a17..e96845deb3a99d660716272f8250c0acff68bf72 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -33,6 +33,9 @@
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
+#pragma mark -
+#pragma mark IOKit.framework APIs
+
 CFMutableDictionaryRef
 _IOBSDNameMatching                     (
                                        mach_port_t             masterPort,
 CFMutableDictionaryRef
 _IOBSDNameMatching                     (
                                        mach_port_t             masterPort,
@@ -148,6 +151,74 @@ _IOServiceMatching                 (
                                        );
 #define IOServiceMatching _IOServiceMatching
 
                                        );
 #define IOServiceMatching _IOServiceMatching
 
+#pragma mark -
+#pragma mark Security.framework APIs
+
+OSStatus
+_AuthorizationMakeExternalForm         (
+                                       AuthorizationRef                authorization,
+                                       AuthorizationExternalForm       *extForm
+                                       );
+#define AuthorizationMakeExternalForm _AuthorizationMakeExternalForm
+
+OSStatus
+_SecAccessCopySelectedACLList          (
+                                       SecAccessRef                    accessRef,
+                                       CSSM_ACL_AUTHORIZATION_TAG      action,
+                                       CFArrayRef                      *aclList
+                                       );
+#define SecAccessCopySelectedACLList _SecAccessCopySelectedACLList
+
+OSStatus
+_SecAccessCreate                       (
+                                       CFStringRef                     descriptor,
+                                       CFArrayRef                      trustedlist,
+                                       SecAccessRef                    *accessRef
+                                       );
+#define SecAccessCreate _SecAccessCreate
+
+OSStatus
+_SecAccessCreateFromOwnerAndACL                (
+                                       const CSSM_ACL_OWNER_PROTOTYPE  *owner,
+                                       uint32                          aclCount,
+                                       const CSSM_ACL_ENTRY_INFO       *acls,
+                                       SecAccessRef                    *accessRef
+                                       );
+#define SecAccessCreateFromOwnerAndACL _SecAccessCreateFromOwnerAndACL
+
+OSStatus
+_SecKeychainCopyDomainDefault          (
+                                       SecPreferencesDomain                    domain,
+                                       SecKeychainRef                          *keychain
+                                       );
+#define SecKeychainCopyDomainDefault _SecKeychainCopyDomainDefault
+
+OSStatus
+_SecKeychainGetPreferenceDomain                (
+                                       SecPreferencesDomain                    *domain
+                                       );
+#define SecKeychainGetPreferenceDomain _SecKeychainGetPreferenceDomain
+
+OSStatus
+_SecKeychainOpen                       (
+                                       const char                              *pathName,
+                                       SecKeychainRef                          *keychain
+                                       );
+#define SecKeychainOpen _SecKeychainOpen
+
+OSStatus
+_SecKeychainSetDomainDefault           (
+                                       SecPreferencesDomain                    domain,
+                                       SecKeychainRef                          keychain
+                                       );
+#define SecKeychainSetDomainDefault _SecKeychainSetDomainDefault
+
+OSStatus
+_SecKeychainSetPreferenceDomain                (
+                                       SecPreferencesDomain                    domain
+                                       );
+#define SecKeychainSetPreferenceDomain _SecKeychainSetPreferenceDomain
+
 OSStatus
 _SecKeychainItemCopyContent            (
                                        SecKeychainItemRef              itemRef,
 OSStatus
 _SecKeychainItemCopyContent            (
                                        SecKeychainItemRef              itemRef,
@@ -158,6 +229,40 @@ _SecKeychainItemCopyContent                (
                                        );
 #define SecKeychainItemCopyContent _SecKeychainItemCopyContent
 
                                        );
 #define SecKeychainItemCopyContent _SecKeychainItemCopyContent
 
+OSStatus
+_SecKeychainItemCreateFromContent      (
+                                       SecItemClass                    itemClass,
+                                       SecKeychainAttributeList        *attrList,
+                                       UInt32                          length,
+                                       const void                      *data,
+                                       SecKeychainRef                  keychainRef,
+                                       SecAccessRef                    initialAccess,
+                                       SecKeychainItemRef              *itemRef
+                                       );
+#define SecKeychainItemCreateFromContent _SecKeychainItemCreateFromContent
+
+OSStatus
+_SecKeychainItemDelete                 (
+                                       SecKeychainItemRef              itemRef
+                                       );
+#define SecKeychainItemDelete _SecKeychainItemDelete
+
+OSStatus
+_SecKeychainItemFreeContent            (
+                                       SecKeychainAttributeList        *attrList,
+                                       void                            *data
+                                       );
+#define SecKeychainItemFreeContent _SecKeychainItemFreeContent
+
+OSStatus
+_SecKeychainItemModifyContent          (
+                                       SecKeychainItemRef              itemRef,
+                                       const SecKeychainAttributeList  *attrList,
+                                       UInt32                          length,
+                                       const void                      *data
+                                       );
+#define SecKeychainItemModifyContent _SecKeychainItemModifyContent
+
 OSStatus
 _SecKeychainSearchCopyNext             (
                                        SecKeychainSearchRef            searchRef,
 OSStatus
 _SecKeychainSearchCopyNext             (
                                        SecKeychainSearchRef            searchRef,
@@ -174,6 +279,13 @@ _SecKeychainSearchCreateFromAttributes     (
                                        );
 #define SecKeychainSearchCreateFromAttributes _SecKeychainSearchCreateFromAttributes
 
                                        );
 #define SecKeychainSearchCreateFromAttributes _SecKeychainSearchCreateFromAttributes
 
+OSStatus
+_SecTrustedApplicationCreateFromPath   (
+                                       const char                      *path,
+                                       SecTrustedApplicationRef        *app
+                                       );
+#define SecTrustedApplicationCreateFromPath _SecTrustedApplicationCreateFromPath
+
 __END_DECLS
 
 #endif /* _DY_FRAMEWORK_H */
 __END_DECLS
 
 #endif /* _DY_FRAMEWORK_H */
index 0601c07067e3eba15e9cadaeb8a69c0cef52bf16..102d693eea96d52de8404fcb03d04880b68838d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -59,7 +59,7 @@
 
 char copyright_string[] =
 "/*\n"
 
 char copyright_string[] =
 "/*\n"
-" * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.\n"
+" * Copyright (c) 2000-2007 Apple Inc. All rights reserved.\n"
 " *\n"
 " * @APPLE_LICENSE_HEADER_START@\n"
 " * \n"
 " *\n"
 " * @APPLE_LICENSE_HEADER_START@\n"
 " * \n"
@@ -87,9 +87,16 @@ typedef enum {
        GROUP,
        SC_10_1,
        SC_10_1_10_4,   // deprecated in 10.4
        GROUP,
        SC_10_1,
        SC_10_1_10_4,   // deprecated in 10.4
+       SC_10_1_10_5,   // deprecated in 10.5
        SC_10_2,
        SC_10_3,
        SC_10_4,
        SC_10_2,
        SC_10_3,
        SC_10_4,
+       SC_10_5,
+       COMMENT_PRIVATE,
+       GROUP_PRIVATE,
+       SC_10_5_PRIVATE,
+       COMMENT_DEPRECATED,
+       GROUP_DEPRECATED,
        END
 } controlType;
 
        END
 } controlType;
 
@@ -114,6 +121,7 @@ typedef enum {
 #define USERSENT               "EntUsers"
 #define USERSPROP              "PropUsers"
 #define VERSION                        "Version"
 #define USERSENT               "EntUsers"
 #define USERSPROP              "PropUsers"
 #define VERSION                        "Version"
+#define VIRTUALPROP            "PropVirtualNetworkInterfaces"
 
 #define CFARRAY_CFNUMBER       "CFArray[CFNumber]"
 #define CFARRAY_CFSTRING       "CFArray[CFString]"
 
 #define CFARRAY_CFNUMBER       "CFArray[CFNumber]"
 #define CFARRAY_CFSTRING       "CFArray[CFString]"
@@ -124,10 +132,12 @@ typedef enum {
 #define CFNUMBER_BOOL          "CFNumber (0 or 1)"
 #define CFSTRING               "CFString"
 
 #define CFNUMBER_BOOL          "CFNumber (0 or 1)"
 #define CFSTRING               "CFString"
 
+#define ACCESSPOINTNAME                "AccessPointName"
 #define ACSP                   "ACSP"                  // Apple Client Server Protocol
 #define ACTIVE                 "Active"
 #define ADDRESSES              "Addresses"
 #define AFTER                  "After"
 #define ACSP                   "ACSP"                  // Apple Client Server Protocol
 #define ACTIVE                 "Active"
 #define ADDRESSES              "Addresses"
 #define AFTER                  "After"
+#define AGGRESSIVE             "Aggressive"
 #define AIRPORT                        "AirPort"
 #define ALERT                  "Alert"
 #define ALLOWNETCREATION       "AllowNetCreation"
 #define AIRPORT                        "AirPort"
 #define ALERT                  "Alert"
 #define ALLOWNETCREATION       "AllowNetCreation"
@@ -135,28 +145,34 @@ typedef enum {
 #define ANYREGEX               "AnyRegex"
 #define APPLETALK              "AppleTalk"
 #define AUTH                   "Auth"
 #define ANYREGEX               "AnyRegex"
 #define APPLETALK              "AppleTalk"
 #define AUTH                   "Auth"
+#define AUTHENTICATIONMETHOD   "AuthenticationMethod"
 #define AUTOCONFIG             "AutoConfig"
 #define AUTODISCOVERY          "AutoDiscovery"
 #define AUTOMATIC              "Automatic"
 #define BEFORE                 "Before"
 #define BINDINGMETHODS         "BindingMethods"
 #define AUTOCONFIG             "AutoConfig"
 #define AUTODISCOVERY          "AutoDiscovery"
 #define AUTOMATIC              "Automatic"
 #define BEFORE                 "Before"
 #define BINDINGMETHODS         "BindingMethods"
+#define        BOND                    "Bond"
 #define BOOTP                  "BOOTP"
 #define BROADCAST              "Broadcast"
 #define CALLWAITINGAUDIBLEALERT        "CallWaitingAudibleAlert"
 #define CAUSE                  "Cause"
 #define CCP                    "CCP"
 #define CHAP                   "CHAP"
 #define BOOTP                  "BOOTP"
 #define BROADCAST              "Broadcast"
 #define CALLWAITINGAUDIBLEALERT        "CallWaitingAudibleAlert"
 #define CAUSE                  "Cause"
 #define CCP                    "CCP"
 #define CHAP                   "CHAP"
+#define CERTIFICATE            "Certificate"
 #define COMM                   "Comm"
 #define COMM                   "Comm"
+#define COMPATIBLE             "Compatible"
 #define COMPRESSIONACFIELD     "CompressionACField"
 #define COMPRESSIONPFIELD      "CompressionPField"
 #define COMPRESSIONVJ          "CompressionVJ"
 #define COMPUTERNAME           "ComputerName"
 #define CONFIGMETHOD           "ConfigMethod"
 #define CONNECTDELAY           "ConnectDelay"
 #define COMPRESSIONACFIELD     "CompressionACField"
 #define COMPRESSIONPFIELD      "CompressionPField"
 #define COMPRESSIONVJ          "CompressionVJ"
 #define COMPUTERNAME           "ComputerName"
 #define CONFIGMETHOD           "ConfigMethod"
 #define CONNECTDELAY           "ConnectDelay"
-#define CONNECTIONSCRIPT       "ConnectionScript"
+#define CONNECTION             "Connection"
 #define CONNECTSPEED           "ConnectSpeed"
 #define CONNECTTIME            "ConnectTime"
 #define CONNECTSPEED           "ConnectSpeed"
 #define CONNECTTIME            "ConnectTime"
+#define CONSERVATIVE           "Conservative"
 #define CONSOLEUSER            "ConsoleUser"
 #define CONSOLEUSER            "ConsoleUser"
+#define CONTEXTID              "ContextID"
 #define CURRENTSET             "CurrentSet"
 #define DATACOMPRESSION                "DataCompression"
 #define DEFAULT                        "Default"
 #define CURRENTSET             "CurrentSet"
 #define DATACOMPRESSION                "DataCompression"
 #define DEFAULT                        "Default"
@@ -181,6 +197,7 @@ typedef enum {
 #define DOMAIN                         "Domain"
 #define DOMAINS                        "Domains"
 #define EAP                    "EAP"
 #define DOMAIN                         "Domain"
 #define DOMAINS                        "Domains"
 #define EAP                    "EAP"
+#define EAPOL                  "EAPOL"
 #define ECHO                   "Echo"
 #define ECHOFAILURE            "EchoFailure"
 #define ECHOINTERVAL           "EchoInterval"
 #define ECHO                   "Echo"
 #define ECHOFAILURE            "EchoFailure"
 #define ECHOINTERVAL           "EchoInterval"
@@ -192,6 +209,7 @@ typedef enum {
 #define ETHERNET               "Ethernet"
 #define EXCEPTIONSLIST         "ExceptionsList"
 #define EXCLUDESIMPLEHOSTNAMES "ExcludeSimpleHostnames"
 #define ETHERNET               "Ethernet"
 #define EXCEPTIONSLIST         "ExceptionsList"
 #define EXCLUDESIMPLEHOSTNAMES "ExcludeSimpleHostnames"
+#define FAILOVER               "Failover"
 #define FILE                   "File"
 #define FIREWIRE               "FireWire"
 #define FIRST                  "First"
 #define FILE                   "File"
 #define FIREWIRE               "FireWire"
 #define FIRST                  "First"
@@ -201,13 +219,17 @@ typedef enum {
 #define GLOBAL                 "Global"
 #define GOPHER                 "Gopher"
 #define HARDWARE               "Hardware"
 #define GLOBAL                 "Global"
 #define GOPHER                 "Gopher"
 #define HARDWARE               "Hardware"
+#define HIGH                   "High"
 #define HOLD                   "Hold"
 #define HOLD                   "Hold"
+#define HOSTNAME               "HostName"
 #define HOSTNAMES              "HostNames"
 #define HTTP                   "HTTP"
 #define HTTPS                  "HTTPS"
 #define HOSTNAMES              "HostNames"
 #define HTTP                   "HTTP"
 #define HTTPS                  "HTTPS"
+#define HYBRID                 "Hybrid"
 #define IDLEREMINDER           "IdleReminder"
 #define IDLEREMINDERTIMER      "IdleReminderTimer"
 #define IGNOREDIALTONE         "IgnoreDialTone"
 #define IDLEREMINDER           "IdleReminder"
 #define IDLEREMINDERTIMER      "IdleReminderTimer"
 #define IGNOREDIALTONE         "IgnoreDialTone"
+#define IGNORELINKSTATUS       "IgnoreLinkStatus"
 #define INACTIVE               "Inactive"
 #define INFORM                 "INFORM"
 #define INTERFACE              "Interface"
 #define INACTIVE               "Inactive"
 #define INFORM                 "INFORM"
 #define INTERFACE              "Interface"
@@ -218,20 +240,27 @@ typedef enum {
 #define IPV4                   "IPv4"
 #define IPV6                   "IPv6"
 #define IPSEC                  "IPSec"
 #define IPV4                   "IPv4"
 #define IPV6                   "IPv6"
 #define IPSEC                  "IPSec"
-#define JOINMODE               "JoinMode"
+#define JOIN                   "Join"
 #define KEYCHAIN               "Keychain"
 #define KEYCHAIN               "Keychain"
+#define KEYID                  "KeyID"
 #define L2TP                   "L2TP"
 #define LAST                   "Last"
 #define LCP                    "LCP"
 #define LINK                   "Link"
 #define LINKLOCAL              "LinkLocal"
 #define L2TP                   "L2TP"
 #define LAST                   "Last"
 #define LCP                    "LCP"
 #define LINK                   "Link"
 #define LINKLOCAL              "LinkLocal"
+#define LOCALCERTIFICATE       "LocalCertificate"
 #define LOCALHOSTNAME          "LocalHostName"
 #define LOCALHOSTNAME          "LocalHostName"
+#define LOCALIDENTIFIER                "LocalIdentifier"
 #define LOGFILE                        "Logfile"
 #define LOGFILE                        "Logfile"
+#define LOW                    "Low"
 #define MACADDRESS             "MACAddress"
 #define MANUAL                 "Manual"
 #define MATCH                  "Match"
 #define MEDIA                  "Media"
 #define MACADDRESS             "MACAddress"
 #define MANUAL                 "Manual"
 #define MATCH                  "Match"
 #define MEDIA                  "Media"
+#define MIXED                  "Mixed"
+#define MODEL                  "Model"
 #define OPTIONS                        "Options"
 #define OPTIONS                        "Options"
+#define MODE                   "Mode"
 #define MODEM                  "Modem"
 #define MPPE40                 "MPPE40"
 #define MPPE128                        "MPPE128"
 #define MODEM                  "Modem"
 #define MPPE40                 "MPPE40"
 #define MPPE128                        "MPPE128"
@@ -240,6 +269,7 @@ typedef enum {
 #define MSCHAP2                        "MSCHAP2"
 #define MTU                    "MTU"
 #define NAME                   "Name"
 #define MSCHAP2                        "MSCHAP2"
 #define MTU                    "MTU"
 #define NAME                   "Name"
+#define NETBIOS                        "NetBIOS"
 #define NETINFO                        "NetInfo"
 #define NETWORK                        "Network"
 #define NETWORKID              "NetworkID"
 #define NETINFO                        "NetInfo"
 #define NETWORK                        "Network"
 #define NETWORKID              "NetworkID"
@@ -248,13 +278,15 @@ typedef enum {
 #define NODE                   "Node"
 #define NODEID                 "NodeID"
 #define NOTE                   "Note"
 #define NODE                   "Node"
 #define NODEID                 "NodeID"
 #define NOTE                   "Note"
+#define ONDEMAND               "OnDemand"
 #define ORDER                  "Order"
 #define ORDERS                 "Orders"
 #define OVERRIDEPRIMARY                "OverridePrimary"
 #define PAP                    "PAP"
 #define PASSIVE                        "Passive"
 #define PASSWORD               "Password"
 #define ORDER                  "Order"
 #define ORDERS                 "Orders"
 #define OVERRIDEPRIMARY                "OverridePrimary"
 #define PAP                    "PAP"
 #define PASSIVE                        "Passive"
 #define PASSWORD               "Password"
-#define PEERDNS                        "PeerDNS"
+#define PEER                   "Peer"
+#define PERSONALITY            "Personality"
 #define PLUGIN                 "Plugin"
 #define PLUGINS                        "Plugins"
 #define POWER                  "Power"
 #define PLUGIN                 "Plugin"
 #define PLUGINS                        "Plugins"
 #define POWER                  "Power"
@@ -268,16 +300,19 @@ typedef enum {
 #define PREFS                  "Prefs"
 #define PRIMARYINTERFACE       "PrimaryInterface"
 #define PRIMARYSERVICE         "PrimaryService"
 #define PREFS                  "Prefs"
 #define PRIMARYINTERFACE       "PrimaryInterface"
 #define PRIMARYSERVICE         "PrimaryService"
+#define PRIORITY               "Priority"
 #define PROMPT                 "Prompt"
 #define PROTOCOL               "Protocol"
 #define PROXIES                        "Proxies"
 #define PROXY                  "Proxy"
 #define PULSEDIAL              "PulseDial"
 #define PROMPT                 "Prompt"
 #define PROTOCOL               "Protocol"
 #define PROXIES                        "Proxies"
 #define PROXY                  "Proxy"
 #define PULSEDIAL              "PulseDial"
+#define RANKED                 "Ranked"
 #define RECEIVEACCM            "ReceiveACCM"
 #define RECENT                 "Recent"
 #define REDIALCOUNT            "RedialCount"
 #define REDIAL                 "Redial"
 #define REDIALINTERVAL         "RedialInterval"
 #define RECEIVEACCM            "ReceiveACCM"
 #define RECENT                 "Recent"
 #define REDIALCOUNT            "RedialCount"
 #define REDIAL                 "Redial"
 #define REDIALINTERVAL         "RedialInterval"
+#define REGION                 "Region"
 #define RELAY                  "Relay"
 #define REMINDER               "Reminder"
 #define REMINDERTIME           "ReminderTime"
 #define RELAY                  "Relay"
 #define REMINDER               "Reminder"
 #define REMINDERTIME           "ReminderTime"
@@ -288,6 +323,8 @@ typedef enum {
 #define ROUTERADVERTISEMENT    "RouterAdvertisement"
 #define RTSP                   "RTSP"
 #define SAVEPASSWORDS          "SavePasswords"
 #define ROUTERADVERTISEMENT    "RouterAdvertisement"
 #define RTSP                   "RTSP"
 #define SAVEPASSWORDS          "SavePasswords"
+#define SCOPE                  "Scope"
+#define SCRIPT                 "Script"
 #define SEARCH                 "Search"
 #define SEEDNETWORKRANGE       "SeedNetworkRange"
 #define SEEDROUTER             "SeedRouter"
 #define SEARCH                 "Search"
 #define SEEDNETWORKRANGE       "SeedNetworkRange"
 #define SEEDROUTER             "SeedRouter"
@@ -299,6 +336,7 @@ typedef enum {
 #define SETS                   "Sets"
 #define SETUP                  "Setup"
 #define        SHAREDSECRET            "SharedSecret"
 #define SETS                   "Sets"
 #define SETUP                  "Setup"
 #define        SHAREDSECRET            "SharedSecret"
+#define SMB                    "SMB"
 #define SOCKS                  "SOCKS"
 #define SORTLIST               "SortList"
 #define SPEAKER                        "Speaker"
 #define SOCKS                  "SOCKS"
 #define SORTLIST               "SortList"
 #define SPEAKER                        "Speaker"
@@ -316,6 +354,7 @@ typedef enum {
 #define TAGS                   "Tags"
 #define TERMINALSCRIPT         "TerminalScript"
 #define TIMEOUT                        "Timeout"
 #define TAGS                   "Tags"
 #define TERMINALSCRIPT         "TerminalScript"
 #define TIMEOUT                        "Timeout"
+#define TOKEN                  "Token"
 #define TRANSMITACCM           "TransmitACCM"
 #define TRANSPORT              "Transport"
 #define TYPE                   "Type"
 #define TRANSMITACCM           "TransmitACCM"
 #define TRANSPORT              "Transport"
 #define TYPE                   "Type"
@@ -325,16 +364,23 @@ typedef enum {
 #define USERDEFINEDNAME                "UserDefinedName"
 #define USE                    "Use"
 #define USERS                  "Users"
 #define USERDEFINEDNAME                "UserDefinedName"
 #define USE                    "Use"
 #define USERS                  "Users"
+#define VENDOR                 "Vendor"
 #define VERBOSELOGGING         "VerboseLogging"
 #define VERBOSELOGGING         "VerboseLogging"
+#define VIRTUALNETWORKINTERFACES       "VirtualNetworkInterfaces"
+#define        VLAN                    "VLAN"
 #define WAITFORDIALTONE                "WaitForDialTone"
 #define WAITFORDIALTONE                "WaitForDialTone"
+#define WINS                   "WINS"
+#define WORKGROUP              "Workgroup"
 
 
-struct {
+typedef struct {
     int                                control;
     const char *               prefix;
     const char *               key;
     const char *               value;
     const char *               type;
     int                                control;
     const char *               prefix;
     const char *               key;
     const char *               value;
     const char *               type;
-} names[] = {
+} schemaDefinition;
+
+static schemaDefinition names[] = {
 
   { GROUP, NULL, "Reserved Keys", NULL, NULL },
 
 
   { GROUP, NULL, "Reserved Keys", NULL, NULL },
 
@@ -358,6 +404,11 @@ struct {
     { SC_10_1, PREF, SYSTEM, NULL, CFDICTIONARY },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_1, PREF, SYSTEM, NULL, CFDICTIONARY },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, PREF, "Preference Keys", NULL, NULL },
+
+    { SC_10_5_PRIVATE, PREF, VIRTUALNETWORKINTERFACES, NULL, CFDICTIONARY },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
   { GROUP, COMP, "Component Keys", NULL, NULL },
 
     { SC_10_1, COMP, NETWORK, NULL, NULL },
   { GROUP, COMP, "Component Keys", NULL, NULL },
 
     { SC_10_1, COMP, NETWORK, NULL, NULL },
@@ -382,27 +433,39 @@ struct {
     { SC_10_1, NETENT, ETHERNET, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, FIREWIRE, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, INTERFACE, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, ETHERNET, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, FIREWIRE, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, INTERFACE, NULL, CFDICTIONARY },
+    { SC_10_5, NETENT, IPSEC, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, IPV4, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, IPV6, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, L2TP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, LINK, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, MODEM, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, IPV4, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, IPV6, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, L2TP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, LINK, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, MODEM, NULL, CFDICTIONARY },
-    { SC_10_1, NETENT, NETINFO, NULL, CFDICTIONARY },
+    { SC_10_1_10_5, NETENT, NETINFO, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PPP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PPPOE, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, PPPSERIAL, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, PPTP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PROXIES, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PPP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PPPOE, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, PPPSERIAL, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, PPTP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PROXIES, NULL, CFDICTIONARY },
+    { SC_10_5, NETENT, SMB, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, STF, NULL, CFDICTIONARY },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_3, NETENT, STF, NULL, CFDICTIONARY },
     { COMMENT, "", NULL, NULL, NULL },
 
-  { GROUP, NETPROP AIRPORT, KEY_PREFIX COMP NETWORK " Properties", NULL, NULL },
+  { GROUP_PRIVATE, NETENT, "Network Entity Keys", NULL, NULL },
+
+    { SC_10_5_PRIVATE, NETENT, EAPOL, NULL, CFDICTIONARY },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
+  { GROUP, NETPROP, KEY_PREFIX COMP NETWORK " Properties", NULL, NULL },
 
     { SC_10_2, NETPROP, OVERRIDEPRIMARY, NULL, CFNUMBER_BOOL },
     { SC_10_1, NETPROP, SERVICE ORDER, NULL, CFARRAY_CFSTRING },
     { SC_10_1, NETPROP, PPP OVERRIDEPRIMARY, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
 
 
     { SC_10_2, NETPROP, OVERRIDEPRIMARY, NULL, CFNUMBER_BOOL },
     { SC_10_1, NETPROP, SERVICE ORDER, NULL, CFARRAY_CFSTRING },
     { SC_10_1, NETPROP, PPP OVERRIDEPRIMARY, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP, KEY_PREFIX COMP NETWORK " Properties", NULL, NULL },
+
+    { SC_10_5_PRIVATE, NETPROP, IGNORELINKSTATUS, NULL, CFBOOLEAN },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL }, 
+       
   { GROUP, NETPROP AIRPORT, KEY_PREFIX COMP NETWORK INTERFACE " Properties", NULL, NULL },
 
     { SC_10_2, NETPROP, INTERFACES, NULL, CFARRAY_CFSTRING },
   { GROUP, NETPROP AIRPORT, KEY_PREFIX COMP NETWORK INTERFACE " Properties", NULL, NULL },
 
     { SC_10_2, NETPROP, INTERFACES, NULL, CFARRAY_CFSTRING },
@@ -418,16 +481,17 @@ struct {
     { SC_10_2, NETPROP AIRPORT, ALLOWNETCREATION, NULL, CFNUMBER_BOOL },
     { SC_10_1, NETPROP AIRPORT, AUTH PASSWORD, NULL, CFDATA },
     { SC_10_1, NETPROP AIRPORT, AUTH PASSWORD ENCRYPTION, NULL, CFSTRING },
     { SC_10_2, NETPROP AIRPORT, ALLOWNETCREATION, NULL, CFNUMBER_BOOL },
     { SC_10_1, NETPROP AIRPORT, AUTH PASSWORD, NULL, CFDATA },
     { SC_10_1, NETPROP AIRPORT, AUTH PASSWORD ENCRYPTION, NULL, CFSTRING },
-    { SC_10_2, NETPROP AIRPORT, JOINMODE, NULL, CFSTRING },
+    { SC_10_2, NETPROP AIRPORT, JOIN MODE, NULL, CFSTRING },
     { SC_10_1, NETPROP AIRPORT, POWER ENABLED, NULL, CFNUMBER_BOOL },
     { SC_10_1, NETPROP AIRPORT, PREFERRED NETWORK, NULL, CFSTRING },
     { SC_10_2, NETPROP AIRPORT, SAVEPASSWORDS, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
     { SC_10_1, NETPROP AIRPORT, POWER ENABLED, NULL, CFNUMBER_BOOL },
     { SC_10_1, NETPROP AIRPORT, PREFERRED NETWORK, NULL, CFSTRING },
     { SC_10_2, NETPROP AIRPORT, SAVEPASSWORDS, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
-    { COMMENT, "--- " KEY_PREFIX NETPROP AIRPORT JOINMODE " values ---", NULL, NULL, NULL },
-    { SC_10_3, NETVAL AIRPORT JOINMODE, AUTOMATIC, NULL, NULL },
-    { SC_10_2, NETVAL AIRPORT JOINMODE, PREFERRED, NULL, NULL },
-    { SC_10_2, NETVAL AIRPORT JOINMODE, RECENT, NULL, NULL },
-    { SC_10_2, NETVAL AIRPORT JOINMODE, STRONGEST, NULL, NULL },
+    { COMMENT, "--- " KEY_PREFIX NETPROP AIRPORT JOIN MODE " values ---", NULL, NULL, NULL },
+    { SC_10_3, NETVAL AIRPORT JOIN MODE, AUTOMATIC, NULL, NULL },
+    { SC_10_2, NETVAL AIRPORT JOIN MODE, PREFERRED, NULL, NULL },
+    { SC_10_4, NETVAL AIRPORT JOIN MODE, RANKED, NULL, NULL },
+    { SC_10_2, NETVAL AIRPORT JOIN MODE, RECENT, NULL, NULL },
+    { SC_10_2, NETVAL AIRPORT JOIN MODE, STRONGEST, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP AIRPORT PASSWORD ENCRYPTION " values ---", NULL, NULL, NULL },
     { SC_10_3, NETVAL AIRPORT AUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP AIRPORT PASSWORD ENCRYPTION " values ---", NULL, NULL, NULL },
     { SC_10_3, NETVAL AIRPORT AUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL },
@@ -498,6 +562,26 @@ struct {
     { SC_10_3, NETVAL INTERFACE SUBTYPE, L2TP, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_3, NETVAL INTERFACE SUBTYPE, L2TP, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP, NETPROP IPSEC, KEY_PREFIX NETENT IPSEC " Entity Keys", NULL, NULL },
+
+    { SC_10_5, NETPROP IPSEC, LOCALIDENTIFIER, NULL, CFSTRING },
+    { SC_10_5, NETPROP IPSEC, LOCALIDENTIFIER TYPE, NULL, CFSTRING },
+    { SC_10_5, NETPROP IPSEC, AUTHENTICATIONMETHOD, NULL, CFSTRING },
+    { SC_10_5, NETPROP IPSEC, SHAREDSECRET, NULL, CFSTRING },
+    { SC_10_5, NETPROP IPSEC, SHAREDSECRET ENCRYPTION, NULL, CFSTRING },
+    { SC_10_5, NETPROP IPSEC, LOCALCERTIFICATE, NULL, CFDATA },
+    { COMMENT, "", NULL, NULL, NULL },
+    { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC AUTHENTICATIONMETHOD " values ---", NULL, NULL, NULL },
+    { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, SHAREDSECRET, NULL, NULL },
+    { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, CERTIFICATE, NULL, NULL },
+    { COMMENT, "", NULL, NULL, NULL },
+    { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC SHAREDSECRET ENCRYPTION " values ---", NULL, NULL, NULL },
+    { SC_10_5, NETVAL IPSEC SHAREDSECRET ENCRYPTION, KEYCHAIN, NULL, NULL },
+    { COMMENT, "", NULL, NULL, NULL },
+    { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC LOCALIDENTIFIER TYPE " values ---", NULL, NULL, NULL },
+    { SC_10_5, NETVAL IPSEC LOCALIDENTIFIER TYPE, KEYID, NULL, NULL },
+    { COMMENT, "", NULL, NULL, NULL },
+
   { GROUP, NETPROP IPV4, KEY_PREFIX NETENT IPV4 " Entity Keys", NULL, NULL },
 
     { SC_10_1, NETPROP IPV4, ADDRESSES, NULL, CFARRAY_CFSTRING },
   { GROUP, NETPROP IPV4, KEY_PREFIX NETENT IPV4 " Entity Keys", NULL, NULL },
 
     { SC_10_1, NETPROP IPV4, ADDRESSES, NULL, CFARRAY_CFSTRING },
@@ -517,6 +601,11 @@ struct {
     { SC_10_1, NETVAL IPV4 CONFIGMETHOD, PPP, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_1, NETVAL IPV4 CONFIGMETHOD, PPP, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP IPV4, KEY_PREFIX NETENT IPV4 " Entity Keys", NULL, NULL },
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP IPV4 CONFIGMETHOD " values ---", NULL, NULL, NULL },
+    { SC_10_5_PRIVATE, NETVAL IPV4 CONFIGMETHOD, FAILOVER, NULL, NULL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
   { GROUP, NETPROP IPV6, KEY_PREFIX NETENT IPV6 " Entity Keys", NULL, NULL },
 
     { SC_10_1, NETPROP IPV6, ADDRESSES, NULL, CFARRAY_CFSTRING },
   { GROUP, NETPROP IPV6, KEY_PREFIX NETENT IPV6 " Entity Keys", NULL, NULL },
 
     { SC_10_1, NETPROP IPV6, ADDRESSES, NULL, CFARRAY_CFSTRING },
@@ -546,9 +635,14 @@ struct {
 
   { GROUP, NETPROP MODEM, KEY_PREFIX NETENT MODEM " (Hardware) Entity Keys", NULL, NULL },
 
 
   { GROUP, NETPROP MODEM, KEY_PREFIX NETENT MODEM " (Hardware) Entity Keys", NULL, NULL },
 
-    { SC_10_1, NETPROP MODEM, CONNECTIONSCRIPT, NULL, CFSTRING },
+    { SC_10_5, NETPROP MODEM, ACCESSPOINTNAME, NULL, CFSTRING },
+    { SC_10_5, NETPROP MODEM, CONNECTION PERSONALITY, NULL, CFSTRING },
+    { SC_10_1, NETPROP MODEM, CONNECTION SCRIPT, NULL, CFSTRING },
     { SC_10_2, NETPROP MODEM, CONNECTSPEED, NULL, CFNUMBER },
     { SC_10_1, NETPROP MODEM, DATACOMPRESSION, NULL, CFNUMBER_BOOL },
     { SC_10_2, NETPROP MODEM, CONNECTSPEED, NULL, CFNUMBER },
     { SC_10_1, NETPROP MODEM, DATACOMPRESSION, NULL, CFNUMBER_BOOL },
+    { SC_10_5, NETPROP MODEM, DEVICE CONTEXTID, NULL, CFSTRING },
+    { SC_10_5, NETPROP MODEM, DEVICE MODEL, NULL, CFSTRING },
+    { SC_10_5, NETPROP MODEM, DEVICE VENDOR, NULL, CFSTRING },
     { SC_10_1, NETPROP MODEM, DIALMODE, NULL, CFSTRING },
     { SC_10_1, NETPROP MODEM, ERRORCORRECTION, NULL, CFNUMBER_BOOL },
     { SC_10_2, NETPROP MODEM, HOLD CALLWAITINGAUDIBLEALERT, NULL, CFNUMBER_BOOL },
     { SC_10_1, NETPROP MODEM, DIALMODE, NULL, CFSTRING },
     { SC_10_1, NETPROP MODEM, ERRORCORRECTION, NULL, CFNUMBER_BOOL },
     { SC_10_2, NETPROP MODEM, HOLD CALLWAITINGAUDIBLEALERT, NULL, CFNUMBER_BOOL },
@@ -567,21 +661,21 @@ struct {
     { SC_10_1, NETVAL MODEM DIALMODE, WAITFORDIALTONE, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_1, NETVAL MODEM DIALMODE, WAITFORDIALTONE, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
-  { GROUP, NETPROP NETINFO, KEY_PREFIX NETENT NETINFO " Entity Keys", NULL, NULL },
-
-    { SC_10_1, NETPROP NETINFO, BINDINGMETHODS, NULL, CFSTRING },
-    { SC_10_1, NETPROP NETINFO, SERVER ADDRESSES, NULL, CFARRAY_CFSTRING },
-    { SC_10_1, NETPROP NETINFO, SERVER TAGS, NULL, CFARRAY_CFSTRING },
-    { SC_10_1, NETPROP NETINFO, BROADCAST SERVER TAG, NULL, CFSTRING },
-    { COMMENT, "", NULL, NULL, NULL },
-    { COMMENT, "--- " KEY_PREFIX NETPROP NETINFO BINDINGMETHODS " values ---", NULL, NULL, NULL },
-    { SC_10_1, NETVAL NETINFO BINDINGMETHODS, BROADCAST, NULL, NULL },
-    { SC_10_1, NETVAL NETINFO BINDINGMETHODS, DHCP, NULL, NULL },
-    { SC_10_1, NETVAL NETINFO BINDINGMETHODS, MANUAL, NULL, NULL },
-    { COMMENT, "", NULL, NULL, NULL },
-    { COMMENT, "--- " KEY_PREFIX NETPROP NETINFO BROADCAST SERVER TAG " default value ---", NULL, NULL, NULL },
-    { SC_10_1, NETVAL NETINFO, DEFAULT SERVER TAG, "network", NULL },
-    { COMMENT, "", NULL, NULL, NULL },
+  { GROUP_DEPRECATED, NETPROP NETINFO, KEY_PREFIX NETENT NETINFO " Entity Keys", NULL, NULL },
+
+    { SC_10_1_10_5, NETPROP NETINFO, BINDINGMETHODS, NULL, CFSTRING },
+    { SC_10_1_10_5, NETPROP NETINFO, SERVER ADDRESSES, NULL, CFARRAY_CFSTRING },
+    { SC_10_1_10_5, NETPROP NETINFO, SERVER TAGS, NULL, CFARRAY_CFSTRING },
+    { SC_10_1_10_5, NETPROP NETINFO, BROADCAST SERVER TAG, NULL, CFSTRING },
+    { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
+    { COMMENT_DEPRECATED, "--- " KEY_PREFIX NETPROP NETINFO BINDINGMETHODS " values ---", NULL, NULL, NULL },
+    { SC_10_1_10_5, NETVAL NETINFO BINDINGMETHODS, BROADCAST, NULL, NULL },
+    { SC_10_1_10_5, NETVAL NETINFO BINDINGMETHODS, DHCP, NULL, NULL },
+    { SC_10_1_10_5, NETVAL NETINFO BINDINGMETHODS, MANUAL, NULL, NULL },
+    { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
+    { COMMENT_DEPRECATED, "--- " KEY_PREFIX NETPROP NETINFO BROADCAST SERVER TAG " default value ---", NULL, NULL, NULL },
+    { SC_10_1_10_5, NETVAL NETINFO, DEFAULT SERVER TAG, "network", NULL },
+    { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
 
   { GROUP, NETPROP PPP, KEY_PREFIX NETENT PPP " Entity Keys", NULL, NULL },
 
 
   { GROUP, NETPROP PPP, KEY_PREFIX NETENT PPP " Entity Keys", NULL, NULL },
 
@@ -617,6 +711,7 @@ struct {
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP PPP AUTH PASSWORD ENCRYPTION " values ---", NULL, NULL, NULL },
     { SC_10_3, NETVAL PPP AUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP PPP AUTH PASSWORD ENCRYPTION " values ---", NULL, NULL, NULL },
     { SC_10_3, NETVAL PPP AUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL },
+    { SC_10_5, NETVAL PPP AUTH PASSWORD ENCRYPTION, TOKEN, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP PPP AUTH PROMPT " values ---", NULL, NULL, NULL },
     { SC_10_3, NETVAL PPP AUTH PROMPT, BEFORE, NULL, CFSTRING },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP PPP AUTH PROMPT " values ---", NULL, NULL, NULL },
     { SC_10_3, NETVAL PPP AUTH PROMPT, BEFORE, NULL, CFSTRING },
@@ -650,7 +745,7 @@ struct {
 
     { COMMENT, "--- " IPCP ": ---", NULL, NULL, NULL },
     { SC_10_1, NETPROP PPP, IPCP COMPRESSIONVJ, NULL, CFNUMBER_BOOL },
 
     { COMMENT, "--- " IPCP ": ---", NULL, NULL, NULL },
     { SC_10_1, NETPROP PPP, IPCP COMPRESSIONVJ, NULL, CFNUMBER_BOOL },
-    { SC_10_4, NETPROP PPP, IPCP USE PEERDNS, NULL, CFNUMBER_BOOL },
+    { SC_10_4, NETPROP PPP, IPCP USE PEER DNS, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { COMMENT, "--- " LCP ": ---", NULL, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { COMMENT, "--- " LCP ": ---", NULL, NULL, NULL },
@@ -665,6 +760,26 @@ struct {
     { SC_10_1, NETPROP PPP, LCP TRANSMITACCM, NULL, CFNUMBER },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_1, NETPROP PPP, LCP TRANSMITACCM, NULL, CFNUMBER },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP PPP, KEY_PREFIX NETENT PPP " Entity Keys", NULL, NULL },
+
+    { COMMENT_PRIVATE, "--- " ONDEMAND ": ---", NULL, NULL, NULL },
+    { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND DOMAINS, NULL, CFARRAY_CFSTRING },
+    { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND ENABLED, NULL, CFNUMBER_BOOL },
+    { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND HOSTNAME, NULL, CFSTRING },
+    { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND MODE, NULL, CFSTRING },
+    { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND PRIORITY, NULL, CFSTRING },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP PPP ONDEMAND MODE " values ---", NULL, NULL, NULL },
+    { SC_10_5_PRIVATE, NETVAL PPP ONDEMAND MODE, AGGRESSIVE, NULL, NULL },
+    { SC_10_5_PRIVATE, NETVAL PPP ONDEMAND MODE, CONSERVATIVE, NULL, NULL },
+    { SC_10_5_PRIVATE, NETVAL PPP ONDEMAND MODE, COMPATIBLE, NULL, NULL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP PPP ONDEMAND PRIORITY " values ---", NULL, NULL, NULL },
+    { SC_10_5_PRIVATE, NETVAL PPP ONDEMAND PRIORITY, DEFAULT, NULL, NULL },
+    { SC_10_5_PRIVATE, NETVAL PPP ONDEMAND PRIORITY, HIGH, NULL, NULL },
+    { SC_10_5_PRIVATE, NETVAL PPP ONDEMAND PRIORITY, LOW, NULL, NULL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
   { GROUP, NETPROP PPPOE, KEY_PREFIX NETENT PPPOE " Entity Keys", NULL, NULL },
 
     { COMMENT, "* RESERVED FOR FUTURE USE *", NULL, NULL, NULL },
   { GROUP, NETPROP PPPOE, KEY_PREFIX NETENT PPPOE " Entity Keys", NULL, NULL },
 
     { COMMENT, "* RESERVED FOR FUTURE USE *", NULL, NULL, NULL },
@@ -722,6 +837,21 @@ struct {
     { SC_10_4, NETPROP PROXIES, PROXY AUTODISCOVERY ENABLE, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_4, NETPROP PROXIES, PROXY AUTODISCOVERY ENABLE, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP, NETPROP SMB, KEY_PREFIX NETENT SMB " Entity Keys", NULL, NULL },
+
+    { SC_10_5, NETPROP SMB, NETBIOS NAME, NULL, CFSTRING },
+    { SC_10_5, NETPROP SMB, NETBIOS NODE TYPE, NULL, CFSTRING },
+    { SC_10_5, NETPROP SMB, NETBIOS SCOPE, NULL, CFSTRING },
+    { SC_10_5, NETPROP SMB, WINS ADDRESSES, NULL, CFARRAY_CFSTRING },
+    { SC_10_5, NETPROP SMB, WORKGROUP, NULL, CFSTRING },
+    { COMMENT, "", NULL, NULL, NULL },
+    { COMMENT, "--- " KEY_PREFIX NETPROP SMB NETBIOS NODE TYPE " values ---", NULL, NULL, NULL },
+    { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, BROADCAST, NULL },
+    { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, PEER, NULL },
+    { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, MIXED, NULL },
+    { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, HYBRID, NULL },
+    { COMMENT, "", NULL, NULL, NULL },
+
   { GROUP, USERSENT CONSOLEUSER, KEY_PREFIX COMP USERS " Entity Keys", NULL, NULL },
 
     { SC_10_1, USERSENT, CONSOLEUSER, NULL, NULL },
   { GROUP, USERSENT CONSOLEUSER, KEY_PREFIX COMP USERS " Entity Keys", NULL, NULL },
 
     { SC_10_1, USERSENT, CONSOLEUSER, NULL, NULL },
@@ -733,6 +863,12 @@ struct {
     { SC_10_1, SYSTEMPROP, COMPUTERNAME ENCODING, NULL, CFNUMBER },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_1, SYSTEMPROP, COMPUTERNAME ENCODING, NULL, CFNUMBER },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, SYSTEMPROP COMPUTERNAME, KEY_PREFIX COMP SYSTEM " Properties", NULL, NULL },
+
+    { SC_10_5_PRIVATE, SYSTEMPROP, COMPUTERNAME REGION, NULL, CFNUMBER },
+    { SC_10_5_PRIVATE, SYSTEMPROP, HOSTNAME, NULL, CFSTRING },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
   { GROUP, DYNAMICSTORE DOMAIN, "SCDynamicStore \"domain\" prefixes", NULL, NULL },
 
     { SC_10_1, DYNAMICSTORE DOMAIN, FILE, "File:", NULL },
   { GROUP, DYNAMICSTORE DOMAIN, "SCDynamicStore \"domain\" prefixes", NULL, NULL },
 
     { SC_10_1, DYNAMICSTORE DOMAIN, FILE, "File:", NULL },
@@ -756,6 +892,17 @@ struct {
     { SC_10_1, DYNAMICSTORE NETPROP, SERVICEIDS, NULL, CFARRAY_CFSTRING },
 //  { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_1, DYNAMICSTORE NETPROP, SERVICEIDS, NULL, CFARRAY_CFSTRING },
 //  { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, VIRTUALNETWORKINTERFACES, "Virtual Network Interface Keys", NULL, NULL },
+
+    { SC_10_5_PRIVATE, VIRTUALPROP BOND, INTERFACES, NULL, CFARRAY_CFSTRING },
+    { SC_10_5_PRIVATE, VIRTUALPROP BOND, MODE, NULL, CFNUMBER },
+    { SC_10_5_PRIVATE, VIRTUALPROP BOND, OPTIONS, NULL, CFDICTIONARY },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { SC_10_5_PRIVATE, VIRTUALPROP VLAN, INTERFACE, NULL, CFSTRING },
+    { SC_10_5_PRIVATE, VIRTUALPROP VLAN, TAG, NULL, CFNUMBER },
+    { SC_10_5_PRIVATE, VIRTUALPROP VLAN, OPTIONS, NULL, CFDICTIONARY },
+//  { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
 //{ GROUP, "DEPRECATED", "Deprecated schema definition keys", NULL, NULL },
 
     { SC_10_1_10_4, USERSPROP CONSOLEUSER, NAME, NULL, CFSTRING },
 //{ GROUP, "DEPRECATED", "Deprecated schema definition keys", NULL, NULL },
 
     { SC_10_1_10_4, USERSPROP CONSOLEUSER, NAME, NULL, CFSTRING },
@@ -766,6 +913,11 @@ struct {
     { END, NULL, NULL, NULL, NULL },
 };
 
     { END, NULL, NULL, NULL, NULL },
 };
 
+static int     maxkbuf         = 0;
+static char    *maxkstr        = NULL;
+static int     maxvbuf         = 0;
+static char    *maxvstr        = NULL;
+
 static inline void
 setmax(int *max, char **maxstr, char *str)
 {
 static inline void
 setmax(int *max, char **maxstr, char *str)
 {
@@ -783,59 +935,265 @@ setmax(int *max, char **maxstr, char *str)
 enum {
     gen_header_e,
     gen_comments_e,
 enum {
     gen_header_e,
     gen_comments_e,
+    gen_comments_private_e,
     gen_headerdoc_e,
     gen_headerdoc_e,
+    gen_headerdoc_private_e,
     gen_hfile_e,
     gen_hfile_e,
+    gen_hfile_private_e,
     gen_cfile_e,
 };
 
     gen_cfile_e,
 };
 
+void
+print_comment(schemaDefinition *def)
+{
+       char kbuf[256];
+       char vbuf[256];
+
+       snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
+                def->prefix, def->key);
+       snprintf(vbuf, sizeof(vbuf), "\"%s\"",
+                def->value ? def->value : def->key);
+                
+       if (def->type)
+           printf(" *   %-50s %-30s %s\n",
+                  kbuf, vbuf, def->type);
+       else
+           printf(" *   %-50s %s\n",
+                  kbuf, vbuf);
+
+       return;
+}
+
+void
+print_headerdoc(schemaDefinition *def)
+{
+       char kbuf[256];
+       char vbuf[256];
+
+       snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
+                def->prefix, def->key);
+       setmax(&maxkbuf, &maxkstr, kbuf);
+
+       snprintf(vbuf, sizeof(vbuf), "\"%s\"",
+                def->value ? def->value : def->key);
+       setmax(&maxvbuf, &maxvstr, vbuf);
+
+       printf("\n");
+
+       printf("/*!\n");
+       printf("  @const %s\n", kbuf);
+       switch (def->control) {
+           case SC_10_1:
+               printf("  @availability Introduced in Mac OS X 10.1.\n");
+               break;
+           case SC_10_2:
+               printf("  @availability Introduced in Mac OS X 10.2.\n");
+               break;
+           case SC_10_1_10_4:
+               printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.4.\n");
+               break;
+           case SC_10_1_10_5:
+               printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.\n");
+               break;
+           case SC_10_3:
+               printf("  @availability Introduced in Mac OS X 10.3.\n");
+               break;
+           case SC_10_4:
+               printf("  @availability Introduced in Mac OS X 10.4.\n");
+               break;
+           case SC_10_5:
+           case SC_10_5_PRIVATE:
+               printf("  @availability Introduced in Mac OS X 10.5.\n");
+               break;
+       }
+       printf(" */\n");
+       printf("extern const CFStringRef %s;\n", kbuf);
+
+       return;
+}
+
+void
+print_hfile(schemaDefinition *def)
+{
+       char kbuf[256];
+       char vbuf[256];
+
+       snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
+                def->prefix, def->key);
+       setmax(&maxkbuf, &maxkstr, kbuf);
+
+       snprintf(vbuf, sizeof(vbuf), "\"%s\"",
+                def->value ? def->value : def->key);
+       setmax(&maxvbuf, &maxvstr, vbuf);
+
+       printf("\n");
+
+       switch (def->control) {
+           case SC_10_1:
+               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)\n", kbuf);
+               printf("#endif\n");
+               break;
+           case SC_10_2:
+               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)\n", kbuf);
+               printf("#endif\n");
+               break;
+           case SC_10_3:
+               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)\n", kbuf);
+               printf("#endif\n");
+               break;
+           case SC_10_1_10_4:
+               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4)\n", kbuf);
+               printf("#endif\n");
+               break;
+           case SC_10_1_10_5:
+               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)\n", kbuf);
+               printf("#endif\n");
+               break;
+           case SC_10_4:
+               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)\n", kbuf);
+               printf("#endif\n");
+               break;
+           case SC_10_5:
+           case SC_10_5_PRIVATE:
+               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)\n", kbuf);
+               printf("#endif\n");
+               break;
+           default:
+               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s,)\n", kbuf);
+               printf("#endif\n");
+               break;
+       }
+
+       switch (def->control) {
+           case SC_10_1:
+           case SC_10_1_10_4:
+           case SC_10_1_10_5:
+               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)\n");
+               break;
+           case SC_10_2:
+               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)\n");
+               break;
+           case SC_10_3:
+               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)\n");
+               break;
+           case SC_10_4:
+               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)\n");
+               break;
+           case SC_10_5:
+           case SC_10_5_PRIVATE:
+               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)\n");
+               break;
+       }
+
+       printf("  #define %-48s              \\\n",
+              kbuf);
+       printf("          " SC_SCHEMA_KV "(%-48s \\\n",
+              kbuf);
+       printf("                      ,%-48s \\\n",
+              vbuf);
+       printf("                      ,%-48s )\n",
+              def->type ? def->type : "");
+
+       switch (def->control) {
+           case SC_10_1:
+           case SC_10_1_10_4:
+           case SC_10_1_10_5:
+           case SC_10_2:
+           case SC_10_3:
+           case SC_10_4:
+           case SC_10_5:
+           case SC_10_5_PRIVATE:
+               printf("#endif\n");
+               break;
+       }
+
+       return;
+}
+
 void
 dump_names(int type)
 {
     int i;
 void
 dump_names(int type)
 {
     int i;
-    int maxkbuf = 0;
-    char *maxkstr = NULL;
-    int maxvbuf = 0;
-    char *maxvstr = NULL;
 
     for (i = 0; TRUE; i++) {
        switch (names[i].control) {
            case END: {
                goto done;
 
     for (i = 0; TRUE; i++) {
        switch (names[i].control) {
            case END: {
                goto done;
-               break;
            }
 
            case COMMENT: {
                switch (type) {
            }
 
            case COMMENT: {
                switch (type) {
-                   case gen_header_e:
-                       break;
                    case gen_comments_e:
                    case gen_comments_e:
-                       if (names[i].prefix)
-                           printf(" *   %s\n", names[i].prefix);
-                       break;
-                   case gen_hfile_e:
-//                     if (names[i].prefix)
-//                         printf("%s\n", names[i].prefix);
-                       break;
+                       if (names[i].prefix)
+                           if (strlen(names[i].prefix) > 0)
+                               printf(" *   %s\n", names[i].prefix);
+                           else
+                               printf(" *\n");
+                       break;
                    default:
                    default:
-                       break;
+                       break;
                }
                break;
            }
 
                }
                break;
            }
 
-           case GROUP: {
+           case COMMENT_PRIVATE: {
+               switch (type) {
+                   case gen_comments_private_e:
+                       if (names[i].prefix)
+                           if (strlen(names[i].prefix) > 0)
+                               printf(" *   %s\n", names[i].prefix);
+                           else
+                               printf(" *\n");
+                       break;
+                   default:
+                       break;
+               }
+               break;
+           }
+
+           case COMMENT_DEPRECATED: {
+               break;
+           }
+
+           case GROUP:
+           case GROUP_DEPRECATED: {
                switch (type) {
                switch (type) {
-                   case gen_header_e:
-                       break;
                    case gen_comments_e:
                    case gen_comments_e:
-                       if (names[i].key)
-                           printf(" * %s\n *\n", names[i].key);
-                       break;
+                       if (names[i].control == GROUP) {
+                               if (names[i].key)
+                                   printf(" * %s\n *\n", names[i].key);
+                       }
+                       break;
                    case gen_headerdoc_e:
                    case gen_headerdoc_e:
-                       if (names[i].prefix)
+                       if (names[i].prefix)
+                           printf("\n/*!\n  @group %s\n */\n", names[i].key);
+                       break;
+                   default:
+                       break;
+               }
+               break;
+           }
+
+           case GROUP_PRIVATE: {
+               switch (type) {
+                   case gen_comments_private_e:
+                       if (names[i].key)
+                           printf(" * %s\n *\n", names[i].key);
+                       break;
+                   case gen_headerdoc_private_e:
+                       if (names[i].prefix)
                            printf("\n/*!\n  @group %s\n */\n", names[i].key);
                            printf("\n/*!\n  @group %s\n */\n", names[i].key);
-                       break;
+                       break;
                    default:
                    default:
-                       break;
+                       break;
                }
                break;
            }
                }
                break;
            }
@@ -846,154 +1204,91 @@ dump_names(int type)
 
                switch (type) {
                    case gen_header_e:
 
                switch (type) {
                    case gen_header_e:
-                       snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
-                                names[i].prefix, names[i].key);
+                       snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
+                                names[i].prefix, names[i].key);
 
 
-                       if (names[i].value)
+                       if (names[i].value)
                            snprintf(vbuf, sizeof(vbuf), "SCSTR(\"%s\")",
                                     names[i].value);
                            snprintf(vbuf, sizeof(vbuf), "SCSTR(\"%s\")",
                                     names[i].value);
-                       else
+                       else
                            snprintf(vbuf, sizeof(vbuf), "SCSTR(\"%s\")",
                                     names[i].key);
 
                            snprintf(vbuf, sizeof(vbuf), "SCSTR(\"%s\")",
                                     names[i].key);
 
-                       printf("#define %-50s %s\n",
+                       printf("#define %-50s %s\n",
                               kbuf, vbuf);
                               kbuf, vbuf);
-                       break;
+                       break;
+
                    case gen_comments_e:
                    case gen_comments_e:
-                       switch (names[i].control) {
+                       switch (names[i].control) {
                            case SC_10_1_10_4:
                            case SC_10_1_10_4:
-                               // don't report deprecated keys
-                               break;
+                           case SC_10_1_10_5:
+                               // don't report deprecated keys
+                               break;
+                           case SC_10_5_PRIVATE:
+                               // don't report private definitions
+                               break;
                            default:
                            default:
-                               snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
-                                        names[i].prefix, names[i].key);
-
-                               snprintf(vbuf, sizeof(vbuf), "\"%s\"",
-                                        names[i].value ? names[i].value : names[i].key);
-
-                               if (names[i].type)
-                                   printf(" *   %-50s %-30s %s\n",
-                                          kbuf, vbuf, names[i].type);
-                               else
-                                   printf(" *   %-50s %s\n",
-                                          kbuf, vbuf);
-                               break;
+                               print_comment(&names[i]);
+                               break;
                        }
                        break;
                        }
                        break;
-                   case gen_headerdoc_e:
-                       snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
-                                names[i].prefix, names[i].key);
-                       setmax(&maxkbuf, &maxkstr, kbuf);
-
-                       snprintf(vbuf, sizeof(vbuf), "\"%s\"",
-                                names[i].value ? names[i].value : names[i].key);
-                       setmax(&maxvbuf, &maxvstr, vbuf);
-
-                       printf("\n");
-
-                       printf("/*!\n");
-                       printf("  @const %s\n", kbuf);
+                   case gen_comments_private_e:
                        switch (names[i].control) {
                        switch (names[i].control) {
-                           case SC_10_1:
-                               printf("  @availability Introduced in Mac OS X 10.1.\n");
-                               break;
-                           case SC_10_2:
-                               printf("  @availability Introduced in Mac OS X 10.2.\n");
-                               break;
                            case SC_10_1_10_4:
                            case SC_10_1_10_4:
-                               printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.4.\n");
+                           case SC_10_1_10_5:
+                               // don't report deprecated keys
                                break;
                                break;
-                           case SC_10_3:
-                               printf("  @availability Introduced in Mac OS X 10.3.\n");
+                           case SC_10_5_PRIVATE:
+                               print_comment(&names[i]);
                                break;
                                break;
-                           case SC_10_4:
-                               printf("  @availability Introduced in Mac OS X 10.4.\n");
+                           default:
+                               // don't report public definitions
                                break;
                        }
                                break;
                        }
-                       printf(" */\n");
-                       printf("extern const CFStringRef %s;\n", kbuf);
-
-                       break;
-                   case gen_hfile_e:
-                       snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
-                                names[i].prefix, names[i].key);
-                       setmax(&maxkbuf, &maxkstr, kbuf);
-
-                       snprintf(vbuf, sizeof(vbuf), "\"%s\"",
-                                names[i].value ? names[i].value : names[i].key);
-                       setmax(&maxvbuf, &maxvstr, vbuf);
-
-                       printf("\n");
+                       break;
 
 
+                   case gen_headerdoc_e:
                        switch (names[i].control) {
                        switch (names[i].control) {
-                           case SC_10_1:
-                               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-                               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)\n", kbuf);
-                               printf("#endif\n");
-                               break;
-                           case SC_10_2:
-                               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-                               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)\n", kbuf);
-                               printf("#endif\n");
-                               break;
-                           case SC_10_3:
-                               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-                               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)\n", kbuf);
-                               printf("#endif\n");
+                           case SC_10_5_PRIVATE:
                                break;
                                break;
-                           case SC_10_1_10_4:
-                               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-                               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4)\n", kbuf);
-                               printf("#endif\n");
+                               // don't report private definitions
+                           default:
+                               print_headerdoc(&names[i]);
                                break;
                                break;
-                           case SC_10_4:
-                               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040\n");
-                               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)\n", kbuf);
-                               printf("#endif\n");
+                       }
+                       break;
+                   case gen_headerdoc_private_e:
+                       switch (names[i].control) {
+                           case SC_10_5_PRIVATE:
+                               print_headerdoc(&names[i]);
                                break;
                            default:
                                break;
                            default:
-                               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-                               printf("  " SC_SCHEMA_DECLARATION "(%s,)\n", kbuf);
-                               printf("#endif\n");
+                               // don't report public definitions
                                break;
                        }
                                break;
                        }
+                       break;
 
 
+                   case gen_hfile_e:
                        switch (names[i].control) {
                        switch (names[i].control) {
-                           case SC_10_1:
-                           case SC_10_1_10_4:
-                               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)\n");
-                               break;
-                           case SC_10_2:
-                               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)\n");
+                           case SC_10_5_PRIVATE:
                                break;
                                break;
-                           case SC_10_3:
-                               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)\n");
-                               break;
-                           case SC_10_4:
-                               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)\n");
+                               // don't report private definitions
+                           default:
+                               print_hfile(&names[i]);
                                break;
                        }
                                break;
                        }
-
-                       printf("  #define %-48s              \\\n",
-                              kbuf);
-                       printf("          " SC_SCHEMA_KV "(%-48s \\\n",
-                              kbuf);
-                       printf("                      ,%-48s \\\n",
-                              vbuf);
-                       printf("                      ,%-48s )\n",
-                              names[i].type ? names[i].type : "");
-
+                       break;
+                   case gen_hfile_private_e:
                        switch (names[i].control) {
                        switch (names[i].control) {
-                           case SC_10_1:
-                           case SC_10_1_10_4:
-                           case SC_10_2:
-                           case SC_10_3:
-                           case SC_10_4:
-                               printf("#endif\n");
+                           case SC_10_5_PRIVATE:
+                               print_hfile(&names[i]);
+                               break;
+                           default:
+                               // don't report public definitions
                                break;
                        }
                                break;
                        }
-
                        break;
                        break;
+
                    case gen_cfile_e:
                        snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
                                 names[i].prefix, names[i].key);
                    case gen_cfile_e:
                        snprintf(kbuf, sizeof(kbuf), KEY_PREFIX "%s%s",
                                 names[i].prefix, names[i].key);
@@ -1119,13 +1414,13 @@ main(int argc, char * argv[])
        printf(" */\n");
 
        printf("#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1020\n");
        printf(" */\n");
 
        printf("#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1020\n");
-       printf("    #ifndef SCSTR\n");
-       printf("      #include <CoreFoundation/CFString.h>\n");
-       printf("      #define SCSTR(s) CFSTR(s)\n");
-       printf("    #endif\n");
+       printf("  #ifndef SCSTR\n");
+       printf("    #include <CoreFoundation/CFString.h>\n");
+       printf("    #define SCSTR(s) CFSTR(s)\n");
+       printf("  #endif\n");
        printf("  #ifndef " SC_SCHEMA_DECLARATION "\n");
        printf("    #define " SC_SCHEMA_DECLARATION "(k,q)\textern const CFStringRef k q;\n");
        printf("  #ifndef " SC_SCHEMA_DECLARATION "\n");
        printf("    #define " SC_SCHEMA_DECLARATION "(k,q)\textern const CFStringRef k q;\n");
-       printf("    #endif\n");
+       printf("  #endif\n");
        printf("  #ifndef " SC_SCHEMA_KV "\n");
        printf("    #define " SC_SCHEMA_KV "(k,v,t)\tSCSTR( v )\n");
        printf("  #endif\n");
        printf("  #ifndef " SC_SCHEMA_KV "\n");
        printf("    #define " SC_SCHEMA_KV "(k,v,t)\tSCSTR( v )\n");
        printf("  #endif\n");
@@ -1153,10 +1448,10 @@ main(int argc, char * argv[])
 
        // The SCSTR() macro should only be availble for Mac OS X 10.1.0 ... 10.4.x
        printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)\n");
 
        // The SCSTR() macro should only be availble for Mac OS X 10.1.0 ... 10.4.x
        printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)\n");
-       printf("    #ifndef SCSTR\n");
-       printf("      #include <CoreFoundation/CFString.h>\n");
-       printf("      #define SCSTR(s) CFSTR(s)\n");
-       printf("    #endif\n");
+       printf("  #ifndef SCSTR\n");
+       printf("    #include <CoreFoundation/CFString.h>\n");
+       printf("    #define SCSTR(s) CFSTR(s)\n");
+       printf("  #endif\n");
        printf("#endif\n\n\n");
 
        printf("/* -------------------- HeaderDoc comments -------------------- */\n\n\n");
        printf("#endif\n\n\n");
 
        printf("/* -------------------- HeaderDoc comments -------------------- */\n\n\n");
@@ -1174,6 +1469,35 @@ main(int argc, char * argv[])
 
        printf("#endif /* _SCSCHEMADEFINITIONS_H */\n");
     }
 
        printf("#endif /* _SCSCHEMADEFINITIONS_H */\n");
     }
+    else if (strcmp(type, "private") == 0) {
+       printf("%s\n", copyright_string);
+       printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n");
+
+       printf("/*\n");
+       dump_names(gen_comments_private_e);
+       printf(" */\n\n\n");
+
+       printf("#ifndef _SCSCHEMADEFINITIONSPRIVATE_H\n#define _SCSCHEMADEFINITIONSPRIVATE_H\n\n");
+
+       printf("/* -------------------- Macro declarations -------------------- */\n\n");
+
+       printf("#include <SystemConfiguration/SCSchemaDefinitions.h>\n\n");
+
+       printf("/* -------------------- HeaderDoc comments -------------------- */\n\n\n");
+       printf("#if\t0\n");
+       printf("/*!\n");
+       printf(" *\t@header SCSchemaDefinitionsPrivate\n");
+       printf(" */\n");
+       dump_names(gen_headerdoc_private_e);
+       printf("\n");
+       printf("#endif\t/* 0 */\n\n\n");
+
+       printf("/* -------------------- Schema declarations -------------------- */\n\n");
+       dump_names(gen_hfile_private_e);
+       printf("\n");
+
+       printf("#endif /* _SCSCHEMADEFINITIONSPRIVATE_H */\n");
+    }
     else if (strcmp(type, "cfile") == 0) {
        printf("/*\n");
        printf(" * This file is automatically generated\n");
     else if (strcmp(type, "cfile") == 0) {
        printf("/*\n");
        printf(" * This file is automatically generated\n");
diff --git a/SystemConfiguration.fproj/helper/SCHelper_client.c b/SystemConfiguration.fproj/helper/SCHelper_client.c
new file mode 100644 (file)
index 0000000..3fe56db
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2005-2007 Apple 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@
+ */
+
+#include <fcntl.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SCPrivate.h>
+
+#include "SCHelper_client.h"
+#include "helper_comm.h"
+
+
+#define        HELPER                                  "SCHelper"
+#define        HELPER_LEN                              (sizeof(HELPER) - 1)
+
+#define        SUFFIX_SYM                              "~sym"
+#define        SUFFIX_SYM_LEN                          (sizeof(SUFFIX_SYM) - 1)
+
+
+__private_extern__
+int
+_SCHelperOpen(CFDataRef authorizationData)
+{
+       sigset_t                        block;
+       sigset_t                        block_old;
+       CFBundleRef                     bundle;
+       int                             comm[2]         = { -1, -1 };
+       int                             exit_status     = 0;
+       struct sigaction                ignore;
+       struct sigaction                int_old;
+       Boolean                         ok              = FALSE;
+       char                            path[MAXPATHLEN]= { 0 };
+       pid_t                           pid1;
+       struct sigaction                quit_old;
+       uint32_t                        status          = 0;
+       CFURLRef                        url             = NULL;
+       static int                      yes             = 1;
+
+       // get CFBundleRef for SystemConfiguration.framework
+       bundle = _SC_CFBundleGet();
+       if (bundle != NULL) {
+               url = CFBundleCopyResourceURL(bundle, CFSTR(HELPER), NULL, NULL);
+       }
+
+       if (url != NULL) {
+               if (!CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)path, sizeof(path))) {
+                       path[0] = 0;
+               }
+               CFRelease(url);
+       }
+
+       // create tool<-->helper communications socket
+       if (socketpair(AF_UNIX, SOCK_STREAM, 0, comm) == -1) {
+               perror("_SCHelperOpen socketpair() failed");
+               return -1;
+       }
+
+       // ignore SIGINT, SIGQUIT
+       ignore.sa_handler = SIG_IGN;
+       ignore.sa_flags   = 0;
+       (void)sigemptyset(&ignore.sa_mask);
+       (void)sigaction(SIGINT , &ignore, &int_old );
+       (void)sigaction(SIGQUIT, &ignore, &quit_old);
+
+       // block SIGCHLD
+       (void)sigemptyset(&block);
+       (void)sigaddset(&block, SIGCHLD);
+       (void)sigprocmask(SIG_BLOCK, &block, &block_old);
+
+       // fork
+       pid1 = fork();
+       if (pid1 == -1) {               // if error
+               perror("_SCHelperOpen fork() failed");
+               goto done;
+       } else if (pid1 == 0) {         // if [first] child
+               int     i;
+               pid_t   pid2;
+
+               // make sure that we don't step on syslog's FD (if open)
+               closelog();
+
+               // set stdin, stdout, stderr (and close other FD's)
+               if (comm[0] != STDIN_FILENO) {
+                       (void)dup2(comm[0], STDIN_FILENO);
+               }
+
+               if (comm[0] != STDOUT_FILENO) {
+                       (void)dup2(comm[0], STDOUT_FILENO);
+               }
+
+               (void)close(STDERR_FILENO);
+               (void)open(_PATH_CONSOLE, O_WRONLY, 0);
+
+               for (i = getdtablesize() - 1; i > STDERR_FILENO; i--) {
+                       (void)close(i);
+               }
+
+               pid2 = vfork();
+               if (pid2 == -1) {               // if error
+                       int     err     = errno;
+
+                       perror("_SCHelperOpen vfork() failed\n");
+                       (void)__SCHelper_txMessage(STDOUT_FILENO, err, NULL);
+                       _exit(err);
+               } else if (pid2 == 0) {         // if [second] child
+                       char            *env;
+                       int             err     = ENOENT;
+                       size_t          len;
+
+                       // restore signal processing
+                       (void)sigaction(SIGINT , &int_old , NULL);
+                       (void)sigaction(SIGQUIT, &quit_old, NULL);
+                       (void)sigprocmask(SIG_SETMASK, &block_old, NULL);
+
+                       if (path[0] != 0) {
+                               (void)execl(path, path, NULL);
+                               err = errno;
+                       }
+
+                       // if appropriate (e.g. when debugging), try a bit harder
+
+                       env = getenv("DYLD_FRAMEWORK_PATH");
+                       len = (env != NULL) ? strlen(env) : 0;
+
+                       // trim any trailing slashes
+                       while ((len > 1) && (env[len - 1] == '/')) {
+                               len--;
+                       }
+
+                       // if DYLD_FRAMEWORK_PATH is ".../xxx~sym" than try ".../xxx~sym/SCHelper"
+                       if ((len > SUFFIX_SYM_LEN) &&
+                           (strncmp(&env[len - SUFFIX_SYM_LEN], SUFFIX_SYM, SUFFIX_SYM_LEN) == 0) &&
+                           ((len + 1 + HELPER_LEN) < MAXPATHLEN)) {
+                               char            path[MAXPATHLEN];
+
+                               strlcpy(path, env, sizeof(path));
+                               strlcpy(&path[len], "/", sizeof(path) - (len - 1));
+                               strlcat(&path[len], HELPER, sizeof(path) - len);
+
+                               (void)execl(path, path, NULL);
+                               err = errno;
+                       }
+
+                       // if SCHelper could not be started
+                       (void)__SCHelper_txMessage(STDOUT_FILENO, err, NULL);
+                       _exit(err != 0 ? err : ENOENT);
+               }
+
+               // [first] child
+               _exit(0);
+       }
+
+       if (wait4(pid1, &exit_status, 0, NULL) == -1) {
+               perror("_SCHelperOpen wait4() failed");
+               goto done;
+       }
+
+       if (WIFEXITED(exit_status)) {
+               if (WEXITSTATUS(exit_status) != 0) {
+                       SCLog(TRUE, LOG_INFO,
+                             CFSTR("could not start \"" HELPER "[1]\", exited w/status = %d"),
+                             WEXITSTATUS(exit_status));
+                       goto done;
+               }
+       } else if (WIFSIGNALED(exit_status)) {
+               SCLog(TRUE, LOG_INFO,
+                     CFSTR("could not start \"" HELPER "[1]\", terminated w/signal = %d"),
+                     WTERMSIG(exit_status));
+               goto done;
+       } else {
+               SCLog(TRUE, LOG_INFO,
+                     CFSTR("could not start \"" HELPER "[1]\", exit_status = %x"),
+                     exit_status);
+               goto done;
+       }
+
+       (void)close(comm[0]);
+       comm[0] = -1;
+
+       if (setsockopt(comm[1], SOL_SOCKET, SO_NOSIGPIPE, (const void *)&yes, sizeof(yes)) == -1) {
+               perror("_SCHelperOpen setsockopt() failed");
+               goto done;
+       }
+
+       ok = __SCHelper_rxMessage(comm[1], &status, NULL);
+       if (!ok) {
+               SCLog(TRUE, LOG_INFO, CFSTR("could not start \"" HELPER "\", no status available"));
+               goto done;
+       }
+
+       ok = (status == 0);
+       if (!ok) {
+               SCLog(TRUE, LOG_INFO, CFSTR("could not start \"" HELPER "\", status = %u"), status);
+               goto done;
+       }
+
+       ok = _SCHelperExec(comm[1], SCHELPER_MSG_AUTH, authorizationData, &status, NULL);
+       if (!ok) {
+               SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen: could not send authorization"));
+               goto done;
+       }
+
+    done :
+
+       // restore signal processing
+       (void)sigaction(SIGINT , &int_old , NULL);
+       (void)sigaction(SIGQUIT, &quit_old, NULL);
+       (void)sigprocmask(SIG_SETMASK, &block_old, NULL);
+
+       if (comm[0] > 0) {
+               (void)close(comm[0]);
+//             comm[0] = -1;
+       }
+
+       if (!ok) {
+               (void)close(comm[1]);
+               comm[1] = -1;
+       }
+
+       return comm[1];
+}
+
+
+__private_extern__
+void
+_SCHelperClose(int helper)
+{
+       if (!_SCHelperExec(helper, SCHELPER_MSG_EXIT, NULL, NULL, NULL)) {
+               SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen: could not send exit request"));
+       }
+
+       (void)close(helper);
+       return;
+}
diff --git a/SystemConfiguration.fproj/helper/SCHelper_client.h b/SystemConfiguration.fproj/helper/SCHelper_client.h
new file mode 100644 (file)
index 0000000..3842793
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2005, 2006 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@
+ */
+
+#ifndef _SCHELPER_CLIENT_H
+#define _SCHELPER_CLIENT_H
+
+#include <sys/cdefs.h>
+#include <Security/Security.h>
+
+#define kSCKeychainOptionsAccount              CFSTR("Account")                // CFString
+#define kSCKeychainOptionsDescription          CFSTR("Description")            // CFString
+#define kSCKeychainOptionsLabel                        CFSTR("Label")                  // CFString
+#define kSCKeychainOptionsPassword             CFSTR("Password")               // CFData
+#define kSCKeychainOptionsUniqueID             CFSTR("UniqueID")               // CFString
+
+enum {
+       // authorization
+       SCHELPER_MSG_AUTH               = 1,
+
+       // SCPreferences
+       SCHELPER_MSG_PREFS_OPEN         = 100,
+       SCHELPER_MSG_PREFS_ACCESS,
+       SCHELPER_MSG_PREFS_LOCK,
+       SCHELPER_MSG_PREFS_LOCKWAIT,
+       SCHELPER_MSG_PREFS_COMMIT,
+       SCHELPER_MSG_PREFS_APPLY,
+       SCHELPER_MSG_PREFS_UNLOCK,
+       SCHELPER_MSG_PREFS_CLOSE,
+
+       // SCNetworkConfiguration
+       SCHELPER_MSG_INTERFACE_REFRESH  = 200,
+
+       // "System" Keychain
+       SCHELPER_MSG_KEYCHAIN_COPY      = 300,
+       SCHELPER_MSG_KEYCHAIN_EXISTS,
+       SCHELPER_MSG_KEYCHAIN_REMOVE,
+       SCHELPER_MSG_KEYCHAIN_SET,
+
+       // miscellaneous
+       SCHELPER_MSG_EXIT               = 9999
+};
+
+__BEGIN_DECLS
+
+int    _SCHelperOpen   (CFDataRef              authorizationData);
+
+Boolean        _SCHelperExec   (int                    helper,
+                        uint32_t               msgID,
+                        CFDataRef              data,
+                        uint32_t               *status,
+                        CFDataRef              *reply);
+
+void   _SCHelperClose  (int                    helper);
+
+__END_DECLS
+
+#endif /* _SCHELPER_CLIENT_H */
+
diff --git a/SystemConfiguration.fproj/helper/SCHelper_server.c b/SystemConfiguration.fproj/helper/SCHelper_server.c
new file mode 100644 (file)
index 0000000..9231e08
--- /dev/null
@@ -0,0 +1,704 @@
+/*
+ * Copyright (c) 2005, 2006 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@
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCPrivate.h>
+#include <Security/Security.h>
+
+#include "SCPreferencesInternal.h"
+#include "SCHelper_client.h"
+#include "helper_comm.h"
+
+
+static AuthorizationRef        authorization   = NULL;
+static SCPreferencesRef        prefs           = NULL;
+
+
+/*
+ * EXIT
+ *   (in)  data   = N/A
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_Exit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       return FALSE;
+}
+
+
+/*
+ * AUTHORIZE
+ *   (in)  data   = AuthorizationExternalForm
+ *   (out) status = OSStatus
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_Auth(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       if (authorization != NULL) {
+               AuthorizationFree(authorization, kAuthorizationFlagDefaults);
+//             AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
+               authorization = NULL;
+       }
+
+       if (data != NULL) {
+               AuthorizationExternalForm       extForm;
+
+               if (CFDataGetLength(data) == sizeof(extForm.bytes)) {
+                       OSStatus        err;
+
+                       memcpy(extForm.bytes, CFDataGetBytePtr(data), sizeof(extForm.bytes));
+                       err = AuthorizationCreateFromExternalForm(&extForm, &authorization);
+                       if (err != errAuthorizationSuccess) {
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("AuthorizationCreateFromExternalForm() failed: status = %d"),
+                                     (int)err);
+                       }
+               }
+
+               CFRelease(data);
+       }
+
+       *status = (authorization != NULL) ? 0 : 1;
+
+       return TRUE;
+}
+
+
+/*
+ * SCHELPER_MSG_KEYCHAIN_COPY
+ *   (in)  data   = unique_id
+ *   (out) status = SCError()
+ *   (out) reply  = password
+ */
+static Boolean
+do_keychain_copy(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       CFStringRef     unique_id       = NULL;
+
+       if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
+               return FALSE;
+       }
+
+       if (!isA_CFString(unique_id)) {
+               return FALSE;
+       }
+
+       *reply = _SCPreferencesSystemKeychainPasswordItemCopy(prefs, unique_id);
+       CFRelease(unique_id);
+       if (*reply == NULL) {
+               *status = SCError();
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * SCHELPER_MSG_KEYCHAIN_EXISTS
+ *   (in)  data   = unique_id
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_keychain_exists(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       Boolean         ok;
+       CFStringRef     unique_id       = NULL;
+
+       if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
+               return FALSE;
+       }
+
+       if (!isA_CFString(unique_id)) {
+               return FALSE;
+       }
+
+       ok = _SCPreferencesSystemKeychainPasswordItemExists(prefs, unique_id);
+       CFRelease(unique_id);
+
+       if (!ok) {
+               *status = SCError();
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * SCHELPER_MSG_KEYCHAIN_REMOVE
+ *   (in)  data   = unique_id
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_keychain_remove(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       Boolean         ok;
+       CFStringRef     unique_id       = NULL;
+
+       if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
+               return FALSE;
+       }
+
+       if (!isA_CFString(unique_id)) {
+               return FALSE;
+       }
+
+       ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
+       CFRelease(unique_id);
+
+       if (!ok) {
+               *status = SCError();
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * SCHELPER_MSG_KEYCHAIN_SET
+ *   (in)  data   = options dictionary
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       CFStringRef     account;
+       CFStringRef     description;
+       CFArrayRef      executablePaths = NULL;
+       CFStringRef     label;
+       Boolean         ok;
+       CFDictionaryRef options         = NULL;
+       CFDataRef       password;
+       CFStringRef     unique_id;
+
+       if ((data != NULL) && !_SCUnserialize((CFPropertyListRef *)&options, data, NULL, 0)) {
+               return FALSE;
+       }
+
+       if (!isA_CFDictionary(options)) {
+               return FALSE;
+       }
+
+       if (CFDictionaryGetValueIfPresent(options,
+                                         kSCKeychainOptionsAllowedExecutables,
+                                         (const void **)&executablePaths)) {
+               CFMutableArrayRef       executableURLs;
+               CFIndex                 i;
+               CFIndex                 n;
+               CFMutableDictionaryRef  newOptions;
+
+               executableURLs = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               n = CFArrayGetCount(executablePaths);
+               for (i = 0; i < n; i++) {
+                       CFDataRef       path;
+                       CFURLRef        url;
+
+                       path = CFArrayGetValueAtIndex(executablePaths, i);
+                       url  = CFURLCreateFromFileSystemRepresentation(NULL,
+                                                                      CFDataGetBytePtr(path),
+                                                                      CFDataGetLength(path),
+                                                                      FALSE);
+                       if (url != NULL) {
+                               CFArrayAppendValue(executableURLs, url);
+                               CFRelease(url);
+                       }
+               }
+
+               newOptions = CFDictionaryCreateMutableCopy(NULL, 0, options);
+               CFDictionarySetValue(newOptions, kSCKeychainOptionsAllowedExecutables, executableURLs);
+               CFRelease(executableURLs);
+
+               CFRelease(options);
+               options = newOptions;
+       }
+
+       unique_id   = CFDictionaryGetValue(options, kSCKeychainOptionsUniqueID);
+       label       = CFDictionaryGetValue(options, kSCKeychainOptionsLabel);
+       description = CFDictionaryGetValue(options, kSCKeychainOptionsDescription);
+       account     = CFDictionaryGetValue(options, kSCKeychainOptionsAccount);
+       password    = CFDictionaryGetValue(options, kSCKeychainOptionsPassword);
+
+       ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
+                                                        unique_id,
+                                                        label,
+                                                        description,
+                                                        account,
+                                                        password,
+                                                        options);
+       CFRelease(options);
+
+       if (!ok) {
+               *status = SCError();
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * SCHELPER_MSG_INTERFACE_REFRESH
+ *   (in)  data   = ifName
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_interface_refresh(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       CFStringRef     ifName  = NULL;
+       Boolean         ok;
+
+       if ((data != NULL) && !_SCUnserializeString(&ifName, data, NULL, 0)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("interface name not valid"));
+               return FALSE;
+       }
+
+       if (!isA_CFString(ifName)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("interface name not valid"));
+               return FALSE;
+       }
+
+       ok = _SCNetworkInterfaceForceConfigurationRefresh(ifName);
+       CFRelease(ifName);
+
+       if (!ok) {
+               *status = SCError();
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * OPEN
+ *   (in)  data   = prefsID
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_prefs_Open(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       CFStringRef     prefsID = NULL;
+
+       if (prefs != NULL) {
+               return FALSE;
+       }
+
+       if ((data != NULL) && !_SCUnserializeString(&prefsID, data, NULL, 0)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("prefsID not valid"));
+               return FALSE;
+       }
+
+       prefs = SCPreferencesCreate(NULL, CFSTR("SCHelper"), prefsID);
+       if (prefsID != NULL) CFRelease(prefsID);
+
+       if (prefs == NULL) {
+               *status = SCError();
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * ACCESS
+ *   (in)  data   = N/A
+ *   (out) status = SCError()
+ *   (out) reply  = current signature + current preferences
+ */
+static Boolean
+do_prefs_Access(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       CFDataRef               signature;
+
+       if (prefs == NULL) {
+               return FALSE;
+       }
+
+       signature = SCPreferencesGetSignature(prefs);
+       if (signature != NULL) {
+               const void *    dictKeys[2];
+               const void *    dictVals[2];
+               CFDictionaryRef replyDict;
+
+               dictKeys[0] = CFSTR("signature");
+               dictVals[0] = signature;
+
+               dictKeys[1] = CFSTR("preferences");
+               dictVals[1] = prefsPrivate->prefs;
+
+               replyDict = CFDictionaryCreate(NULL,
+                                              (const void **)&dictKeys,
+                                              (const void **)&dictVals,
+                                              sizeof(dictKeys)/sizeof(dictKeys[0]),
+                                              &kCFTypeDictionaryKeyCallBacks,
+                                              &kCFTypeDictionaryValueCallBacks);
+
+               ok = _SCSerialize(replyDict, reply, NULL, NULL);
+               CFRelease(replyDict);
+               if (!ok) {
+                       return FALSE;
+               }
+       } else {
+               *status = SCError();
+       }
+
+       SCPreferencesSynchronize(prefs);
+       return TRUE;
+}
+
+
+/*
+ * LOCK
+ *   (in)  data   = client prefs signature (NULL if check not needed)
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_prefs_Lock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       CFDataRef       clientSignature = (CFDataRef)data;
+       Boolean         ok;
+       Boolean         wait            = (info == (void *)FALSE) ? FALSE : TRUE;
+
+       if (prefs == NULL) {
+               return FALSE;
+       }
+
+       ok = SCPreferencesLock(prefs, wait);
+       if (!ok) {
+               *status = SCError();
+               return TRUE;
+       }
+
+       if (clientSignature != NULL) {
+               CFDataRef       serverSignature;
+
+               serverSignature = SCPreferencesGetSignature(prefs);
+               if (!CFEqual(clientSignature, serverSignature)) {
+                       (void)SCPreferencesUnlock(prefs);
+                       *status = kSCStatusStale;
+               }
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * COMMIT
+ *   (in)  data   = new preferences (NULL if commit w/no changes)
+ *   (out) status = SCError()
+ *   (out) reply  = new signature
+ */
+static Boolean
+do_prefs_Commit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       Boolean                 ok;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+
+       if (prefs == NULL) {
+               return FALSE;
+       }
+
+       if (data != NULL) {
+               if (prefsPrivate->prefs != NULL) {
+                       CFRelease(prefsPrivate->prefs);
+               }
+
+               ok = _SCUnserialize((CFPropertyListRef *)&prefsPrivate->prefs, data, NULL, 0);
+               if (!ok) {
+                       return FALSE;
+               }
+
+               prefsPrivate->accessed = TRUE;
+               prefsPrivate->changed  = TRUE;
+       }
+
+       ok = SCPreferencesCommitChanges(prefs);
+       if (ok) {
+               *reply = SCPreferencesGetSignature(prefs);
+               CFRetain(*reply);
+       } else {
+               *status = SCError();
+       }
+
+       SCPreferencesSynchronize(prefs);
+       return TRUE;
+}
+
+
+/*
+ * APPLY
+ *   (in)  data   = N/A
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_prefs_Apply(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       Boolean ok;
+
+       if (prefs == NULL) {
+               return FALSE;
+       }
+
+       ok = SCPreferencesApplyChanges(prefs);
+       if (!ok) {
+               *status = SCError();
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * UNLOCK
+ *   (in)  data   = N/A
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_prefs_Unlock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       Boolean ok;
+
+       if (prefs == NULL) {
+               return FALSE;
+       }
+
+       ok = SCPreferencesUnlock(prefs);
+       if (!ok) {
+               *status = SCError();
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * CLOSE
+ *   (in)  data   = N/A
+ *   (out) status = SCError()
+ *   (out) reply  = N/A
+ */
+static Boolean
+do_prefs_Close(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       if (prefs == NULL) {
+               return FALSE;
+       }
+
+       CFRelease(prefs);
+       prefs = NULL;
+
+       return TRUE;
+}
+
+
+static Boolean
+hasAuthorization()
+{
+       AuthorizationFlags      flags;
+       AuthorizationItem       items[1];
+       AuthorizationRights     rights;
+       OSStatus                status;
+
+       if (authorization == NULL) {
+               return FALSE;
+       }
+
+       items[0].name        = "system.preferences";
+       items[0].value       = NULL;
+       items[0].valueLength = 0;
+       items[0].flags       = 0;
+
+       rights.count = sizeof(items) / sizeof(items[0]);
+       rights.items = items;
+
+       flags = kAuthorizationFlagDefaults;
+       flags |= kAuthorizationFlagExtendRights;
+       flags |= kAuthorizationFlagInteractionAllowed;
+//     flags |= kAuthorizationFlagPartialRights;
+//     flags |= kAuthorizationFlagPreAuthorize;
+
+       status = AuthorizationCopyRights(authorization,
+                                        &rights,
+                                        kAuthorizationEmptyEnvironment,
+                                        flags,
+                                        NULL);
+       if (status != errAuthorizationSuccess) {
+               return FALSE;
+       }
+
+if (items[0].flags != 0) SCLog(TRUE, LOG_DEBUG, CFSTR("***** success w/flags (%u) != 0"), items[0].flags);
+       return TRUE;
+}
+
+
+typedef Boolean (*helperFunction)      (void           *info,
+                                        CFDataRef      data,
+                                        uint32_t       *status,
+                                        CFDataRef      *reply);
+
+
+static const struct helper {
+       int             command;
+       const char      *commandName;
+       Boolean         needsAuthorization;
+       helperFunction  func;
+       void            *info;
+} helpers[] = {
+       { SCHELPER_MSG_AUTH,                    "AUTH",                 FALSE,  do_Auth                 , NULL          },
+
+       { SCHELPER_MSG_PREFS_OPEN,              "PREFS open",           FALSE,  do_prefs_Open           , NULL          },
+       { SCHELPER_MSG_PREFS_ACCESS,            "PREFS access",         TRUE,   do_prefs_Access         , NULL          },
+       { SCHELPER_MSG_PREFS_LOCK,              "PREFS lock",           TRUE,   do_prefs_Lock           , (void *)FALSE },
+       { SCHELPER_MSG_PREFS_LOCKWAIT,          "PREFS lock/wait",      TRUE,   do_prefs_Lock           , (void *)TRUE  },
+       { SCHELPER_MSG_PREFS_COMMIT,            "PREFS commit",         TRUE,   do_prefs_Commit         , NULL          },
+       { 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_INTERFACE_REFRESH,       "INTERFACE refresh",    TRUE,   do_interface_refresh    , NULL          },
+
+       { SCHELPER_MSG_KEYCHAIN_COPY,           "KEYCHAIN copy",        TRUE,   do_keychain_copy        , NULL          },
+       { SCHELPER_MSG_KEYCHAIN_EXISTS,         "KEYCHAIN exists",      TRUE,   do_keychain_exists      , NULL          },
+       { SCHELPER_MSG_KEYCHAIN_REMOVE,         "KEYCHAIN remove",      TRUE,   do_keychain_remove      , NULL          },
+       { SCHELPER_MSG_KEYCHAIN_SET,            "KEYCHAIN set",         TRUE,   do_keychain_set         , NULL          },
+
+       { SCHELPER_MSG_EXIT,                    "EXIT",                 FALSE,  do_Exit                 , NULL          }
+};
+#define nHELPERS (sizeof(helpers)/sizeof(struct helper))
+
+
+static int
+findHelper(command)
+{
+       int     i;
+
+       for (i = 0; i < (int)nHELPERS; i++) {
+               if (helpers[i].command == command) {
+                       return i;
+               }
+       }
+
+       return -1;
+}
+
+
+int
+main(int argc, char **argv)
+{
+       int             err     = 0;
+       Boolean         ok      = TRUE;
+
+       openlog("SCHelper", LOG_CONS|LOG_PID, LOG_DAEMON);
+
+       if (geteuid() != 0) {
+               (void)__SCHelper_txMessage(STDOUT_FILENO, EACCES, NULL);
+               exit(EACCES);
+       }
+
+       // send "we are here" message
+       if (!__SCHelper_txMessage(STDOUT_FILENO, 0, NULL)) {
+               exit(EIO);
+       }
+
+       while (ok) {
+               uint32_t        command;
+               CFDataRef       data;
+               int             i;
+               CFDataRef       reply;
+               uint32_t        status;
+
+               command = 0;
+               data    = NULL;
+               if (!__SCHelper_rxMessage(STDIN_FILENO, &command, &data)) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("no command"));
+                       err = EIO;
+                       break;
+               }
+
+               i = findHelper(command);
+               if (i == -1) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("received unknown command : %u"), command);
+                       err = EINVAL;
+                       break;
+               }
+
+               SCLog(TRUE, LOG_DEBUG,
+                     CFSTR("processing command \"%s\"%s"),
+                     helpers[i].commandName,
+                     (data != NULL) ? " w/data" : "");
+
+               status = kSCStatusOK;
+               reply  = NULL;
+
+               if (helpers[i].needsAuthorization && !hasAuthorization()) {
+                       SCLog(TRUE, LOG_DEBUG,
+                             CFSTR("command \"%s\" : not authorized"),
+                             helpers[i].commandName);
+                       status = kSCStatusAccessError;
+               }
+
+               if (status == kSCStatusOK) {
+                       ok = (*helpers[i].func)(helpers[i].info, data, &status, &reply);
+               }
+
+               SCLog(TRUE, LOG_DEBUG,
+                     CFSTR("sending status %u%s"),
+                     status,
+                     (reply != NULL) ? " w/reply" : "");
+
+               if (!__SCHelper_txMessage(STDOUT_FILENO, status, reply)) {
+                       err = EIO;
+                       break;
+               }
+
+               if (reply != NULL) {
+                       CFRelease(reply);
+               }
+       }
+
+       if (prefs != NULL) {
+               CFRelease(prefs);
+       }
+
+       if (authorization != NULL) {
+               AuthorizationFree(authorization, kAuthorizationFlagDefaults);
+//             AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
+       }
+
+       exit(err);
+}
diff --git a/SystemConfiguration.fproj/helper/helper_comm.c b/SystemConfiguration.fproj/helper/helper_comm.c
new file mode 100644 (file)
index 0000000..fd4193d
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2005 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@
+ */
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include "helper_comm.h"
+
+#include <SystemConfiguration/SCPrivate.h>
+
+
+static ssize_t
+readn(int ref, void *data, size_t len)
+{
+       size_t  left    = len;
+       ssize_t n;
+       void    *p      = data;
+
+       while (left > 0) {
+               if ((n = read(ref, p, left)) == -1) {
+                       if (errno != EINTR) {
+                               return -1;
+                       }
+                       n = 0;
+               } else if (n == 0) {
+                       break; /* EOF */
+               }
+
+               left -= n;
+               p += n;
+       }
+       return (len - left);
+}
+
+
+static ssize_t
+writen(int ref, const void *data, size_t len)
+{
+       size_t          left    = len;
+       ssize_t         n;
+       const void      *p      = data;
+
+       while (left > 0) {
+               if ((n = write(ref, p, left)) == -1) {
+                       if (errno != EINTR) {
+                               return -1;
+                       }
+                       n = 0;
+               }
+               left -= n;
+               p += n;
+       }
+       return len;
+}
+
+
+Boolean
+__SCHelper_txMessage(int fd, uint32_t msgID, CFDataRef data)
+{
+       ssize_t         n_written;
+       uint32_t        header[2];
+
+       header[0] = msgID;
+       header[1] = (data != NULL) ? CFDataGetLength(data) : 0;
+
+       n_written = writen(fd, header, sizeof(header));
+       if (n_written != sizeof(header)) {
+               if ((n_written == -1) && (errno != EPIPE)) {
+                       perror("write() failed while sending msgID");
+               }
+               return FALSE;
+       }
+
+       if (header[1] == 0) {
+               // if no data to send
+               return TRUE;
+       }
+
+       n_written = writen(fd, CFDataGetBytePtr(data), header[1]);
+       if (n_written != header[1]) {
+               if ((n_written == -1) && (errno != EPIPE)) {
+                       perror("write() failed while sending data");
+               }
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+Boolean
+__SCHelper_rxMessage(int fd, uint32_t *msgID, CFDataRef *data)
+{
+       void            *bytes;
+       size_t          n_read;
+       uint32_t        header[2];
+
+       n_read = readn(fd, header, sizeof(header));
+       if (n_read != sizeof(header)) {
+               if (n_read == -1) {
+                       perror("read() failed while reading msgID");
+               }
+               return FALSE;
+       }
+
+       if (msgID != NULL) {
+               *msgID = header[0];
+       }
+
+       if (header[1] == 0) {
+               if (data != NULL) {
+                       *data = NULL;
+               }
+               return TRUE;
+       } else if ((int32_t)header[1] < 0) {
+               perror("read() failed, invalid data length");
+               return FALSE;
+       }
+
+       bytes  = CFAllocatorAllocate(NULL, header[1], 0);
+       n_read = readn(fd, bytes, header[1]);
+       if (n_read != header[1]) {
+               if (n_read == -1) {
+                       perror("read() failed while reading data");
+               }
+               CFAllocatorDeallocate(NULL, bytes);
+               return FALSE;
+       }
+
+       if (data != NULL) {
+               *data = CFDataCreateWithBytesNoCopy(NULL, bytes, header[1], NULL);
+       } else {
+               // toss reply data
+               CFAllocatorDeallocate(NULL, bytes);
+       }
+
+       return TRUE;
+}
+
+
+Boolean
+_SCHelperExec(int fd, uint32_t msgID, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       Boolean         ok;
+
+       ok = __SCHelper_txMessage(fd, msgID, data);
+       if (!ok) {
+               return FALSE;
+       }
+
+       if ((status == NULL) && (reply == NULL)) {
+               // if no reply expected (one way)
+               return TRUE;
+       }
+
+       ok = __SCHelper_rxMessage(fd, status, reply);
+       if (!ok) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
diff --git a/SystemConfiguration.fproj/helper/helper_comm.h b/SystemConfiguration.fproj/helper/helper_comm.h
new file mode 100644 (file)
index 0000000..9ea23c8
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2005 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@
+ */
+
+#ifndef _HELPER_COMM_H
+#define _HELPER_COMM_H
+
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+__BEGIN_DECLS
+
+Boolean __SCHelper_txMessage(int       fd,
+                            uint32_t   msgID,
+                            CFDataRef  data);
+
+Boolean __SCHelper_rxMessage(int       fd,
+                            uint32_t   *msgID,
+                            CFDataRef  *data);
+
+__END_DECLS
+
+#endif /* _HELPER_COMM_H */
index 31929d73cb85852749e20fc23bcba9d5291bfcb2..0b87ff06531107ed5eeed3e9a8a3200fc2793171 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2003, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 //       present in the system when we create the socket.
 
 
 //       present in the system when we create the socket.
 
 
-static int
-readn(int ref, void *data, int len)
+static ssize_t
+readn(int ref, void *data, size_t len)
 {
 {
-       int     left    = len;
-       int     n;
+       size_t  left    = len;
+       ssize_t n;
        void    *p      = data;
 
        while (left > 0) {
        void    *p      = data;
 
        while (left > 0) {
-               if ((n = read(ref, p, left)) < 0) {
+               if ((n = read(ref, p, left)) == -1) {
                        if (errno != EINTR) {
                                return -1;
                        }
                        if (errno != EINTR) {
                                return -1;
                        }
@@ -71,15 +71,15 @@ readn(int ref, void *data, int len)
 }
 
 
 }
 
 
-static int
-writen(int ref, void *data, int len)
+static ssize_t
+writen(int ref, const void *data, size_t len)
 {
 {
-       int     left    = len;
-       int     n;
-       void    *p      = data;
+       size_t          left    = len;
+       ssize_t         n;
+       const void      *p      = data;
 
        while (left > 0) {
 
        while (left > 0) {
-               if ((n = write(ref, p, left)) <= 0) {
+               if ((n = write(ref, p, left)) == -1) {
                        if (errno != EINTR) {
                                return -1;
                        }
                        if (errno != EINTR) {
                                return -1;
                        }
@@ -107,7 +107,7 @@ MOHInit(int *ref, CFStringRef deviceName)
        strncpy(sun.sun_path, MOH_PATH, sizeof(sun.sun_path));
 
        status = connect(sock, (struct sockaddr *)&sun, sizeof(sun));
        strncpy(sun.sun_path, MOH_PATH, sizeof(sun.sun_path));
 
        status = connect(sock, (struct sockaddr *)&sun, sizeof(sun));
-       if (status < 0) {
+       if (status == -1) {
                return errno;
        }
 
                return errno;
        }
 
@@ -120,7 +120,7 @@ __private_extern__
 int
 MOHDispose(int ref)
 {
 int
 MOHDispose(int ref)
 {
-       if (close(ref) < 0) {
+       if (close(ref) == -1) {
                return errno;
        }
        return 0;
                return errno;
        }
        return 0;
@@ -130,12 +130,12 @@ MOHDispose(int ref)
 __private_extern__
 int
 MOHExec(int            ref,
 __private_extern__
 int
 MOHExec(int            ref,
-       u_long          link,
+       uint32_t        link,
        uint32_t        cmd,
        void            *request,
        uint32_t        cmd,
        void            *request,
-       u_long          requestLen,
+       size_t          requestLen,
        void            **reply,
        void            **reply,
-       u_long          *replyLen)
+       size_t          *replyLen)
 {
        struct moh_msg_hdr      msg;
        char                    *buf            = NULL;
 {
        struct moh_msg_hdr      msg;
        char                    *buf            = NULL;
index 22c39d1ed3daca49f48c307245f3ea3eaf7bb34f..6af6760a16549c680bfaca0322eb50d5abdaf3eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2003, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -47,12 +47,12 @@ MOHDispose  (
 
 int
 MOHExec                (int            ref,
 
 int
 MOHExec                (int            ref,
-               u_long          link,
+               uint32_t        link,
                uint32_t        cmd,
                void            *request,
                uint32_t        cmd,
                void            *request,
-               u_long          requestLen,
+               size_t          requestLen,
                void            **reply,
                void            **reply,
-               u_long          *replyLen
+               size_t          *replyLen
                );
 
 __END_DECLS
                );
 
 __END_DECLS
index f03fe939d05f49cc09f5d562a86047bb245b4dc6..77b120f9511472e002ea6eedea05ce8d263f666c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2003, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 061b514f8d4ec2806851894ff47d2a474e92d276..87b8ade62e9c944a7dddd8266c66f8059db4adc5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -297,9 +297,6 @@ pushNotifications()
                 */
                if ((storePrivate->notifyStatus == Using_NotifierInformViaMachPort) &&
                    (storePrivate->notifyPort != MACH_PORT_NULL)) {
                 */
                if ((storePrivate->notifyStatus == Using_NotifierInformViaMachPort) &&
                    (storePrivate->notifyPort != MACH_PORT_NULL)) {
-                       mach_msg_empty_send_t   msg;
-                       mach_msg_option_t       options;
-                       kern_return_t           status;
                        /*
                         * Post notification as mach message
                         */
                        /*
                         * Post notification as mach message
                         */
@@ -310,22 +307,7 @@ pushNotifications()
                                SCLog(TRUE, LOG_DEBUG, CFSTR("  msgid = %d"), storePrivate->notifyPortIdentifier);
                        }
 #endif /* DEBUG */
                                SCLog(TRUE, LOG_DEBUG, CFSTR("  msgid = %d"), storePrivate->notifyPortIdentifier);
                        }
 #endif /* DEBUG */
-                       msg.header.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0);
-                       msg.header.msgh_size = sizeof(msg);
-                       msg.header.msgh_remote_port = storePrivate->notifyPort;
-                       msg.header.msgh_local_port = MACH_PORT_NULL;
-                       msg.header.msgh_id = storePrivate->notifyPortIdentifier;
-                       options = MACH_SEND_TIMEOUT;
-                       status = mach_msg(&msg.header,                  /* msg */
-                                         MACH_SEND_MSG|options,        /* options */
-                                         msg.header.msgh_size,         /* send_size */
-                                         0,                            /* rcv_size */
-                                         MACH_PORT_NULL,               /* rcv_name */
-                                         0,                            /* timeout */
-                                         MACH_PORT_NULL);              /* notify */
-                       if (status == MACH_SEND_TIMED_OUT) {
-                               mach_msg_destroy(&msg.header);
-                       }
+                       _SC_sendMachMessage(storePrivate->notifyPort, storePrivate->notifyPortIdentifier);
                }
 
                if ((storePrivate->notifyStatus == Using_NotifierInformViaFD) &&
                }
 
                if ((storePrivate->notifyStatus == Using_NotifierInformViaFD) &&
index db03de87aeea28ddf3d88af9579cc8f17e60a543..56abe72c8f8e971f92113116b240f72b343f2cba 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -203,7 +203,7 @@ int
 __SCDynamicStoreNotifyCancel           (SCDynamicStoreRef      store);
 
 void
 __SCDynamicStoreNotifyCancel           (SCDynamicStoreRef      store);
 
 void
-_swapLockedStoreData                   ();
+_swapLockedStoreData                   (void);
 
 void
 _addWatcher                            (CFNumberRef            sessionNum,
 
 void
 _addWatcher                            (CFNumberRef            sessionNum,
@@ -214,7 +214,7 @@ _removeWatcher                              (CFNumberRef            sessionNum,
                                         CFStringRef            watchedKey);
 
 void
                                         CFStringRef            watchedKey);
 
 void
-pushNotifications                      ();
+pushNotifications                      (void);
 
 __END_DECLS
 
 
 __END_DECLS
 
index 792e57a0e0e9281cf4eecfba9e8deef2925729d5..87bfe7b4e2521343ed46654b1771cc5f23d15323 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -42,7 +42,7 @@ __SCDynamicStoreAddValue(SCDynamicStoreRef store, CFStringRef key, CFDataRef val
        int                             sc_status       = kSCStatusOK;
        CFDataRef                       tempValue;
 
        int                             sc_status       = kSCStatusOK;
        CFDataRef                       tempValue;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -117,24 +117,29 @@ _configadd(mach_port_t                    server,
        CFDataRef               data            = NULL;         /* data (un-serialized) */
        serverSessionRef        mySession       = getSession(server);
 
        CFDataRef               data            = NULL;         /* data (un-serialized) */
        serverSessionRef        mySession       = getSession(server);
 
+       *sc_status = kSCStatusOK;
+
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
                *sc_status = kSCStatusFailed;
                goto done;
        }
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
                *sc_status = kSCStatusFailed;
                goto done;
        }
 
-       if (!isA_CFString(key)) {
-               *sc_status = kSCStatusInvalidArgument;
-               goto done;
-       }
-
        /* un-serialize the data */
        if (!_SCUnserializeData(&data, (void *)dataRef, dataLen)) {
                *sc_status = kSCStatusFailed;
        /* un-serialize the data */
        if (!_SCUnserializeData(&data, (void *)dataRef, dataLen)) {
                *sc_status = kSCStatusFailed;
+       }
+
+       if (*sc_status != kSCStatusOK) {
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (!isA_CFString(key)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
@@ -146,8 +151,8 @@ _configadd(mach_port_t                      server,
 
     done :
 
 
     done :
 
-       if (key)        CFRelease(key);
-       if (data)       CFRelease(data);
+       if (key != NULL)        CFRelease(key);
+       if (data != NULL)       CFRelease(data);
 
        return KERN_SUCCESS;
 }
 
        return KERN_SUCCESS;
 }
@@ -170,24 +175,28 @@ _configadd_s(mach_port_t          server,
        SCDynamicStorePrivateRef        storePrivate;
        Boolean                         useSessionKeys;
 
        SCDynamicStorePrivateRef        storePrivate;
        Boolean                         useSessionKeys;
 
+       *sc_status = kSCStatusOK;
+
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
                *sc_status = kSCStatusFailed;
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
                *sc_status = kSCStatusFailed;
-               goto done;
-       }
-
-       if (!isA_CFString(key)) {
-               *sc_status = kSCStatusInvalidArgument;
-               goto done;
        }
 
        /* un-serialize the data */
        if (!_SCUnserializeData(&data, (void *)dataRef, dataLen)) {
                *sc_status = kSCStatusFailed;
        }
 
        /* un-serialize the data */
        if (!_SCUnserializeData(&data, (void *)dataRef, dataLen)) {
                *sc_status = kSCStatusFailed;
+       }
+
+       if (*sc_status != kSCStatusOK) {
+               goto done;
+       }
+
+       if (!isA_CFString(key)) {
+               *sc_status = kSCStatusInvalidArgument;
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
@@ -207,8 +216,8 @@ _configadd_s(mach_port_t            server,
 
     done :
 
 
     done :
 
-       if (key)        CFRelease(key);
-       if (data)       CFRelease(data);
+       if (key != NULL)        CFRelease(key);
+       if (data != NULL)       CFRelease(data);
 
        return KERN_SUCCESS;
 }
 
        return KERN_SUCCESS;
 }
index fbd48ab178500b7d09f14c40f853613bd70141a7..40db4e8cffbf1bd369652dd080bd4ea73eba1df0 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -200,7 +200,7 @@ _configclose(mach_port_t server, int *sc_status)
 {
        serverSessionRef        mySession = getSession(server);
 
 {
        serverSessionRef        mySession = getSession(server);
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
index caeae329395d1ba1ed5596adf356a457503c4e49..52525e36a5b3688edee5dee9b8529c1b013d229b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -41,7 +41,7 @@ __SCDynamicStoreCopyValue(SCDynamicStoreRef store, CFStringRef key, CFDataRef *v
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        CFDictionaryRef                 dict;
 
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        CFDictionaryRef                 dict;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -95,7 +95,7 @@ _configget(mach_port_t                        server,
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
@@ -120,7 +120,7 @@ _configget(mach_port_t                      server,
 
     done :
 
 
     done :
 
-       if (key)        CFRelease(key);
+       if (key != NULL)        CFRelease(key);
        return KERN_SUCCESS;
 }
 
        return KERN_SUCCESS;
 }
 
@@ -184,7 +184,7 @@ __SCDynamicStoreCopyMultiple(SCDynamicStoreRef store, CFArrayRef keys, CFArrayRe
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        addSpecific                     myContext;
 
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        addSpecific                     myContext;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -242,16 +242,12 @@ _configget_m(mach_port_t          server,
        *dataRef = NULL;
        *dataLen = 0;
 
        *dataRef = NULL;
        *dataLen = 0;
 
+       *sc_status = kSCStatusOK;
+
        if (keysRef && (keysLen > 0)) {
                /* un-serialize the keys */
                if (!_SCUnserialize((CFPropertyListRef *)&keys, NULL, (void *)keysRef, keysLen)) {
                        *sc_status = kSCStatusFailed;
        if (keysRef && (keysLen > 0)) {
                /* un-serialize the keys */
                if (!_SCUnserialize((CFPropertyListRef *)&keys, NULL, (void *)keysRef, keysLen)) {
                        *sc_status = kSCStatusFailed;
-                       goto done;
-               }
-
-               if (!isA_CFArray(keys)) {
-                       *sc_status = kSCStatusInvalidArgument;
-                       goto done;
                }
        }
 
                }
        }
 
@@ -259,16 +255,24 @@ _configget_m(mach_port_t          server,
                /* un-serialize the patterns */
                if (!_SCUnserialize((CFPropertyListRef *)&patterns, NULL, (void *)patternsRef, patternsLen)) {
                        *sc_status = kSCStatusFailed;
                /* un-serialize the patterns */
                if (!_SCUnserialize((CFPropertyListRef *)&patterns, NULL, (void *)patternsRef, patternsLen)) {
                        *sc_status = kSCStatusFailed;
-                       goto done;
                }
                }
+       }
 
 
-               if (!isA_CFArray(patterns)) {
-                       *sc_status = kSCStatusInvalidArgument;
-                       goto done;
-               }
+       if (*sc_status != kSCStatusOK) {
+               goto done;
+       }
+
+       if ((keys != NULL) && !isA_CFArray(keys)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       if ((patterns != NULL) && !isA_CFArray(patterns)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
        }
 
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
index 6591a9972f5c5aa8ce4da94d87404f676d1a8282..9201f65be00f054df300db9fb448763dc3d0057d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -43,23 +43,17 @@ __SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef key, Boolean is
 {
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
        CFMutableArrayRef               keyArray;
 {
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
        CFMutableArrayRef               keyArray;
-       regex_t                         preg;
        CFIndex                         storeCnt;
        CFStringRef                     storeStr;
        CFDictionaryRef                 storeValue;
 
        CFIndex                         storeCnt;
        CFStringRef                     storeStr;
        CFDictionaryRef                 storeValue;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
        if (isRegex) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
        if (isRegex) {
-               CFStringRef     reErrStr;
-
-               if (!patternCompile(key, &preg, &reErrStr)) {
-                       *subKeys = CFArrayCreate(NULL, (const void **)&reErrStr, 1, &kCFTypeArrayCallBacks);
-                       CFRelease(reErrStr);
-                       return kSCStatusFailed;
-               }
+               *subKeys = patternCopyMatches(key);
+               return (*subKeys != NULL) ? kSCStatusOK : kSCStatusFailed;
        }
 
        storeCnt = CFDictionaryGetCount(storeData);
        }
 
        storeCnt = CFDictionaryGetCount(storeData);
@@ -80,57 +74,13 @@ __SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef key, Boolean is
                for (i = 0; i < storeCnt; i++) {
                        storeStr   = (CFStringRef)storeKeys[i];
                        storeValue = (CFDictionaryRef)storeValues[i];
                for (i = 0; i < storeCnt; i++) {
                        storeStr   = (CFStringRef)storeKeys[i];
                        storeValue = (CFDictionaryRef)storeValues[i];
-                       if (isRegex) {
-                               /*
-                                * only return those keys which match the regular
-                                * expression specified in the provided key.
-                                */
-
-                               int     reError;
-                               char    storeKey_q[256];
-                               char *  storeKey        = storeKey_q;
-                               CFIndex storeKeyLen     = CFStringGetLength(storeStr) + 1;
-
-                               if (storeKeyLen > (CFIndex)sizeof(storeKey_q))
-                                       storeKey = CFAllocatorAllocate(NULL, storeKeyLen, 0);
-                               if (_SC_cfstring_to_cstring(storeStr, storeKey, storeKeyLen, kCFStringEncodingASCII) == NULL) {
-                                       SCLog(TRUE, LOG_DEBUG, CFSTR("__SCDynamicStoreCopyKeyList(): could not convert store key to C string"));
-                                       if (storeKey != storeKey_q) CFAllocatorDeallocate(NULL, storeKey);
-                                       continue;
-                               }
-
-                               reError = regexec(&preg, storeKey, 0, NULL, 0);
-                               switch (reError) {
-                                       case 0 :
-                                               /* we've got a match */
-                                               if (CFDictionaryContainsKey(storeValue, kSCDData))
-                                                       CFArrayAppendValue(keyArray, storeStr);
-                                               break;
-                                       case REG_NOMATCH :
-                                               /* no match */
-                                               break;
-                                       default : {
-                                               char    reErrBuf[256];
-                                               int     reErrStrLen;
-
-                                               reErrStrLen = regerror(reError,
-                                                                      &preg,
-                                                                      reErrBuf,
-                                                                      sizeof(reErrBuf));
-                                               SCLog(TRUE, LOG_DEBUG, CFSTR("__SCDynamicStoreCopyKeyList regexec() failed: %s"), reErrBuf);
-                                               break;
-                                       }
-                               }
-                               if (storeKey != storeKey_q) CFAllocatorDeallocate(NULL, storeKey);
-                       } else {
-                               /*
-                                * only return those keys which are prefixed by the
-                                * provided key string and have data.
-                                */
-                               if (((CFStringGetLength(key) == 0) || CFStringHasPrefix(storeStr, key)) &&
-                                   CFDictionaryContainsKey(storeValue, kSCDData)) {
-                                       CFArrayAppendValue(keyArray, storeStr);
-                               }
+                       /*
+                        * only return those keys which are prefixed by the
+                        * provided key string and have data.
+                        */
+                       if (((CFStringGetLength(key) == 0) || CFStringHasPrefix(storeStr, key)) &&
+                           CFDictionaryContainsKey(storeValue, kSCDData)) {
+                               CFArrayAppendValue(keyArray, storeStr);
                        }
                }
 
                        }
                }
 
@@ -140,10 +90,6 @@ __SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef key, Boolean is
                }
        }
 
                }
        }
 
-       if (isRegex) {
-               regfree(&preg);
-       }
-
        *subKeys = CFArrayCreateCopy(NULL, keyArray);
        CFRelease(keyArray);
        return kSCStatusOK;
        *subKeys = CFArrayCreateCopy(NULL, keyArray);
        CFRelease(keyArray);
        return kSCStatusOK;
@@ -180,7 +126,7 @@ _configlist(mach_port_t                     server,
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
index c383da6ba5f987de63121471fbce93476c402278..9ed185ba37b1eb781dda13bed20a7c32b412ca7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -43,7 +43,7 @@ __SCDynamicStoreLock(SCDynamicStoreRef store, Boolean recursive)
        serverSessionRef                mySession;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
 
        serverSessionRef                mySession;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession;         /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession;         /* you must have an open session to play */
        }
 
@@ -98,7 +98,7 @@ _configlock(mach_port_t server, int *sc_status)
 {
        serverSessionRef        mySession = getSession(server);
 
 {
        serverSessionRef        mySession = getSession(server);
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
index e4e0dea332ffb3f5d566ae05264a608dd17335c9..26fb1f412e34adda7eb4617f5ab7c66806bdff85 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -41,7 +41,7 @@ __SCDynamicStoreNotifyValue(SCDynamicStoreRef store, CFStringRef key, Boolean in
        Boolean                         newValue        = FALSE;
        CFDataRef                       value;
 
        Boolean                         newValue        = FALSE;
        CFDataRef                       value;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -111,7 +111,7 @@ _confignotify(mach_port_t           server,
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
index facaf7e27372a4ab6e9660872f168070e370c48a..91b3065089bf63d4446332d51b6e93bd4b1f889a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "configd_server.h"
 #include "session.h"
 
 #include "configd_server.h"
 #include "session.h"
 
+#include <bsm/libbsm.h>
+#include <sys/types.h>
+#include <unistd.h>
+
 __private_extern__
 int
 __SCDynamicStoreOpen(SCDynamicStoreRef *store, CFStringRef name)
 __private_extern__
 int
 __SCDynamicStoreOpen(SCDynamicStoreRef *store, CFStringRef name)
@@ -75,6 +79,13 @@ __SCDynamicStoreOpen(SCDynamicStoreRef *store, CFStringRef name)
 }
 
 
 }
 
 
+static CFStringRef
+openMPCopyDescription(const void *info)
+{
+       return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SCDynamicStore MP>"));
+}
+
+
 __private_extern__
 kern_return_t
 _configopen(mach_port_t                        server,
 __private_extern__
 kern_return_t
 _configopen(mach_port_t                        server,
@@ -83,8 +94,15 @@ _configopen(mach_port_t                      server,
            xmlData_t                   optionsRef,             /* raw XML bytes */
            mach_msg_type_number_t      optionsLen,
            mach_port_t                 *newServer,
            xmlData_t                   optionsRef,             /* raw XML bytes */
            mach_msg_type_number_t      optionsLen,
            mach_port_t                 *newServer,
-           int                         *sc_status)
+           int                         *sc_status,
+           audit_token_t               audit_token)
 {
 {
+       CFMachPortContext               context         = { 0
+                                                         , (void *)1
+                                                         , NULL
+                                                         , NULL
+                                                         , openMPCopyDescription
+                                                         };
        CFDictionaryRef                 info;
        CFMachPortRef                   mp;
        serverSessionRef                mySession;
        CFDictionaryRef                 info;
        CFMachPortRef                   mp;
        serverSessionRef                mySession;
@@ -98,9 +116,21 @@ _configopen(mach_port_t                     server,
        SCDynamicStorePrivateRef        storePrivate;
        CFBooleanRef                    useSessionKeys  = NULL;
 
        SCDynamicStorePrivateRef        storePrivate;
        CFBooleanRef                    useSessionKeys  = NULL;
 
+       *sc_status = kSCStatusOK;
+
        /* un-serialize the name */
        if (!_SCUnserializeString(&name, NULL, (void *)nameRef, nameLen)) {
                *sc_status = kSCStatusFailed;
        /* un-serialize the name */
        if (!_SCUnserializeString(&name, NULL, (void *)nameRef, nameLen)) {
                *sc_status = kSCStatusFailed;
+       }
+
+       if ((optionsRef != NULL) && (optionsLen > 0)) {
+               /* un-serialize the [session] options */
+               if (!_SCUnserialize((CFPropertyListRef *)&options, NULL, (void *)optionsRef, optionsLen)) {
+                       *sc_status = kSCStatusFailed;
+               }
+       }
+
+       if (*sc_status != kSCStatusOK) {
                goto done;
        }
 
                goto done;
        }
 
@@ -109,13 +139,7 @@ _configopen(mach_port_t                    server,
                goto done;
        }
 
                goto done;
        }
 
-       if (optionsRef && (optionsLen > 0)) {
-               /* un-serialize the [session] options */
-               if (!_SCUnserialize((CFPropertyListRef *)&options, NULL, (void *)optionsRef, optionsLen)) {
-                       *sc_status = kSCStatusFailed;
-                       goto done;
-               }
-
+       if (options != NULL) {
                if (!isA_CFDictionary(options)) {
                        *sc_status = kSCStatusInvalidArgument;
                        goto done;
                if (!isA_CFDictionary(options)) {
                        *sc_status = kSCStatusInvalidArgument;
                        goto done;
@@ -134,7 +158,7 @@ _configopen(mach_port_t                     server,
        }
 
        mySession = getSession(server);
        }
 
        mySession = getSession(server);
-       if (mySession->store) {
+       if (mySession->store != NULL) {
 #ifdef DEBUG
                SCLog(TRUE, LOG_DEBUG, CFSTR("_configopen(): session is already open."));
 #endif /* DEBUG */
 #ifdef DEBUG
                SCLog(TRUE, LOG_DEBUG, CFSTR("_configopen(): session is already open."));
 #endif /* DEBUG */
@@ -143,7 +167,7 @@ _configopen(mach_port_t                     server,
        }
 
        /* Create the server port for this session */
        }
 
        /* Create the server port for this session */
-       mp = CFMachPortCreate(NULL, configdCallback, NULL, NULL);
+       mp = CFMachPortCreate(NULL, configdCallback, &context, NULL);
 
        /* return the newly allocated port to be used for this session */
        *newServer = CFMachPortGetPort(mp);
 
        /* return the newly allocated port to be used for this session */
        *newServer = CFMachPortGetPort(mp);
@@ -153,20 +177,30 @@ _configopen(mach_port_t                   server,
         */
        newSession = addSession(mp);
 
         */
        newSession = addSession(mp);
 
+       /*
+        * get the credentials associated with the caller.
+        */
+       audit_token_to_au32(audit_token,
+                           NULL,                       // auidp
+                           &newSession->callerEUID,    // euid
+                           NULL,                       // egid
+                           NULL,                       // ruid
+                           NULL,                       // rgid
+                           NULL,                       // pid
+                           NULL,                       // asid
+                           NULL);                      // tid
+
        /* Create and add a run loop source for the port */
        newSession->serverRunLoopSource = CFMachPortCreateRunLoopSource(NULL, mp, 0);
        CFRunLoopAddSource(CFRunLoopGetCurrent(),
                           newSession->serverRunLoopSource,
                           kCFRunLoopDefaultMode);
 
        /* Create and add a run loop source for the port */
        newSession->serverRunLoopSource = CFMachPortCreateRunLoopSource(NULL, mp, 0);
        CFRunLoopAddSource(CFRunLoopGetCurrent(),
                           newSession->serverRunLoopSource,
                           kCFRunLoopDefaultMode);
 
-       /*
-        * save the credentials associated with the caller.
-        */
-       newSession->callerEUID = mySession->callerEUID;
-       newSession->callerEGID = mySession->callerEGID;
-
        if (_configd_trace) {
        if (_configd_trace) {
-               SCTrace(TRUE, _configd_trace, CFSTR("open    : %5d : %@\n"), *newServer, name);
+               SCTrace(TRUE, _configd_trace,
+                       CFSTR("open    : %5d : %@\n"),
+                       *newServer,
+                       name);
        }
 
        *sc_status = __SCDynamicStoreOpen(&newSession->store, name);
        }
 
        *sc_status = __SCDynamicStoreOpen(&newSession->store, name);
@@ -211,7 +245,7 @@ _configopen(mach_port_t                     server,
         */
        sessionKey = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), *newServer);
        info = CFDictionaryGetValue(sessionData, sessionKey);
         */
        sessionKey = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), *newServer);
        info = CFDictionaryGetValue(sessionData, sessionKey);
-       if (info) {
+       if (info != NULL) {
                newInfo = CFDictionaryCreateMutableCopy(NULL, 0, info);
        } else {
                newInfo = CFDictionaryCreateMutable(NULL,
                newInfo = CFDictionaryCreateMutableCopy(NULL, 0, info);
        } else {
                newInfo = CFDictionaryCreateMutable(NULL,
@@ -226,7 +260,7 @@ _configopen(mach_port_t                     server,
 
     done :
 
 
     done :
 
-       if (name)       CFRelease(name);
-       if (options)    CFRelease(options);
+       if (name != NULL)       CFRelease(name);
+       if (options != NULL)    CFRelease(options);
        return KERN_SUCCESS;
 }
        return KERN_SUCCESS;
 }
index d3bcb0034b7065d081c19bdb999a7272325a1b6d..33e8b5792f74e96a183b61e63e36a320ef123d57 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -44,7 +44,7 @@ __SCDynamicStoreRemoveValue(SCDynamicStoreRef store, CFStringRef key, Boolean in
        CFMutableDictionaryRef          newDict;
        CFStringRef                     sessionKey;
 
        CFMutableDictionaryRef          newDict;
        CFStringRef                     sessionKey;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -150,7 +150,7 @@ _configremove(mach_port_t           server,
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
index 2cd2ce5acb1d3b55aa1b61909dfec84c01655419..3fda0fe243d087a4af90160464a3a290ad502163 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -49,7 +49,7 @@ __SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFDataRef val
        CFStringRef                     sessionKey;
        CFStringRef                     storeSessionKey;
 
        CFStringRef                     sessionKey;
        CFStringRef                     storeSessionKey;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -236,24 +236,28 @@ _configset(mach_port_t                    server,
        CFStringRef             key             = NULL; /* key  (un-serialized) */
        serverSessionRef        mySession       = getSession(server);
 
        CFStringRef             key             = NULL; /* key  (un-serialized) */
        serverSessionRef        mySession       = getSession(server);
 
+       *sc_status = kSCStatusOK;
+
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
                *sc_status = kSCStatusFailed;
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
                *sc_status = kSCStatusFailed;
-               goto done;
-       }
-
-       if (!isA_CFString(key)) {
-               *sc_status = kSCStatusInvalidArgument;
-               goto done;
        }
 
        /* un-serialize the data */
        if (!_SCUnserializeData(&data, (void *)dataRef, dataLen)) {
                *sc_status = kSCStatusFailed;
        }
 
        /* un-serialize the data */
        if (!_SCUnserializeData(&data, (void *)dataRef, dataLen)) {
                *sc_status = kSCStatusFailed;
+       }
+
+       if (*sc_status != kSCStatusOK) {
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (!isA_CFString(key)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
@@ -325,7 +329,7 @@ __SCDynamicStoreSetMultiple(SCDynamicStoreRef store, CFDictionaryRef keysToSet,
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
        int                             sc_status       = kSCStatusOK;
 
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
        int                             sc_status       = kSCStatusOK;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -397,46 +401,49 @@ _configset_m(mach_port_t          server,
        CFArrayRef              notify          = NULL;         /* keys to notify (un-serialized) */
        CFArrayRef              remove          = NULL;         /* keys to remove (un-serialized) */
 
        CFArrayRef              notify          = NULL;         /* keys to notify (un-serialized) */
        CFArrayRef              remove          = NULL;         /* keys to remove (un-serialized) */
 
-       if (dictRef && (dictLen > 0)) {
+       *sc_status = kSCStatusOK;
+
+       if ((dictRef != NULL) && (dictLen > 0)) {
                /* un-serialize the key/value pairs to set */
                if (!_SCUnserialize((CFPropertyListRef *)&dict, NULL, (void *)dictRef, dictLen)) {
                        *sc_status = kSCStatusFailed;
                /* un-serialize the key/value pairs to set */
                if (!_SCUnserialize((CFPropertyListRef *)&dict, NULL, (void *)dictRef, dictLen)) {
                        *sc_status = kSCStatusFailed;
-                       goto done;
-               }
-
-               if (!isA_CFDictionary(dict)) {
-                       *sc_status = kSCStatusInvalidArgument;
-                       goto done;
                }
        }
 
                }
        }
 
-       if (removeRef && (removeLen > 0)) {
+       if ((removeRef != NULL) && (removeLen > 0)) {
                /* un-serialize the keys to remove */
                if (!_SCUnserialize((CFPropertyListRef *)&remove, NULL, (void *)removeRef, removeLen)) {
                        *sc_status = kSCStatusFailed;
                /* un-serialize the keys to remove */
                if (!_SCUnserialize((CFPropertyListRef *)&remove, NULL, (void *)removeRef, removeLen)) {
                        *sc_status = kSCStatusFailed;
-                       goto done;
-               }
-
-               if (!isA_CFArray(remove)) {
-                       *sc_status = kSCStatusInvalidArgument;
-                       goto done;
                }
        }
 
                }
        }
 
-       if (notifyRef && (notifyLen > 0)) {
+       if ((notifyRef != NULL) && (notifyLen > 0)) {
                /* un-serialize the keys to notify */
                if (!_SCUnserialize((CFPropertyListRef *)&notify, NULL, (void *)notifyRef, notifyLen)) {
                        *sc_status = kSCStatusFailed;
                /* un-serialize the keys to notify */
                if (!_SCUnserialize((CFPropertyListRef *)&notify, NULL, (void *)notifyRef, notifyLen)) {
                        *sc_status = kSCStatusFailed;
-                       goto done;
                }
                }
+       }
 
 
-               if (!isA_CFArray(notify)) {
-                       *sc_status = kSCStatusInvalidArgument;
-                       goto done;
-               }
+       if (*sc_status != kSCStatusOK) {
+               goto done;
+       }
+
+       if ((dict != NULL) && !isA_CFDictionary(dict)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       if ((remove != NULL) && !isA_CFArray(remove)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       if ((notify != NULL) && !isA_CFArray(notify)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
        }
 
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                /* you must have an open session to play */
                *sc_status = kSCStatusNoStoreSession;
                goto done;
                /* you must have an open session to play */
                *sc_status = kSCStatusNoStoreSession;
                goto done;
@@ -446,9 +453,9 @@ _configset_m(mach_port_t            server,
 
     done :
 
 
     done :
 
-       if (dict)       CFRelease(dict);
-       if (remove)     CFRelease(remove);
-       if (notify)     CFRelease(notify);
+       if (dict != NULL)       CFRelease(dict);
+       if (remove != NULL)     CFRelease(remove);
+       if (notify != NULL)     CFRelease(notify);
 
        return KERN_SUCCESS;
 }
 
        return KERN_SUCCESS;
 }
index d35842085189f1f1599e436ab3aab156bace4a7a..242f8ef71586e390e201bc9d7ce4146f569e33f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -42,7 +42,7 @@ __SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key)
        int                             sc_status;
        CFDataRef                       value;
 
        int                             sc_status;
        CFDataRef                       value;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -131,7 +131,7 @@ _configtouch(mach_port_t            server,
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
index 21d08158125c61831d26a02e7227cfa9ba0f1d3e..e441ec3b14ce133212ccb178478eeb5b8ee4c0ec 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -255,7 +255,7 @@ __SCDynamicStoreUnlock(SCDynamicStoreRef store, Boolean recursive)
        serverSessionRef                mySession;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
 
        serverSessionRef                mySession;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession;         /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession;         /* you must have an open session to play */
        }
 
@@ -316,7 +316,7 @@ _configunlock(mach_port_t server, int *sc_status)
 {
        serverSessionRef        mySession = getSession(server);
 
 {
        serverSessionRef        mySession = getSession(server);
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
index 27c6a88db1164ebd4e48c8a2c27540bc5ab795c0..90616fdad949b41a179493807e0f47fe5be72e8c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -60,7 +60,7 @@ __SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
        CFNumberRef                     sessionNum      = NULL;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
        CFNumberRef                     sessionNum      = NULL;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -111,7 +111,7 @@ __SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
 
     done :
 
 
     done :
 
-       if (sessionNum) CFRelease(sessionNum);
+       if (sessionNum != NULL) CFRelease(sessionNum);
        return sc_status;
 }
 
        return sc_status;
 }
 
@@ -139,7 +139,7 @@ _notifyadd(mach_port_t                      server,
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
@@ -175,7 +175,7 @@ removeOldKey(const void *value, void *context)
                return;
        }
 
                return;
        }
 
-       if (!myContextRef->newKeys ||
+       if ((myContextRef->newKeys == NULL) ||
            !CFArrayContainsValue(myContextRef->newKeys,
                                  CFRangeMake(0, CFArrayGetCount(myContextRef->newKeys)),
                                  oldKey)) {
            !CFArrayContainsValue(myContextRef->newKeys,
                                  CFRangeMake(0, CFArrayGetCount(myContextRef->newKeys)),
                                  oldKey)) {
@@ -200,7 +200,7 @@ addNewKey(const void *value, void *context)
                return;
        }
 
                return;
        }
 
-       if (!myContextRef->oldKeys ||
+       if ((myContextRef->oldKeys == NULL) ||
            !CFSetContainsValue(myContextRef->oldKeys, newKey)) {
                /* if this is a new notification key */
                myContextRef->sc_status = __SCDynamicStoreAddWatchedKey(myContextRef->store,
            !CFSetContainsValue(myContextRef->oldKeys, newKey)) {
                /* if this is a new notification key */
                myContextRef->sc_status = __SCDynamicStoreAddWatchedKey(myContextRef->store,
@@ -220,7 +220,7 @@ __SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef store, CFArrayRef keys, CF
        updateKeysContext               myContext;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
 
        updateKeysContext               myContext;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -240,7 +240,7 @@ __SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef store, CFArrayRef keys, CF
        myContext.newKeys = keys;
        myContext.isRegex = FALSE;
        my_CFSetApplyFunction(storePrivate->keys, removeOldKey, &myContext);
        myContext.newKeys = keys;
        myContext.isRegex = FALSE;
        my_CFSetApplyFunction(storePrivate->keys, removeOldKey, &myContext);
-       if (keys) {
+       if (keys != NULL) {
                CFArrayApplyFunction(keys,
                                     CFRangeMake(0, CFArrayGetCount(keys)),
                                     addNewKey,
                CFArrayApplyFunction(keys,
                                     CFRangeMake(0, CFArrayGetCount(keys)),
                                     addNewKey,
@@ -253,7 +253,7 @@ __SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef store, CFArrayRef keys, CF
        myContext.newKeys = patterns;
        myContext.isRegex = TRUE;
        my_CFSetApplyFunction(storePrivate->patterns, removeOldKey, &myContext);
        myContext.newKeys = patterns;
        myContext.isRegex = TRUE;
        my_CFSetApplyFunction(storePrivate->patterns, removeOldKey, &myContext);
-       if (patterns) {
+       if (patterns != NULL) {
                CFArrayApplyFunction(patterns,
                                     CFRangeMake(0, CFArrayGetCount(patterns)),
                                     addNewKey,
                CFArrayApplyFunction(patterns,
                                     CFRangeMake(0, CFArrayGetCount(patterns)),
                                     addNewKey,
@@ -281,35 +281,46 @@ _notifyset(mach_port_t                    server,
 
        *sc_status = kSCStatusOK;
 
 
        *sc_status = kSCStatusOK;
 
-       if (keysRef && (keysLen > 0)) {
+       if ((keysRef != NULL) && (keysLen > 0)) {
                /* un-serialize the keys */
                if (!_SCUnserialize((CFPropertyListRef *)&keys, NULL, (void *)keysRef, keysLen)) {
                        *sc_status = kSCStatusFailed;
                /* un-serialize the keys */
                if (!_SCUnserialize((CFPropertyListRef *)&keys, NULL, (void *)keysRef, keysLen)) {
                        *sc_status = kSCStatusFailed;
-               } else if (!isA_CFArray(keys)) {
-                       *sc_status = kSCStatusInvalidArgument;
                }
        }
 
                }
        }
 
-       if (patternsRef && (patternsLen > 0)) {
+       if ((patternsRef != NULL) && (patternsLen > 0)) {
                /* un-serialize the patterns */
                if (!_SCUnserialize((CFPropertyListRef *)&patterns, NULL, (void *)patternsRef, patternsLen)) {
                        *sc_status = kSCStatusFailed;
                /* un-serialize the patterns */
                if (!_SCUnserialize((CFPropertyListRef *)&patterns, NULL, (void *)patternsRef, patternsLen)) {
                        *sc_status = kSCStatusFailed;
-               } else if (!isA_CFArray(patterns)) {
-                       *sc_status = kSCStatusInvalidArgument;
                }
        }
 
                }
        }
 
-       if (!mySession) {
+       if (*sc_status != kSCStatusOK) {
+               goto done;
+       }
+
+       if ((keys != NULL) && !isA_CFArray(keys)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       if ((patterns != NULL) && !isA_CFArray(patterns)) {
+               *sc_status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       if (mySession == NULL) {
                /* you must have an open session to play */
                *sc_status = kSCStatusNoStoreSession;
                /* you must have an open session to play */
                *sc_status = kSCStatusNoStoreSession;
+               goto done;
        }
 
        }
 
-       if (*sc_status == kSCStatusOK) {
-               *sc_status = __SCDynamicStoreSetNotificationKeys(mySession->store, keys, patterns);
-       }
+       *sc_status = __SCDynamicStoreSetNotificationKeys(mySession->store, keys, patterns);
+
+    done :
 
 
-       if (keys)       CFRelease(keys);
-       if (patterns)   CFRelease(patterns);
+       if (keys != NULL)       CFRelease(keys);
+       if (patterns != NULL)   CFRelease(patterns);
 
        return KERN_SUCCESS;
 }
 
        return KERN_SUCCESS;
 }
index 06194ed8eebcbef7936c698db2e46338ffca8cb6..ba77aa02444dbebe5ed0d7ad4ec6266ad6c5f82b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -54,7 +54,7 @@ __SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
        /*
         * cleanup any file based notifications.
         */
        /*
         * cleanup any file based notifications.
         */
-       if (storePrivate->notifyFile >= 0) {
+       if (storePrivate->notifyFile != -1) {
                // close (notification) fd
                (void) close(storePrivate->notifyFile);
                storePrivate->notifyFile = -1;
                // close (notification) fd
                (void) close(storePrivate->notifyFile);
                storePrivate->notifyFile = -1;
@@ -97,7 +97,7 @@ _notifycancel(mach_port_t     server,
 {
        serverSessionRef        mySession = getSession(server);
 
 {
        serverSessionRef        mySession = getSession(server);
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
index 9b2c902be2b66dcbf612ea322b51f7d426bf967a..1c1ec6f9e111a4d5400faa1f8389efc9a410e4aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2003, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -43,7 +43,7 @@ __SCDynamicStoreCopyNotifiedKeys(SCDynamicStoreRef store, CFArrayRef *notifierKe
        CFDictionaryRef                 info;
        CFMutableDictionaryRef          newInfo;
 
        CFDictionaryRef                 info;
        CFMutableDictionaryRef          newInfo;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -52,7 +52,7 @@ __SCDynamicStoreCopyNotifiedKeys(SCDynamicStoreRef store, CFArrayRef *notifierKe
        if ((info == NULL) ||
            (CFDictionaryContainsKey(info, kSCDChangedKeys) == FALSE)) {
                CFRelease(sessionKey);
        if ((info == NULL) ||
            (CFDictionaryContainsKey(info, kSCDChangedKeys) == FALSE)) {
                CFRelease(sessionKey);
-               *notifierKeys = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);;
+               *notifierKeys = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
                return kSCStatusOK;
        }
        newInfo = CFDictionaryCreateMutableCopy(NULL, 0, info);
                return kSCStatusOK;
        }
        newInfo = CFDictionaryCreateMutableCopy(NULL, 0, info);
@@ -88,7 +88,7 @@ _notifychanges(mach_port_t                    server,
        *listRef = NULL;
        *listLen = 0;
 
        *listRef = NULL;
        *listLen = 0;
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
index adc4676200bc8fae2539d84d934a904eeac54f54..346beb03f63ddd38ca469b7edf5e1060516c9e51 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -44,7 +44,7 @@ __SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boole
        CFNumberRef                     sessionNum;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
 
        CFNumberRef                     sessionNum;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -115,7 +115,7 @@ _notifyremove(mach_port_t           server,
                goto done;
        }
 
                goto done;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        }
index 6a11e21649784d6f20df0cc1e5e25058e7a775fb..7c1201f1c374d29588495f9362dacaa6138b12f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -52,7 +52,7 @@ __SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef        store,
        CFStringRef                     sessionKey;
        CFDictionaryRef                 info;
 
        CFStringRef                     sessionKey;
        CFDictionaryRef                 info;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -135,7 +135,7 @@ _notifyviafd(mach_port_t            server,
        }
 #endif /* DEBUG */
 
        }
 #endif /* DEBUG */
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
@@ -161,7 +161,7 @@ _notifyviafd(mach_port_t            server,
        (void) unlink(un.sun_path);
 
        bufSiz = sizeof(storePrivate->notifyFileIdentifier);
        (void) unlink(un.sun_path);
 
        bufSiz = sizeof(storePrivate->notifyFileIdentifier);
-       if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &bufSiz, sizeof(bufSiz)) < 0) {
+       if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &bufSiz, sizeof(bufSiz)) == -1) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd setsockopt() failed: %s"), strerror(errno));
                (void) close(sock);
                *sc_status = kSCStatusFailed;
                SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd setsockopt() failed: %s"), strerror(errno));
                (void) close(sock);
                *sc_status = kSCStatusFailed;
index 4b7df81d3a0b23143296d902fb72c566a5affb9b..906fe1407614143a6c348236cd462a1e32ddaed8 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -44,7 +44,7 @@ __SCDynamicStoreNotifyMachPort(SCDynamicStoreRef      store,
        CFStringRef                     sessionKey;
        CFDictionaryRef                 info;
 
        CFStringRef                     sessionKey;
        CFDictionaryRef                 info;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession;         /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession;         /* you must have an open session to play */
        }
 
@@ -90,7 +90,7 @@ _notifyviaport(mach_port_t    server,
        serverSessionRef                mySession = getSession(server);
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)mySession->store;
 
        serverSessionRef                mySession = getSession(server);
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)mySession->store;
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
index 28aea5a3966a627701334e413bd27ee75bb53c78..a31dcb54a131e15afab298365bae23fba63f8e26 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -46,7 +46,7 @@ __SCDynamicStoreNotifySignal(SCDynamicStoreRef store, pid_t pid, int sig)
        CFStringRef                     sessionKey;
        CFDictionaryRef                 info;
 
        CFStringRef                     sessionKey;
        CFDictionaryRef                 info;
 
-       if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+       if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
                return kSCStatusNoStoreSession; /* you must have an open session to play */
        }
 
@@ -107,7 +107,7 @@ _notifyviasignal(mach_port_t        server,
                return KERN_SUCCESS;
        }
 
                return KERN_SUCCESS;
        }
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
index 22b23261e91b0742a73c8e5e15ed70a8a4d6c758..8452da2c9f1258d434b0cd6062580e3a8a79e3de 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "configd.h"
 #include "configd_server.h"
 #include "session.h"
 #include "configd.h"
 #include "configd_server.h"
 #include "session.h"
+#include "plugin_support.h"
 
 
 
 
+#define        SNAPSHOT_PATH_STATE     _PATH_VARTMP "configd-state"
 #define        SNAPSHOT_PATH_STORE     _PATH_VARTMP "configd-store.xml"
 #define        SNAPSHOT_PATH_PATTERN   _PATH_VARTMP "configd-pattern.xml"
 #define        SNAPSHOT_PATH_SESSION   _PATH_VARTMP "configd-session.xml"
 #define        SNAPSHOT_PATH_STORE     _PATH_VARTMP "configd-store.xml"
 #define        SNAPSHOT_PATH_PATTERN   _PATH_VARTMP "configd-pattern.xml"
 #define        SNAPSHOT_PATH_SESSION   _PATH_VARTMP "configd-session.xml"
@@ -125,6 +127,7 @@ int
 __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
 {
        CFDictionaryRef                 expandedStoreData;
 __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
 {
        CFDictionaryRef                 expandedStoreData;
+       FILE                            *f;
        int                             fd;
        serverSessionRef                mySession;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        int                             fd;
        serverSessionRef                mySession;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
@@ -137,11 +140,30 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
                return kSCStatusAccessError;
        }
 
                return kSCStatusAccessError;
        }
 
+       /* Save a snapshot of configd's "state" */
+
+       (void) unlink(SNAPSHOT_PATH_STATE);
+       fd = open(SNAPSHOT_PATH_STATE, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+       if (fd == -1) {
+               return kSCStatusFailed;
+       }
+       f = fdopen(fd, "w");
+       if (f == NULL) {
+               return kSCStatusFailed;
+       }
+       SCPrint(TRUE, f, CFSTR("Main thread :\n\n"));
+       SCPrint(TRUE, f, CFSTR("%@\n"), CFRunLoopGetCurrent());
+       if (plugin_runLoop != NULL) {
+               SCPrint(TRUE, f, CFSTR("Plug-in thread :\n\n"));
+               SCPrint(TRUE, f, CFSTR("%@\n"), plugin_runLoop);
+       }
+       (void) fclose(f);
+
        /* Save a snapshot of the "store" data */
 
        (void) unlink(SNAPSHOT_PATH_STORE);
        /* Save a snapshot of the "store" data */
 
        (void) unlink(SNAPSHOT_PATH_STORE);
-       fd = open(SNAPSHOT_PATH_STORE, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-       if (fd < 0) {
+       fd = open(SNAPSHOT_PATH_STORE, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+       if (fd == -1) {
                return kSCStatusFailed;
        }
 
                return kSCStatusFailed;
        }
 
@@ -160,8 +182,8 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
        /* Save a snapshot of the "pattern" data */
 
        (void) unlink(SNAPSHOT_PATH_PATTERN);
        /* Save a snapshot of the "pattern" data */
 
        (void) unlink(SNAPSHOT_PATH_PATTERN);
-       fd = open(SNAPSHOT_PATH_PATTERN, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-       if (fd < 0) {
+       fd = open(SNAPSHOT_PATH_PATTERN, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+       if (fd == -1) {
                return kSCStatusFailed;
        }
 
                return kSCStatusFailed;
        }
 
@@ -178,8 +200,8 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
        /* Save a snapshot of the "session" data */
 
        (void) unlink(SNAPSHOT_PATH_SESSION);
        /* Save a snapshot of the "session" data */
 
        (void) unlink(SNAPSHOT_PATH_SESSION);
-       fd = open(SNAPSHOT_PATH_SESSION, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-       if (fd < 0) {
+       fd = open(SNAPSHOT_PATH_SESSION, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+       if (fd == -1) {
                return kSCStatusFailed;
        }
 
                return kSCStatusFailed;
        }
 
@@ -203,7 +225,7 @@ _snapshot(mach_port_t server, int *sc_status)
 {
        serverSessionRef        mySession = getSession(server);
 
 {
        serverSessionRef        mySession = getSession(server);
 
-       if (!mySession) {
+       if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
diff --git a/configd.tproj/com.apple.configd.plist b/configd.tproj/com.apple.configd.plist
new file mode 100644 (file)
index 0000000..4a228fe
--- /dev/null
@@ -0,0 +1,19 @@
+<?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">
+<plist version="1.0">
+<dict>
+       <key>KeepAlive</key>
+       <true/>
+       <key>Label</key>
+       <string>com.apple.configd</string>
+       <key>MachServices</key>
+       <dict>
+               <key>com.apple.SystemConfiguration.configd</key>
+               <true/>
+       </dict>
+       <key>ProgramArguments</key>
+       <array>
+               <string>/usr/sbin/configd</string>
+       </array>
+</dict>
+</plist>
index 744dfe7916720d7e09991b1173ad1fa55b553d04..12df9c6a60def2329d6f6aa31cdd0763ae9326d5 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .Dd November 4, 2003
 .Dt CONFIGD 8
 .\"
 .Dd November 4, 2003
 .Dt CONFIGD 8
-.Os Mac OS X
+.Os "Mac OS X"
 .Sh NAME
 .Nm configd
 .Nd System Configuration Daemon
 .Sh NAME
 .Nm configd
 .Nd System Configuration Daemon
@@ -129,7 +129,7 @@ shutdown of the daemon.
 ./".Xr SystemConfiguration.framework 3 ,
 .Xr scutil 8 ,
 .Xr scselect 8
 ./".Xr SystemConfiguration.framework 3 ,
 .Xr scutil 8 ,
 .Xr scselect 8
-./".Xr mach_init 8
+./".Xr launchd 8
 .Sh HISTORY
 The
 .Nm
 .Sh HISTORY
 The
 .Nm
@@ -140,7 +140,7 @@ Unless started with the
 option,
 .Nm
 will register with
 option,
 .Nm
 will register with
-.Xr mach_init 8
+.Xr launchd 8
 such that the daemon will be restarted in the event of a crash.
 This registration will be removed during
 .Qq graceful
 such that the daemon will be restarted in the event of a crash.
 This registration will be removed during
 .Qq graceful
index c49cf8ae74cb022154e8287301aba6d0c1279025..ffb79c2af581c98f61a5a8fcb043bbab34454e34 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -42,6 +42,7 @@
 
 /* configd doesn't need the preference keys */
 #define _SCSCHEMADEFINITIONS_H
 
 /* configd doesn't need the preference keys */
 #define _SCSCHEMADEFINITIONS_H
+#define _SCSCHEMADEFINITIONSPRIVATE_H
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
index cc059168d9fe4857e46af571d8ff7db84992fc9e..b115bcbf2d4855439de93808895106d4f523504b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -30,7 +30,7 @@
  * June 1, 2001                        Allan Nathanson <ajn@apple.com>
  * - public API conversion
  *
  * June 1, 2001                        Allan Nathanson <ajn@apple.com>
  * - public API conversion
  *
- * 24 March 2000               Allan Nathanson (ajn@apple.com)
+ * 24 March 2000               Allan Nathanson <ajn@apple.com>
  * - created
  */
 
  * - created
  */
 
 #include <paths.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <paths.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/wait.h>
 #include <objc/objc-runtime.h>
 #include <sys/wait.h>
 #include <objc/objc-runtime.h>
+#include <servers/bootstrap.h>
 
 #include "configd.h"
 #include "configd_server.h"
 
 #include "configd.h"
 #include "configd_server.h"
@@ -92,36 +94,82 @@ usage(const char *prog)
 }
 
 
 }
 
 
+static void
+allow_crash_reports(void)
+{
+       mach_msg_type_number_t  i;
+       exception_mask_t        masks[EXC_TYPES_COUNT];
+       mach_msg_type_number_t  n_masks                 = 0;
+       mach_port_t             new_exception_port      = MACH_PORT_NULL;
+       exception_port_t        old_handlers[EXC_TYPES_COUNT];
+       exception_behavior_t    old_behaviors[EXC_TYPES_COUNT];
+       thread_state_flavor_t   old_flavors[EXC_TYPES_COUNT];
+       kern_return_t           status;
+
+       status = bootstrap_look_up(bootstrap_port, "com.apple.ReportCrash.DirectoryService", &new_exception_port);
+       if (status != BOOTSTRAP_SUCCESS) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("allow_crash_reports bootstrap_look_up() failed: %s"),
+                     bootstrap_strerror(status));
+               return;
+       }
+
+       // get information about the original crash exception port for the task
+       status = task_get_exception_ports(mach_task_self(),
+                                         EXC_MASK_CRASH,
+                                         masks,
+                                         &n_masks,
+                                         old_handlers,
+                                         old_behaviors,
+                                         old_flavors);
+       if (status != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("allow_crash_reports task_get_exception_ports() failed: %s"),
+                     mach_error_string(status));
+               return;
+       }
+
+       // replace the original crash exception port with our new port
+       for (i = 0; i < n_masks; i++) {
+               status = task_set_exception_ports(mach_task_self(),
+                                                 masks[i],
+                                                 new_exception_port,
+                                                 old_behaviors[i],
+                                                 old_flavors[i]);
+               if (status != KERN_SUCCESS) {
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("allow_crash_reports task_set_exception_ports() failed: %s"),
+                             mach_error_string(status));
+               }
+       }
+
+       return;
+}
+
+
 static void
 catcher(int signum)
 {
        switch (signum) {
 static void
 catcher(int signum)
 {
        switch (signum) {
+               case SIGINT :
                case SIGTERM :
                        if (termRequested != NULL) {
                case SIGTERM :
                        if (termRequested != NULL) {
-                               mach_msg_empty_send_t   msg;
-                               mach_msg_option_t       options;
-                               kern_return_t           status;
+                               if (_sc_log > 0) {
+                                       /*
+                                        * if we've received a [shutdown] SIGTERM
+                                        * and we are syslog'ing than it's likely
+                                        * that syslogd is also being term'd.  As
+                                        * such, let's also push any remaining log
+                                        * messages to stdout/stderr.
+                                        */
+                                       _sc_log++;
+                               }
 
                                /*
                                 * send message to indicate that a request has been made
                                 * for the daemon to be shutdown.
                                 */
 
                                /*
                                 * send message to indicate that a request has been made
                                 * for the daemon to be shutdown.
                                 */
-                               msg.header.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0);
-                               msg.header.msgh_size = sizeof(msg);
-                               msg.header.msgh_remote_port = CFMachPortGetPort(termRequested);
-                               msg.header.msgh_local_port = MACH_PORT_NULL;
-                               msg.header.msgh_id = 0;
-                               options = MACH_SEND_TIMEOUT;
-                               status = mach_msg(&msg.header,                          /* msg */
-                                                           MACH_SEND_MSG|options,      /* options */
-                                                           msg.header.msgh_size,       /* send_size */
-                                                           0,                          /* rcv_size */
-                                                           MACH_PORT_NULL,             /* rcv_name */
-                                                           0,                          /* timeout */
-                                                           MACH_PORT_NULL);            /* notify */
-                               if (status == MACH_SEND_TIMED_OUT) {
-                                       mach_msg_destroy(&msg.header);
-                               }
+                               _SC_sendMachMessage(CFMachPortGetPort(termRequested), 0);
                        } else {
                                _exit(EX_OK);
                        }
                        } else {
                                _exit(EX_OK);
                        }
@@ -188,6 +236,7 @@ init_fds()
                }
        }
 
                }
        }
 
+       SCTrace(TRUE, stdout, CFSTR("start\n"));
        return;
 }
 
        return;
 }
 
@@ -201,6 +250,7 @@ set_trace()
        fd = open("/var/log/configd.trace", O_WRONLY|O_APPEND, 0);
        if (fd != -1) {
                _configd_trace = fdopen(fd, "a");
        fd = open("/var/log/configd.trace", O_WRONLY|O_APPEND, 0);
        if (fd != -1) {
                _configd_trace = fdopen(fd, "a");
+               SCTrace(TRUE, _configd_trace, CFSTR("start\n"));
        }
 
        return;
        }
 
        return;
@@ -264,9 +314,22 @@ writepid(void)
 }
 
 
 }
 
 
+static CFStringRef
+termMPCopyDescription(const void *info)
+{
+       return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SIGTERM MP>"));
+}
+
+
 int
 main(int argc, char * const argv[])
 {
 int
 main(int argc, char * const argv[])
 {
+       CFMachPortContext       context         = { 0
+                                                 , (void *)1
+                                                 , NULL
+                                                 , NULL
+                                                 , termMPCopyDescription
+                                                 };
        Boolean                 enableRestart   = (argc <= 1);  /* only if there are no arguments */
        Boolean                 forceForeground = FALSE;
        mach_port_limits_t      limits;
        Boolean                 enableRestart   = (argc <= 1);  /* only if there are no arguments */
        Boolean                 forceForeground = FALSE;
        mach_port_limits_t      limits;
@@ -341,7 +404,7 @@ main(int argc, char * const argv[])
        if (!forceForeground && (service_port == MACH_PORT_NULL)) {
                /*
                 * if we haven't been asked to run in the foreground
        if (!forceForeground && (service_port == MACH_PORT_NULL)) {
                /*
                 * if we haven't been asked to run in the foreground
-                * and have not been started by mach_init (i.e. we're
+                * and have not been started by launchd (i.e. we're
                 * not already running as a Foreground process) then
                 * daemonize ourself.
                 */
                 * not already running as a Foreground process) then
                 * daemonize ourself.
                 */
@@ -361,17 +424,30 @@ main(int argc, char * const argv[])
         * setup logging.
         */
        if (!forceForeground) {
         * setup logging.
         */
        if (!forceForeground) {
-               int     logopt  = LOG_NDELAY|LOG_PID;
+               int             facility        = LOG_DAEMON;
+               int             logopt          = LOG_CONS|LOG_NDELAY|LOG_PID;
+               struct stat     statbuf;
 
 
-               init_fds();
+               if (service_port == MACH_PORT_NULL) {
+                       init_fds();
+               }
 
 
-               if (_configd_verbose)
+               if (_configd_verbose) {
                        logopt |= LOG_CONS;
                        logopt |= LOG_CONS;
-               openlog("configd", logopt, LOG_DAEMON);
+               }
+
+               if (stat("/etc/rc.cdrom", &statbuf) == 0) {
+                       facility = LOG_INSTALL;
+               }
+
+               openlog("configd", logopt, facility);
        } else {
                _sc_log = FALSE;        /* redirect SCLog() to stdout/stderr */
        }
 
        } else {
                _sc_log = FALSE;        /* redirect SCLog() to stdout/stderr */
        }
 
+       /* enable crash reporting */
+       allow_crash_reports();
+
        /* check/enable trace logging */
        set_trace();
 
        /* check/enable trace logging */
        set_trace();
 
@@ -404,10 +480,17 @@ main(int argc, char * const argv[])
                      strerror(errno));
        }
 
                      strerror(errno));
        }
 
+       /* add signal handler to catch a SIGINT */
+       if (sigaction(SIGINT, &nact, NULL) == -1) {
+               SCLog(_configd_verbose, LOG_ERR,
+                     CFSTR("sigaction(SIGINT, ...) failed: %s"),
+                     strerror(errno));
+       }
+
        /* create the "shutdown requested" notification port */
        /* create the "shutdown requested" notification port */
-       termRequested = CFMachPortCreate(NULL, term, NULL, NULL);
+       termRequested = CFMachPortCreate(NULL, term, &context, NULL);
 
 
-       // set queue limit
+       /* set queue limit */
        limits.mpl_qlimit = 1;
        status = mach_port_set_attributes(mach_task_self(),
                                          CFMachPortGetPort(termRequested),
        limits.mpl_qlimit = 1;
        status = mach_port_set_attributes(mach_task_self(),
                                          CFMachPortGetPort(termRequested),
@@ -418,7 +501,7 @@ main(int argc, char * const argv[])
                perror("mach_port_set_attributes");
        }
 
                perror("mach_port_set_attributes");
        }
 
-       // add to our runloop
+       /* add to our runloop */
        rls = CFMachPortCreateRunLoopSource(NULL, termRequested, 0);
        CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
        CFRelease(rls);
        rls = CFMachPortCreateRunLoopSource(NULL, termRequested, 0);
        CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
        CFRelease(rls);
@@ -428,13 +511,13 @@ main(int argc, char * const argv[])
                server_init(service_port, enableRestart);
 
                if (!forceForeground && (service_port == MACH_PORT_NULL)) {
                server_init(service_port, enableRestart);
 
                if (!forceForeground && (service_port == MACH_PORT_NULL)) {
-                   /* synchronize with parent process */
-                   kill(getppid(), SIGTERM);
+                       /* synchronize with parent process */
+                       kill(getppid(), SIGTERM);
                }
 
                /* load/initialize/start bundles into the secondary thread */
                if (loadBundles) {
                }
 
                /* load/initialize/start bundles into the secondary thread */
                if (loadBundles) {
-                       objc_setMultithreaded(YES);
+                       /* start plug-in initialization */
                        plugin_init();
                }
 
                        plugin_init();
                }
 
@@ -445,6 +528,6 @@ main(int argc, char * const argv[])
                plugin_exec((void *)testBundle);
        }
 
                plugin_exec((void *)testBundle);
        }
 
-       exit (EX_OK);   // insure the process exit status is 0
-       return 0;       // ...and make main fit the ANSI spec.
+       exit (EX_OK);   /* insure the process exit status is 0 */
+       return 0;       /* ...and make main fit the ANSI spec. */
 }
 }
diff --git a/configd.tproj/configd.plist b/configd.tproj/configd.plist
deleted file mode 100644 (file)
index a8d692a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?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">
-<plist version="1.0">
-<dict>
-        <key>ServiceName</key>
-        <string>com.apple.SystemConfiguration.configd</string>
-        <key>Command</key>
-        <string>/usr/sbin/configd</string>
-       <key>OnDemand</key>
-       <false/>
-</dict>
-</plist>
index adfe9a55cbb55875f1bfcf9503ab8813a521c564..cdaf65535029c96bf3ef0a3c3811902cfe85e958 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -58,7 +58,7 @@ extern boolean_t              shared_dns_info_server(mach_msg_header_t *, mach_msg_header_t
 /* configd server port (for new session requests) */
 static CFMachPortRef           configd_port            = NULL;
 
 /* configd server port (for new session requests) */
 static CFMachPortRef           configd_port            = NULL;
 
-/* priviledged bootstrap port (for registering/unregistering w/mach_init) */
+/* priviledged bootstrap port (for registering/unregistering w/launchd) */
 static mach_port_t             priv_bootstrap_port     = MACH_PORT_NULL;
 
 __private_extern__
 static mach_port_t             priv_bootstrap_port     = MACH_PORT_NULL;
 
 __private_extern__
@@ -66,32 +66,6 @@ boolean_t
 config_demux(mach_msg_header_t *request, mach_msg_header_t *reply)
 {
        Boolean                         processed = FALSE;
 config_demux(mach_msg_header_t *request, mach_msg_header_t *reply)
 {
        Boolean                         processed = FALSE;
-       serverSessionRef                thisSession;
-       mach_msg_format_0_trailer_t     *trailer;
-
-       thisSession = getSession(request->msgh_local_port);
-       if (thisSession) {
-               /*
-                * Get the caller's credentials (eUID/eGID) from the message trailer.
-                */
-               trailer = (mach_msg_security_trailer_t *)((vm_offset_t)request +
-                                                         round_msg(request->msgh_size));
-
-               if ((trailer->msgh_trailer_type == MACH_MSG_TRAILER_FORMAT_0) &&
-                   (trailer->msgh_trailer_size >= MACH_MSG_TRAILER_FORMAT_0_SIZE)) {
-                       thisSession->callerEUID = trailer->msgh_sender.val[0];
-                       thisSession->callerEGID = trailer->msgh_sender.val[1];
-               } else {
-                       static Boolean warned   = FALSE;
-
-                       if (!warned) {
-                               SCLog(TRUE, LOG_WARNING, CFSTR("caller's credentials not available."));
-                               warned = TRUE;
-                       }
-                       thisSession->callerEUID = 0;
-                       thisSession->callerEGID = 0;
-               }
-       }
 
        /*
         * (attempt to) process SCDynamicStore requests.
 
        /*
         * (attempt to) process SCDynamicStore requests.
@@ -246,7 +220,7 @@ server_active(mach_port_t *restart_service_port)
        status = bootstrap_check_in(bootstrap_port, service_name, restart_service_port);
        switch (status) {
                case BOOTSTRAP_SUCCESS :
        status = bootstrap_check_in(bootstrap_port, service_name, restart_service_port);
        switch (status) {
                case BOOTSTRAP_SUCCESS :
-                       /* if we are being restarted by mach_init */
+                       /* if we are being restarted by launchd */
                        priv_bootstrap_port = bootstrap_port;
                        break;
                case BOOTSTRAP_SERVICE_ACTIVE :
                        priv_bootstrap_port = bootstrap_port;
                        break;
                case BOOTSTRAP_SERVICE_ACTIVE :
@@ -260,7 +234,9 @@ server_active(mach_port_t *restart_service_port)
                        *restart_service_port = MACH_PORT_NULL;
                        break;
                default :
                        *restart_service_port = MACH_PORT_NULL;
                        break;
                default :
-                       fprintf(stderr, "bootstrap_check_in() failed: status=%d\n", status);
+                       fprintf(stderr,
+                               "bootstrap_check_in() failed: %s\n",
+                               bootstrap_strerror(status));
                        exit (EX_UNAVAILABLE);
        }
 
                        exit (EX_UNAVAILABLE);
        }
 
@@ -268,10 +244,25 @@ server_active(mach_port_t *restart_service_port)
 }
 
 
 }
 
 
+static CFStringRef
+serverMPCopyDescription(const void *info)
+{
+       return CFStringCreateWithFormat(NULL, NULL, CFSTR("<main DynamicStore MP>"));
+}
+
+
 __private_extern__
 void
 __private_extern__
 void
-server_init(mach_port_t        restart_service_port, Boolean enableRestart)
+server_init(mach_port_t                restart_service_port,
+           Boolean             enableRestart)
 {
 {
+       CFMachPortContext       context         = { 0
+                                                 , (void *)1
+                                                 , NULL
+                                                 , NULL
+                                                 , serverMPCopyDescription
+                                                 };
+
        CFRunLoopSourceRef      rls;
        char                    *service_name;
        mach_port_t             service_port    = restart_service_port;
        CFRunLoopSourceRef      rls;
        char                    *service_name;
        mach_port_t             service_port    = restart_service_port;
@@ -290,7 +281,7 @@ server_init(mach_port_t     restart_service_port, Boolean enableRestart)
                status = bootstrap_check_in(bootstrap_port, service_name, &service_port);
                switch (status) {
                        case BOOTSTRAP_SUCCESS :
                status = bootstrap_check_in(bootstrap_port, service_name, &service_port);
                switch (status) {
                        case BOOTSTRAP_SUCCESS :
-                               /* if we are being restarted by mach_init */
+                               /* if we are being restarted by launchd */
                                priv_bootstrap_port = bootstrap_port;
                                break;
                        case BOOTSTRAP_NOT_PRIVILEGED :
                                priv_bootstrap_port = bootstrap_port;
                                break;
                        case BOOTSTRAP_NOT_PRIVILEGED :
@@ -306,7 +297,9 @@ server_init(mach_port_t     restart_service_port, Boolean enableRestart)
                                                                         FALSE,         /* not onDemand == restart now */
                                                                         &priv_bootstrap_port);
                                        if (status != BOOTSTRAP_SUCCESS) {
                                                                         FALSE,         /* not onDemand == restart now */
                                                                         &priv_bootstrap_port);
                                        if (status != BOOTSTRAP_SUCCESS) {
-                                               SCLog(TRUE, LOG_ERR, CFSTR("server_init bootstrap_create_server() failed: status=%d"), status);
+                                               SCLog(TRUE, LOG_ERR,
+                                                     CFSTR("server_init bootstrap_create_server() failed: %s"),
+                                                     bootstrap_strerror(status));
                                                exit (EX_UNAVAILABLE);
                                        }
                                } else {
                                                exit (EX_UNAVAILABLE);
                                        }
                                } else {
@@ -315,13 +308,17 @@ server_init(mach_port_t   restart_service_port, Boolean enableRestart)
 
                                status = bootstrap_create_service(priv_bootstrap_port, service_name, &service_send_port);
                                if (status != BOOTSTRAP_SUCCESS) {
 
                                status = bootstrap_create_service(priv_bootstrap_port, service_name, &service_send_port);
                                if (status != BOOTSTRAP_SUCCESS) {
-                                       SCLog(TRUE, LOG_ERR, CFSTR("server_init bootstrap_create_service() failed: status=%d"), status);
+                                       SCLog(TRUE, LOG_ERR,
+                                             CFSTR("server_init bootstrap_create_service() failed: %s"),
+                                             bootstrap_strerror(status));
                                        exit (EX_UNAVAILABLE);
                                }
 
                                status = bootstrap_check_in(priv_bootstrap_port, service_name, &service_port);
                                if (status != BOOTSTRAP_SUCCESS) {
                                        exit (EX_UNAVAILABLE);
                                }
 
                                status = bootstrap_check_in(priv_bootstrap_port, service_name, &service_port);
                                if (status != BOOTSTRAP_SUCCESS) {
-                                       SCLog(TRUE, LOG_ERR, CFSTR("server_init bootstrap_check_in() failed: status=%d"), status);
+                                       SCLog(TRUE, LOG_ERR,
+                                             CFSTR("server_init bootstrap_check_in() failed: %s"),
+                                             bootstrap_strerror(status));
                                        exit (EX_UNAVAILABLE);
                                }
                                break;
                                        exit (EX_UNAVAILABLE);
                                }
                                break;
@@ -330,8 +327,10 @@ server_init(mach_port_t    restart_service_port, Boolean enableRestart)
                                SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already active"), service_name);
                                exit (EX_UNAVAILABLE);
                        default :
                                SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already active"), service_name);
                                exit (EX_UNAVAILABLE);
                        default :
-                               SCLog(TRUE, LOG_ERR, CFSTR("server_init bootstrap_check_in() failed: status=%d"), status);
-                               exit (EX_UNAVAILABLE);
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("server_init bootstrap_check_in() failed: %s"),
+                             bootstrap_strerror(status));
+                       exit (EX_UNAVAILABLE);
                }
 
        }
                }
 
        }
@@ -339,19 +338,25 @@ server_init(mach_port_t   restart_service_port, Boolean enableRestart)
        /* we don't want to pass our priviledged bootstrap port along to any spawned helpers so... */
        status = bootstrap_unprivileged(priv_bootstrap_port, &unpriv_bootstrap_port);
        if (status != BOOTSTRAP_SUCCESS) {
        /* we don't want to pass our priviledged bootstrap port along to any spawned helpers so... */
        status = bootstrap_unprivileged(priv_bootstrap_port, &unpriv_bootstrap_port);
        if (status != BOOTSTRAP_SUCCESS) {
-               SCLog(TRUE, LOG_ERR, CFSTR("server_init bootstrap_unprivileged() failed: status=%d"), status);
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("server_init bootstrap_unprivileged() failed: %s"),
+                     bootstrap_strerror(status));
                exit (EX_UNAVAILABLE);
        }
 
        status = task_set_bootstrap_port(mach_task_self(), unpriv_bootstrap_port);
        if (status != BOOTSTRAP_SUCCESS) {
                exit (EX_UNAVAILABLE);
        }
 
        status = task_set_bootstrap_port(mach_task_self(), unpriv_bootstrap_port);
        if (status != BOOTSTRAP_SUCCESS) {
-               SCLog(TRUE, LOG_ERR, CFSTR("server_init task_set_bootstrap_port(): %s"),
-                       mach_error_string(status));
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("server_init task_set_bootstrap_port(): %s"),
+                     mach_error_string(status));
                exit (EX_UNAVAILABLE);
        }
 
                exit (EX_UNAVAILABLE);
        }
 
+       /* ... and make sure that the global "bootstrap_port" is also unpriviledged */
+       bootstrap_port = unpriv_bootstrap_port;
+
        /* Create the primary / new connection port */
        /* Create the primary / new connection port */
-       configd_port = CFMachPortCreateWithPort(NULL, service_port, configdCallback, NULL, NULL);
+       configd_port = CFMachPortCreateWithPort(NULL, service_port, configdCallback, &context, NULL);
 
        /*
         * Create and add a run loop source for the port and add this source
 
        /*
         * Create and add a run loop source for the port and add this source
@@ -404,15 +409,12 @@ server_shutdown()
                        break;
                case MACH_SEND_INVALID_DEST :
                case MIG_SERVER_DIED :
                        break;
                case MACH_SEND_INVALID_DEST :
                case MIG_SERVER_DIED :
-                       /* something happened to mach_init */
+                       /* something happened to launchd */
                        break;
                default :
                        break;
                default :
-                       if (_configd_verbose) {
-                               syslog (LOG_ERR, "bootstrap_register() failed: status=%d"  , status);
-                       } else {
-                               fprintf(stderr,  "bootstrap_register() failed: status=%d\n", status);
-                               fflush (stderr);
-                       }
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("server_shutdown bootstrap_register(): %s"),
+                             bootstrap_strerror(status));
                        return EX_UNAVAILABLE;
        }
 
                        return EX_UNAVAILABLE;
        }
 
index 4784de975035c544f103ec29a2635f7b65bd188d..07becd3666c84c86265dcf5e2ead7835151320b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -50,9 +50,9 @@ boolean_t     server_active   (mach_port_t            *service_port);
 void           server_init     (mach_port_t            service_port,
                                 Boolean                enableRestart);
 
 void           server_init     (mach_port_t            service_port,
                                 Boolean                enableRestart);
 
-int            server_shutdown ();
+int            server_shutdown (void);
 
 
-void           server_loop     ();
+void           server_loop     (void);
 
 kern_return_t  _snapshot       (mach_port_t            server,
                                 int                    *sc_status);
 
 kern_return_t  _snapshot       (mach_port_t            server,
                                 int                    *sc_status);
@@ -63,7 +63,8 @@ kern_return_t _configopen     (mach_port_t            server,
                                 xmlData_t              optionsRef,
                                 mach_msg_type_number_t optionsLen,
                                 mach_port_t            *newServer,
                                 xmlData_t              optionsRef,
                                 mach_msg_type_number_t optionsLen,
                                 mach_port_t            *newServer,
-                                int                    *sc_status);
+                                int                    *sc_status,
+                                audit_token_t          audit_token);
 
 kern_return_t  _configclose    (mach_port_t            server,
                                 int                    *sc_status);
 
 kern_return_t  _configclose    (mach_port_t            server,
                                 int                    *sc_status);
index 704eedd122dc6039876fca055fbcc1962fb2f523..f1b46ec1805f924cf94a2326fe47acbf3069c032 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 72446273e5884e16a1ff0cd293e45ef6c9d7be6f..e4bc1c43eb90e2f94ed6c8a013064e51af6a4878 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003, 2004, 2006, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -86,7 +86,7 @@ identifyKeyForPattern(const void *key, void *val, void *context)
        }
 
        /* convert store key to C string */
        }
 
        /* convert store key to C string */
-       len = CFStringGetLength(storeKey) + 1;
+       len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(storeKey), kCFStringEncodingASCII) + 1;
        if (len > (CFIndex)sizeof(str_q))
                str = CFAllocatorAllocate(NULL, len, 0);
        if (_SC_cfstring_to_cstring(storeKey, str, len, kCFStringEncodingASCII) == NULL) {
        if (len > (CFIndex)sizeof(str_q))
                str = CFAllocatorAllocate(NULL, len, 0);
        if (_SC_cfstring_to_cstring(storeKey, str, len, kCFStringEncodingASCII) == NULL) {
@@ -120,7 +120,7 @@ identifyKeyForPattern(const void *key, void *val, void *context)
 }
 
 
 }
 
 
-__private_extern__ Boolean
+static Boolean
 patternCompile(CFStringRef pattern, regex_t *preg, CFStringRef *error)
 {
        Boolean         append          = FALSE;
 patternCompile(CFStringRef pattern, regex_t *preg, CFStringRef *error)
 {
        Boolean         append          = FALSE;
@@ -190,8 +190,7 @@ patternCompile(CFStringRef pattern, regex_t *preg, CFStringRef *error)
 }
 
 
 }
 
 
-__private_extern__
-CFMutableArrayRef
+static CFMutableArrayRef
 patternCopy(CFStringRef        pattern)
 {
        CFArrayRef      pInfo;
 patternCopy(CFStringRef        pattern)
 {
        CFArrayRef      pInfo;
@@ -201,12 +200,11 @@ patternCopy(CFStringRef   pattern)
 }
 
 
 }
 
 
-__private_extern__
-CFMutableArrayRef
+static CFMutableArrayRef
 patternNew(CFStringRef pattern)
 {
        addContext              context;
 patternNew(CFStringRef pattern)
 {
        addContext              context;
-       CFStringRef             err;
+       CFStringRef             err     = NULL;
        CFMutableArrayRef       pInfo;
        CFMutableDataRef        pRegex;
        CFArrayRef              pSessions;
        CFMutableArrayRef       pInfo;
        CFMutableDataRef        pRegex;
        CFArrayRef              pSessions;
@@ -244,6 +242,41 @@ patternNew(CFStringRef pattern)
 }
 
 
 }
 
 
+__private_extern__
+CFArrayRef
+patternCopyMatches(CFStringRef pattern)
+{
+       Boolean                 isNew   = FALSE;
+       CFArrayRef              keys;
+       CFMutableArrayRef       pInfo;
+
+       /* find (or create new instance of) this pattern */
+       pInfo = patternCopy(pattern);
+       if (pInfo == NULL) {
+               /* if new pattern */
+               pInfo = patternNew(pattern);
+               if (pInfo == NULL) {
+                       return NULL;
+               }
+
+               isNew = TRUE;
+       }
+
+       if (isNew) {
+               CFDataRef       pRegex;
+
+               pRegex = CFArrayGetValueAtIndex(pInfo, 0);
+               regfree((regex_t *)CFDataGetBytePtr(pRegex));
+       }
+
+       CFArrayReplaceValues(pInfo, CFRangeMake(0, 2), NULL, 0);
+       keys = CFArrayCreateCopy(NULL, pInfo);
+       CFRelease(pInfo);
+
+       return keys;
+}
+
+
 __private_extern__
 Boolean
 patternAddSession(CFStringRef pattern, CFNumberRef sessionNum)
 __private_extern__
 Boolean
 patternAddSession(CFStringRef pattern, CFNumberRef sessionNum)
@@ -255,10 +288,10 @@ patternAddSession(CFStringRef pattern, CFNumberRef sessionNum)
 
        /* find (or create new instance of) this pattern */
        pInfo = patternCopy(pattern);
 
        /* find (or create new instance of) this pattern */
        pInfo = patternCopy(pattern);
-       if (!pInfo) {
+       if (pInfo == NULL) {
                /* if new pattern */
                pInfo = patternNew(pattern);
                /* if new pattern */
                pInfo = patternNew(pattern);
-               if (!pInfo) {
+               if (pInfo == NULL) {
                        return FALSE;
                }
        }
                        return FALSE;
                }
        }
@@ -349,7 +382,7 @@ addKeyForPattern(const void *key, void *val, void *context)
        char *                  str             = str_q;
 
        /* convert store key to C string */
        char *                  str             = str_q;
 
        /* convert store key to C string */
-       len = CFStringGetLength(storeKey) + 1;
+       len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(storeKey), kCFStringEncodingASCII) + 1;
        if (len > (CFIndex)sizeof(str_q))
                str = CFAllocatorAllocate(NULL, len, 0);
        if (_SC_cfstring_to_cstring(storeKey, str, len, kCFStringEncodingASCII) == NULL) {
        if (len > (CFIndex)sizeof(str_q))
                str = CFAllocatorAllocate(NULL, len, 0);
        if (_SC_cfstring_to_cstring(storeKey, str, len, kCFStringEncodingASCII) == NULL) {
index 549d8ef2a394fa3ec5b426d3ea9b9f77dec4bce6..417fedc7e68c6e18ffd1ead7f2fff557b8d88a49 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
-Boolean                        patternCompile          (CFStringRef            pattern,
-                                                regex_t                *preg,
-                                                CFStringRef            *error);
-
-CFMutableArrayRef      patternCopy             (CFStringRef            pattern);
-
-CFMutableArrayRef      patternNew              (CFStringRef            pattern);
+CFArrayRef             patternCopyMatches      (CFStringRef            pattern);
 
 Boolean                        patternAddSession       (CFStringRef            pattern,
                                                 CFNumberRef            sessionNum);
 
 Boolean                        patternAddSession       (CFStringRef            pattern,
                                                 CFNumberRef            sessionNum);
index 97357cae6f0fe8e2ba07a2bdac0e13ce6c259083..9ddeb4a3a5ac79332136e2c3629d7390b47b202e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -41,6 +41,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
+#include <sys/wait.h>
 #include <dirent.h>
 #include <sysexits.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <sysexits.h>
 #include <unistd.h>
@@ -63,6 +64,7 @@ typedef struct {
        CFBundleRef                             bundle;
        Boolean                                 loaded;
        Boolean                                 builtin;
        CFBundleRef                             bundle;
        Boolean                                 loaded;
        Boolean                                 builtin;
+       Boolean                                 enabled;
        Boolean                                 verbose;
        SCDynamicStoreBundleLoadFunction        load;
        SCDynamicStoreBundleStartFunction       start;
        Boolean                                 verbose;
        SCDynamicStoreBundleLoadFunction        load;
        SCDynamicStoreBundleStartFunction       start;
@@ -72,29 +74,33 @@ typedef struct {
 
 
 // all loaded bundles
 
 
 // all loaded bundles
-static CFMutableArrayRef       allBundles      = NULL;
+static CFMutableArrayRef       allBundles              = NULL;
 
 // exiting bundles
 
 // exiting bundles
-static CFMutableDictionaryRef  exiting         = NULL;
+static CFMutableDictionaryRef  exiting                 = NULL;
 
 // plugin CFRunLoopRef
 
 // plugin CFRunLoopRef
-static CFRunLoopRef            plugin_runLoop  = NULL;
+__private_extern__
+CFRunLoopRef                   plugin_runLoop          = NULL;
 
 
 
 
-#ifdef ppc
 extern SCDynamicStoreBundleLoadFunction                load_ATconfig;
 extern SCDynamicStoreBundleStopFunction                stop_ATconfig;
 extern SCDynamicStoreBundleLoadFunction                load_ATconfig;
 extern SCDynamicStoreBundleStopFunction                stop_ATconfig;
-#endif /* ppc */
 extern SCDynamicStoreBundleLoadFunction                load_IPMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_IPMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_InterfaceNamer;
 extern SCDynamicStoreBundleLoadFunction                load_KernelEventMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_KernelEventMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_IPMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_IPMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_InterfaceNamer;
 extern SCDynamicStoreBundleLoadFunction                load_KernelEventMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_KernelEventMonitor;
+#ifdef INCLUDE_KICKER
 extern SCDynamicStoreBundleLoadFunction                load_Kicker;
 extern SCDynamicStoreBundleLoadFunction                load_Kicker;
+#endif // INCLUDE_KICKER
 extern SCDynamicStoreBundleLoadFunction                load_LinkConfiguration;
 extern SCDynamicStoreBundleLoadFunction                load_PreferencesMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_PreferencesMonitor;
 extern SCDynamicStoreBundleStopFunction                stop_PreferencesMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_LinkConfiguration;
 extern SCDynamicStoreBundleLoadFunction                load_PreferencesMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_PreferencesMonitor;
 extern SCDynamicStoreBundleStopFunction                stop_PreferencesMonitor;
+extern SCDynamicStoreBundleLoadFunction                load_NetworkIdentification;
+extern SCDynamicStoreBundlePrimeFunction       prime_NetworkIdentification;
+extern SCDynamicStoreBundleStopFunction                stop_NetworkIdentification;
 
 
 typedef struct {
 
 
 typedef struct {
@@ -107,7 +113,6 @@ typedef struct {
 
 
 static const builtin builtin_plugins[] = {
 
 
 static const builtin builtin_plugins[] = {
-#ifdef ppc
        {
                CFSTR("com.apple.SystemConfiguration.ATconfig"),
                &load_ATconfig,
        {
                CFSTR("com.apple.SystemConfiguration.ATconfig"),
                &load_ATconfig,
@@ -115,7 +120,6 @@ static const builtin builtin_plugins[] = {
                NULL,
                &stop_ATconfig
        },
                NULL,
                &stop_ATconfig
        },
-#endif /* ppc */
        {
                CFSTR("com.apple.SystemConfiguration.IPMonitor"),
                &load_IPMonitor,
        {
                CFSTR("com.apple.SystemConfiguration.IPMonitor"),
                &load_IPMonitor,
@@ -137,6 +141,7 @@ static const builtin builtin_plugins[] = {
                &prime_KernelEventMonitor,
                NULL
        },
                &prime_KernelEventMonitor,
                NULL
        },
+#ifdef INCLUDE_KICKER
        {
                CFSTR("com.apple.SystemConfiguration.Kicker"),
                &load_Kicker,
        {
                CFSTR("com.apple.SystemConfiguration.Kicker"),
                &load_Kicker,
@@ -144,6 +149,7 @@ static const builtin builtin_plugins[] = {
                NULL,
                NULL
        },
                NULL,
                NULL
        },
+#endif // INCLUDE_KICKER
        {
                CFSTR("com.apple.SystemConfiguration.LinkConfiguration"),
                &load_LinkConfiguration,
        {
                CFSTR("com.apple.SystemConfiguration.LinkConfiguration"),
                &load_LinkConfiguration,
@@ -151,6 +157,13 @@ static const builtin builtin_plugins[] = {
                NULL,
                NULL
        },
                NULL,
                NULL
        },
+       {
+               CFSTR("com.apple.SystemConfiguration.NetworkIdentification"),
+               &load_NetworkIdentification,
+               NULL,
+               &prime_NetworkIdentification,
+               &stop_NetworkIdentification
+       },
        {
                CFSTR("com.apple.SystemConfiguration.PreferencesMonitor"),
                &load_PreferencesMonitor,
        {
                CFSTR("com.apple.SystemConfiguration.PreferencesMonitor"),
                &load_PreferencesMonitor,
@@ -161,8 +174,32 @@ static const builtin builtin_plugins[] = {
 };
 
 
 };
 
 
+#ifdef DEBUG
 static void
 static void
-addBundle(CFBundleRef bundle)
+traceBundle(const char *op, CFBundleRef bundle)
+{
+       if (_configd_trace != NULL) {
+               if (bundle != NULL) {
+                       CFStringRef     bundleID        = CFBundleGetIdentifier(bundle);
+
+                       SCTrace(TRUE, _configd_trace,
+                               CFSTR("bundle  : %s %@\n"),
+                               op,
+                               bundleID);
+               } else {
+                       SCTrace(TRUE, _configd_trace,
+                               CFSTR("bundle  : %s\n"),
+                               op);
+               }
+       }
+
+       return;
+}
+#endif /* DEBUG */
+
+
+static void
+addBundle(CFBundleRef bundle, Boolean forceEnabled)
 {
        CFDictionaryRef         bundleDict;
        bundleInfoRef           bundleInfo;
 {
        CFDictionaryRef         bundleDict;
        bundleInfoRef           bundleInfo;
@@ -171,6 +208,7 @@ addBundle(CFBundleRef bundle)
        bundleInfo->bundle      = (CFBundleRef)CFRetain(bundle);
        bundleInfo->loaded      = FALSE;
        bundleInfo->builtin     = FALSE;
        bundleInfo->bundle      = (CFBundleRef)CFRetain(bundle);
        bundleInfo->loaded      = FALSE;
        bundleInfo->builtin     = FALSE;
+       bundleInfo->enabled     = TRUE;
        bundleInfo->verbose     = FALSE;
        bundleInfo->load        = NULL;
        bundleInfo->start       = NULL;
        bundleInfo->verbose     = FALSE;
        bundleInfo->load        = NULL;
        bundleInfo->start       = NULL;
@@ -182,16 +220,25 @@ addBundle(CFBundleRef bundle)
                CFBooleanRef    bVal;
 
                bVal = CFDictionaryGetValue(bundleDict, kSCBundleIsBuiltinKey);
                CFBooleanRef    bVal;
 
                bVal = CFDictionaryGetValue(bundleDict, kSCBundleIsBuiltinKey);
-               if (isA_CFBoolean(bVal) && CFBooleanGetValue(bVal)) {
-                       bundleInfo->builtin = TRUE;
+               if (isA_CFBoolean(bVal)) {
+                       bundleInfo->builtin = CFBooleanGetValue(bVal);
+               }
+
+               bVal = CFDictionaryGetValue(bundleDict, kSCBundleEnabledKey);
+               if (isA_CFBoolean(bVal)) {
+                       bundleInfo->enabled = CFBooleanGetValue(bVal);
                }
 
                bVal = CFDictionaryGetValue(bundleDict, kSCBundleVerboseKey);
                }
 
                bVal = CFDictionaryGetValue(bundleDict, kSCBundleVerboseKey);
-               if (isA_CFBoolean(bVal) && CFBooleanGetValue(bVal)) {
-                       bundleInfo->verbose = TRUE;
+               if (isA_CFBoolean(bVal)) {
+                       bundleInfo->verbose = CFBooleanGetValue(bVal);
                }
        }
 
                }
        }
 
+       if (forceEnabled) {
+               bundleInfo->enabled = TRUE;
+       }
+
        CFArrayAppendValue(allBundles, bundleInfo);
        return;
 }
        CFArrayAppendValue(allBundles, bundleInfo);
        return;
 }
@@ -257,14 +304,14 @@ loadBundle(const void *value, void *context) {
        bundleID = CFBundleGetIdentifier(bundleInfo->bundle);
        if (bundleID == NULL) {
                // sorry, no bundles without a bundle identifier
        bundleID = CFBundleGetIdentifier(bundleInfo->bundle);
        if (bundleID == NULL) {
                // sorry, no bundles without a bundle identifier
-               SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@"), bundleInfo->bundle);
+               SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (no bundle ID)"), bundleInfo->bundle);
                return;
        }
 
        shortID = shortBundleIdentifier(bundleID);
 
        bundleExclude = CFSetContainsValue(_plugins_exclude, bundleID);
                return;
        }
 
        shortID = shortBundleIdentifier(bundleID);
 
        bundleExclude = CFSetContainsValue(_plugins_exclude, bundleID);
-       if (bundleExclude) {
+       if (!bundleExclude) {
                if (shortID != NULL) {
                        bundleExclude = CFSetContainsValue(_plugins_exclude, shortID);
                }
                if (shortID != NULL) {
                        bundleExclude = CFSetContainsValue(_plugins_exclude, shortID);
                }
@@ -272,7 +319,13 @@ loadBundle(const void *value, void *context) {
 
        if (bundleExclude) {
                // sorry, this bundle has been excluded
 
        if (bundleExclude) {
                // sorry, this bundle has been excluded
-               SCLog(TRUE, LOG_DEBUG, CFSTR("excluded %@"), bundleID);
+               SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (excluded)"), bundleID);
+               goto done;
+       }
+
+       if (!bundleInfo->enabled) {
+               // sorry, this bundle has not been enaabled
+               SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (disabled)"), bundleID);
                goto done;
        }
 
                goto done;
        }
 
@@ -299,9 +352,21 @@ loadBundle(const void *value, void *context) {
                                break;
                        }
                }
                                break;
                        }
                }
+
+               if ((bundleInfo->load  == NULL) &&
+                   (bundleInfo->start == NULL) &&
+                   (bundleInfo->prime == NULL) &&
+                   (bundleInfo->stop  == NULL)) {
+                       SCLog(TRUE, LOG_NOTICE, CFSTR("%@ add failed"), bundleID);
+                       goto done;
+               }
        } else {
                SCLog(TRUE, LOG_DEBUG, CFSTR("loading %@"), bundleID);
 
        } else {
                SCLog(TRUE, LOG_DEBUG, CFSTR("loading %@"), bundleID);
 
+#ifdef DEBUG
+               traceBundle("loading", bundleInfo->bundle);
+#endif /* DEBUG */
+
                if (!CFBundleLoadExecutable(bundleInfo->bundle)) {
                        SCLog(TRUE, LOG_NOTICE, CFSTR("%@ load failed"), bundleID);
                        goto done;
                if (!CFBundleLoadExecutable(bundleInfo->bundle)) {
                        SCLog(TRUE, LOG_NOTICE, CFSTR("%@ load failed"), bundleID);
                        goto done;
@@ -340,7 +405,12 @@ callLoadFunction(const void *value, void *context) {
                return;
        }
 
                return;
        }
 
+#ifdef DEBUG
+       traceBundle("calling load() for", bundleInfo->bundle);
+#endif /* DEBUG */
+
        (*bundleInfo->load)(bundleInfo->bundle, bundleInfo->verbose);
        (*bundleInfo->load)(bundleInfo->bundle, bundleInfo->verbose);
+
        return;
 }
 
        return;
 }
 
@@ -402,7 +472,12 @@ callStartFunction(const void *value, void *context) {
        bundleName[0] = '\0';
        (void) strncat(bundleName, cp, len);
 
        bundleName[0] = '\0';
        (void) strncat(bundleName, cp, len);
 
+#ifdef DEBUG
+       traceBundle("calling start() for", bundleInfo->bundle);
+#endif /* DEBUG */
+
        (*bundleInfo->start)(bundleName, bundlePath);
        (*bundleInfo->start)(bundleName, bundlePath);
+
        return;
 }
 
        return;
 }
 
@@ -420,7 +495,12 @@ callPrimeFunction(const void *value, void *context) {
                return;
        }
 
                return;
        }
 
+#ifdef DEBUG
+       traceBundle("calling prime() for", bundleInfo->bundle);
+#endif /* DEBUG */
+
        (*bundleInfo->prime)();
        (*bundleInfo->prime)();
+
        return;
 }
 
        return;
 }
 
@@ -483,20 +563,33 @@ stopDelayed(CFRunLoopTimerRef timer, void *info)
        exit (status);
 }
 
        exit (status);
 }
 
+static CFStringRef
+stopRLSCopyDescription(const void *info)
+{
+       CFBundleRef     bundle  = (CFBundleRef)info;
+
+       return CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("<stopRLS %p> {bundleID = %@}"),
+                                       info,
+                                       CFBundleGetIdentifier(bundle));
+}
+
+
 static void
 stopBundle(const void *value, void *context) {
        bundleInfoRef                   bundleInfo      = (bundleInfoRef)value;
        CFRunLoopSourceRef              stopRls;
 static void
 stopBundle(const void *value, void *context) {
        bundleInfoRef                   bundleInfo      = (bundleInfoRef)value;
        CFRunLoopSourceRef              stopRls;
-       CFRunLoopSourceContext          stopContext     = { 0                   // version
-                                                         , bundleInfo->bundle  // info
-                                                         , CFRetain            // retain
-                                                         , CFRelease           // release
-                                                         , CFCopyDescription   // copyDescription
-                                                         , CFEqual             // equal
-                                                         , CFHash              // hash
-                                                         , NULL                // schedule
-                                                         , NULL                // cancel
-                                                         , stopComplete        // perform
+       CFRunLoopSourceContext          stopContext     = { 0                           // version
+                                                         , bundleInfo->bundle          // info
+                                                         , CFRetain                    // retain
+                                                         , CFRelease                   // release
+                                                         , stopRLSCopyDescription      // copyDescription
+                                                         , CFEqual                     // equal
+                                                         , CFHash                      // hash
+                                                         , NULL                        // schedule
+                                                         , NULL                        // cancel
+                                                         , stopComplete                // perform
                                                          };
 
        if (!bundleInfo->loaded) {
                                                          };
 
        if (!bundleInfo->loaded) {
@@ -560,22 +653,29 @@ stopBundles()
 }
 
 
 }
 
 
+static CFStringRef
+termRLSCopyDescription(const void *info)
+{
+       return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SIGTERM RLS>"));
+}
+
+
 __private_extern__
 Boolean
 plugin_term(int *status)
 {
 __private_extern__
 Boolean
 plugin_term(int *status)
 {
-       CFRunLoopSourceRef      stopRls;
-       CFRunLoopSourceContext  stopContext = { 0               // version
-                                             , NULL            // info
-                                             , NULL            // retain
-                                             , NULL            // release
-                                             , NULL            // copyDescription
-                                             , NULL            // equal
-                                             , NULL            // hash
-                                             , NULL            // schedule
-                                             , NULL            // cancel
-                                             , stopBundles     // perform
+       CFRunLoopSourceContext  termContext = { 0                       // version
+                                             , (void *)1               // info
+                                             , NULL                    // retain
+                                             , NULL                    // release
+                                             , termRLSCopyDescription  // copyDescription
+                                             , NULL                    // equal
+                                             , NULL                    // hash
+                                             , NULL                    // schedule
+                                             , NULL                    // cancel
+                                             , stopBundles             // perform
                                              };
                                              };
+       CFRunLoopSourceRef      termRls;
 
        if (plugin_runLoop == NULL) {
                // if no plugins
 
        if (plugin_runLoop == NULL) {
                // if no plugins
@@ -595,10 +695,10 @@ plugin_term(int *status)
                                            &kCFTypeDictionaryKeyCallBacks,
                                            &kCFTypeDictionaryValueCallBacks);
 
                                            &kCFTypeDictionaryKeyCallBacks,
                                            &kCFTypeDictionaryValueCallBacks);
 
-       stopRls = CFRunLoopSourceCreate(NULL, 0, &stopContext);
-       CFRunLoopAddSource(plugin_runLoop, stopRls, kCFRunLoopDefaultMode);
-       CFRunLoopSourceSignal(stopRls);
-       CFRelease(stopRls);
+       termRls = CFRunLoopSourceCreate(NULL, 0, &termContext);
+       CFRunLoopAddSource(plugin_runLoop, termRls, kCFRunLoopDefaultMode);
+       CFRunLoopSourceSignal(termRls);
+       CFRelease(termRls);
        CFRunLoopWakeUp(plugin_runLoop);
 
        return TRUE;
        CFRunLoopWakeUp(plugin_runLoop);
 
        return TRUE;
@@ -606,16 +706,19 @@ plugin_term(int *status)
 
 
 #ifdef DEBUG
 
 
 #ifdef DEBUG
-
 static void
 timerCallback(CFRunLoopTimerRef timer, void *info)
 {
 static void
 timerCallback(CFRunLoopTimerRef timer, void *info)
 {
-       SCLog(_configd_verbose,
-             LOG_INFO,
-             CFSTR("the CFRunLoop is waiting for something to happen...."));
+       static int      pass    = 0;
+
+       pass++;
+       if ((pass > 120) && ((pass % 60) != 0)) {
+               return;
+       }
+
+       traceBundle("the [plugin] CFRunLoop is waiting...", NULL);
        return;
 }
        return;
 }
-
 #endif /* DEBUG */
 
 
 #endif /* DEBUG */
 
 
@@ -721,7 +824,7 @@ plugin_exec(void *arg)
                        CFURLRef        url;
 
                        /* load any available bundle */
                        CFURLRef        url;
 
                        /* load any available bundle */
-                       strcat(path, BUNDLE_DIRECTORY);
+                       strlcat(path, BUNDLE_DIRECTORY, sizeof(path));
                        SCLog(_configd_verbose, LOG_DEBUG, CFSTR("searching for bundles in \".\""));
                        url = CFURLCreateFromFileSystemRepresentation(NULL,
                                                                      (UInt8 *)path,
                        SCLog(_configd_verbose, LOG_DEBUG, CFSTR("searching for bundles in \".\""));
                        url = CFURLCreateFromFileSystemRepresentation(NULL,
                                                                      (UInt8 *)path,
@@ -739,7 +842,7 @@ plugin_exec(void *arg)
                                        CFBundleRef     bundle;
 
                                        bundle = (CFBundleRef)CFArrayGetValueAtIndex(bundles, i);
                                        CFBundleRef     bundle;
 
                                        bundle = (CFBundleRef)CFArrayGetValueAtIndex(bundles, i);
-                                       addBundle(bundle);
+                                       addBundle(bundle, FALSE);
                                }
                                CFRelease(bundles);
                        }
                                }
                                CFRelease(bundles);
                        }
@@ -759,12 +862,16 @@ plugin_exec(void *arg)
                                                              TRUE);
                bundle = CFBundleCreate(NULL, url);
                if (bundle != NULL) {
                                                              TRUE);
                bundle = CFBundleCreate(NULL, url);
                if (bundle != NULL) {
-                       addBundle(bundle);
+                       addBundle(bundle, TRUE);
                        CFRelease(bundle);
                }
                CFRelease(url);
        }
 
                        CFRelease(bundle);
                }
                CFRelease(url);
        }
 
+#ifdef DEBUG
+       traceBundle("before loading any plugins", NULL);
+#endif /* DEBUG */
+
        /*
         * load each bundle.
         */
        /*
         * load each bundle.
         */
@@ -828,7 +935,7 @@ plugin_exec(void *arg)
                /* allocate a periodic event (to help show we're not blocking) */
                timer = CFRunLoopTimerCreate(NULL,                              /* allocator */
                                             CFAbsoluteTimeGetCurrent() + 1.0,  /* fireDate */
                /* allocate a periodic event (to help show we're not blocking) */
                timer = CFRunLoopTimerCreate(NULL,                              /* allocator */
                                             CFAbsoluteTimeGetCurrent() + 1.0,  /* fireDate */
-                                            60.0,                              /* interval */
+                                            1.0,                               /* interval */
                                             0,                                 /* flags */
                                             0,                                 /* order */
                                             timerCallback,                     /* callout */
                                             0,                                 /* flags */
                                             0,                                 /* order */
                                             timerCallback,                     /* callout */
@@ -838,6 +945,10 @@ plugin_exec(void *arg)
        }
 #endif /* DEBUG */
 
        }
 #endif /* DEBUG */
 
+#ifdef DEBUG
+       traceBundle("about to start plugin CFRunLoop", NULL);
+#endif /* DEBUG */
+
        /*
         * The assumption is that each loaded plugin will establish CFMachPortRef,
         * CFSocketRef, and CFRunLoopTimerRef input sources to handle any events
        /*
         * The assumption is that each loaded plugin will establish CFMachPortRef,
         * CFSocketRef, and CFRunLoopTimerRef input sources to handle any events
index 63d515a55c2a8fa3a5c59c5b5d5981040cff64e7..2b035faaed921f88d5f29439558b69c1ac554620 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2005, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 #include <sys/cdefs.h>
 
 
 #include <sys/cdefs.h>
 
+extern CFRunLoopRef    plugin_runLoop;
+
 __BEGIN_DECLS
 
 __BEGIN_DECLS
 
-void   plugin_init     ();
-void   plugin_exec     (void   *arg);
-Boolean        plugin_term     (int    *status);
+void   plugin_init     (void);
+void   plugin_exec     (void           *arg);
+Boolean        plugin_term     (int            *status);
 
 __END_DECLS
 
 
 __END_DECLS
 
index 94e421345bf1adad31fc8c04eb147804006b39ec..866ede4795101c6ff9725d659fb84057b4dd4786 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -104,7 +104,6 @@ addSession(CFMachPortRef server)
        sessions[n]->serverRunLoopSource = NULL;
        sessions[n]->store               = NULL;
        sessions[n]->callerEUID          = 1;           /* not "root" */
        sessions[n]->serverRunLoopSource = NULL;
        sessions[n]->store               = NULL;
        sessions[n]->callerEUID          = 1;           /* not "root" */
-       sessions[n]->callerEGID          = 1;           /* not "wheel" */
 
        return sessions[n];
 }
 
        return sessions[n];
 }
index d4921ed90da65949b3cffcbdcee63011471e690b..eb560102bb58f06b1fe3dbe9a844c7ffd3f44f64 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2005, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -50,8 +50,7 @@ typedef struct {
        SCDynamicStoreRef       store;
 
        /* credentials associated with this "open" session */
        SCDynamicStoreRef       store;
 
        /* credentials associated with this "open" session */
-       int                     callerEUID;
-       int                     callerEGID;
+       uid_t                   callerEUID;
 
 } serverSession, *serverSessionRef;
 
 
 } serverSession, *serverSessionRef;
 
@@ -65,7 +64,7 @@ void                  removeSession   (mach_port_t    server);
 
 void                   cleanupSession  (mach_port_t    server);
 
 
 void                   cleanupSession  (mach_port_t    server);
 
-void                   listSessions    ();
+void                   listSessions    (void);
 
 __END_DECLS
 
 
 __END_DECLS
 
diff --git a/configd.xcode/project.pbxproj b/configd.xcode/project.pbxproj
deleted file mode 100644 (file)
index dab6a36..0000000
+++ /dev/null
@@ -1,5705 +0,0 @@
-// !$*UTF8*$!
-{
-       archiveVersion = 1;
-       classes = {
-       };
-       objectVersion = 39;
-       objects = {
-               150607BD075A00A200B147BA = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCSchemaDefinitions.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               150607DE075A00A300B147BA = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCSchemaDefinitions.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15060818075A00A300B147BA = {
-                       fileRef = 150607BD075A00A200B147BA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1506081A075A00A300B147BA = {
-                       fileRef = 150607DE075A00A300B147BA;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                               );
-                       };
-               };
-               1508E39F07552B6A0062B350 = {
-                       fileRef = 159D53C707528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1508E3A007552B6B0062B350 = {
-                       fileRef = 159D53C507528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1508E3A107552B720062B350 = {
-                       fileRef = 159D53CA07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1514D76D05C08A5F00757DC9 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = config_types.h;
-                       path = SystemConfiguration.fproj/config_types.h;
-                       refType = 2;
-                       sourceTree = SOURCE_ROOT;
-               };
-               1514D77D05C08AB700757DC9 = {
-                       children = (
-                               15CB690505C0722A0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = "Initial Preferences";
-                       path = "";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               151BDA2B05D9E28B00657BC7 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = SCPreferencesPathKey.h;
-                       path = SystemConfiguration.fproj/SCPreferencesPathKey.h;
-                       refType = 2;
-                       sourceTree = SOURCE_ROOT;
-               };
-               151BDA5D05D9E2ED00657BC7 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       name = SCPreferencesPathKey.c;
-                       path = SystemConfiguration.fproj/SCPreferencesPathKey.c;
-                       refType = 2;
-                       sourceTree = SOURCE_ROOT;
-               };
-               1521FC5C060F296A003B28F5 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       name = dnsinfo_create.c;
-                       path = dnsinfo/dnsinfo_create.c;
-                       refType = 2;
-                       sourceTree = SOURCE_ROOT;
-               };
-               1523F6EE075A36210066F0B2 = {
-                       fileRef = 15DAD6C807591A1A0084A6ED;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1523F6F1075A36F70066F0B2 = {
-                       fileRef = 15DAD6C807591A1A0084A6ED;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1523F6F2075A37050066F0B2 = {
-                       fileRef = 15DAD6C807591A1A0084A6ED;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1523F710075A371D0066F0B2 = {
-                       fileRef = 15DAD6C807591A1A0084A6ED;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1523F715075A376B0066F0B2 = {
-                       fileRef = 15DAD5EE075913CE0084A6ED;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1523F719075A37C70066F0B2 = {
-                       fileRef = 15DAD5EE075913CE0084A6ED;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               152CEED0070CF6640050F23C = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = "compiled.mach-o.dylib";
-                       name = libedit.dylib;
-                       path = /usr/lib/libedit.2.dylib;
-                       refType = 0;
-                       sourceTree = "<absolute>";
-               };
-               1532629006281C9D00B1C10C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = dnsinfo_create.h;
-                       path = dnsinfo/dnsinfo_create.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               154361E00752C81800A8EC6C = {
-                       fileRef = 159D53AB07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1543636A0752D03C00A8EC6C = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = wrapper.framework;
-                       name = IOKit.framework;
-                       path = /System/Library/Frameworks/IOKit.framework;
-                       refType = 0;
-                       sourceTree = "<absolute>";
-               };
-               1543636B0752D03C00A8EC6C = {
-                       fileRef = 1543636A0752D03C00A8EC6C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15481BF7075A2B3900B32F56 = {
-                       buildPhases = (
-                               15481C14075A2B7300B32F56,
-                       );
-                       buildSettings = {
-                               INSTALLHDRS_SCRIPT_PHASE = YES;
-                               OTHER_CFLAGS = "";
-                               OTHER_LDFLAGS = "";
-                               PRODUCT_NAME = genSCPreferences;
-                               SECTORDER_FLAGS = "";
-                               WARNING_CFLAGS = "-Wall -Wno-four-char-constants -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXToolTarget;
-                       name = Schema;
-                       productInstallPath = /usr/local/bin;
-                       productName = Schema;
-                       productReference = 15481BF8075A2B3900B32F56;
-               };
-               15481BF8075A2B3900B32F56 = {
-                       explicitFileType = "compiled.mach-o.executable";
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = genSCPreferences;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15481C14075A2B7300B32F56 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       inputPaths = (
-                               SystemConfiguration.fproj/genSCPreferences.c,
-                       );
-                       isa = PBXShellScriptBuildPhase;
-                       outputPaths = (
-                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h",
-                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c",
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-                       shellPath = /bin/sh;
-                       shellScript = "cc -o ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} ${SRCROOT}/SystemConfiguration.fproj/genSCPreferences.c\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} header   > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} cfile    > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c\nexit 0";
-               };
-               154CF3F307E1EA4D00D8302E = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCPreferencesGetSpecificPrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               154CF3F407E1EA4D00D8302E = {
-                       fileRef = 154CF3F307E1EA4D00D8302E;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               155847430754FDCD0046C2E9 = {
-                       buildPhases = (
-                               155847460754FDCD0046C2E9,
-                               155847540754FDCD0046C2E9,
-                               155847620754FDCD0046C2E9,
-                               155847670754FDCD0046C2E9,
-                               155847680754FDCD0046C2E9,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               CURRENT_PROJECT_VERSION = 137.3;
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/sbin;
-                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = scutil;
-                               STRIPFLAGS = "-S";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = scutil;
-                       productInstallPath = /usr/sbin;
-                       productName = "scutil (Tool)";
-                       productReference = 1558476A0754FDCD0046C2E9;
-                       productType = "com.apple.product-type.tool";
-               };
-               155847460754FDCD0046C2E9 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               155847470754FDCD0046C2E9,
-                               155847480754FDCD0046C2E9,
-                               155847490754FDCD0046C2E9,
-                               1558474A0754FDCD0046C2E9,
-                               1558474B0754FDCD0046C2E9,
-                               1558474C0754FDCD0046C2E9,
-                               1558474D0754FDCD0046C2E9,
-                               1558474E0754FDCD0046C2E9,
-                               1558474F0754FDCD0046C2E9,
-                               155847500754FDCD0046C2E9,
-                               155847510754FDCD0046C2E9,
-                               155847520754FDCD0046C2E9,
-                               155847530754FDCD0046C2E9,
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               155847470754FDCD0046C2E9 = {
-                       fileRef = 15CB6A4305C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847480754FDCD0046C2E9 = {
-                       fileRef = 15CB6A4505C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847490754FDCD0046C2E9 = {
-                       fileRef = 15CB6A4705C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558474A0754FDCD0046C2E9 = {
-                       fileRef = 15CB6A4905C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558474B0754FDCD0046C2E9 = {
-                       fileRef = 15CB6A4B05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558474C0754FDCD0046C2E9 = {
-                       fileRef = 15CB6A4D05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558474D0754FDCD0046C2E9 = {
-                       fileRef = 15CB6A4F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558474E0754FDCD0046C2E9 = {
-                       fileRef = 15CB6A5105C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558474F0754FDCD0046C2E9 = {
-                       fileRef = 15A509A406C2518F001F0AB7;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847500754FDCD0046C2E9 = {
-                       fileRef = 15DC34680711D49400A3311C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847510754FDCD0046C2E9 = {
-                       fileRef = 15DC346A0711D49400A3311C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847520754FDCD0046C2E9 = {
-                       fileRef = 15DC346C0711D49400A3311C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847530754FDCD0046C2E9 = {
-                       fileRef = 15DC346E0711D49400A3311C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847540754FDCD0046C2E9 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               155847550754FDCD0046C2E9,
-                               155847560754FDCD0046C2E9,
-                               155847570754FDCD0046C2E9,
-                               155847580754FDCD0046C2E9,
-                               155847590754FDCD0046C2E9,
-                               1558475A0754FDCD0046C2E9,
-                               1558475B0754FDCD0046C2E9,
-                               1558475C0754FDCD0046C2E9,
-                               1558475D0754FDCD0046C2E9,
-                               1558475E0754FDCD0046C2E9,
-                               1558475F0754FDCD0046C2E9,
-                               155847600754FDCD0046C2E9,
-                               155847610754FDCD0046C2E9,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               155847550754FDCD0046C2E9 = {
-                       fileRef = 15CB6A5405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               155847560754FDCD0046C2E9 = {
-                       fileRef = 15CB6A5605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               155847570754FDCD0046C2E9 = {
-                       fileRef = 15CB6A5805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               155847580754FDCD0046C2E9 = {
-                       fileRef = 15CB6A5A05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               155847590754FDCD0046C2E9 = {
-                       fileRef = 15CB6A5C05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               1558475A0754FDCD0046C2E9 = {
-                       fileRef = 15CB6A5E05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               1558475B0754FDCD0046C2E9 = {
-                       fileRef = 15CB6A6005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               1558475C0754FDCD0046C2E9 = {
-                       fileRef = 15CB6A6205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               1558475D0754FDCD0046C2E9 = {
-                       fileRef = 15A509A306C2518F001F0AB7;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558475E0754FDCD0046C2E9 = {
-                       fileRef = 15DC34670711D49400A3311C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558475F0754FDCD0046C2E9 = {
-                       fileRef = 15DC34690711D49400A3311C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847600754FDCD0046C2E9 = {
-                       fileRef = 15DC346B0711D49400A3311C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847610754FDCD0046C2E9 = {
-                       fileRef = 15DC346D0711D49400A3311C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847620754FDCD0046C2E9 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               155847640754FDCD0046C2E9,
-                               1523F710075A371D0066F0B2,
-                               1523F719075A37C70066F0B2,
-                               155847660754FDCD0046C2E9,
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               155847640754FDCD0046C2E9 = {
-                       fileRef = 15CB6A6F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847660754FDCD0046C2E9 = {
-                       fileRef = 152CEED0070CF6640050F23C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               155847670754FDCD0046C2E9 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXRezBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               155847680754FDCD0046C2E9 = {
-                       buildActionMask = 2147483647;
-                       dstPath = /usr/share/man/man8;
-                       dstSubfolderSpec = 0;
-                       files = (
-                               155847690754FDCD0046C2E9,
-                       );
-                       isa = PBXCopyFilesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               155847690754FDCD0046C2E9 = {
-                       fileRef = 15CB6A6A05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558476A0754FDCD0046C2E9 = {
-                       explicitFileType = "compiled.mach-o.executable";
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = scutil;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               155847FA07550D210046C2E9 = {
-                       buildPhases = (
-                       );
-                       buildSettings = {
-                               DEAD_CODE_STRIPPING = YES;
-                               PRODUCT_NAME = configd_executables;
-                               STRIPFLAGS = "-S";
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                               1558480607550D470046C2E9,
-                               1558480807550D470046C2E9,
-                               1558480A07550D470046C2E9,
-                       );
-                       isa = PBXAggregateTarget;
-                       name = configd_executables;
-                       productName = configd_executables;
-               };
-               1558480507550D470046C2E9 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 159D549F07529FFF004F8947;
-                       remoteInfo = configd;
-               };
-               1558480607550D470046C2E9 = {
-                       isa = PBXTargetDependency;
-                       target = 159D549F07529FFF004F8947;
-                       targetProxy = 1558480507550D470046C2E9;
-               };
-               1558480707550D470046C2E9 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15CB6A2705C0722B0099E85F;
-                       remoteInfo = scselect;
-               };
-               1558480807550D470046C2E9 = {
-                       isa = PBXTargetDependency;
-                       target = 1558481207550EC10046C2E9;
-                       targetProxy = 1558480707550D470046C2E9;
-               };
-               1558480907550D470046C2E9 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 155847430754FDCD0046C2E9;
-                       remoteInfo = scutil;
-               };
-               1558480A07550D470046C2E9 = {
-                       isa = PBXTargetDependency;
-                       target = 155847430754FDCD0046C2E9;
-                       targetProxy = 1558480907550D470046C2E9;
-               };
-               1558480E07550DD00046C2E9 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 155847FA07550D210046C2E9;
-                       remoteInfo = configd_executables;
-               };
-               1558480F07550DD00046C2E9 = {
-                       isa = PBXTargetDependency;
-                       target = 155847FA07550D210046C2E9;
-                       targetProxy = 1558480E07550DD00046C2E9;
-               };
-               1558481207550EC10046C2E9 = {
-                       buildPhases = (
-                               1558481407550EC10046C2E9,
-                               1558481507550EC10046C2E9,
-                               1558481707550EC10046C2E9,
-                               1558481A07550EC10046C2E9,
-                               1558481B07550EC10046C2E9,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               CURRENT_PROJECT_VERSION = 137.3;
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
-                               INSTALL_PATH = /usr/sbin;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = scselect;
-                               STRIPFLAGS = "-S";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = scselect;
-                       productInstallPath = /usr/sbin;
-                       productName = "scselect (Tool)";
-                       productReference = 1558481D07550EC10046C2E9;
-                       productType = "com.apple.product-type.tool";
-               };
-               1558481407550EC10046C2E9 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               1558481507550EC10046C2E9 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               1558481607550EC10046C2E9,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               1558481607550EC10046C2E9 = {
-                       fileRef = 15CB6A2E05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               1558481707550EC10046C2E9 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               1558481907550EC10046C2E9,
-                               1523F6F2075A37050066F0B2,
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               1558481907550EC10046C2E9 = {
-                       fileRef = 15CB6A6F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558481A07550EC10046C2E9 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXRezBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               1558481B07550EC10046C2E9 = {
-                       buildActionMask = 2147483647;
-                       dstPath = /usr/share/man/man8;
-                       dstSubfolderSpec = 0;
-                       files = (
-                               1558481C07550EC10046C2E9,
-                       );
-                       isa = PBXCopyFilesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               1558481C07550EC10046C2E9 = {
-                       fileRef = 15CB6A3605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               1558481D07550EC10046C2E9 = {
-                       explicitFileType = "compiled.mach-o.executable";
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = scselect;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               156BD6BB07E0DFA9008698FF = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCPreferencesSetSpecificPrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               156BD6BC07E0DFA9008698FF = {
-                       fileRef = 156BD6BB07E0DFA9008698FF;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               1577252F06EFB96700D7B52B = {
-                       fileEncoding = 10;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.plist.strings;
-                       name = English;
-                       path = English.lproj/NetworkInterface.strings;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               1577253606EFBF3100D7B52B = {
-                       children = (
-                               1577252F06EFB96700D7B52B,
-                       );
-                       isa = PBXVariantGroup;
-                       name = NetworkInterface.strings;
-                       path = "";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               157BB8AE075924360025DA7A = {
-                       buildPhases = (
-                       );
-                       buildSettings = {
-                               PRODUCT_NAME = Frameworks;
-                               WARNING_CFLAGS = "-Wmost -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                               157BB8C2075924470025DA7A,
-                               157BB8C0075924460025DA7A,
-                       );
-                       isa = PBXAggregateTarget;
-                       name = configd_base;
-                       productName = Frameworks;
-               };
-               157BB8BF075924460025DA7A = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15DAD63F07591A1A0084A6ED;
-                       remoteInfo = SystemConfiguration.framework;
-               };
-               157BB8C0075924460025DA7A = {
-                       isa = PBXTargetDependency;
-                       target = 15DAD63F07591A1A0084A6ED;
-                       targetProxy = 157BB8BF075924460025DA7A;
-               };
-               157BB8C1075924470025DA7A = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15DAD5DF075913CE0084A6ED;
-                       remoteInfo = DNSConfiguration;
-               };
-               157BB8C2075924470025DA7A = {
-                       isa = PBXTargetDependency;
-                       target = 15DAD5DF075913CE0084A6ED;
-                       targetProxy = 157BB8C1075924470025DA7A;
-               };
-               157BB8C30759244B0025DA7A = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 157BB8AE075924360025DA7A;
-                       remoteInfo = Frameworks;
-               };
-               157BB8C40759244B0025DA7A = {
-                       isa = PBXTargetDependency;
-                       target = 157BB8AE075924360025DA7A;
-                       targetProxy = 157BB8C30759244B0025DA7A;
-               };
-               15828AE30753B5F900AD4710 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXResourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15828AE60753B5F900AD4710 = {
-                       buildPhases = (
-                               15828AE30753B5F900AD4710,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               LIBRARY_STYLE = BUNDLE;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = KernelEventMonitor;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = KernelEventMonitor.bundle;
-                       productName = KernelEventMonitor.bundle;
-                       productReference = 15828AE70753B5F900AD4710;
-                       productSettingsXML = "<?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\">
-<plist version=\"1.0\">
-<dict>
-       <key>CFBundleDevelopmentRegion</key>
-       <string>English</string>
-       <key>CFBundleExecutable</key>
-       <string>KernelEventMonitor.bundle</string>
-       <key>CFBundleIdentifier</key>
-       <string>com.yourcompany.KernelEventMonitor_bundle</string>
-       <key>CFBundleInfoDictionaryVersion</key>
-       <string>6.0</string>
-       <key>CFBundlePackageType</key>
-       <string>APPL</string>
-       <key>CFBundleSignature</key>
-       <string>????</string>
-       <key>CFBundleVersion</key>
-       <string>1.0</string>
-       <key>CSResourcesFileMapped</key>
-       <string>yes</string>
-</dict>
-</plist>
-";
-                       productType = "com.apple.product-type.bundle";
-               };
-               15828AE70753B5F900AD4710 = {
-                       explicitFileType = wrapper.cfbundle;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = KernelEventMonitor.bundle;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15828B060753B77E00AD4710 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15828AE60753B5F900AD4710;
-                       remoteInfo = KernelEventMonitor.bundle;
-               };
-               15828B070753B77E00AD4710 = {
-                       isa = PBXTargetDependency;
-                       target = 15828AE60753B5F900AD4710;
-                       targetProxy = 15828B060753B77E00AD4710;
-               };
-               1582B36B05FD1A4D009C2750 = {
-                       children = (
-                               1582B37205FD1A5B009C2750,
-                               1582B37905FD1A66009C2750,
-                       );
-                       isa = PBXGroup;
-                       name = DNSConfiguration;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               1582B37205FD1A5B009C2750 = {
-                       children = (
-                               15B73F0905FD1B670096477F,
-                               1532629006281C9D00B1C10C,
-                               15B73F0C05FD1B670096477F,
-                               15B73F0E05FD1B670096477F,
-                       );
-                       isa = PBXGroup;
-                       name = Headers;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               1582B37905FD1A66009C2750 = {
-                       children = (
-                               15B73F0B05FD1B670096477F,
-                               15B73F0805FD1B670096477F,
-                               1521FC5C060F296A003B28F5,
-                               15B73F0D05FD1B670096477F,
-                       );
-                       isa = PBXGroup;
-                       name = Sources;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               158AD85B0754E38F00124717 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Info.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               158AD8700754E3D400124717 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Info.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               158AD8C00754E3EF00124717 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Info.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               158AD9100754E40E00124717 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Info.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               158AD9850754E72500124717 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15FD72A10754DA4C001CC321;
-                       remoteInfo = IPMonitor.bundle;
-               };
-               158AD9860754E72500124717 = {
-                       isa = PBXTargetDependency;
-                       target = 15FD72A10754DA4C001CC321;
-                       targetProxy = 158AD9850754E72500124717;
-               };
-               158AD9870754E72500124717 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15FD72930754DA2B001CC321;
-                       remoteInfo = InterfaceNamer.bundle;
-               };
-               158AD9880754E72500124717 = {
-                       isa = PBXTargetDependency;
-                       target = 15FD72930754DA2B001CC321;
-                       targetProxy = 158AD9870754E72500124717;
-               };
-               158AD9890754E72500124717 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15FD70FF0754D627001CC321;
-                       remoteInfo = Kicker.bundle;
-               };
-               158AD98A0754E72500124717 = {
-                       isa = PBXTargetDependency;
-                       target = 15FD70FF0754D627001CC321;
-                       targetProxy = 158AD9890754E72500124717;
-               };
-               158AD98B0754E72500124717 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15FD72B10754DA69001CC321;
-                       remoteInfo = LinkConfiguration.bundle;
-               };
-               158AD98C0754E72500124717 = {
-                       isa = PBXTargetDependency;
-                       target = 15FD72B10754DA69001CC321;
-                       targetProxy = 158AD98B0754E72500124717;
-               };
-               158AD98D0754E72500124717 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15FD72C50754DA7E001CC321;
-                       remoteInfo = PreferencesMonitor.bundle;
-               };
-               158AD98E0754E72500124717 = {
-                       isa = PBXTargetDependency;
-                       target = 15FD72C50754DA7E001CC321;
-                       targetProxy = 158AD98D0754E72500124717;
-               };
-               158AD9F80754EA2F00124717 = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = wrapper.framework;
-                       name = AppleTalk.framework;
-                       path = /System/Library/Frameworks/AppleTalk.framework;
-                       refType = 0;
-                       sourceTree = "<absolute>";
-               };
-               158ADA160754EA2F00124717 = {
-                       fileRef = 158AD9F80754EA2F00124717;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               158ADA3D0754EA5A00124717 = {
-                       fileRef = 15CB6A6F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               158ADABB0754EAAE00124717 = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = wrapper.framework;
-                       name = SystemConfiguration.framework;
-                       path = /System/Library/Frameworks/SystemConfiguration.framework;
-                       refType = 0;
-                       sourceTree = "<absolute>";
-               };
-               158ADBFD0754ECB100124717 = {
-                       children = (
-                               15FD73400754DBDA001CC321,
-                               15FD73220754DB9F001CC321,
-                               159D53EC07528C61004F8947,
-                               15FD72A50754DA4C001CC321,
-                               159D53E507528C4A004F8947,
-                               15FD72970754DA2B001CC321,
-                               159D53D407528BDA004F8947,
-                               15828AE70753B5F900AD4710,
-                               159D53DE07528C2E004F8947,
-                               15FD71090754D628001CC321,
-                               159D53F307528C79004F8947,
-                               15FD72B50754DA69001CC321,
-                               159D53FA07528C95004F8947,
-                               15FD72C90754DA7E001CC321,
-                       );
-                       isa = PBXGroup;
-                       name = Plugins;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               158ADCA60754ECC800124717 = {
-                       children = (
-                               159D54D907529FFF004F8947,
-                       );
-                       isa = PBXGroup;
-                       name = "configd, scutil, scselect";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               158ADD0E0754F1A000124717 = {
-                       fileRef = 159D53A807528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               158ADD190754F1F100124717 = {
-                       fileRef = 159D53BC07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               158ADD1B0754F1F400124717 = {
-                       fileRef = 159D53BD07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D53A207528B06004F8947 = {
-                       children = (
-                               159D53C907528B36004F8947,
-                               159D53C407528B36004F8947,
-                               159D53A607528B36004F8947,
-                               159D53AC07528B36004F8947,
-                               159D53AF07528B36004F8947,
-                               159D53BB07528B36004F8947,
-                               159D53C007528B36004F8947,
-                               159D53C207528B36004F8947,
-                       );
-                       isa = PBXGroup;
-                       name = Plugins;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53A607528B36004F8947 = {
-                       children = (
-                               159D53A707528B36004F8947,
-                               159D53AA07528B36004F8947,
-                               159D53AB07528B36004F8947,
-                               159D53A807528B36004F8947,
-                               15FD743E0754DE7A001CC321,
-                       );
-                       isa = PBXGroup;
-                       name = IPMonitor;
-                       path = Plugins/IPMonitor;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53A707528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = ip_plugin.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53A807528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Resolvers.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53AA07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = "dns-configuration.c";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53AB07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = "set-hostname.c";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53AC07528B36004F8947 = {
-                       children = (
-                               159D53AE07528B36004F8947,
-                               15FD73EE0754DE62001CC321,
-                       );
-                       isa = PBXGroup;
-                       name = InterfaceNamer;
-                       path = Plugins/InterfaceNamer;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53AE07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = ifnamer.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53AF07528B36004F8947 = {
-                       children = (
-                               159D53B707528B36004F8947,
-                               159D53B607528B36004F8947,
-                               159D53B207528B36004F8947,
-                               159D53B807528B36004F8947,
-                               159D53BA07528B36004F8947,
-                               159D53B007528B36004F8947,
-                               159D53B907528B36004F8947,
-                               159D53B107528B36004F8947,
-                               159D53B307528B36004F8947,
-                               159D53B407528B36004F8947,
-                               158AD8700754E3D400124717,
-                       );
-                       isa = PBXGroup;
-                       name = KernelEventMonitor;
-                       path = Plugins/KernelEventMonitor;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B007528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = eventmon.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B107528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = ev_dlil.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B207528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = ev_dlil.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B307528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = ev_ipv4.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B407528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = ev_ipv6.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B607528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = ev_appletalk.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B707528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = eventmon.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B807528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = ev_ipv4.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53B907528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = ev_appletalk.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53BA07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = ev_ipv6.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53BB07528B36004F8947 = {
-                       children = (
-                               159D53BE07528B36004F8947,
-                               158AD85B0754E38F00124717,
-                               159D53BC07528B36004F8947,
-                               159D53BD07528B36004F8947,
-                       );
-                       isa = PBXGroup;
-                       name = Kicker;
-                       path = Plugins/Kicker;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53BC07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Kicker.xml;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53BD07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.script.sh;
-                       path = "enable-network";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53BE07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = kicker.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C007528B36004F8947 = {
-                       children = (
-                               159D53C107528B36004F8947,
-                               158AD8C00754E3EF00124717,
-                       );
-                       isa = PBXGroup;
-                       name = LinkConfiguration;
-                       path = Plugins/LinkConfiguration;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C107528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = linkconfig.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C207528B36004F8947 = {
-                       children = (
-                               159D53C307528B36004F8947,
-                               158AD9100754E40E00124717,
-                       );
-                       isa = PBXGroup;
-                       name = PreferencesMonitor;
-                       path = Plugins/PreferencesMonitor;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C307528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = prefsmon.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C407528B36004F8947 = {
-                       children = (
-                               159D53C507528B36004F8947,
-                               159D53C607528B36004F8947,
-                               159D53C707528B36004F8947,
-                               15FD73970754DE49001CC321,
-                       );
-                       isa = PBXGroup;
-                       name = ATconfig;
-                       path = Plugins/ATconfig;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C507528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = cfManager.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C607528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = cfManager.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C707528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = atconfig.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53C907528B36004F8947 = {
-                       children = (
-                               159D53CA07528B36004F8947,
-                               159D53CB07528B36004F8947,
-                       );
-                       isa = PBXGroup;
-                       name = common;
-                       path = Plugins/common;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53CA07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = cache.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53CB07528B36004F8947 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = cache.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               159D53D007528BDA004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D540A07528D3B004F8947,
-                               159D540C07528DAA004F8947,
-                               159D540E07528DAE004F8947,
-                               159D541007528DB1004F8947,
-                               159D541207528DB3004F8947,
-                               159D541407528DB5004F8947,
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53D107528BDA004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D540907528D3A004F8947,
-                               159D540B07528DA9004F8947,
-                               159D540D07528DAE004F8947,
-                               159D540F07528DB0004F8947,
-                               159D541107528DB2004F8947,
-                               159D541307528DB5004F8947,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53D207528BDA004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53D307528BDA004F8947 = {
-                       buildPhases = (
-                               159D53D007528BDA004F8947,
-                               159D53D107528BDA004F8947,
-                               159D53D207528BDA004F8947,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = KernelEventMonitor;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = KernelEventMonitor;
-                       productName = KernelEventMonitor;
-                       productReference = 159D53D407528BDA004F8947;
-                       productType = "com.apple.product-type.library.static";
-               };
-               159D53D407528BDA004F8947 = {
-                       explicitFileType = archive.ar;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = libKernelEventMonitor.a;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               159D53DA07528C2E004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53DB07528C2E004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D541507528DDE004F8947,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53DC07528C2E004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53DD07528C2E004F8947 = {
-                       buildPhases = (
-                               159D53DA07528C2E004F8947,
-                               159D53DB07528C2E004F8947,
-                               159D53DC07528C2E004F8947,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = Kicker;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = Kicker;
-                       productName = Kicker;
-                       productReference = 159D53DE07528C2E004F8947;
-                       productType = "com.apple.product-type.library.static";
-               };
-               159D53DE07528C2E004F8947 = {
-                       explicitFileType = archive.ar;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = libKicker.a;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               159D53E107528C4A004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53E207528C4A004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D541607528DF1004F8947,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53E307528C4A004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53E407528C4A004F8947 = {
-                       buildPhases = (
-                               159D53E107528C4A004F8947,
-                               159D53E207528C4A004F8947,
-                               159D53E307528C4A004F8947,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = InterfaceNamer;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = InterfaceNamer;
-                       productName = InterfaceNamer;
-                       productReference = 159D53E507528C4A004F8947;
-                       productType = "com.apple.product-type.library.static";
-               };
-               159D53E507528C4A004F8947 = {
-                       explicitFileType = archive.ar;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = libInterfaceNamer.a;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               159D53E807528C61004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53E907528C61004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D541707528E05004F8947,
-                               159D541807528E09004F8947,
-                               154361E00752C81800A8EC6C,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53EA07528C61004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53EB07528C61004F8947 = {
-                       buildPhases = (
-                               159D53E807528C61004F8947,
-                               159D53E907528C61004F8947,
-                               159D53EA07528C61004F8947,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = IPMonitor;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = IPMonitor;
-                       productName = IPMonitor;
-                       productReference = 159D53EC07528C61004F8947;
-                       productType = "com.apple.product-type.library.static";
-               };
-               159D53EC07528C61004F8947 = {
-                       explicitFileType = archive.ar;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = libIPMonitor.a;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               159D53EF07528C79004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53F007528C79004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D541B07528E4A004F8947,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53F107528C79004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53F207528C79004F8947 = {
-                       buildPhases = (
-                               159D53EF07528C79004F8947,
-                               159D53F007528C79004F8947,
-                               159D53F107528C79004F8947,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = LinkConfiguration;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = LinkConfiguration;
-                       productName = LinkConfiguration;
-                       productReference = 159D53F307528C79004F8947;
-                       productType = "com.apple.product-type.library.static";
-               };
-               159D53F307528C79004F8947 = {
-                       explicitFileType = archive.ar;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = libLinkConfiguration.a;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               159D53F607528C95004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53F707528C95004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D541C07528E58004F8947,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53F807528C95004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D53F907528C95004F8947 = {
-                       buildPhases = (
-                               159D53F607528C95004F8947,
-                               159D53F707528C95004F8947,
-                               159D53F807528C95004F8947,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = PreferencesMonitor;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = PreferencesMonitor;
-                       productName = PreferencesMonitor;
-                       productReference = 159D53FA07528C95004F8947;
-                       productType = "com.apple.product-type.library.static";
-               };
-               159D53FA07528C95004F8947 = {
-                       explicitFileType = archive.ar;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = libPreferencesMonitor.a;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               159D540907528D3A004F8947 = {
-                       fileRef = 159D53CA07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D540A07528D3B004F8947 = {
-                       fileRef = 159D53CB07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D540B07528DA9004F8947 = {
-                       fileRef = 159D53B907528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D540C07528DAA004F8947 = {
-                       fileRef = 159D53B607528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D540D07528DAE004F8947 = {
-                       fileRef = 159D53B107528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D540E07528DAE004F8947 = {
-                       fileRef = 159D53B207528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D540F07528DB0004F8947 = {
-                       fileRef = 159D53B307528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541007528DB1004F8947 = {
-                       fileRef = 159D53B807528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541107528DB2004F8947 = {
-                       fileRef = 159D53B407528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541207528DB3004F8947 = {
-                       fileRef = 159D53BA07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541307528DB5004F8947 = {
-                       fileRef = 159D53B007528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541407528DB5004F8947 = {
-                       fileRef = 159D53B707528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541507528DDE004F8947 = {
-                       fileRef = 159D53BE07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541607528DF1004F8947 = {
-                       fileRef = 159D53AE07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541707528E05004F8947 = {
-                       fileRef = 159D53A707528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541807528E09004F8947 = {
-                       fileRef = 159D53AA07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541B07528E4A004F8947 = {
-                       fileRef = 159D53C107528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D541C07528E58004F8947 = {
-                       fileRef = 159D53C307528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D542007528E7C004F8947 = {
-                       buildPhases = (
-                       );
-                       buildSettings = {
-                               PRODUCT_NAME = Plugins;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                               15DAD5740759115F0084A6ED,
-                               159D542807528E85004F8947,
-                               158AD9860754E72500124717,
-                               159D542607528E85004F8947,
-                               158AD9880754E72500124717,
-                               15828B070753B77E00AD4710,
-                               159D542207528E85004F8947,
-                               159D542407528E85004F8947,
-                               158AD98A0754E72500124717,
-                               159D542A07528E85004F8947,
-                               158AD98C0754E72500124717,
-                               159D542C07528E85004F8947,
-                               158AD98E0754E72500124717,
-                       );
-                       isa = PBXAggregateTarget;
-                       name = configd_plugins;
-                       productName = Plugins;
-               };
-               159D542107528E85004F8947 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 159D53D307528BDA004F8947;
-                       remoteInfo = KernelEventMonitor;
-               };
-               159D542207528E85004F8947 = {
-                       isa = PBXTargetDependency;
-                       target = 159D53D307528BDA004F8947;
-                       targetProxy = 159D542107528E85004F8947;
-               };
-               159D542307528E85004F8947 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 159D53DD07528C2E004F8947;
-                       remoteInfo = Kicker;
-               };
-               159D542407528E85004F8947 = {
-                       isa = PBXTargetDependency;
-                       target = 159D53DD07528C2E004F8947;
-                       targetProxy = 159D542307528E85004F8947;
-               };
-               159D542507528E85004F8947 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 159D53E407528C4A004F8947;
-                       remoteInfo = InterfaceNamer;
-               };
-               159D542607528E85004F8947 = {
-                       isa = PBXTargetDependency;
-                       target = 159D53E407528C4A004F8947;
-                       targetProxy = 159D542507528E85004F8947;
-               };
-               159D542707528E85004F8947 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 159D53EB07528C61004F8947;
-                       remoteInfo = IPMonitor;
-               };
-               159D542807528E85004F8947 = {
-                       isa = PBXTargetDependency;
-                       target = 159D53EB07528C61004F8947;
-                       targetProxy = 159D542707528E85004F8947;
-               };
-               159D542907528E85004F8947 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 159D53F207528C79004F8947;
-                       remoteInfo = LinkConfiguration;
-               };
-               159D542A07528E85004F8947 = {
-                       isa = PBXTargetDependency;
-                       target = 159D53F207528C79004F8947;
-                       targetProxy = 159D542907528E85004F8947;
-               };
-               159D542B07528E85004F8947 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 159D53F907528C95004F8947;
-                       remoteInfo = PreferencesMonitor;
-               };
-               159D542C07528E85004F8947 = {
-                       isa = PBXTargetDependency;
-                       target = 159D53F907528C95004F8947;
-                       targetProxy = 159D542B07528E85004F8947;
-               };
-               159D542D07529008004F8947 = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 159D542007528E7C004F8947;
-                       remoteInfo = Plugins;
-               };
-               159D542E07529008004F8947 = {
-                       isa = PBXTargetDependency;
-                       target = 159D542007528E7C004F8947;
-                       targetProxy = 159D542D07529008004F8947;
-               };
-               159D549F07529FFF004F8947 = {
-                       buildPhases = (
-                               159D54A307529FFF004F8947,
-                               159D54AB07529FFF004F8947,
-                               159D54CA07529FFF004F8947,
-                               159D54D407529FFF004F8947,
-                               159D54D507529FFF004F8947,
-                               159D54D707529FFF004F8947,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               CURRENT_PROJECT_VERSION = 137.3;
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/sbin;
-                               LIBRARY_SEARCH_PATHS = "\"$(SYMROOT)\" /usr/local/lib/SystemConfiguration";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = "-prebind_all_twolevel_modules";
-                               PRODUCT_NAME = configd;
-                               STRIPFLAGS = "-S";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = configd;
-                       productInstallPath = /usr/sbin;
-                       productName = "configd (Tool)";
-                       productReference = 159D54D907529FFF004F8947;
-                       productType = "com.apple.product-type.tool";
-               };
-               159D54A307529FFF004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D54A407529FFF004F8947,
-                               159D54A507529FFF004F8947,
-                               159D54A607529FFF004F8947,
-                               159D54A707529FFF004F8947,
-                               159D54A807529FFF004F8947,
-                               159D54A907529FFF004F8947,
-                               159D54AA07529FFF004F8947,
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D54A407529FFF004F8947 = {
-                       fileRef = 15CB69CF05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54A507529FFF004F8947 = {
-                       fileRef = 15CB69D105C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54A607529FFF004F8947 = {
-                       fileRef = 15CB69D305C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54A707529FFF004F8947 = {
-                       fileRef = 15CB69D505C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54A807529FFF004F8947 = {
-                       fileRef = 15CB69D705C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54A907529FFF004F8947 = {
-                       fileRef = 15CB69D905C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54AA07529FFF004F8947 = {
-                       fileRef = 15CB69DB05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54AB07529FFF004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D54AC07529FFF004F8947,
-                               159D54AD07529FFF004F8947,
-                               159D54AE07529FFF004F8947,
-                               159D54AF07529FFF004F8947,
-                               159D54B007529FFF004F8947,
-                               159D54B107529FFF004F8947,
-                               159D54B207529FFF004F8947,
-                               159D54B307529FFF004F8947,
-                               159D54B407529FFF004F8947,
-                               159D54B507529FFF004F8947,
-                               159D54B607529FFF004F8947,
-                               159D54B707529FFF004F8947,
-                               159D54B807529FFF004F8947,
-                               159D54B907529FFF004F8947,
-                               159D54BA07529FFF004F8947,
-                               159D54BB07529FFF004F8947,
-                               159D54BC07529FFF004F8947,
-                               159D54BD07529FFF004F8947,
-                               159D54BE07529FFF004F8947,
-                               159D54BF07529FFF004F8947,
-                               159D54C007529FFF004F8947,
-                               159D54C107529FFF004F8947,
-                               159D54C207529FFF004F8947,
-                               159D54C307529FFF004F8947,
-                               159D54C407529FFF004F8947,
-                               159D54C507529FFF004F8947,
-                               159D54C607529FFF004F8947,
-                               159D54C707529FFF004F8947,
-                               159D54C807529FFF004F8947,
-                               159D54C907529FFF004F8947,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D54AC07529FFF004F8947 = {
-                       fileRef = 15CB69E005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54AD07529FFF004F8947 = {
-                       fileRef = 15CB69E205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54AE07529FFF004F8947 = {
-                       fileRef = 15CB69E405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54AF07529FFF004F8947 = {
-                       fileRef = 15CB69E605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B007529FFF004F8947 = {
-                       fileRef = 15CB69E805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B107529FFF004F8947 = {
-                       fileRef = 15CB69EA05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B207529FFF004F8947 = {
-                       fileRef = 15CB69EC05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B307529FFF004F8947 = {
-                       fileRef = 15CB69F005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B407529FFF004F8947 = {
-                       fileRef = 15CB69F205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B507529FFF004F8947 = {
-                       fileRef = 15CB69F405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B607529FFF004F8947 = {
-                       fileRef = 15CB69F605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B707529FFF004F8947 = {
-                       fileRef = 15CB69F805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B807529FFF004F8947 = {
-                       fileRef = 15CB69FA05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54B907529FFF004F8947 = {
-                       fileRef = 15CB69FE05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54BA07529FFF004F8947 = {
-                       fileRef = 15CB6A0005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54BB07529FFF004F8947 = {
-                       fileRef = 15CB6A0205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54BC07529FFF004F8947 = {
-                       fileRef = 15CB6A0405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54BD07529FFF004F8947 = {
-                       fileRef = 15CB6A0605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54BE07529FFF004F8947 = {
-                       fileRef = 15CB6A0805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54BF07529FFF004F8947 = {
-                       fileRef = 15CB6A0A05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54C007529FFF004F8947 = {
-                       fileRef = 15CB6A0C05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54C107529FFF004F8947 = {
-                       fileRef = 15CB6A0E05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54C207529FFF004F8947 = {
-                       fileRef = 15CB6A1005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54C307529FFF004F8947 = {
-                       fileRef = 15CB6A1205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54C407529FFF004F8947 = {
-                       fileRef = 15CB6A1405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54C507529FFF004F8947 = {
-                       fileRef = 15CB6A1605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               159D54C607529FFF004F8947 = {
-                       fileRef = 15CB69BE05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Server,
-                               );
-                       };
-               };
-               159D54C707529FFF004F8947 = {
-                       fileRef = 15B73F0B05FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54C807529FFF004F8947 = {
-                       fileRef = 15B73F0D05FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54C907529FFF004F8947 = {
-                       fileRef = 15FCAAD005FD0EBF00CB79E6;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Server,
-                               );
-                       };
-               };
-               159D54CA07529FFF004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               159D54CC07529FFF004F8947,
-                               1523F6F1075A36F70066F0B2,
-                               1543636B0752D03C00A8EC6C,
-                               159D54CD07529FFF004F8947,
-                               1523F715075A376B0066F0B2,
-                               159D54CE07529FFF004F8947,
-                               159D54CF07529FFF004F8947,
-                               159D54D007529FFF004F8947,
-                               159D54D107529FFF004F8947,
-                               159D54D207529FFF004F8947,
-                               159D54D307529FFF004F8947,
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D54CC07529FFF004F8947 = {
-                       fileRef = 15CB6A6F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54CD07529FFF004F8947 = {
-                       fileRef = 15CB6A7405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54CE07529FFF004F8947 = {
-                       fileRef = 159D53D407528BDA004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54CF07529FFF004F8947 = {
-                       fileRef = 159D53DE07528C2E004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54D007529FFF004F8947 = {
-                       fileRef = 159D53E507528C4A004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54D107529FFF004F8947 = {
-                       fileRef = 159D53EC07528C61004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54D207529FFF004F8947 = {
-                       fileRef = 159D53F307528C79004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54D307529FFF004F8947 = {
-                       fileRef = 159D53FA07528C95004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54D407529FFF004F8947 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXRezBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D54D507529FFF004F8947 = {
-                       buildActionMask = 12;
-                       dstPath = /usr/share/man/man8;
-                       dstSubfolderSpec = 0;
-                       files = (
-                               159D54D607529FFF004F8947,
-                       );
-                       isa = PBXCopyFilesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D54D607529FFF004F8947 = {
-                       fileRef = 15CB6A2005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54D707529FFF004F8947 = {
-                       buildActionMask = 2147483647;
-                       dstPath = /private/etc/mach_init.d;
-                       dstSubfolderSpec = 0;
-                       files = (
-                               159D54D807529FFF004F8947,
-                       );
-                       isa = PBXCopyFilesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               159D54D807529FFF004F8947 = {
-                       fileRef = 15CB6A1F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               159D54D907529FFF004F8947 = {
-                       explicitFileType = "compiled.mach-o.executable";
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = configd;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15A509A306C2518F001F0AB7 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = net.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15A509A406C2518F001F0AB7 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = net.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15AD7A380670A85900BFE03C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCNetworkConfiguration.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15AD7A390670A85900BFE03C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCNetworkConfigurationInternal.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15AD7A3A0670A85900BFE03C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCNetworkConfigurationInternal.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15AD7A3B0670A85900BFE03C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCNetworkInterface.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15AD7A3C0670A85900BFE03C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCNetworkProtocol.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15AD7A3D0670A85900BFE03C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCNetworkService.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15AD7A3E0670A85900BFE03C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCNetworkSet.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15B6861D0678B61900FF4023 = {
-                       children = (
-                               15B686220678B65C00FF4023,
-                               1577253606EFBF3100D7B52B,
-                               15CFC229068B222F00123568,
-                       );
-                       isa = PBXGroup;
-                       name = "Supporting Files";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15B686220678B65C00FF4023 = {
-                       explicitFileType = text.xml;
-                       fileEncoding = 4;
-                       isa = PBXFileReference;
-                       path = NetworkConfiguration.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15B73F0805FD1B670096477F = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       name = dnsinfo_copy.c;
-                       path = dnsinfo/dnsinfo_copy.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15B73F0905FD1B670096477F = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = dnsinfo.h;
-                       path = dnsinfo/dnsinfo.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15B73F0B05FD1B670096477F = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       name = dnsinfo_private.c;
-                       path = dnsinfo/dnsinfo_private.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15B73F0C05FD1B670096477F = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = dnsinfo_private.h;
-                       path = dnsinfo/dnsinfo_private.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15B73F0D05FD1B670096477F = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       name = dnsinfo_server.c;
-                       path = dnsinfo/dnsinfo_server.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15B73F0E05FD1B670096477F = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = dnsinfo_server.h;
-                       path = dnsinfo/dnsinfo_server.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB68FC05C072220099E85F = {
-                       children = (
-                               15CB6A8605C072500099E85F,
-                               15CB6A8305C072410099E85F,
-                               1582B36B05FD1A4D009C2750,
-                               15CB690705C0722A0099E85F,
-                               15CB69C205C0722B0099E85F,
-                               15CB6A2205C0722B0099E85F,
-                               15CB6A3705C0722B0099E85F,
-                               159D53A207528B06004F8947,
-                               1514D77D05C08AB700757DC9,
-                               15CB6A6E05C0722B0099E85F,
-                               15CB690F05C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = configd;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB68FE05C072220099E85F = {
-                       buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               MACOSX_DEPLOYMENT_TARGET = 10.4;
-                       };
-                       isa = PBXBuildStyle;
-                       name = Development;
-               };
-               15CB68FF05C072220099E85F = {
-                       buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               MACOSX_DEPLOYMENT_TARGET = 10.4;
-                       };
-                       isa = PBXBuildStyle;
-                       name = Deployment;
-               };
-               15CB690005C0722A0099E85F = {
-                       buildPhases = (
-                       );
-                       buildSettings = {
-                               PRODUCT_NAME = "configd (Aggregate)";
-                       };
-                       dependencies = (
-                               157BB8C40759244B0025DA7A,
-                               159D542E07529008004F8947,
-                               1558480F07550DD00046C2E9,
-                       );
-                       isa = PBXAggregateTarget;
-                       name = All;
-                       productName = "configd (Aggregate)";
-               };
-               15CB690505C0722A0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = preferences.xml;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB690705C0722A0099E85F = {
-                       children = (
-                               15CB691205C0722B0099E85F,
-                               15CB694F05C0722B0099E85F,
-                               15B6861D0678B61900FF4023,
-                       );
-                       isa = PBXGroup;
-                       name = SystemConfiguration;
-                       path = SystemConfiguration.fproj;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB690F05C0722B0099E85F = {
-                       children = (
-                               158ADBFD0754ECB100124717,
-                               158ADCA60754ECC800124717,
-                               1558476A0754FDCD0046C2E9,
-                               1558481D07550EC10046C2E9,
-                               15DAD5EE075913CE0084A6ED,
-                               15DAD6C807591A1A0084A6ED,
-                               15481BF8075A2B3900B32F56,
-                       );
-                       isa = PBXGroup;
-                       name = Products;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB691205C0722B0099E85F = {
-                       children = (
-                               15CB691305C0722B0099E85F,
-                               15CB691705C0722B0099E85F,
-                               15CB691B05C0722B0099E85F,
-                               15CB691D05C0722B0099E85F,
-                               15CB691F05C0722B0099E85F,
-                               15CB692105C0722B0099E85F,
-                               15CB693F05C0722B0099E85F,
-                               15CB692305C0722B0099E85F,
-                               15CB692505C0722B0099E85F,
-                               15CB692705C0722B0099E85F,
-                               15CB692905C0722B0099E85F,
-                               15CB692B05C0722B0099E85F,
-                               15CB692D05C0722B0099E85F,
-                               15CB692F05C0722B0099E85F,
-                               151BDA2B05D9E28B00657BC7,
-                               154CF3F307E1EA4D00D8302E,
-                               15CB693105C0722B0099E85F,
-                               156BD6BB07E0DFA9008698FF,
-                               15CB691505C0722B0099E85F,
-                               15AD7A380670A85900BFE03C,
-                               15AD7A3A0670A85900BFE03C,
-                               15CB693305C0722B0099E85F,
-                               15CB693505C0722B0099E85F,
-                               15CB693705C0722B0099E85F,
-                               15CB693905C0722B0099E85F,
-                               9EE943F406AF409B00772EB5,
-                               9EE943F506AF409B00772EB5,
-                               15CB694505C0722B0099E85F,
-                               15CB693D05C0722B0099E85F,
-                               15CB694705C0722B0099E85F,
-                               15CB694B05C0722B0099E85F,
-                               15CB694D05C0722B0099E85F,
-                               15CB694905C0722B0099E85F,
-                               15CB694305C0722B0099E85F,
-                               15CB694105C0722B0099E85F,
-                               23C1E2BE062DD5DB00835B54,
-                       );
-                       isa = PBXGroup;
-                       name = Headers;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB691305C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SystemConfiguration.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB691505C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCPrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB691705C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDPlugin.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB691B05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDynamicStoreInternal.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB691D05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDynamicStore.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB691F05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDynamicStorePrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB692105C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDynamicStoreKey.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB692305C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDynamicStoreCopySpecific.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB692505C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDynamicStoreCopySpecificPrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB692705C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDynamicStoreSetSpecificPrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB692905C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCPreferencesInternal.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB692B05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCPreferences.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB692D05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCPreferencesPrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB692F05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCPreferencesPath.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB693105C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCPreferencesSetSpecific.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB693305C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCNetwork.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB693505C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCNetworkConnection.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB693705C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCNetworkReachability.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB693905C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCValidation.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB693D05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = DHCPClientPreferences.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB693F05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = SCDynamicStoreCopyDHCPInfo.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB694105C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = moh_msg.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB694305C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = moh.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB694505C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = DeviceOnHold.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB694705C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = LinkConfiguration.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB694905C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = dy_framework.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB694B05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = VLANConfiguration.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB694D05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = VLANConfigurationPrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB694F05C0722B0099E85F = {
-                       children = (
-                               150607BD075A00A200B147BA,
-                               150607DE075A00A300B147BA,
-                               15CB695005C0722B0099E85F,
-                               15CB695205C0722B0099E85F,
-                               15CB695405C0722B0099E85F,
-                               15CB695605C0722B0099E85F,
-                               15CB695805C0722B0099E85F,
-                               15CB695A05C0722B0099E85F,
-                               15CB695C05C0722B0099E85F,
-                               15CB695E05C0722B0099E85F,
-                               15CB696005C0722B0099E85F,
-                               15CB696405C0722B0099E85F,
-                               15CB696605C0722B0099E85F,
-                               15CB696805C0722B0099E85F,
-                               15CB696A05C0722B0099E85F,
-                               15CB696C05C0722B0099E85F,
-                               15CB696E05C0722B0099E85F,
-                               15CB697005C0722B0099E85F,
-                               15CB697205C0722B0099E85F,
-                               15CB697405C0722B0099E85F,
-                               15CB697605C0722B0099E85F,
-                               15CB697805C0722B0099E85F,
-                               15CB697A05C0722B0099E85F,
-                               15CB697C05C0722B0099E85F,
-                               15CB697E05C0722B0099E85F,
-                               15CB698005C0722B0099E85F,
-                               15CB698205C0722B0099E85F,
-                               15CB698405C0722B0099E85F,
-                               15CB698605C0722B0099E85F,
-                               15CB698805C0722B0099E85F,
-                               15CB698A05C0722B0099E85F,
-                               15CB698C05C0722B0099E85F,
-                               15CB698E05C0722B0099E85F,
-                               15CB699005C0722B0099E85F,
-                               15CB699205C0722B0099E85F,
-                               15CB699405C0722B0099E85F,
-                               15CB699605C0722B0099E85F,
-                               15CB699805C0722B0099E85F,
-                               15CB699A05C0722B0099E85F,
-                               151BDA5D05D9E2ED00657BC7,
-                               15AD7A390670A85900BFE03C,
-                               15AD7A3B0670A85900BFE03C,
-                               15AD7A3C0670A85900BFE03C,
-                               15AD7A3D0670A85900BFE03C,
-                               15AD7A3E0670A85900BFE03C,
-                               15CB699C05C0722B0099E85F,
-                               15CB699E05C0722B0099E85F,
-                               15CB69A005C0722B0099E85F,
-                               15CB69A205C0722B0099E85F,
-                               15CB69A405C0722B0099E85F,
-                               15CB69A605C0722B0099E85F,
-                               15CB69A805C0722B0099E85F,
-                               15CB69AC05C0722B0099E85F,
-                               15CB69AE05C0722B0099E85F,
-                               15CB69B005C0722B0099E85F,
-                               15CB69B205C0722B0099E85F,
-                               15CB69B405C0722B0099E85F,
-                               9EE943F306AF409B00772EB5,
-                               15CB69B605C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = Sources;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB695005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCD.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB695205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDKeys.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB695405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDPrivate.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB695605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDPlugin.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB695805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDOpen.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB695A05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDLock.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB695C05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDUnlock.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB695E05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDList.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB696005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDAdd.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB696405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDGet.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB696605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDSet.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB696805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDRemove.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB696A05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDTouch.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB696C05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotify.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB696E05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierSetKeys.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB697005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierAdd.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB697205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierRemove.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB697405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierGetChanges.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB697605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierWait.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB697805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierInformViaCallback.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB697A05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierInformViaMachPort.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB697C05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierInformViaFD.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB697E05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierInformViaSignal.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB698005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDNotifierCancel.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB698205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDSnapshot.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB698405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCP.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB698605C0722B0099E85F = {
-                       indentWidth = 8;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPOpen.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-                       tabWidth = 8;
-               };
-               15CB698805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPLock.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB698A05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPUnlock.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB698C05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPList.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB698E05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPGet.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB699005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPAdd.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB699205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPSet.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB699405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPRemove.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB699605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPCommit.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB699805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPApply.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB699A05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCPPath.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB699C05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDConsoleUser.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB699E05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCDHostName.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69A005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCLocation.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69A205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCNetwork.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69A405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCNetworkConnection.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69A605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCNetworkReachability.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69A805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = SCProxies.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69AC05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = DHCP.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69AE05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = moh.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69B005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = DeviceOnHold.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69B205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = LinkConfiguration.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69B405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = dy_framework.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69B605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = VLANConfiguration.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69BE05C0722B0099E85F = {
-                       explicitFileType = sourcecode.mig;
-                       isa = PBXFileReference;
-                       name = config.defs;
-                       path = SystemConfiguration.fproj/config.defs;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69BF05C0722B0099E85F = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       name = genSCPreferences.c;
-                       path = SystemConfiguration.fproj/genSCPreferences.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69C205C0722B0099E85F = {
-                       children = (
-                               15CB69CE05C0722B0099E85F,
-                               15CB69DF05C0722B0099E85F,
-                               15CB6A1805C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = configd;
-                       path = configd.tproj;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69CE05C0722B0099E85F = {
-                       children = (
-                               15CB69CF05C0722B0099E85F,
-                               15CB69D105C0722B0099E85F,
-                               15CB69D305C0722B0099E85F,
-                               15CB69D505C0722B0099E85F,
-                               15CB69D705C0722B0099E85F,
-                               15CB69D905C0722B0099E85F,
-                               15CB69DB05C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = Headers;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69CF05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = configd.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69D105C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = _SCD.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69D305C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = configd_server.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69D505C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = notify_server.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69D705C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = plugin_support.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69D905C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = session.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69DB05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = pattern.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69DF05C0722B0099E85F = {
-                       children = (
-                               15CB69E005C0722B0099E85F,
-                               15CB69E205C0722B0099E85F,
-                               15CB69E405C0722B0099E85F,
-                               15CB69E605C0722B0099E85F,
-                               15CB69E805C0722B0099E85F,
-                               15CB69EA05C0722B0099E85F,
-                               15CB69EC05C0722B0099E85F,
-                               15CB69F005C0722B0099E85F,
-                               15CB69F205C0722B0099E85F,
-                               15CB69F405C0722B0099E85F,
-                               15CB69F605C0722B0099E85F,
-                               15CB69F805C0722B0099E85F,
-                               15CB69FA05C0722B0099E85F,
-                               15CB69FE05C0722B0099E85F,
-                               15CB6A0005C0722B0099E85F,
-                               15CB6A0205C0722B0099E85F,
-                               15CB6A0405C0722B0099E85F,
-                               15CB6A0605C0722B0099E85F,
-                               15CB6A0805C0722B0099E85F,
-                               15CB6A0A05C0722B0099E85F,
-                               15CB6A0C05C0722B0099E85F,
-                               15CB6A0E05C0722B0099E85F,
-                               15CB6A1005C0722B0099E85F,
-                               15CB6A1205C0722B0099E85F,
-                               15CB6A1405C0722B0099E85F,
-                               15CB6A1605C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = Sources;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69E005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.objc;
-                       path = configd.m;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69E205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _SCD.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69E405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = configd_server.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69E605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = notify_server.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69E805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = plugin_support.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69EA05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = session.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69EC05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = pattern.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69F005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configopen.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69F205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configclose.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69F405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configlock.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69F605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configunlock.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69F805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configlist.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69FA05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configadd.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB69FE05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configget.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A0005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configset.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A0205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configremove.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A0405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _configtouch.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A0605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _confignotify.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A0805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _notifyadd.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A0A05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _notifyremove.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A0C05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _notifychanges.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A0E05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _notifyviaport.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A1005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _notifyviafd.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A1205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _notifyviasignal.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A1405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _notifycancel.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A1605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = _snapshot.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A1805C0722B0099E85F = {
-                       children = (
-                               15CB6A1F05C0722B0099E85F,
-                               15CB6A2005C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = "Supporting Files";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A1F05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = configd.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A2005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = text;
-                       path = configd.8;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A2205C0722B0099E85F = {
-                       children = (
-                               15CB6A2D05C0722B0099E85F,
-                               15CB6A3005C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = scselect;
-                       path = scselect.tproj;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A2D05C0722B0099E85F = {
-                       children = (
-                               15CB6A2E05C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = Sources;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A2E05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = scselect.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A3005C0722B0099E85F = {
-                       children = (
-                               15CB6A3605C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = "Supporting Files";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A3605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = text;
-                       path = scselect.8;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A3705C0722B0099E85F = {
-                       children = (
-                               15CB6A4205C0722B0099E85F,
-                               15CB6A5305C0722B0099E85F,
-                               15CB6A6405C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = scutil;
-                       path = scutil.tproj;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A4205C0722B0099E85F = {
-                       children = (
-                               15CB6A4305C0722B0099E85F,
-                               15CB6A4505C0722B0099E85F,
-                               15CB6A4705C0722B0099E85F,
-                               15CB6A4905C0722B0099E85F,
-                               15CB6A4B05C0722B0099E85F,
-                               15CB6A4D05C0722B0099E85F,
-                               15CB6A4F05C0722B0099E85F,
-                               15CB6A5105C0722B0099E85F,
-                               15A509A406C2518F001F0AB7,
-                               15DC34680711D49400A3311C,
-                               15DC346A0711D49400A3311C,
-                               15DC346C0711D49400A3311C,
-                               15DC346E0711D49400A3311C,
-                       );
-                       isa = PBXGroup;
-                       name = Headers;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A4305C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = scutil.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A4505C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = commands.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A4705C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = dictionary.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A4905C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = session.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A4B05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = cache.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A4D05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = notifications.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A4F05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = tests.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A5105C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = prefs.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A5305C0722B0099E85F = {
-                       children = (
-                               15CB6A5405C0722B0099E85F,
-                               15CB6A5605C0722B0099E85F,
-                               15CB6A5805C0722B0099E85F,
-                               15CB6A5A05C0722B0099E85F,
-                               15CB6A5C05C0722B0099E85F,
-                               15CB6A5E05C0722B0099E85F,
-                               15CB6A6005C0722B0099E85F,
-                               15CB6A6205C0722B0099E85F,
-                               15A509A306C2518F001F0AB7,
-                               15DC34670711D49400A3311C,
-                               15DC34690711D49400A3311C,
-                               15DC346B0711D49400A3311C,
-                               15DC346D0711D49400A3311C,
-                       );
-                       isa = PBXGroup;
-                       name = Sources;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A5405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = scutil.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A5605C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = commands.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A5805C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = dictionary.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A5A05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = session.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A5C05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = cache.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A5E05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = notifications.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A6005C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = tests.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A6205C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = prefs.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A6405C0722B0099E85F = {
-                       children = (
-                               15CB6A6A05C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = "Supporting Files";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A6A05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = text;
-                       path = scutil.8;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A6E05C0722B0099E85F = {
-                       children = (
-                               158AD9F80754EA2F00124717,
-                               15CB6A6F05C0722B0099E85F,
-                               1543636A0752D03C00A8EC6C,
-                               158ADABB0754EAAE00124717,
-                               15CB6A7405C0722B0099E85F,
-                               152CEED0070CF6640050F23C,
-                       );
-                       isa = PBXGroup;
-                       name = "External Frameworks and Libraries";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A6F05C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = wrapper.framework;
-                       name = CoreFoundation.framework;
-                       path = /System/Library/Frameworks/CoreFoundation.framework;
-                       refType = 0;
-                       sourceTree = "<absolute>";
-               };
-               15CB6A7405C0722B0099E85F = {
-                       isa = PBXFileReference;
-                       lastKnownFileType = "compiled.mach-o.dylib";
-                       name = libobjc.dylib;
-                       path = /usr/lib/libobjc.A.dylib;
-                       refType = 0;
-                       sourceTree = "<absolute>";
-               };
-               15CB6A7705C0722B0099E85F = {
-                       buildSettings = {
-                               CURRENT_PROJECT_VERSION = 137.3;
-                               FRAMEWORK_SEARCH_PATHS = "";
-                               HEADER_SEARCH_PATHS = "";
-                               INSTALL_GROUP = wheel;
-                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
-                               INSTALL_OWNER = root;
-                               INSTALL_PATH = /usr/sbin;
-                               LIBRARY_SEARCH_PATHS = "";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = "-dead_strip";
-                               OTHER_REZFLAGS = "";
-                               PRODUCT_NAME = scselect;
-                               REZ_EXECUTABLE = YES;
-                               SECTORDER_FLAGS = "";
-                               STRIPFLAGS = "-S";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = "-Wall -Wno-four-char-constants -Wno-unknown-pragmas";
-                       };
-                       buildStyles = (
-                               15CB68FE05C072220099E85F,
-                               15CB68FF05C072220099E85F,
-                       );
-                       hasScannedForEncodings = 1;
-                       isa = PBXProject;
-                       mainGroup = 15CB68FC05C072220099E85F;
-                       productRefGroup = 15CB690F05C0722B0099E85F;
-                       projectDirPath = "";
-                       targets = (
-                               15CB690005C0722A0099E85F,
-                               157BB8AE075924360025DA7A,
-                               159D542007528E7C004F8947,
-                               155847FA07550D210046C2E9,
-                               15DAD5DF075913CE0084A6ED,
-                               15481BF7075A2B3900B32F56,
-                               15DAD63F07591A1A0084A6ED,
-                               159D549F07529FFF004F8947,
-                               1558481207550EC10046C2E9,
-                               155847430754FDCD0046C2E9,
-                               15FD733A0754DBDA001CC321,
-                               15FD731E0754DB9F001CC321,
-                               159D53EB07528C61004F8947,
-                               15FD72A10754DA4C001CC321,
-                               159D53E407528C4A004F8947,
-                               15FD72930754DA2B001CC321,
-                               159D53D307528BDA004F8947,
-                               15828AE60753B5F900AD4710,
-                               159D53DD07528C2E004F8947,
-                               15FD70FF0754D627001CC321,
-                               159D53F207528C79004F8947,
-                               15FD72B10754DA69001CC321,
-                               159D53F907528C95004F8947,
-                               15FD72C50754DA7E001CC321,
-                       );
-               };
-               15CB6A8305C072410099E85F = {
-                       children = (
-                               15CB69BF05C0722B0099E85F,
-                       );
-                       isa = PBXGroup;
-                       name = Schema;
-                       path = "";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CB6A8605C072500099E85F = {
-                       children = (
-                               15CB69BE05C0722B0099E85F,
-                               1514D76D05C08A5F00757DC9,
-                               15FCAAD005FD0EBF00CB79E6,
-                               15FCAACF05FD0EBF00CB79E6,
-                               23C1E2B8062DD45900835B54,
-                               23C1E2B4062DD2C700835B54,
-                       );
-                       isa = PBXGroup;
-                       name = MiG;
-                       path = "";
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15CFC229068B222F00123568 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.script.sh;
-                       path = "get-mobility-info";
-                       refType = 2;
-                       sourceTree = SOURCE_ROOT;
-               };
-               15DAD5730759115F0084A6ED = {
-                       containerPortal = 15CB6A7705C0722B0099E85F;
-                       isa = PBXContainerItemProxy;
-                       proxyType = 1;
-                       remoteGlobalIDString = 15FD731E0754DB9F001CC321;
-                       remoteInfo = ATconfig.bundle;
-               };
-               15DAD5740759115F0084A6ED = {
-                       isa = PBXTargetDependency;
-                       target = 15FD731E0754DB9F001CC321;
-                       targetProxy = 15DAD5730759115F0084A6ED;
-               };
-               15DAD5DF075913CE0084A6ED = {
-                       buildPhases = (
-                               15DAD5E0075913CE0084A6ED,
-                               15DAD5E4075913CE0084A6ED,
-                               15DAD5E9075913CE0084A6ED,
-                               15DAD5EA075913CE0084A6ED,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 1;
-                               INSTALLHDRS_COPY_PHASE = YES;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = dnsinfo;
-                               SECTORDER_FLAGS = "";
-                               UNSTRIPPED_PRODUCT = YES;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = DNSConfiguration;
-                       productInstallPath = /usr/local/lib;
-                       productName = DNSConfiguration;
-                       productReference = 15DAD5EE075913CE0084A6ED;
-                       productType = "com.apple.product-type.library.static";
-               };
-               15DAD5E0075913CE0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               15DAD5E1075913CE0084A6ED,
-                               15DAD5E2075913CE0084A6ED,
-                               15DAD5E3075913CE0084A6ED,
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD5E1075913CE0084A6ED = {
-                       fileRef = 15B73F0905FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                               );
-                       };
-               };
-               15DAD5E2075913CE0084A6ED = {
-                       fileRef = 15B73F0C05FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD5E3075913CE0084A6ED = {
-                       fileRef = 1532629006281C9D00B1C10C;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                               );
-                       };
-               };
-               15DAD5E4075913CE0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               15DAD5E5075913CE0084A6ED,
-                               15DAD5E6075913CE0084A6ED,
-                               15DAD5E7075913CE0084A6ED,
-                               15DAD5E8075913CE0084A6ED,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD5E5075913CE0084A6ED = {
-                       fileRef = 15FCAAD005FD0EBF00CB79E6;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Client,
-                               );
-                       };
-               };
-               15DAD5E6075913CE0084A6ED = {
-                       fileRef = 15B73F0805FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD5E7075913CE0084A6ED = {
-                       fileRef = 15B73F0B05FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD5E8075913CE0084A6ED = {
-                       fileRef = 1521FC5C060F296A003B28F5;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD5E9075913CE0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD5EA075913CE0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXRezBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD5EE075913CE0084A6ED = {
-                       explicitFileType = archive.ar;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = libdnsinfo.a;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15DAD63F07591A1A0084A6ED = {
-                       buildPhases = (
-                               15DAD6AC07591A1A0084A6ED,
-                               15DAD64107591A1A0084A6ED,
-                               15DAD66807591A1A0084A6ED,
-                               15DAD66C07591A1A0084A6ED,
-                               15DAD6AD07591A1A0084A6ED,
-                               15DAD6AF07591A1A0084A6ED,
-                               15DAD6B007591A1A0084A6ED,
-                               15DAD6B107591A1A0084A6ED,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               CURRENT_PROJECT_VERSION = 137.3;
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 1;
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
-                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = "-seg_addr_table $(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table";
-                               PRODUCT_NAME = SystemConfiguration;
-                               SECTORDER_FLAGS = "-sectorder __TEXT __text $(OBJROOT)/SystemConfiguration.order";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                               WRAPPER_EXTENSION = framework;
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = SystemConfiguration.framework;
-                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
-                       productName = "SystemConfiguration (Framework)";
-                       productReference = 15DAD6C807591A1A0084A6ED;
-                       productType = "com.apple.product-type.framework";
-               };
-               15DAD64107591A1A0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               1506081A075A00A300B147BA,
-                               15DAD64307591A1A0084A6ED,
-                               15DAD64407591A1A0084A6ED,
-                               15DAD64507591A1A0084A6ED,
-                               15DAD64607591A1A0084A6ED,
-                               15DAD64707591A1A0084A6ED,
-                               15DAD64807591A1A0084A6ED,
-                               15DAD64907591A1A0084A6ED,
-                               15DAD64A07591A1A0084A6ED,
-                               15DAD64B07591A1A0084A6ED,
-                               15DAD64C07591A1A0084A6ED,
-                               15DAD64D07591A1A0084A6ED,
-                               15DAD64E07591A1A0084A6ED,
-                               15DAD64F07591A1A0084A6ED,
-                               15DAD65007591A1A0084A6ED,
-                               15DAD65107591A1A0084A6ED,
-                               15DAD65207591A1A0084A6ED,
-                               15DAD65307591A1A0084A6ED,
-                               15DAD65407591A1A0084A6ED,
-                               15DAD65507591A1A0084A6ED,
-                               15DAD65607591A1A0084A6ED,
-                               15DAD65707591A1A0084A6ED,
-                               15DAD65807591A1A0084A6ED,
-                               15DAD65907591A1A0084A6ED,
-                               15DAD65A07591A1A0084A6ED,
-                               15DAD65B07591A1A0084A6ED,
-                               15DAD65C07591A1A0084A6ED,
-                               15DAD65D07591A1A0084A6ED,
-                               15DAD65E07591A1A0084A6ED,
-                               15DAD65F07591A1A0084A6ED,
-                               15DAD66007591A1A0084A6ED,
-                               15DAD66107591A1A0084A6ED,
-                               15DAD66207591A1A0084A6ED,
-                               15DAD66307591A1A0084A6ED,
-                               15DAD66407591A1A0084A6ED,
-                               15DAD66507591A1A0084A6ED,
-                               15DAD66607591A1A0084A6ED,
-                               15DAD66707591A1A0084A6ED,
-                               156BD6BC07E0DFA9008698FF,
-                               154CF3F407E1EA4D00D8302E,
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD64307591A1A0084A6ED = {
-                       fileRef = 15CB691305C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD64407591A1A0084A6ED = {
-                       fileRef = 15CB691505C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                                       Private,
-                               );
-                       };
-               };
-               15DAD64507591A1A0084A6ED = {
-                       fileRef = 15CB691705C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               15DAD64607591A1A0084A6ED = {
-                       fileRef = 15CB691B05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                               );
-                       };
-               };
-               15DAD64707591A1A0084A6ED = {
-                       fileRef = 15CB691D05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD64807591A1A0084A6ED = {
-                       fileRef = 15CB691F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                                       Private,
-                               );
-                       };
-               };
-               15DAD64907591A1A0084A6ED = {
-                       fileRef = 15CB692105C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD64A07591A1A0084A6ED = {
-                       fileRef = 15CB692305C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD64B07591A1A0084A6ED = {
-                       fileRef = 15CB692505C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                                       Private,
-                               );
-                       };
-               };
-               15DAD64C07591A1A0084A6ED = {
-                       fileRef = 15CB692705C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                                       Private,
-                               );
-                       };
-               };
-               15DAD64D07591A1A0084A6ED = {
-                       fileRef = 15CB692905C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                               );
-                       };
-               };
-               15DAD64E07591A1A0084A6ED = {
-                       fileRef = 15CB692B05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD64F07591A1A0084A6ED = {
-                       fileRef = 15CB692D05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                                       Private,
-                               );
-                       };
-               };
-               15DAD65007591A1A0084A6ED = {
-                       fileRef = 15CB692F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD65107591A1A0084A6ED = {
-                       fileRef = 15CB693105C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD65207591A1A0084A6ED = {
-                       fileRef = 15AD7A380670A85900BFE03C;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                               );
-                       };
-               };
-               15DAD65307591A1A0084A6ED = {
-                       fileRef = 15AD7A3A0670A85900BFE03C;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD65407591A1A0084A6ED = {
-                       fileRef = 15CB693305C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD65507591A1A0084A6ED = {
-                       fileRef = 15CB693505C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD65607591A1A0084A6ED = {
-                       fileRef = 15CB693705C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                                       Project,
-                               );
-                       };
-               };
-               15DAD65707591A1A0084A6ED = {
-                       fileRef = 15CB693905C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                                       Private,
-                               );
-                       };
-               };
-               15DAD65807591A1A0084A6ED = {
-                       fileRef = 15CB693D05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                               );
-                       };
-               };
-               15DAD65907591A1A0084A6ED = {
-                       fileRef = 15CB693F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Public,
-                               );
-                       };
-               };
-               15DAD65A07591A1A0084A6ED = {
-                       fileRef = 15CB694105C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD65B07591A1A0084A6ED = {
-                       fileRef = 15CB694305C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD65C07591A1A0084A6ED = {
-                       fileRef = 15CB694505C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               15DAD65D07591A1A0084A6ED = {
-                       fileRef = 15CB694705C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               15DAD65E07591A1A0084A6ED = {
-                       fileRef = 15CB694905C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD65F07591A1A0084A6ED = {
-                       fileRef = 15CB694B05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               15DAD66007591A1A0084A6ED = {
-                       fileRef = 15CB694D05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Project,
-                                       Private,
-                               );
-                       };
-               };
-               15DAD66107591A1A0084A6ED = {
-                       fileRef = 151BDA2B05D9E28B00657BC7;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               15DAD66207591A1A0084A6ED = {
-                       fileRef = 15B73F0905FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD66307591A1A0084A6ED = {
-                       fileRef = 15B73F0C05FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD66407591A1A0084A6ED = {
-                       fileRef = 23C1E2B4062DD2C700835B54;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD66507591A1A0084A6ED = {
-                       fileRef = 23C1E2BE062DD5DB00835B54;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD66607591A1A0084A6ED = {
-                       fileRef = 9EE943F406AF409B00772EB5;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               15DAD66707591A1A0084A6ED = {
-                       fileRef = 9EE943F506AF409B00772EB5;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Private,
-                               );
-                       };
-               };
-               15DAD66807591A1A0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               15DAD66907591A1A0084A6ED,
-                               15DAD66A07591A1A0084A6ED,
-                               15DAD66B07591A1A0084A6ED,
-                       );
-                       isa = PBXResourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD66907591A1A0084A6ED = {
-                       fileRef = 15B686220678B65C00FF4023;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD66A07591A1A0084A6ED = {
-                       fileRef = 15CFC229068B222F00123568;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD66B07591A1A0084A6ED = {
-                       fileRef = 1577253606EFBF3100D7B52B;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD66C07591A1A0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               15060818075A00A300B147BA,
-                               15DAD66D07591A1A0084A6ED,
-                               15DAD66E07591A1A0084A6ED,
-                               15DAD66F07591A1A0084A6ED,
-                               15DAD67007591A1A0084A6ED,
-                               15DAD67107591A1A0084A6ED,
-                               15DAD67207591A1A0084A6ED,
-                               15DAD67307591A1A0084A6ED,
-                               15DAD67407591A1A0084A6ED,
-                               15DAD67507591A1A0084A6ED,
-                               15DAD67607591A1A0084A6ED,
-                               15DAD67707591A1A0084A6ED,
-                               15DAD67807591A1A0084A6ED,
-                               15DAD67907591A1A0084A6ED,
-                               15DAD67A07591A1A0084A6ED,
-                               15DAD67B07591A1A0084A6ED,
-                               15DAD67C07591A1A0084A6ED,
-                               15DAD67D07591A1A0084A6ED,
-                               15DAD67E07591A1A0084A6ED,
-                               15DAD67F07591A1A0084A6ED,
-                               15DAD68007591A1A0084A6ED,
-                               15DAD68107591A1A0084A6ED,
-                               15DAD68207591A1A0084A6ED,
-                               15DAD68307591A1A0084A6ED,
-                               15DAD68407591A1A0084A6ED,
-                               15DAD68507591A1A0084A6ED,
-                               15DAD68607591A1A0084A6ED,
-                               15DAD68707591A1A0084A6ED,
-                               15DAD68807591A1A0084A6ED,
-                               15DAD68907591A1A0084A6ED,
-                               15DAD68A07591A1A0084A6ED,
-                               15DAD68B07591A1A0084A6ED,
-                               15DAD68C07591A1A0084A6ED,
-                               15DAD68D07591A1A0084A6ED,
-                               15DAD68E07591A1A0084A6ED,
-                               15DAD68F07591A1A0084A6ED,
-                               15DAD69007591A1A0084A6ED,
-                               15DAD69107591A1A0084A6ED,
-                               15DAD69207591A1A0084A6ED,
-                               15DAD69307591A1A0084A6ED,
-                               15DAD69407591A1A0084A6ED,
-                               15DAD69507591A1A0084A6ED,
-                               15DAD69607591A1A0084A6ED,
-                               15DAD69707591A1A0084A6ED,
-                               15DAD69807591A1A0084A6ED,
-                               15DAD69907591A1A0084A6ED,
-                               15DAD69A07591A1A0084A6ED,
-                               15DAD69B07591A1A0084A6ED,
-                               15DAD69C07591A1A0084A6ED,
-                               15DAD69D07591A1A0084A6ED,
-                               15DAD69E07591A1A0084A6ED,
-                               15DAD69F07591A1A0084A6ED,
-                               15DAD6A007591A1A0084A6ED,
-                               15DAD6A207591A1A0084A6ED,
-                               15DAD6A307591A1A0084A6ED,
-                               15DAD6A407591A1A0084A6ED,
-                               15DAD6A507591A1A0084A6ED,
-                               15DAD6A607591A1A0084A6ED,
-                               15DAD6A707591A1A0084A6ED,
-                               15DAD6A807591A1A0084A6ED,
-                               15DAD6A907591A1A0084A6ED,
-                               15DAD6AA07591A1A0084A6ED,
-                               15DAD6AB07591A1A0084A6ED,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD66D07591A1A0084A6ED = {
-                       fileRef = 15CB695005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD66E07591A1A0084A6ED = {
-                       fileRef = 15CB695205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD66F07591A1A0084A6ED = {
-                       fileRef = 15CB695405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67007591A1A0084A6ED = {
-                       fileRef = 15CB695605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67107591A1A0084A6ED = {
-                       fileRef = 15CB695805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67207591A1A0084A6ED = {
-                       fileRef = 15CB695A05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67307591A1A0084A6ED = {
-                       fileRef = 15CB695C05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67407591A1A0084A6ED = {
-                       fileRef = 15CB695E05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67507591A1A0084A6ED = {
-                       fileRef = 15CB696005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67607591A1A0084A6ED = {
-                       fileRef = 15CB696405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67707591A1A0084A6ED = {
-                       fileRef = 15CB696605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67807591A1A0084A6ED = {
-                       fileRef = 15CB696805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67907591A1A0084A6ED = {
-                       fileRef = 15CB696A05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67A07591A1A0084A6ED = {
-                       fileRef = 15CB696C05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67B07591A1A0084A6ED = {
-                       fileRef = 15CB696E05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67C07591A1A0084A6ED = {
-                       fileRef = 15CB697005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67D07591A1A0084A6ED = {
-                       fileRef = 15CB697205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67E07591A1A0084A6ED = {
-                       fileRef = 15CB697405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD67F07591A1A0084A6ED = {
-                       fileRef = 15CB697605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68007591A1A0084A6ED = {
-                       fileRef = 15CB697805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68107591A1A0084A6ED = {
-                       fileRef = 15CB697A05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68207591A1A0084A6ED = {
-                       fileRef = 15CB697C05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68307591A1A0084A6ED = {
-                       fileRef = 15CB697E05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68407591A1A0084A6ED = {
-                       fileRef = 15CB698005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68507591A1A0084A6ED = {
-                       fileRef = 15CB698205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68607591A1A0084A6ED = {
-                       fileRef = 15CB698405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68707591A1A0084A6ED = {
-                       fileRef = 15CB698605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68807591A1A0084A6ED = {
-                       fileRef = 15CB698805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68907591A1A0084A6ED = {
-                       fileRef = 15CB698A05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68A07591A1A0084A6ED = {
-                       fileRef = 15CB698C05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68B07591A1A0084A6ED = {
-                       fileRef = 15CB698E05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68C07591A1A0084A6ED = {
-                       fileRef = 15CB699005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68D07591A1A0084A6ED = {
-                       fileRef = 15CB699205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68E07591A1A0084A6ED = {
-                       fileRef = 15CB699405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD68F07591A1A0084A6ED = {
-                       fileRef = 15CB699605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69007591A1A0084A6ED = {
-                       fileRef = 15CB699805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69107591A1A0084A6ED = {
-                       fileRef = 15CB699A05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69207591A1A0084A6ED = {
-                       fileRef = 15CB699C05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69307591A1A0084A6ED = {
-                       fileRef = 15CB699E05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69407591A1A0084A6ED = {
-                       fileRef = 15CB69A005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69507591A1A0084A6ED = {
-                       fileRef = 15CB69A205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69607591A1A0084A6ED = {
-                       fileRef = 23C1E2B8062DD45900835B54;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Client,
-                               );
-                       };
-               };
-               15DAD69707591A1A0084A6ED = {
-                       fileRef = 15CB69A405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69807591A1A0084A6ED = {
-                       fileRef = 15CB69A605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69907591A1A0084A6ED = {
-                       fileRef = 15CB69A805C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69A07591A1A0084A6ED = {
-                       fileRef = 15CB69AC05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69B07591A1A0084A6ED = {
-                       fileRef = 15CB69AE05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69C07591A1A0084A6ED = {
-                       fileRef = 15CB69B005C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69D07591A1A0084A6ED = {
-                       fileRef = 15CB69B205C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69E07591A1A0084A6ED = {
-                       fileRef = 15CB69B405C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD69F07591A1A0084A6ED = {
-                       fileRef = 15CB69B605C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                               );
-                       };
-               };
-               15DAD6A007591A1A0084A6ED = {
-                       fileRef = 15CB69BE05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Client,
-                               );
-                       };
-               };
-               15DAD6A207591A1A0084A6ED = {
-                       fileRef = 151BDA5D05D9E2ED00657BC7;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6A307591A1A0084A6ED = {
-                       fileRef = 15B73F0B05FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6A407591A1A0084A6ED = {
-                       fileRef = 15B73F0805FD1B670096477F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6A507591A1A0084A6ED = {
-                       fileRef = 15FCAAD005FD0EBF00CB79E6;
-                       isa = PBXBuildFile;
-                       settings = {
-                               ATTRIBUTES = (
-                                       Client,
-                               );
-                       };
-               };
-               15DAD6A607591A1A0084A6ED = {
-                       fileRef = 15AD7A390670A85900BFE03C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6A707591A1A0084A6ED = {
-                       fileRef = 15AD7A3B0670A85900BFE03C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6A807591A1A0084A6ED = {
-                       fileRef = 15AD7A3C0670A85900BFE03C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6A907591A1A0084A6ED = {
-                       fileRef = 15AD7A3D0670A85900BFE03C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6AA07591A1A0084A6ED = {
-                       fileRef = 15AD7A3E0670A85900BFE03C;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6AB07591A1A0084A6ED = {
-                       fileRef = 9EE943F306AF409B00772EB5;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6AC07591A1A0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       inputPaths = (
-                               /usr/local/lib/OrderFiles/SystemConfiguration.order,
-                       );
-                       isa = PBXShellScriptBuildPhase;
-                       name = SystemConfiguration.order;
-                       outputPaths = (
-                               "${OBJROOT}/SystemConfiguration.order",
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-                       shellPath = /bin/sh;
-                       shellScript = "if [ -r /usr/local/lib/OrderFiles/SystemConfiguration.order ]; then\n\tcp /usr/local/lib/OrderFiles/SystemConfiguration.order ${OBJROOT}/SystemConfiguration.order\nelse\n\ttouch ${OBJROOT}/SystemConfiguration.order\nfi";
-               };
-               15DAD6AD07591A1A0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               15DAD6AE07591A1A0084A6ED,
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD6AE07591A1A0084A6ED = {
-                       fileRef = 15CB6A6F05C0722B0099E85F;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15DAD6AF07591A1A0084A6ED = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXRezBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD6B007591A1A0084A6ED = {
-                       buildActionMask = 8;
-                       files = (
-                       );
-                       inputPaths = (
-                       );
-                       isa = PBXShellScriptBuildPhase;
-                       name = "get-mobility-info";
-                       outputPaths = (
-                       );
-                       runOnlyForDeploymentPostprocessing = 1;
-                       shellPath = /bin/sh;
-                       shellScript = "mkdir -p \"${DSTROOT}/usr/local/bin\"\nln -fs \"${INSTALL_PATH}/${TARGET_NAME}/Resources/get-mobility-info\" \"${DSTROOT}/usr/local/bin/\"\n";
-               };
-               15DAD6B107591A1A0084A6ED = {
-                       buildActionMask = 8;
-                       files = (
-                       );
-                       inputPaths = (
-                               preferences.xml,
-                       );
-                       isa = PBXShellScriptBuildPhase;
-                       name = preferences.plist;
-                       outputPaths = (
-                       );
-                       runOnlyForDeploymentPostprocessing = 1;
-                       shellPath = /bin/sh;
-                       shellScript = "PREFS_DIR=\"/Library/Preferences/SystemConfiguration\"\nmkdir -p ${DSTROOT}${PREFS_DIR}\nchmod 755 ${DSTROOT}${PREFS_DIR}\ninstall -c -m 644 preferences.xml ${DSTROOT}${PREFS_DIR}/preferences.plist";
-               };
-               15DAD6C807591A1A0084A6ED = {
-                       explicitFileType = wrapper.framework;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = SystemConfiguration.framework;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15DC34670711D49400A3311C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = net_interface.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15DC34680711D49400A3311C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = net_interface.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15DC34690711D49400A3311C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = net_protocol.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15DC346A0711D49400A3311C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = net_protocol.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15DC346B0711D49400A3311C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = net_service.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15DC346C0711D49400A3311C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = net_service.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15DC346D0711D49400A3311C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = net_set.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15DC346E0711D49400A3311C = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = net_set.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15FCAACF05FD0EBF00CB79E6 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = shared_dns_info_types.h;
-                       path = dnsinfo/shared_dns_info_types.h;
-                       refType = 2;
-                       sourceTree = SOURCE_ROOT;
-               };
-               15FCAAD005FD0EBF00CB79E6 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.mig;
-                       name = shared_dns_info.defs;
-                       path = dnsinfo/shared_dns_info.defs;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15FD70FF0754D627001CC321 = {
-                       buildPhases = (
-                               15FD71010754D627001CC321,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/Kicker/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = Kicker;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                               WRAPPER_EXTENSION = bundle;
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = Kicker.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
-                       productReference = 15FD71090754D628001CC321;
-                       productType = "com.apple.product-type.bundle";
-               };
-               15FD71010754D627001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               158ADD190754F1F100124717,
-                               158ADD1B0754F1F400124717,
-                       );
-                       isa = PBXResourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD71090754D628001CC321 = {
-                       explicitFileType = wrapper.cfbundle;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = Kicker.bundle;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15FD72930754DA2B001CC321 = {
-                       buildPhases = (
-                               15FD72940754DA2B001CC321,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = InterfaceNamer;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                               WRAPPER_EXTENSION = bundle;
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = InterfaceNamer.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
-                       productReference = 15FD72970754DA2B001CC321;
-                       productType = "com.apple.product-type.bundle";
-               };
-               15FD72940754DA2B001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXResourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD72970754DA2B001CC321 = {
-                       explicitFileType = wrapper.cfbundle;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = InterfaceNamer.bundle;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15FD72A10754DA4C001CC321 = {
-                       buildPhases = (
-                               15FD72A20754DA4C001CC321,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = IPMonitor;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                               WRAPPER_EXTENSION = bundle;
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = IPMonitor.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
-                       productReference = 15FD72A50754DA4C001CC321;
-                       productType = "com.apple.product-type.bundle";
-               };
-               15FD72A20754DA4C001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               158ADD0E0754F1A000124717,
-                       );
-                       isa = PBXResourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD72A50754DA4C001CC321 = {
-                       explicitFileType = wrapper.cfbundle;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = IPMonitor.bundle;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15FD72B10754DA69001CC321 = {
-                       buildPhases = (
-                               15FD72B20754DA69001CC321,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = LinkConfiguration;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                               WRAPPER_EXTENSION = bundle;
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = LinkConfiguration.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
-                       productReference = 15FD72B50754DA69001CC321;
-                       productType = "com.apple.product-type.bundle";
-               };
-               15FD72B20754DA69001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXResourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD72B50754DA69001CC321 = {
-                       explicitFileType = wrapper.cfbundle;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = LinkConfiguration.bundle;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15FD72C50754DA7E001CC321 = {
-                       buildPhases = (
-                               15FD72C60754DA7E001CC321,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = PreferencesMonitor;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                               WRAPPER_EXTENSION = bundle;
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = PreferencesMonitor.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
-                       productReference = 15FD72C90754DA7E001CC321;
-                       productType = "com.apple.product-type.bundle";
-               };
-               15FD72C60754DA7E001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXResourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD72C90754DA7E001CC321 = {
-                       explicitFileType = wrapper.cfbundle;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = PreferencesMonitor.bundle;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15FD731E0754DB9F001CC321 = {
-                       buildPhases = (
-                               15FD731F0754DB9F001CC321,
-                               15FD73200754DB9F001CC321,
-                               15FD73210754DB9F001CC321,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               CURRENT_PROJECT_VERSION = 137.3;
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = ATconfig;
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                               WRAPPER_EXTENSION = bundle;
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = ATconfig.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
-                       productReference = 15FD73220754DB9F001CC321;
-                       productType = "com.apple.product-type.bundle";
-               };
-               15FD731F0754DB9F001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXResourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD73200754DB9F001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               15FD73480754DC2A001CC321,
-                               15FD735C0754DC3F001CC321,
-                               15FD735E0754DC43001CC321,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD73210754DB9F001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               158ADA3D0754EA5A00124717,
-                               1523F6EE075A36210066F0B2,
-                               158ADA160754EA2F00124717,
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD73220754DB9F001CC321 = {
-                       explicitFileType = wrapper.cfbundle;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = ATconfig.bundle;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15FD733A0754DBDA001CC321 = {
-                       buildPhases = (
-                               15FD733C0754DBDA001CC321,
-                               15FD733D0754DBDA001CC321,
-                               15FD733F0754DBDA001CC321,
-                       );
-                       buildRules = (
-                       );
-                       buildSettings = {
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = ATconfig;
-                               WARNING_CFLAGS = "-Wall -Wno-unknown-pragmas";
-                       };
-                       dependencies = (
-                       );
-                       isa = PBXNativeTarget;
-                       name = ATconfig;
-                       productName = InterfaceNamer;
-                       productReference = 15FD73400754DBDA001CC321;
-                       productType = "com.apple.product-type.library.static";
-               };
-               15FD733C0754DBDA001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXHeadersBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD733D0754DBDA001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                               1508E39F07552B6A0062B350,
-                               1508E3A007552B6B0062B350,
-                               1508E3A107552B720062B350,
-                       );
-                       isa = PBXSourcesBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD733F0754DBDA001CC321 = {
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       isa = PBXFrameworksBuildPhase;
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD73400754DBDA001CC321 = {
-                       explicitFileType = archive.ar;
-                       includeInIndex = 0;
-                       isa = PBXFileReference;
-                       path = libATconfig.a;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-               15FD73480754DC2A001CC321 = {
-                       fileRef = 159D53C707528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                               COMPILER_FLAGS = "-Wno-deprecated-declarations";
-                       };
-               };
-               15FD735C0754DC3F001CC321 = {
-                       fileRef = 159D53CA07528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15FD735E0754DC43001CC321 = {
-                       fileRef = 159D53C507528B36004F8947;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               15FD73970754DE49001CC321 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Info.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15FD73EE0754DE62001CC321 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Info.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               15FD743E0754DE7A001CC321 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = text.xml;
-                       path = Info.plist;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-//150
-//151
-//152
-//153
-//154
-//230
-//231
-//232
-//233
-//234
-               23C1E2B4062DD2C700835B54 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = pppcontroller_types.h;
-                       path = /usr/local/include/ppp/pppcontroller_types.h;
-                       refType = 0;
-                       sourceTree = "<absolute>";
-               };
-               23C1E2B8062DD45900835B54 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.mig;
-                       name = pppcontroller.defs;
-                       path = SystemConfiguration.fproj/pppcontroller.defs;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               23C1E2BE062DD5DB00835B54 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       name = pppcontroller.h;
-                       path = configd.build/SystemConfiguration.framework.build/DerivedSources/pppcontroller.h;
-                       refType = 3;
-                       sourceTree = BUILT_PRODUCTS_DIR;
-               };
-//230
-//231
-//232
-//233
-//234
-//9E0
-//9E1
-//9E2
-//9E3
-//9E4
-               9EE943F306AF409B00772EB5 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.c;
-                       path = BondConfiguration.c;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               9EE943F406AF409B00772EB5 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = BondConfiguration.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-               9EE943F506AF409B00772EB5 = {
-                       fileEncoding = 30;
-                       isa = PBXFileReference;
-                       lastKnownFileType = sourcecode.c.h;
-                       path = BondConfigurationPrivate.h;
-                       refType = 4;
-                       sourceTree = "<group>";
-               };
-       };
-       rootObject = 15CB6A7705C0722B0099E85F;
-}
diff --git a/configd.xcodeproj/project.pbxproj b/configd.xcodeproj/project.pbxproj
new file mode 100644 (file)
index 0000000..e1e8d3f
--- /dev/null
@@ -0,0 +1,4308 @@
+// !$*UTF8*$!
+{
+       archiveVersion = 1;
+       classes = {
+       };
+       objectVersion = 42;
+       objects = {
+
+/* Begin PBXAggregateTarget section */
+               155847FA07550D210046C2E9 /* configd_executables */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 156EB62E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_executables" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               1558480607550D470046C2E9 /* PBXTargetDependency */,
+                               1558480807550D470046C2E9 /* PBXTargetDependency */,
+                               1558480A07550D470046C2E9 /* PBXTargetDependency */,
+                       );
+                       name = configd_executables;
+                       productName = configd_executables;
+               };
+               157BB8AE075924360025DA7A /* configd_base */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 156EB5E60905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_base" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               157BB8C2075924470025DA7A /* PBXTargetDependency */,
+                               157BB8C0075924460025DA7A /* PBXTargetDependency */,
+                               1520A386084681350010B584 /* PBXTargetDependency */,
+                       );
+                       name = configd_base;
+                       productName = Frameworks;
+               };
+               159D542007528E7C004F8947 /* configd_plugins */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               1533B94109731A9600F2B34A /* PBXTargetDependency */,
+                               15DAD5740759115F0084A6ED /* PBXTargetDependency */,
+                               159D542807528E85004F8947 /* PBXTargetDependency */,
+                               158AD9860754E72500124717 /* PBXTargetDependency */,
+                               159D542607528E85004F8947 /* PBXTargetDependency */,
+                               158AD9880754E72500124717 /* PBXTargetDependency */,
+                               15828B070753B77E00AD4710 /* PBXTargetDependency */,
+                               159D542207528E85004F8947 /* PBXTargetDependency */,
+                               159D542A07528E85004F8947 /* PBXTargetDependency */,
+                               158AD98C0754E72500124717 /* PBXTargetDependency */,
+                               159D542C07528E85004F8947 /* PBXTargetDependency */,
+                               158AD98E0754E72500124717 /* PBXTargetDependency */,
+                               F95B8A790B03FB9100993BA3 /* PBXTargetDependency */,
+                               F95B8A770B03FB9100993BA3 /* PBXTargetDependency */,
+                       );
+                       name = configd_plugins;
+                       productName = Plugins;
+               };
+               15CB690005C0722A0099E85F /* All */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 156EB6320905594A00EEF749 /* Build configuration list for PBXAggregateTarget "All" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               157BB8C40759244B0025DA7A /* PBXTargetDependency */,
+                               159D542E07529008004F8947 /* PBXTargetDependency */,
+                               1558480F07550DD00046C2E9 /* PBXTargetDependency */,
+                       );
+                       name = All;
+                       productName = "configd (Aggregate)";
+               };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+               15060818075A00A300B147BA /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; };
+               1506081A075A00A300B147BA /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               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 */; };
+               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 */; };
+               1523F6F1075A36F70066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
+               1523F6F2075A37050066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
+               1523F710075A371D0066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
+               1523F715075A376B0066F0B2 /* libdnsinfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */; };
+               1523F719075A37C70066F0B2 /* libdnsinfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */; };
+               152E68C10A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               152E68C30A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; };
+               1533B94D09731BE600F2B34A /* libATconfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15FD73400754DBDA001CC321 /* libATconfig.a */; };
+               1533D77B0B10A14300CA4946 /* libNetworkIdentification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */; };
+               153BED940B75566200989D5C /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1587A31F0B6AACD70063104A /* libicucore.dylib */; };
+               1540E3610987DA9500157C07 /* com.apple.configd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1540E3600987DA9500157C07 /* com.apple.configd.plist */; };
+               154361E00752C81800A8EC6C /* set-hostname.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AB07528B36004F8947 /* set-hostname.c */; };
+               1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               155847470754FDCD0046C2E9 /* scutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4305C0722B0099E85F /* scutil.h */; };
+               155847480754FDCD0046C2E9 /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4505C0722B0099E85F /* commands.h */; };
+               155847490754FDCD0046C2E9 /* dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4705C0722B0099E85F /* dictionary.h */; };
+               1558474A0754FDCD0046C2E9 /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4905C0722B0099E85F /* session.h */; };
+               1558474B0754FDCD0046C2E9 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4B05C0722B0099E85F /* cache.h */; };
+               1558474C0754FDCD0046C2E9 /* notifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4D05C0722B0099E85F /* notifications.h */; };
+               1558474D0754FDCD0046C2E9 /* tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4F05C0722B0099E85F /* tests.h */; };
+               1558474E0754FDCD0046C2E9 /* prefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A5105C0722B0099E85F /* prefs.h */; };
+               1558474F0754FDCD0046C2E9 /* net.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A509A406C2518F001F0AB7 /* net.h */; };
+               155847500754FDCD0046C2E9 /* net_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC34680711D49400A3311C /* net_interface.h */; };
+               155847510754FDCD0046C2E9 /* net_protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346A0711D49400A3311C /* net_protocol.h */; };
+               155847520754FDCD0046C2E9 /* net_service.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346C0711D49400A3311C /* net_service.h */; };
+               155847530754FDCD0046C2E9 /* net_set.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346E0711D49400A3311C /* net_set.h */; };
+               155847550754FDCD0046C2E9 /* scutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5405C0722B0099E85F /* scutil.c */; settings = {ATTRIBUTES = (); }; };
+               155847560754FDCD0046C2E9 /* commands.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5605C0722B0099E85F /* commands.c */; settings = {ATTRIBUTES = (); }; };
+               155847570754FDCD0046C2E9 /* dictionary.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5805C0722B0099E85F /* dictionary.c */; settings = {ATTRIBUTES = (); }; };
+               155847580754FDCD0046C2E9 /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5A05C0722B0099E85F /* session.c */; settings = {ATTRIBUTES = (); }; };
+               155847590754FDCD0046C2E9 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5C05C0722B0099E85F /* cache.c */; settings = {ATTRIBUTES = (); }; };
+               1558475A0754FDCD0046C2E9 /* notifications.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5E05C0722B0099E85F /* notifications.c */; settings = {ATTRIBUTES = (); }; };
+               1558475B0754FDCD0046C2E9 /* tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A6005C0722B0099E85F /* tests.c */; settings = {ATTRIBUTES = (); }; };
+               1558475C0754FDCD0046C2E9 /* prefs.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A6205C0722B0099E85F /* prefs.c */; settings = {ATTRIBUTES = (); }; };
+               1558475D0754FDCD0046C2E9 /* net.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A509A306C2518F001F0AB7 /* net.c */; };
+               1558475E0754FDCD0046C2E9 /* net_interface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC34670711D49400A3311C /* net_interface.c */; };
+               1558475F0754FDCD0046C2E9 /* net_protocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC34690711D49400A3311C /* net_protocol.c */; };
+               155847600754FDCD0046C2E9 /* net_service.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC346B0711D49400A3311C /* net_service.c */; };
+               155847610754FDCD0046C2E9 /* net_set.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC346D0711D49400A3311C /* net_set.c */; };
+               155847640754FDCD0046C2E9 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               155847660754FDCD0046C2E9 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 152CEED0070CF6640050F23C /* libedit.dylib */; };
+               155847690754FDCD0046C2E9 /* scutil.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A6A05C0722B0099E85F /* scutil.8 */; };
+               1558481607550EC10046C2E9 /* scselect.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A2E05C0722B0099E85F /* scselect.c */; settings = {ATTRIBUTES = (); }; };
+               1558481907550EC10046C2E9 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1558481C07550EC10046C2E9 /* scselect.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A3605C0722B0099E85F /* scselect.8 */; };
+               155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               155B7BF70847776D00F0E262 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
+               155B7BF80847776D00F0E262 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
+               155D223B0AF13A7300D52ED0 /* dns-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22380AF13A7300D52ED0 /* dns-configuration.h */; };
+               155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22390AF13A7300D52ED0 /* set-hostname.h */; };
+               155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D223A0AF13A7300D52ED0 /* smb-configuration.h */; };
+               156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572EB7B0A506D3B00D02459 /* smb-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 1572EB7A0A506D3B00D02459 /* smb-configuration.c */; };
+               157A88890A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               158ADD0E0754F1A000124717 /* Resolvers.plist in Resources */ = {isa = PBXBuildFile; fileRef = 159D53A807528B36004F8947 /* Resolvers.plist */; };
+               158ADD190754F1F100124717 /* Kicker.xml in Resources */ = {isa = PBXBuildFile; fileRef = 159D53BC07528B36004F8947 /* Kicker.xml */; };
+               158ADD1B0754F1F400124717 /* enable-network in Resources */ = {isa = PBXBuildFile; fileRef = 159D53BD07528B36004F8947 /* enable-network */; };
+               159D540907528D3A004F8947 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
+               159D540A07528D3B004F8947 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53CB07528B36004F8947 /* cache.h */; };
+               159D540B07528DA9004F8947 /* ev_appletalk.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B907528B36004F8947 /* ev_appletalk.c */; };
+               159D540C07528DAA004F8947 /* ev_appletalk.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B607528B36004F8947 /* ev_appletalk.h */; };
+               159D540D07528DAE004F8947 /* ev_dlil.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B107528B36004F8947 /* ev_dlil.c */; };
+               159D540E07528DAE004F8947 /* ev_dlil.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B207528B36004F8947 /* ev_dlil.h */; };
+               159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B307528B36004F8947 /* ev_ipv4.c */; };
+               159D541007528DB1004F8947 /* ev_ipv4.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B807528B36004F8947 /* ev_ipv4.h */; };
+               159D541107528DB2004F8947 /* ev_ipv6.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B407528B36004F8947 /* ev_ipv6.c */; };
+               159D541207528DB3004F8947 /* ev_ipv6.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53BA07528B36004F8947 /* ev_ipv6.h */; };
+               159D541307528DB5004F8947 /* eventmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B007528B36004F8947 /* eventmon.c */; };
+               159D541407528DB5004F8947 /* eventmon.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B707528B36004F8947 /* eventmon.h */; };
+               159D541507528DDE004F8947 /* kicker.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53BE07528B36004F8947 /* kicker.c */; };
+               159D541607528DF1004F8947 /* ifnamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AE07528B36004F8947 /* ifnamer.c */; };
+               159D541707528E05004F8947 /* ip_plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53A707528B36004F8947 /* ip_plugin.c */; };
+               159D541807528E09004F8947 /* dns-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AA07528B36004F8947 /* dns-configuration.c */; };
+               159D541B07528E4A004F8947 /* linkconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C107528B36004F8947 /* linkconfig.c */; };
+               159D541C07528E58004F8947 /* prefsmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C307528B36004F8947 /* prefsmon.c */; };
+               159D54A407529FFF004F8947 /* configd.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69CF05C0722B0099E85F /* configd.h */; };
+               159D54A507529FFF004F8947 /* _SCD.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D105C0722B0099E85F /* _SCD.h */; };
+               159D54A607529FFF004F8947 /* configd_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D305C0722B0099E85F /* configd_server.h */; };
+               159D54A707529FFF004F8947 /* notify_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D505C0722B0099E85F /* notify_server.h */; };
+               159D54A807529FFF004F8947 /* plugin_support.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D705C0722B0099E85F /* plugin_support.h */; };
+               159D54A907529FFF004F8947 /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D905C0722B0099E85F /* session.h */; };
+               159D54AA07529FFF004F8947 /* pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69DB05C0722B0099E85F /* pattern.h */; };
+               159D54AC07529FFF004F8947 /* configd.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E005C0722B0099E85F /* configd.m */; settings = {ATTRIBUTES = (); }; };
+               159D54AD07529FFF004F8947 /* _SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E205C0722B0099E85F /* _SCD.c */; settings = {ATTRIBUTES = (); }; };
+               159D54AE07529FFF004F8947 /* configd_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E405C0722B0099E85F /* configd_server.c */; settings = {ATTRIBUTES = (); }; };
+               159D54AF07529FFF004F8947 /* notify_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E605C0722B0099E85F /* notify_server.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B007529FFF004F8947 /* plugin_support.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E805C0722B0099E85F /* plugin_support.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B107529FFF004F8947 /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69EA05C0722B0099E85F /* session.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B207529FFF004F8947 /* pattern.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69EC05C0722B0099E85F /* pattern.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B307529FFF004F8947 /* _configopen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F005C0722B0099E85F /* _configopen.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B407529FFF004F8947 /* _configclose.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F205C0722B0099E85F /* _configclose.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B507529FFF004F8947 /* _configlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F405C0722B0099E85F /* _configlock.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B607529FFF004F8947 /* _configunlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F605C0722B0099E85F /* _configunlock.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B707529FFF004F8947 /* _configlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F805C0722B0099E85F /* _configlist.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B807529FFF004F8947 /* _configadd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69FA05C0722B0099E85F /* _configadd.c */; settings = {ATTRIBUTES = (); }; };
+               159D54B907529FFF004F8947 /* _configget.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69FE05C0722B0099E85F /* _configget.c */; settings = {ATTRIBUTES = (); }; };
+               159D54BA07529FFF004F8947 /* _configset.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0005C0722B0099E85F /* _configset.c */; settings = {ATTRIBUTES = (); }; };
+               159D54BB07529FFF004F8947 /* _configremove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0205C0722B0099E85F /* _configremove.c */; settings = {ATTRIBUTES = (); }; };
+               159D54BC07529FFF004F8947 /* _configtouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0405C0722B0099E85F /* _configtouch.c */; settings = {ATTRIBUTES = (); }; };
+               159D54BD07529FFF004F8947 /* _confignotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0605C0722B0099E85F /* _confignotify.c */; settings = {ATTRIBUTES = (); }; };
+               159D54BE07529FFF004F8947 /* _notifyadd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0805C0722B0099E85F /* _notifyadd.c */; settings = {ATTRIBUTES = (); }; };
+               159D54BF07529FFF004F8947 /* _notifyremove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0A05C0722B0099E85F /* _notifyremove.c */; settings = {ATTRIBUTES = (); }; };
+               159D54C007529FFF004F8947 /* _notifychanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0C05C0722B0099E85F /* _notifychanges.c */; settings = {ATTRIBUTES = (); }; };
+               159D54C107529FFF004F8947 /* _notifyviaport.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0E05C0722B0099E85F /* _notifyviaport.c */; settings = {ATTRIBUTES = (); }; };
+               159D54C207529FFF004F8947 /* _notifyviafd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1005C0722B0099E85F /* _notifyviafd.c */; settings = {ATTRIBUTES = (); }; };
+               159D54C307529FFF004F8947 /* _notifyviasignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1205C0722B0099E85F /* _notifyviasignal.c */; settings = {ATTRIBUTES = (); }; };
+               159D54C407529FFF004F8947 /* _notifycancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1405C0722B0099E85F /* _notifycancel.c */; settings = {ATTRIBUTES = (); }; };
+               159D54C507529FFF004F8947 /* _snapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1605C0722B0099E85F /* _snapshot.c */; settings = {ATTRIBUTES = (); }; };
+               159D54C607529FFF004F8947 /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               159D54C707529FFF004F8947 /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               159D54C807529FFF004F8947 /* dnsinfo_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0D05FD1B670096477F /* dnsinfo_server.c */; };
+               159D54C907529FFF004F8947 /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               159D54CC07529FFF004F8947 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               159D54CE07529FFF004F8947 /* libKernelEventMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */; };
+               159D54D007529FFF004F8947 /* libInterfaceNamer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */; };
+               159D54D107529FFF004F8947 /* libIPMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53EC07528C61004F8947 /* libIPMonitor.a */; };
+               159D54D207529FFF004F8947 /* libLinkConfiguration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53F307528C79004F8947 /* libLinkConfiguration.a */; };
+               159D54D307529FFF004F8947 /* libPreferencesMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */; };
+               159D54D607529FFF004F8947 /* configd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A2005C0722B0099E85F /* configd.8 */; };
+               15A2972F0A13C08C009879B3 /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; };
+               15A297300A13C08C009879B3 /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; };
+               15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; };
+               15DAD5E1075913CE0084A6ED /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15DAD5E2075913CE0084A6ED /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
+               15DAD5E3075913CE0084A6ED /* dnsinfo_create.h in Headers */ = {isa = PBXBuildFile; fileRef = 1532629006281C9D00B1C10C /* dnsinfo_create.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
+               15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               15DAD5E8075913CE0084A6ED /* dnsinfo_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */; };
+               15DAD64307591A1A0084A6ED /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD64407591A1A0084A6ED /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15DAD64507591A1A0084A6ED /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15DAD64607591A1A0084A6ED /* SCDynamicStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691B05C0722B0099E85F /* SCDynamicStoreInternal.h */; settings = {ATTRIBUTES = (Project, ); }; };
+               15DAD64707591A1A0084A6ED /* SCDynamicStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691D05C0722B0099E85F /* SCDynamicStore.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD64807591A1A0084A6ED /* SCDynamicStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691F05C0722B0099E85F /* SCDynamicStorePrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15DAD64907591A1A0084A6ED /* SCDynamicStoreKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692105C0722B0099E85F /* SCDynamicStoreKey.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD64A07591A1A0084A6ED /* SCDynamicStoreCopySpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692305C0722B0099E85F /* SCDynamicStoreCopySpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD64B07591A1A0084A6ED /* SCDynamicStoreCopySpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692505C0722B0099E85F /* SCDynamicStoreCopySpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15DAD64C07591A1A0084A6ED /* SCDynamicStoreSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692705C0722B0099E85F /* SCDynamicStoreSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15DAD64D07591A1A0084A6ED /* SCPreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692905C0722B0099E85F /* SCPreferencesInternal.h */; settings = {ATTRIBUTES = (Project, ); }; };
+               15DAD64E07591A1A0084A6ED /* SCPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692B05C0722B0099E85F /* SCPreferences.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD64F07591A1A0084A6ED /* SCPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692D05C0722B0099E85F /* SCPreferencesPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15DAD65007591A1A0084A6ED /* SCPreferencesPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692F05C0722B0099E85F /* SCPreferencesPath.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD65107591A1A0084A6ED /* SCPreferencesSetSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD65207591A1A0084A6ED /* SCNetworkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15DAD65307591A1A0084A6ED /* SCNetworkConfigurationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */; settings = {ATTRIBUTES = (); }; };
+               15DAD65407591A1A0084A6ED /* SCNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693305C0722B0099E85F /* SCNetwork.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD65507591A1A0084A6ED /* SCNetworkConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693505C0722B0099E85F /* SCNetworkConnection.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD65607591A1A0084A6ED /* SCNetworkReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693705C0722B0099E85F /* SCNetworkReachability.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15DAD65707591A1A0084A6ED /* SCValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693905C0722B0099E85F /* SCValidation.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15DAD65807591A1A0084A6ED /* DHCPClientPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15DAD65907591A1A0084A6ED /* SCDynamicStoreCopyDHCPInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693F05C0722B0099E85F /* SCDynamicStoreCopyDHCPInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15DAD65A07591A1A0084A6ED /* moh_msg.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694105C0722B0099E85F /* moh_msg.h */; };
+               15DAD65B07591A1A0084A6ED /* moh.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694305C0722B0099E85F /* moh.h */; };
+               15DAD65C07591A1A0084A6ED /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694705C0722B0099E85F /* LinkConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15DAD65E07591A1A0084A6ED /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; };
+               15DAD65F07591A1A0084A6ED /* VLANConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694B05C0722B0099E85F /* VLANConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15DAD66107591A1A0084A6ED /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15DAD66207591A1A0084A6ED /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; };
+               15DAD66307591A1A0084A6ED /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
+               15DAD66407591A1A0084A6ED /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; };
+               15DAD66507591A1A0084A6ED /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; };
+               15DAD66607591A1A0084A6ED /* BondConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EE943F406AF409B00772EB5 /* BondConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15DAD66707591A1A0084A6ED /* BondConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; };
+               15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */ = {isa = PBXBuildFile; fileRef = 15CFC229068B222F00123568 /* get-mobility-info */; };
+               15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; };
+               15DAD66D07591A1A0084A6ED /* SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695005C0722B0099E85F /* SCD.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD66E07591A1A0084A6ED /* SCDKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695205C0722B0099E85F /* SCDKeys.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD66F07591A1A0084A6ED /* SCDPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695405C0722B0099E85F /* SCDPrivate.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67007591A1A0084A6ED /* SCDPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695605C0722B0099E85F /* SCDPlugin.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67107591A1A0084A6ED /* SCDOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695805C0722B0099E85F /* SCDOpen.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67207591A1A0084A6ED /* SCDLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695A05C0722B0099E85F /* SCDLock.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67307591A1A0084A6ED /* SCDUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695C05C0722B0099E85F /* SCDUnlock.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67407591A1A0084A6ED /* SCDList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695E05C0722B0099E85F /* SCDList.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67507591A1A0084A6ED /* SCDAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696005C0722B0099E85F /* SCDAdd.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67607591A1A0084A6ED /* SCDGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696405C0722B0099E85F /* SCDGet.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67707591A1A0084A6ED /* SCDSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696605C0722B0099E85F /* SCDSet.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67807591A1A0084A6ED /* SCDRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696805C0722B0099E85F /* SCDRemove.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67907591A1A0084A6ED /* SCDTouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696A05C0722B0099E85F /* SCDTouch.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67A07591A1A0084A6ED /* SCDNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696C05C0722B0099E85F /* SCDNotify.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67B07591A1A0084A6ED /* SCDNotifierSetKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696E05C0722B0099E85F /* SCDNotifierSetKeys.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67C07591A1A0084A6ED /* SCDNotifierAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697005C0722B0099E85F /* SCDNotifierAdd.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67D07591A1A0084A6ED /* SCDNotifierRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697205C0722B0099E85F /* SCDNotifierRemove.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67E07591A1A0084A6ED /* SCDNotifierGetChanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697405C0722B0099E85F /* SCDNotifierGetChanges.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD67F07591A1A0084A6ED /* SCDNotifierWait.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697605C0722B0099E85F /* SCDNotifierWait.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68007591A1A0084A6ED /* SCDNotifierInformViaCallback.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697805C0722B0099E85F /* SCDNotifierInformViaCallback.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68107591A1A0084A6ED /* SCDNotifierInformViaMachPort.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697A05C0722B0099E85F /* SCDNotifierInformViaMachPort.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68207591A1A0084A6ED /* SCDNotifierInformViaFD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697C05C0722B0099E85F /* SCDNotifierInformViaFD.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68307591A1A0084A6ED /* SCDNotifierInformViaSignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697E05C0722B0099E85F /* SCDNotifierInformViaSignal.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68407591A1A0084A6ED /* SCDNotifierCancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698005C0722B0099E85F /* SCDNotifierCancel.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68507591A1A0084A6ED /* SCDSnapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698205C0722B0099E85F /* SCDSnapshot.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68607591A1A0084A6ED /* SCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698405C0722B0099E85F /* SCP.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68707591A1A0084A6ED /* SCPOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698605C0722B0099E85F /* SCPOpen.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68807591A1A0084A6ED /* SCPLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698805C0722B0099E85F /* SCPLock.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68907591A1A0084A6ED /* SCPUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698A05C0722B0099E85F /* SCPUnlock.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68A07591A1A0084A6ED /* SCPList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698C05C0722B0099E85F /* SCPList.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68B07591A1A0084A6ED /* SCPGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698E05C0722B0099E85F /* SCPGet.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68C07591A1A0084A6ED /* SCPAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699005C0722B0099E85F /* SCPAdd.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68D07591A1A0084A6ED /* SCPSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699205C0722B0099E85F /* SCPSet.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68E07591A1A0084A6ED /* SCPRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699405C0722B0099E85F /* SCPRemove.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD68F07591A1A0084A6ED /* SCPCommit.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699605C0722B0099E85F /* SCPCommit.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69007591A1A0084A6ED /* SCPApply.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699805C0722B0099E85F /* SCPApply.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69107591A1A0084A6ED /* SCPPath.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699A05C0722B0099E85F /* SCPPath.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69207591A1A0084A6ED /* SCDConsoleUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699C05C0722B0099E85F /* SCDConsoleUser.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69307591A1A0084A6ED /* SCDHostName.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699E05C0722B0099E85F /* SCDHostName.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69407591A1A0084A6ED /* SCLocation.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A005C0722B0099E85F /* SCLocation.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69507591A1A0084A6ED /* SCNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A205C0722B0099E85F /* SCNetwork.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69607591A1A0084A6ED /* pppcontroller.defs in Sources */ = {isa = PBXBuildFile; fileRef = 23C1E2B8062DD45900835B54 /* pppcontroller.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               15DAD69707591A1A0084A6ED /* SCNetworkConnection.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A405C0722B0099E85F /* SCNetworkConnection.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69807591A1A0084A6ED /* SCNetworkReachability.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A605C0722B0099E85F /* SCNetworkReachability.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69907591A1A0084A6ED /* SCProxies.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A805C0722B0099E85F /* SCProxies.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69A07591A1A0084A6ED /* DHCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AC05C0722B0099E85F /* DHCP.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69B07591A1A0084A6ED /* moh.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AE05C0722B0099E85F /* moh.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69C07591A1A0084A6ED /* DeviceOnHold.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B005C0722B0099E85F /* DeviceOnHold.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69D07591A1A0084A6ED /* LinkConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B205C0722B0099E85F /* LinkConfiguration.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69E07591A1A0084A6ED /* dy_framework.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B405C0722B0099E85F /* dy_framework.c */; settings = {ATTRIBUTES = (); }; };
+               15DAD69F07591A1A0084A6ED /* VLANConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B605C0722B0099E85F /* VLANConfiguration.c */; settings = {ATTRIBUTES = (); COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
+               15DAD6A007591A1A0084A6ED /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               15DAD6A207591A1A0084A6ED /* SCPreferencesPathKey.c in Sources */ = {isa = PBXBuildFile; fileRef = 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */; };
+               15DAD6A307591A1A0084A6ED /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               15DAD6A407591A1A0084A6ED /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
+               15DAD6A507591A1A0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               15DAD6A607591A1A0084A6ED /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; };
+               15DAD6A707591A1A0084A6ED /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; };
+               15DAD6A807591A1A0084A6ED /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; };
+               15DAD6A907591A1A0084A6ED /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; };
+               15DAD6AA07591A1A0084A6ED /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; };
+               15DAD6AB07591A1A0084A6ED /* BondConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 9EE943F306AF409B00772EB5 /* BondConfiguration.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
+               15DAD6AE07591A1A0084A6ED /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               15DAF2DA08466D4900D1B2BD /* helper_comm.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D608466D4900D1B2BD /* helper_comm.c */; };
+               15DAF2DB08466D4900D1B2BD /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; };
+               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 */; };
+               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, ); }; };
+               F95B8A690B03F9B500993BA3 /* NetworkIdentification.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A680B03F97800993BA3 /* NetworkIdentification.c */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+               1520A385084681350010B584 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1547001808455B98006787CE;
+                       remoteInfo = SCHelper;
+               };
+               1533B94009731A9600F2B34A /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15FD733A0754DBDA001CC321;
+                       remoteInfo = ATconfig;
+               };
+               1558480507550D470046C2E9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 159D549F07529FFF004F8947;
+                       remoteInfo = configd;
+               };
+               1558480707550D470046C2E9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1558481207550EC10046C2E9;
+                       remoteInfo = scselect;
+               };
+               1558480907550D470046C2E9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 155847430754FDCD0046C2E9;
+                       remoteInfo = scutil;
+               };
+               1558480E07550DD00046C2E9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 155847FA07550D210046C2E9;
+                       remoteInfo = configd_executables;
+               };
+               157BB8BF075924460025DA7A /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15DAD63F07591A1A0084A6ED;
+                       remoteInfo = SystemConfiguration.framework;
+               };
+               157BB8C1075924470025DA7A /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15DAD5DF075913CE0084A6ED;
+                       remoteInfo = DNSConfiguration;
+               };
+               157BB8C30759244B0025DA7A /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 157BB8AE075924360025DA7A;
+                       remoteInfo = Frameworks;
+               };
+               15828B060753B77E00AD4710 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15828AE60753B5F900AD4710;
+                       remoteInfo = KernelEventMonitor.bundle;
+               };
+               158AD9850754E72500124717 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15FD72A10754DA4C001CC321;
+                       remoteInfo = IPMonitor.bundle;
+               };
+               158AD9870754E72500124717 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15FD72930754DA2B001CC321;
+                       remoteInfo = InterfaceNamer.bundle;
+               };
+               158AD98B0754E72500124717 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15FD72B10754DA69001CC321;
+                       remoteInfo = LinkConfiguration.bundle;
+               };
+               158AD98D0754E72500124717 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15FD72C50754DA7E001CC321;
+                       remoteInfo = PreferencesMonitor.bundle;
+               };
+               159D542107528E85004F8947 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 159D53D307528BDA004F8947;
+                       remoteInfo = KernelEventMonitor;
+               };
+               159D542507528E85004F8947 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 159D53E407528C4A004F8947;
+                       remoteInfo = InterfaceNamer;
+               };
+               159D542707528E85004F8947 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 159D53EB07528C61004F8947;
+                       remoteInfo = IPMonitor;
+               };
+               159D542907528E85004F8947 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 159D53F207528C79004F8947;
+                       remoteInfo = LinkConfiguration;
+               };
+               159D542B07528E85004F8947 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 159D53F907528C95004F8947;
+                       remoteInfo = PreferencesMonitor;
+               };
+               159D542D07529008004F8947 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 159D542007528E7C004F8947;
+                       remoteInfo = Plugins;
+               };
+               15DAD5730759115F0084A6ED /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15FD731E0754DB9F001CC321;
+                       remoteInfo = ATconfig.bundle;
+               };
+               F95B8A760B03FB9100993BA3 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = F95B8A6A0B03F9D100993BA3;
+                       remoteInfo = NetworkIdentification.bundle;
+               };
+               F95B8A780B03FB9100993BA3 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = F95B8A5E0B03F81400993BA3;
+                       remoteInfo = NetworkIdentification;
+               };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+               155847680754FDCD0046C2E9 /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /usr/share/man/man8;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               155847690754FDCD0046C2E9 /* scutil.8 in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
+               1558481B07550EC10046C2E9 /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /usr/share/man/man8;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               1558481C07550EC10046C2E9 /* scselect.8 in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
+               159D54D507529FFF004F8947 /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /usr/share/man/man8;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               159D54D607529FFF004F8947 /* configd.8 in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
+               159D54D707529FFF004F8947 /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /System/Library/LaunchDaemons;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               1540E3610987DA9500157C07 /* com.apple.configd.plist in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+               150607BD075A00A200B147BA /* SCSchemaDefinitions.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCSchemaDefinitions.c; sourceTree = "<group>"; };
+               150607DE075A00A300B147BA /* SCSchemaDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitions.h; sourceTree = "<group>"; };
+               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; };
+               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; };
+               152CEED0070CF6640050F23C /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.2.dylib; sourceTree = "<absolute>"; };
+               152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesKeychainPrivate.h; sourceTree = "<group>"; };
+               152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCPreferencesKeychainPrivate.c; sourceTree = "<group>"; };
+               1532629006281C9D00B1C10C /* dnsinfo_create.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_create.h; path = dnsinfo/dnsinfo_create.h; sourceTree = "<group>"; };
+               1540E3600987DA9500157C07 /* com.apple.configd.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = com.apple.configd.plist; sourceTree = "<group>"; };
+               1543636A0752D03C00A8EC6C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
+               1547001D08455B98006787CE /* SCHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCHelper; sourceTree = BUILT_PRODUCTS_DIR; };
+               154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesGetSpecificPrivate.h; sourceTree = "<group>"; };
+               1558476A0754FDCD0046C2E9 /* scutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scutil; sourceTree = BUILT_PRODUCTS_DIR; };
+               1558481D07550EC10046C2E9 /* scselect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scselect; sourceTree = BUILT_PRODUCTS_DIR; };
+               155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfigurationPrivate.h; sourceTree = "<group>"; };
+               155B7BF60847776D00F0E262 /* SCHelper_client.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCHelper_client.h; path = helper/SCHelper_client.h; sourceTree = "<group>"; };
+               155D22380AF13A7300D52ED0 /* dns-configuration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "dns-configuration.h"; sourceTree = "<group>"; };
+               155D22390AF13A7300D52ED0 /* set-hostname.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "set-hostname.h"; sourceTree = "<group>"; };
+               155D223A0AF13A7300D52ED0 /* smb-configuration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "smb-configuration.h"; sourceTree = "<group>"; };
+               156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesSetSpecificPrivate.h; sourceTree = "<group>"; };
+               1572EB7A0A506D3B00D02459 /* smb-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "smb-configuration.c"; sourceTree = "<group>"; };
+               1577252F06EFB96700D7B52B /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/NetworkInterface.strings; sourceTree = "<group>"; };
+               157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitionsPrivate.h; sourceTree = "<group>"; };
+               15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1587A31F0B6AACD70063104A /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; };
+               158AD85B0754E38F00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               158AD8700754E3D400124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               158AD8C00754E3EF00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               158AD9100754E40E00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               158AD9F80754EA2F00124717 /* AppleTalk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppleTalk.framework; path = /System/Library/Frameworks/AppleTalk.framework; sourceTree = "<absolute>"; };
+               159D53A707528B36004F8947 /* ip_plugin.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ip_plugin.c; sourceTree = "<group>"; tabWidth = 8; usesTabs = 1; };
+               159D53A807528B36004F8947 /* Resolvers.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Resolvers.plist; sourceTree = "<group>"; };
+               159D53AA07528B36004F8947 /* dns-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "dns-configuration.c"; sourceTree = "<group>"; };
+               159D53AB07528B36004F8947 /* set-hostname.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "set-hostname.c"; sourceTree = "<group>"; };
+               159D53AE07528B36004F8947 /* ifnamer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ifnamer.c; sourceTree = "<group>"; };
+               159D53B007528B36004F8947 /* eventmon.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = eventmon.c; sourceTree = "<group>"; };
+               159D53B107528B36004F8947 /* ev_dlil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_dlil.c; sourceTree = "<group>"; };
+               159D53B207528B36004F8947 /* ev_dlil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_dlil.h; sourceTree = "<group>"; };
+               159D53B307528B36004F8947 /* ev_ipv4.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_ipv4.c; sourceTree = "<group>"; };
+               159D53B407528B36004F8947 /* ev_ipv6.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_ipv6.c; sourceTree = "<group>"; };
+               159D53B607528B36004F8947 /* ev_appletalk.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_appletalk.h; sourceTree = "<group>"; };
+               159D53B707528B36004F8947 /* eventmon.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = eventmon.h; sourceTree = "<group>"; };
+               159D53B807528B36004F8947 /* ev_ipv4.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_ipv4.h; sourceTree = "<group>"; };
+               159D53B907528B36004F8947 /* ev_appletalk.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_appletalk.c; sourceTree = "<group>"; };
+               159D53BA07528B36004F8947 /* ev_ipv6.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_ipv6.h; sourceTree = "<group>"; };
+               159D53BC07528B36004F8947 /* Kicker.xml */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Kicker.xml; sourceTree = "<group>"; };
+               159D53BD07528B36004F8947 /* enable-network */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = "enable-network"; sourceTree = "<group>"; };
+               159D53BE07528B36004F8947 /* kicker.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kicker.c; sourceTree = "<group>"; };
+               159D53C107528B36004F8947 /* linkconfig.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = linkconfig.c; sourceTree = "<group>"; };
+               159D53C307528B36004F8947 /* prefsmon.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = prefsmon.c; sourceTree = "<group>"; };
+               159D53C507528B36004F8947 /* cfManager.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cfManager.c; sourceTree = "<group>"; };
+               159D53C607528B36004F8947 /* cfManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cfManager.h; sourceTree = "<group>"; };
+               159D53C707528B36004F8947 /* atconfig.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = atconfig.c; sourceTree = "<group>"; };
+               159D53CA07528B36004F8947 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
+               159D53CB07528B36004F8947 /* cache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cache.h; sourceTree = "<group>"; };
+               159D53D407528BDA004F8947 /* libKernelEventMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKernelEventMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               159D53DE07528C2E004F8947 /* libKicker.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKicker.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               159D53E507528C4A004F8947 /* libInterfaceNamer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInterfaceNamer.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               159D53EC07528C61004F8947 /* libIPMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIPMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               159D53F307528C79004F8947 /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               159D53FA07528C95004F8947 /* libPreferencesMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPreferencesMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               159D54D907529FFF004F8947 /* configd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = configd; sourceTree = BUILT_PRODUCTS_DIR; };
+               15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkConnectionPrivate.c; sourceTree = "<group>"; };
+               15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConnectionPrivate.h; sourceTree = "<group>"; };
+               15A509A306C2518F001F0AB7 /* net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net.c; sourceTree = "<group>"; };
+               15A509A406C2518F001F0AB7 /* net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net.h; sourceTree = "<group>"; };
+               15A6F7C30A4B266D00B907EA /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
+               15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfiguration.h; sourceTree = "<group>"; };
+               15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkConfigurationInternal.c; sourceTree = "<group>"; };
+               15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfigurationInternal.h; sourceTree = "<group>"; };
+               15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkInterface.c; sourceTree = "<group>"; };
+               15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkProtocol.c; sourceTree = "<group>"; };
+               15AD7A3D0670A85900BFE03C /* SCNetworkService.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkService.c; sourceTree = "<group>"; };
+               15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSet.c; sourceTree = "<group>"; };
+               15B686220678B65C00FF4023 /* NetworkConfiguration.plist */ = {isa = PBXFileReference; explicitFileType = text.xml; fileEncoding = 4; path = NetworkConfiguration.plist; sourceTree = "<group>"; };
+               15B73F0805FD1B670096477F /* dnsinfo_copy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_copy.c; path = dnsinfo/dnsinfo_copy.c; sourceTree = "<group>"; };
+               15B73F0905FD1B670096477F /* dnsinfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo.h; path = dnsinfo/dnsinfo.h; sourceTree = "<group>"; };
+               15B73F0B05FD1B670096477F /* dnsinfo_private.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_private.c; path = dnsinfo/dnsinfo_private.c; sourceTree = "<group>"; };
+               15B73F0C05FD1B670096477F /* dnsinfo_private.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_private.h; path = dnsinfo/dnsinfo_private.h; sourceTree = "<group>"; };
+               15B73F0D05FD1B670096477F /* dnsinfo_server.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_server.c; path = dnsinfo/dnsinfo_server.c; sourceTree = "<group>"; };
+               15B73F0E05FD1B670096477F /* dnsinfo_server.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_server.h; path = dnsinfo/dnsinfo_server.h; sourceTree = "<group>"; };
+               15BAA32207F0699A00D9EC95 /* libbsm.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbsm.dylib; path = /usr/lib/libbsm.dylib; sourceTree = "<absolute>"; };
+               15CB690505C0722A0099E85F /* preferences.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = preferences.xml; sourceTree = "<group>"; };
+               15CB691305C0722B0099E85F /* SystemConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemConfiguration.h; sourceTree = "<group>"; };
+               15CB691505C0722B0099E85F /* SCPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPrivate.h; sourceTree = "<group>"; };
+               15CB691705C0722B0099E85F /* SCDPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDPlugin.h; sourceTree = "<group>"; };
+               15CB691B05C0722B0099E85F /* SCDynamicStoreInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDynamicStoreInternal.h; sourceTree = "<group>"; };
+               15CB691D05C0722B0099E85F /* SCDynamicStore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDynamicStore.h; sourceTree = "<group>"; };
+               15CB691F05C0722B0099E85F /* SCDynamicStorePrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDynamicStorePrivate.h; sourceTree = "<group>"; };
+               15CB692105C0722B0099E85F /* SCDynamicStoreKey.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDynamicStoreKey.h; sourceTree = "<group>"; };
+               15CB692305C0722B0099E85F /* SCDynamicStoreCopySpecific.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDynamicStoreCopySpecific.h; sourceTree = "<group>"; };
+               15CB692505C0722B0099E85F /* SCDynamicStoreCopySpecificPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDynamicStoreCopySpecificPrivate.h; sourceTree = "<group>"; };
+               15CB692705C0722B0099E85F /* SCDynamicStoreSetSpecificPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDynamicStoreSetSpecificPrivate.h; sourceTree = "<group>"; };
+               15CB692905C0722B0099E85F /* SCPreferencesInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPreferencesInternal.h; sourceTree = "<group>"; };
+               15CB692B05C0722B0099E85F /* SCPreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPreferences.h; sourceTree = "<group>"; };
+               15CB692D05C0722B0099E85F /* SCPreferencesPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPreferencesPrivate.h; sourceTree = "<group>"; };
+               15CB692F05C0722B0099E85F /* SCPreferencesPath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPreferencesPath.h; sourceTree = "<group>"; };
+               15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPreferencesSetSpecific.h; sourceTree = "<group>"; };
+               15CB693305C0722B0099E85F /* SCNetwork.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCNetwork.h; sourceTree = "<group>"; };
+               15CB693505C0722B0099E85F /* SCNetworkConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCNetworkConnection.h; sourceTree = "<group>"; };
+               15CB693705C0722B0099E85F /* SCNetworkReachability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCNetworkReachability.h; sourceTree = "<group>"; };
+               15CB693905C0722B0099E85F /* SCValidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCValidation.h; sourceTree = "<group>"; };
+               15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DHCPClientPreferences.h; sourceTree = "<group>"; };
+               15CB693F05C0722B0099E85F /* SCDynamicStoreCopyDHCPInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDynamicStoreCopyDHCPInfo.h; sourceTree = "<group>"; };
+               15CB694105C0722B0099E85F /* moh_msg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = moh_msg.h; sourceTree = "<group>"; };
+               15CB694305C0722B0099E85F /* moh.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = moh.h; sourceTree = "<group>"; };
+               15CB694505C0722B0099E85F /* DeviceOnHold.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceOnHold.h; sourceTree = "<group>"; };
+               15CB694705C0722B0099E85F /* LinkConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LinkConfiguration.h; sourceTree = "<group>"; };
+               15CB694905C0722B0099E85F /* dy_framework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dy_framework.h; sourceTree = "<group>"; };
+               15CB694B05C0722B0099E85F /* VLANConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLANConfiguration.h; sourceTree = "<group>"; };
+               15CB695005C0722B0099E85F /* SCD.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCD.c; sourceTree = "<group>"; };
+               15CB695205C0722B0099E85F /* SCDKeys.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDKeys.c; sourceTree = "<group>"; };
+               15CB695405C0722B0099E85F /* SCDPrivate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDPrivate.c; sourceTree = "<group>"; };
+               15CB695605C0722B0099E85F /* SCDPlugin.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDPlugin.c; sourceTree = "<group>"; };
+               15CB695805C0722B0099E85F /* SCDOpen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDOpen.c; sourceTree = "<group>"; };
+               15CB695A05C0722B0099E85F /* SCDLock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDLock.c; sourceTree = "<group>"; };
+               15CB695C05C0722B0099E85F /* SCDUnlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDUnlock.c; sourceTree = "<group>"; };
+               15CB695E05C0722B0099E85F /* SCDList.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDList.c; sourceTree = "<group>"; };
+               15CB696005C0722B0099E85F /* SCDAdd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDAdd.c; sourceTree = "<group>"; };
+               15CB696405C0722B0099E85F /* SCDGet.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDGet.c; sourceTree = "<group>"; };
+               15CB696605C0722B0099E85F /* SCDSet.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDSet.c; sourceTree = "<group>"; };
+               15CB696805C0722B0099E85F /* SCDRemove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDRemove.c; sourceTree = "<group>"; };
+               15CB696A05C0722B0099E85F /* SCDTouch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDTouch.c; sourceTree = "<group>"; };
+               15CB696C05C0722B0099E85F /* SCDNotify.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotify.c; sourceTree = "<group>"; };
+               15CB696E05C0722B0099E85F /* SCDNotifierSetKeys.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierSetKeys.c; sourceTree = "<group>"; };
+               15CB697005C0722B0099E85F /* SCDNotifierAdd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierAdd.c; sourceTree = "<group>"; };
+               15CB697205C0722B0099E85F /* SCDNotifierRemove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierRemove.c; sourceTree = "<group>"; };
+               15CB697405C0722B0099E85F /* SCDNotifierGetChanges.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierGetChanges.c; sourceTree = "<group>"; };
+               15CB697605C0722B0099E85F /* SCDNotifierWait.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierWait.c; sourceTree = "<group>"; };
+               15CB697805C0722B0099E85F /* SCDNotifierInformViaCallback.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierInformViaCallback.c; sourceTree = "<group>"; };
+               15CB697A05C0722B0099E85F /* SCDNotifierInformViaMachPort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierInformViaMachPort.c; sourceTree = "<group>"; };
+               15CB697C05C0722B0099E85F /* SCDNotifierInformViaFD.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierInformViaFD.c; sourceTree = "<group>"; };
+               15CB697E05C0722B0099E85F /* SCDNotifierInformViaSignal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierInformViaSignal.c; sourceTree = "<group>"; };
+               15CB698005C0722B0099E85F /* SCDNotifierCancel.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierCancel.c; sourceTree = "<group>"; };
+               15CB698205C0722B0099E85F /* SCDSnapshot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDSnapshot.c; sourceTree = "<group>"; };
+               15CB698405C0722B0099E85F /* SCP.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCP.c; sourceTree = "<group>"; };
+               15CB698605C0722B0099E85F /* SCPOpen.c */ = {isa = PBXFileReference; indentWidth = 8; lastKnownFileType = sourcecode.c.c; path = SCPOpen.c; sourceTree = "<group>"; tabWidth = 8; };
+               15CB698805C0722B0099E85F /* SCPLock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPLock.c; sourceTree = "<group>"; };
+               15CB698A05C0722B0099E85F /* SCPUnlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPUnlock.c; sourceTree = "<group>"; };
+               15CB698C05C0722B0099E85F /* SCPList.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPList.c; sourceTree = "<group>"; };
+               15CB698E05C0722B0099E85F /* SCPGet.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPGet.c; sourceTree = "<group>"; };
+               15CB699005C0722B0099E85F /* SCPAdd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPAdd.c; sourceTree = "<group>"; };
+               15CB699205C0722B0099E85F /* SCPSet.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPSet.c; sourceTree = "<group>"; };
+               15CB699405C0722B0099E85F /* SCPRemove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPRemove.c; sourceTree = "<group>"; };
+               15CB699605C0722B0099E85F /* SCPCommit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPCommit.c; sourceTree = "<group>"; };
+               15CB699805C0722B0099E85F /* SCPApply.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPApply.c; sourceTree = "<group>"; };
+               15CB699A05C0722B0099E85F /* SCPPath.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPPath.c; sourceTree = "<group>"; };
+               15CB699C05C0722B0099E85F /* SCDConsoleUser.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDConsoleUser.c; sourceTree = "<group>"; };
+               15CB699E05C0722B0099E85F /* SCDHostName.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDHostName.c; sourceTree = "<group>"; };
+               15CB69A005C0722B0099E85F /* SCLocation.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCLocation.c; sourceTree = "<group>"; };
+               15CB69A205C0722B0099E85F /* SCNetwork.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCNetwork.c; sourceTree = "<group>"; };
+               15CB69A405C0722B0099E85F /* SCNetworkConnection.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCNetworkConnection.c; sourceTree = "<group>"; };
+               15CB69A605C0722B0099E85F /* SCNetworkReachability.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCNetworkReachability.c; sourceTree = "<group>"; };
+               15CB69A805C0722B0099E85F /* SCProxies.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCProxies.c; sourceTree = "<group>"; };
+               15CB69AC05C0722B0099E85F /* DHCP.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = DHCP.c; sourceTree = "<group>"; };
+               15CB69AE05C0722B0099E85F /* moh.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = moh.c; sourceTree = "<group>"; };
+               15CB69B005C0722B0099E85F /* DeviceOnHold.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = DeviceOnHold.c; sourceTree = "<group>"; };
+               15CB69B205C0722B0099E85F /* LinkConfiguration.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = LinkConfiguration.c; sourceTree = "<group>"; };
+               15CB69B405C0722B0099E85F /* dy_framework.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dy_framework.c; sourceTree = "<group>"; };
+               15CB69B605C0722B0099E85F /* VLANConfiguration.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = VLANConfiguration.c; sourceTree = "<group>"; };
+               15CB69BE05C0722B0099E85F /* config.defs */ = {isa = PBXFileReference; explicitFileType = sourcecode.mig; name = config.defs; path = SystemConfiguration.fproj/config.defs; sourceTree = "<group>"; };
+               15CB69BF05C0722B0099E85F /* genSCPreferences.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = genSCPreferences.c; path = SystemConfiguration.fproj/genSCPreferences.c; sourceTree = "<group>"; };
+               15CB69CF05C0722B0099E85F /* configd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configd.h; sourceTree = "<group>"; };
+               15CB69D105C0722B0099E85F /* _SCD.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _SCD.h; sourceTree = "<group>"; };
+               15CB69D305C0722B0099E85F /* configd_server.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configd_server.h; sourceTree = "<group>"; };
+               15CB69D505C0722B0099E85F /* notify_server.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = notify_server.h; sourceTree = "<group>"; };
+               15CB69D705C0722B0099E85F /* plugin_support.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = plugin_support.h; sourceTree = "<group>"; };
+               15CB69D905C0722B0099E85F /* session.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = session.h; sourceTree = "<group>"; };
+               15CB69DB05C0722B0099E85F /* pattern.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pattern.h; sourceTree = "<group>"; };
+               15CB69E005C0722B0099E85F /* configd.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = configd.m; sourceTree = "<group>"; };
+               15CB69E205C0722B0099E85F /* _SCD.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _SCD.c; sourceTree = "<group>"; };
+               15CB69E405C0722B0099E85F /* configd_server.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = configd_server.c; sourceTree = "<group>"; };
+               15CB69E605C0722B0099E85F /* notify_server.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = notify_server.c; sourceTree = "<group>"; };
+               15CB69E805C0722B0099E85F /* plugin_support.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = plugin_support.c; sourceTree = "<group>"; };
+               15CB69EA05C0722B0099E85F /* session.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = session.c; sourceTree = "<group>"; };
+               15CB69EC05C0722B0099E85F /* pattern.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pattern.c; sourceTree = "<group>"; };
+               15CB69F005C0722B0099E85F /* _configopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configopen.c; sourceTree = "<group>"; };
+               15CB69F205C0722B0099E85F /* _configclose.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configclose.c; sourceTree = "<group>"; };
+               15CB69F405C0722B0099E85F /* _configlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configlock.c; sourceTree = "<group>"; };
+               15CB69F605C0722B0099E85F /* _configunlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configunlock.c; sourceTree = "<group>"; };
+               15CB69F805C0722B0099E85F /* _configlist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configlist.c; sourceTree = "<group>"; };
+               15CB69FA05C0722B0099E85F /* _configadd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configadd.c; sourceTree = "<group>"; };
+               15CB69FE05C0722B0099E85F /* _configget.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configget.c; sourceTree = "<group>"; };
+               15CB6A0005C0722B0099E85F /* _configset.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configset.c; sourceTree = "<group>"; };
+               15CB6A0205C0722B0099E85F /* _configremove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configremove.c; sourceTree = "<group>"; };
+               15CB6A0405C0722B0099E85F /* _configtouch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _configtouch.c; sourceTree = "<group>"; };
+               15CB6A0605C0722B0099E85F /* _confignotify.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _confignotify.c; sourceTree = "<group>"; };
+               15CB6A0805C0722B0099E85F /* _notifyadd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _notifyadd.c; sourceTree = "<group>"; };
+               15CB6A0A05C0722B0099E85F /* _notifyremove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _notifyremove.c; sourceTree = "<group>"; };
+               15CB6A0C05C0722B0099E85F /* _notifychanges.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _notifychanges.c; sourceTree = "<group>"; };
+               15CB6A0E05C0722B0099E85F /* _notifyviaport.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _notifyviaport.c; sourceTree = "<group>"; };
+               15CB6A1005C0722B0099E85F /* _notifyviafd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _notifyviafd.c; sourceTree = "<group>"; };
+               15CB6A1205C0722B0099E85F /* _notifyviasignal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _notifyviasignal.c; sourceTree = "<group>"; };
+               15CB6A1405C0722B0099E85F /* _notifycancel.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _notifycancel.c; sourceTree = "<group>"; };
+               15CB6A1605C0722B0099E85F /* _snapshot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _snapshot.c; sourceTree = "<group>"; };
+               15CB6A2005C0722B0099E85F /* configd.8 */ = {isa = PBXFileReference; explicitFileType = text.man; path = configd.8; sourceTree = "<group>"; };
+               15CB6A2E05C0722B0099E85F /* scselect.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scselect.c; sourceTree = "<group>"; };
+               15CB6A3605C0722B0099E85F /* scselect.8 */ = {isa = PBXFileReference; explicitFileType = text.man; path = scselect.8; sourceTree = "<group>"; };
+               15CB6A4305C0722B0099E85F /* scutil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scutil.h; sourceTree = "<group>"; };
+               15CB6A4505C0722B0099E85F /* commands.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = commands.h; sourceTree = "<group>"; };
+               15CB6A4705C0722B0099E85F /* dictionary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dictionary.h; sourceTree = "<group>"; };
+               15CB6A4905C0722B0099E85F /* session.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = session.h; sourceTree = "<group>"; };
+               15CB6A4B05C0722B0099E85F /* cache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cache.h; sourceTree = "<group>"; };
+               15CB6A4D05C0722B0099E85F /* notifications.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = notifications.h; sourceTree = "<group>"; };
+               15CB6A4F05C0722B0099E85F /* tests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tests.h; sourceTree = "<group>"; };
+               15CB6A5105C0722B0099E85F /* prefs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = prefs.h; sourceTree = "<group>"; };
+               15CB6A5405C0722B0099E85F /* scutil.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scutil.c; sourceTree = "<group>"; };
+               15CB6A5605C0722B0099E85F /* commands.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = commands.c; sourceTree = "<group>"; };
+               15CB6A5805C0722B0099E85F /* dictionary.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dictionary.c; sourceTree = "<group>"; };
+               15CB6A5A05C0722B0099E85F /* session.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = session.c; sourceTree = "<group>"; };
+               15CB6A5C05C0722B0099E85F /* cache.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
+               15CB6A5E05C0722B0099E85F /* notifications.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = notifications.c; sourceTree = "<group>"; };
+               15CB6A6005C0722B0099E85F /* tests.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tests.c; sourceTree = "<group>"; };
+               15CB6A6205C0722B0099E85F /* prefs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = prefs.c; sourceTree = "<group>"; };
+               15CB6A6A05C0722B0099E85F /* scutil.8 */ = {isa = PBXFileReference; explicitFileType = text.man; path = scutil.8; sourceTree = "<group>"; };
+               15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+               15CFC229068B222F00123568 /* get-mobility-info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = "get-mobility-info"; sourceTree = SOURCE_ROOT; };
+               15DAD5EE075913CE0084A6ED /* libdnsinfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdnsinfo.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+               15DAF2D608466D4900D1B2BD /* helper_comm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = helper_comm.c; path = helper/helper_comm.c; sourceTree = "<group>"; };
+               15DAF2D708466D4900D1B2BD /* helper_comm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = helper_comm.h; path = helper/helper_comm.h; sourceTree = "<group>"; };
+               15DAF2D808466D4900D1B2BD /* SCHelper_client.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCHelper_client.c; path = helper/SCHelper_client.c; sourceTree = "<group>"; };
+               15DAF2D908466D4900D1B2BD /* SCHelper_server.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCHelper_server.c; path = helper/SCHelper_server.c; sourceTree = "<group>"; };
+               15DC34670711D49400A3311C /* net_interface.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net_interface.c; sourceTree = "<group>"; };
+               15DC34680711D49400A3311C /* net_interface.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net_interface.h; sourceTree = "<group>"; };
+               15DC34690711D49400A3311C /* net_protocol.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net_protocol.c; sourceTree = "<group>"; };
+               15DC346A0711D49400A3311C /* net_protocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net_protocol.h; sourceTree = "<group>"; };
+               15DC346B0711D49400A3311C /* net_service.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net_service.c; sourceTree = "<group>"; };
+               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>"; };
+               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; };
+               15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InterfaceNamer.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               15FD72A50754DA4C001CC321 /* IPMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IPMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LinkConfiguration.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PreferencesMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               15FD73220754DB9F001CC321 /* ATconfig.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ATconfig.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               15FD73400754DBDA001CC321 /* libATconfig.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libATconfig.a; 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>"; };
+               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; };
+               9EE943F306AF409B00772EB5 /* BondConfiguration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = BondConfiguration.c; sourceTree = "<group>"; };
+               9EE943F406AF409B00772EB5 /* BondConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BondConfiguration.h; sourceTree = "<group>"; };
+               9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BondConfigurationPrivate.h; sourceTree = "<group>"; };
+               F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSignature.c; sourceTree = "<group>"; };
+               F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignature.h; sourceTree = "<group>"; };
+               F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignaturePrivate.h; sourceTree = "<group>"; };
+               F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetworkIdentification.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               F95B8A670B03F97800993BA3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               F95B8A680B03F97800993BA3 /* NetworkIdentification.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = NetworkIdentification.c; sourceTree = "<group>"; };
+               F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkIdentification.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+               1547001B08455B98006787CE /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */,
+                               1520A3D0084682A30010B584 /* SystemConfiguration.framework in Frameworks */,
+                               1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               155847620754FDCD0046C2E9 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               155847640754FDCD0046C2E9 /* CoreFoundation.framework in Frameworks */,
+                               1523F710075A371D0066F0B2 /* SystemConfiguration.framework in Frameworks */,
+                               1523F719075A37C70066F0B2 /* libdnsinfo.a in Frameworks */,
+                               155847660754FDCD0046C2E9 /* libedit.dylib in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1558481707550EC10046C2E9 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1558481907550EC10046C2E9 /* CoreFoundation.framework in Frameworks */,
+                               1523F6F2075A37050066F0B2 /* SystemConfiguration.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53D207528BDA004F8947 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53DC07528C2E004F8947 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53E307528C4A004F8947 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53EA07528C61004F8947 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53F107528C79004F8947 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53F807528C95004F8947 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D54CA07529FFF004F8947 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D54CC07529FFF004F8947 /* CoreFoundation.framework in Frameworks */,
+                               1523F6F1075A36F70066F0B2 /* SystemConfiguration.framework in Frameworks */,
+                               1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */,
+                               1523F715075A376B0066F0B2 /* libdnsinfo.a in Frameworks */,
+                               15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */,
+                               1533B94D09731BE600F2B34A /* libATconfig.a in Frameworks */,
+                               159D54CE07529FFF004F8947 /* libKernelEventMonitor.a in Frameworks */,
+                               159D54D007529FFF004F8947 /* libInterfaceNamer.a in Frameworks */,
+                               159D54D107529FFF004F8947 /* libIPMonitor.a in Frameworks */,
+                               159D54D207529FFF004F8947 /* libLinkConfiguration.a in Frameworks */,
+                               1533D77B0B10A14300CA4946 /* libNetworkIdentification.a in Frameworks */,
+                               159D54D307529FFF004F8947 /* libPreferencesMonitor.a in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD5E9075913CE0084A6ED /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD6AD07591A1A0084A6ED /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15DAD6AE07591A1A0084A6ED /* CoreFoundation.framework in Frameworks */,
+                               153BED940B75566200989D5C /* libicucore.dylib in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD733F0754DBDA001CC321 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               F95B8A5D0B03F81400993BA3 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+               1514D77D05C08AB700757DC9 /* Initial Preferences */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB690505C0722A0099E85F /* preferences.xml */,
+                       );
+                       name = "Initial Preferences";
+                       sourceTree = "<group>";
+               };
+               1547002E084561B4006787CE /* SCHelper */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1547002F084561ED006787CE /* Headers */,
+                               15470030084561FF006787CE /* Sources */,
+                       );
+                       name = SCHelper;
+                       path = SystemConfiguration.fproj;
+                       sourceTree = "<group>";
+               };
+               1547002F084561ED006787CE /* Headers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15DAF2D708466D4900D1B2BD /* helper_comm.h */,
+                               155B7BF60847776D00F0E262 /* SCHelper_client.h */,
+                       );
+                       name = Headers;
+                       sourceTree = "<group>";
+               };
+               15470030084561FF006787CE /* Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15DAF2D608466D4900D1B2BD /* helper_comm.c */,
+                               15DAF2D808466D4900D1B2BD /* SCHelper_client.c */,
+                               15DAF2D908466D4900D1B2BD /* SCHelper_server.c */,
+                       );
+                       name = Sources;
+                       sourceTree = "<group>";
+               };
+               1582B36B05FD1A4D009C2750 /* DNSConfiguration */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1582B37205FD1A5B009C2750 /* Headers */,
+                               1582B37905FD1A66009C2750 /* Sources */,
+                       );
+                       name = DNSConfiguration;
+                       sourceTree = "<group>";
+               };
+               1582B37205FD1A5B009C2750 /* Headers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15B73F0905FD1B670096477F /* dnsinfo.h */,
+                               1532629006281C9D00B1C10C /* dnsinfo_create.h */,
+                               15B73F0C05FD1B670096477F /* dnsinfo_private.h */,
+                               15B73F0E05FD1B670096477F /* dnsinfo_server.h */,
+                       );
+                       name = Headers;
+                       sourceTree = "<group>";
+               };
+               1582B37905FD1A66009C2750 /* Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15B73F0B05FD1B670096477F /* dnsinfo_private.c */,
+                               15B73F0805FD1B670096477F /* dnsinfo_copy.c */,
+                               1521FC5C060F296A003B28F5 /* dnsinfo_create.c */,
+                               15B73F0D05FD1B670096477F /* dnsinfo_server.c */,
+                       );
+                       name = Sources;
+                       sourceTree = "<group>";
+               };
+               158ADBFD0754ECB100124717 /* Plugins */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15FD73400754DBDA001CC321 /* libATconfig.a */,
+                               15FD73220754DB9F001CC321 /* ATconfig.bundle */,
+                               159D53EC07528C61004F8947 /* libIPMonitor.a */,
+                               15FD72A50754DA4C001CC321 /* IPMonitor.bundle */,
+                               159D53E507528C4A004F8947 /* libInterfaceNamer.a */,
+                               15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */,
+                               159D53D407528BDA004F8947 /* libKernelEventMonitor.a */,
+                               15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */,
+                               159D53DE07528C2E004F8947 /* libKicker.a */,
+                               15FD71090754D628001CC321 /* Kicker.bundle */,
+                               159D53F307528C79004F8947 /* libLinkConfiguration.a */,
+                               15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */,
+                               F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */,
+                               F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */,
+                               15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */,
+                               159D53FA07528C95004F8947 /* libPreferencesMonitor.a */,
+                       );
+                       name = Plugins;
+                       sourceTree = "<group>";
+               };
+               158ADCA60754ECC800124717 /* configd, scutil, scselect */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D54D907529FFF004F8947 /* configd */,
+                               1558476A0754FDCD0046C2E9 /* scutil */,
+                               1558481D07550EC10046C2E9 /* scselect */,
+                       );
+                       name = "configd, scutil, scselect";
+                       sourceTree = "<group>";
+               };
+               159D53A207528B06004F8947 /* Plugins */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53C907528B36004F8947 /* common */,
+                               159D53C407528B36004F8947 /* ATconfig */,
+                               159D53A607528B36004F8947 /* IPMonitor */,
+                               159D53AC07528B36004F8947 /* InterfaceNamer */,
+                               159D53AF07528B36004F8947 /* KernelEventMonitor */,
+                               159D53BB07528B36004F8947 /* Kicker */,
+                               159D53C007528B36004F8947 /* LinkConfiguration */,
+                               F95B8A660B03F97800993BA3 /* NetworkIdentification */,
+                               159D53C207528B36004F8947 /* PreferencesMonitor */,
+                       );
+                       name = Plugins;
+                       sourceTree = "<group>";
+               };
+               159D53A607528B36004F8947 /* IPMonitor */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53A707528B36004F8947 /* ip_plugin.c */,
+                               155D22380AF13A7300D52ED0 /* dns-configuration.h */,
+                               159D53AA07528B36004F8947 /* dns-configuration.c */,
+                               155D22390AF13A7300D52ED0 /* set-hostname.h */,
+                               159D53AB07528B36004F8947 /* set-hostname.c */,
+                               155D223A0AF13A7300D52ED0 /* smb-configuration.h */,
+                               1572EB7A0A506D3B00D02459 /* smb-configuration.c */,
+                               159D53A807528B36004F8947 /* Resolvers.plist */,
+                               15FD743E0754DE7A001CC321 /* Info.plist */,
+                       );
+                       name = IPMonitor;
+                       path = Plugins/IPMonitor;
+                       sourceTree = "<group>";
+               };
+               159D53AC07528B36004F8947 /* InterfaceNamer */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53AE07528B36004F8947 /* ifnamer.c */,
+                               15FD73EE0754DE62001CC321 /* Info.plist */,
+                       );
+                       name = InterfaceNamer;
+                       path = Plugins/InterfaceNamer;
+                       sourceTree = "<group>";
+               };
+               159D53AF07528B36004F8947 /* KernelEventMonitor */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53B707528B36004F8947 /* eventmon.h */,
+                               159D53B607528B36004F8947 /* ev_appletalk.h */,
+                               159D53B207528B36004F8947 /* ev_dlil.h */,
+                               159D53B807528B36004F8947 /* ev_ipv4.h */,
+                               159D53BA07528B36004F8947 /* ev_ipv6.h */,
+                               159D53B007528B36004F8947 /* eventmon.c */,
+                               159D53B907528B36004F8947 /* ev_appletalk.c */,
+                               159D53B107528B36004F8947 /* ev_dlil.c */,
+                               159D53B307528B36004F8947 /* ev_ipv4.c */,
+                               159D53B407528B36004F8947 /* ev_ipv6.c */,
+                               158AD8700754E3D400124717 /* Info.plist */,
+                       );
+                       name = KernelEventMonitor;
+                       path = Plugins/KernelEventMonitor;
+                       sourceTree = "<group>";
+               };
+               159D53BB07528B36004F8947 /* Kicker */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53BE07528B36004F8947 /* kicker.c */,
+                               158AD85B0754E38F00124717 /* Info.plist */,
+                               159D53BC07528B36004F8947 /* Kicker.xml */,
+                               159D53BD07528B36004F8947 /* enable-network */,
+                       );
+                       name = Kicker;
+                       path = Plugins/Kicker;
+                       sourceTree = "<group>";
+               };
+               159D53C007528B36004F8947 /* LinkConfiguration */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53C107528B36004F8947 /* linkconfig.c */,
+                               158AD8C00754E3EF00124717 /* Info.plist */,
+                       );
+                       name = LinkConfiguration;
+                       path = Plugins/LinkConfiguration;
+                       sourceTree = "<group>";
+               };
+               159D53C207528B36004F8947 /* PreferencesMonitor */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53C307528B36004F8947 /* prefsmon.c */,
+                               158AD9100754E40E00124717 /* Info.plist */,
+                       );
+                       name = PreferencesMonitor;
+                       path = Plugins/PreferencesMonitor;
+                       sourceTree = "<group>";
+               };
+               159D53C407528B36004F8947 /* ATconfig */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53C507528B36004F8947 /* cfManager.c */,
+                               159D53C607528B36004F8947 /* cfManager.h */,
+                               159D53C707528B36004F8947 /* atconfig.c */,
+                               15FD73970754DE49001CC321 /* Info.plist */,
+                       );
+                       name = ATconfig;
+                       path = Plugins/ATconfig;
+                       sourceTree = "<group>";
+               };
+               159D53C907528B36004F8947 /* common */ = {
+                       isa = PBXGroup;
+                       children = (
+                               159D53CA07528B36004F8947 /* cache.c */,
+                               159D53CB07528B36004F8947 /* cache.h */,
+                       );
+                       name = common;
+                       path = Plugins/common;
+                       sourceTree = "<group>";
+               };
+               15B6861D0678B61900FF4023 /* Supporting Files */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15A6F7C20A4B266D00B907EA /* Localizable.strings */,
+                               15B686220678B65C00FF4023 /* NetworkConfiguration.plist */,
+                               1577253606EFBF3100D7B52B /* NetworkInterface.strings */,
+                               15CFC229068B222F00123568 /* get-mobility-info */,
+                       );
+                       name = "Supporting Files";
+                       sourceTree = "<group>";
+               };
+               15CB68FC05C072220099E85F /* configd */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB6A8605C072500099E85F /* MiG */,
+                               15CB6A8305C072410099E85F /* Schema */,
+                               1582B36B05FD1A4D009C2750 /* DNSConfiguration */,
+                               15CB690705C0722A0099E85F /* SystemConfiguration */,
+                               1547002E084561B4006787CE /* SCHelper */,
+                               15CB69C205C0722B0099E85F /* configd */,
+                               15CB6A2205C0722B0099E85F /* scselect */,
+                               15CB6A3705C0722B0099E85F /* scutil */,
+                               159D53A207528B06004F8947 /* Plugins */,
+                               1514D77D05C08AB700757DC9 /* Initial Preferences */,
+                               15CB6A6E05C0722B0099E85F /* External Frameworks and Libraries */,
+                               15CB690F05C0722B0099E85F /* Products */,
+                       );
+                       name = configd;
+                       sourceTree = "<group>";
+               };
+               15CB690705C0722A0099E85F /* SystemConfiguration */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB691205C0722B0099E85F /* Headers */,
+                               15CB694F05C0722B0099E85F /* Sources */,
+                               15B6861D0678B61900FF4023 /* Supporting Files */,
+                       );
+                       name = SystemConfiguration;
+                       path = SystemConfiguration.fproj;
+                       sourceTree = "<group>";
+               };
+               15CB690F05C0722B0099E85F /* Products */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */,
+                               15DAD5EE075913CE0084A6ED /* libdnsinfo.a */,
+                               1547001D08455B98006787CE /* SCHelper */,
+                               158ADCA60754ECC800124717 /* configd, scutil, scselect */,
+                               158ADBFD0754ECB100124717 /* Plugins */,
+                               151F63EC09328A3C0096DCC9 /* genSCPreferences */,
+                       );
+                       name = Products;
+                       sourceTree = "<group>";
+               };
+               15CB691205C0722B0099E85F /* Headers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */,
+                               F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */,
+                               152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */,
+                               15CB691305C0722B0099E85F /* SystemConfiguration.h */,
+                               150607DE075A00A300B147BA /* SCSchemaDefinitions.h */,
+                               157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */,
+                               15CB691705C0722B0099E85F /* SCDPlugin.h */,
+                               15CB691B05C0722B0099E85F /* SCDynamicStoreInternal.h */,
+                               15CB691D05C0722B0099E85F /* SCDynamicStore.h */,
+                               15CB691F05C0722B0099E85F /* SCDynamicStorePrivate.h */,
+                               15CB692105C0722B0099E85F /* SCDynamicStoreKey.h */,
+                               15CB693F05C0722B0099E85F /* SCDynamicStoreCopyDHCPInfo.h */,
+                               15CB692305C0722B0099E85F /* SCDynamicStoreCopySpecific.h */,
+                               15CB692505C0722B0099E85F /* SCDynamicStoreCopySpecificPrivate.h */,
+                               15CB692705C0722B0099E85F /* SCDynamicStoreSetSpecificPrivate.h */,
+                               15CB692905C0722B0099E85F /* SCPreferencesInternal.h */,
+                               15CB692B05C0722B0099E85F /* SCPreferences.h */,
+                               15CB692D05C0722B0099E85F /* SCPreferencesPrivate.h */,
+                               15CB692F05C0722B0099E85F /* SCPreferencesPath.h */,
+                               151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */,
+                               154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */,
+                               15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */,
+                               156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */,
+                               15CB691505C0722B0099E85F /* SCPrivate.h */,
+                               15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */,
+                               155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */,
+                               15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */,
+                               15CB693305C0722B0099E85F /* SCNetwork.h */,
+                               15CB693505C0722B0099E85F /* SCNetworkConnection.h */,
+                               15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */,
+                               15CB693705C0722B0099E85F /* SCNetworkReachability.h */,
+                               15CB693905C0722B0099E85F /* SCValidation.h */,
+                               9EE943F406AF409B00772EB5 /* BondConfiguration.h */,
+                               9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */,
+                               15CB694505C0722B0099E85F /* DeviceOnHold.h */,
+                               15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */,
+                               15CB694705C0722B0099E85F /* LinkConfiguration.h */,
+                               15CB694B05C0722B0099E85F /* VLANConfiguration.h */,
+                               15CB694905C0722B0099E85F /* dy_framework.h */,
+                               15CB694305C0722B0099E85F /* moh.h */,
+                               15CB694105C0722B0099E85F /* moh_msg.h */,
+                               23C1E2BE062DD5DB00835B54 /* pppcontroller.h */,
+                       );
+                       name = Headers;
+                       sourceTree = "<group>";
+               };
+               15CB694F05C0722B0099E85F /* Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */,
+                               152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */,
+                               150607BD075A00A200B147BA /* SCSchemaDefinitions.c */,
+                               15CB695005C0722B0099E85F /* SCD.c */,
+                               15CB695205C0722B0099E85F /* SCDKeys.c */,
+                               15CB695405C0722B0099E85F /* SCDPrivate.c */,
+                               15CB695605C0722B0099E85F /* SCDPlugin.c */,
+                               15CB695805C0722B0099E85F /* SCDOpen.c */,
+                               15CB695A05C0722B0099E85F /* SCDLock.c */,
+                               15CB695C05C0722B0099E85F /* SCDUnlock.c */,
+                               15CB695E05C0722B0099E85F /* SCDList.c */,
+                               15CB696005C0722B0099E85F /* SCDAdd.c */,
+                               15CB696405C0722B0099E85F /* SCDGet.c */,
+                               15CB696605C0722B0099E85F /* SCDSet.c */,
+                               15CB696805C0722B0099E85F /* SCDRemove.c */,
+                               15CB696A05C0722B0099E85F /* SCDTouch.c */,
+                               15CB696C05C0722B0099E85F /* SCDNotify.c */,
+                               15CB696E05C0722B0099E85F /* SCDNotifierSetKeys.c */,
+                               15CB697005C0722B0099E85F /* SCDNotifierAdd.c */,
+                               15CB697205C0722B0099E85F /* SCDNotifierRemove.c */,
+                               15CB697405C0722B0099E85F /* SCDNotifierGetChanges.c */,
+                               15CB697605C0722B0099E85F /* SCDNotifierWait.c */,
+                               15CB697805C0722B0099E85F /* SCDNotifierInformViaCallback.c */,
+                               15CB697A05C0722B0099E85F /* SCDNotifierInformViaMachPort.c */,
+                               15CB697C05C0722B0099E85F /* SCDNotifierInformViaFD.c */,
+                               15CB697E05C0722B0099E85F /* SCDNotifierInformViaSignal.c */,
+                               15CB698005C0722B0099E85F /* SCDNotifierCancel.c */,
+                               15CB698205C0722B0099E85F /* SCDSnapshot.c */,
+                               15CB698405C0722B0099E85F /* SCP.c */,
+                               15CB698605C0722B0099E85F /* SCPOpen.c */,
+                               15CB698805C0722B0099E85F /* SCPLock.c */,
+                               15CB698A05C0722B0099E85F /* SCPUnlock.c */,
+                               15CB698C05C0722B0099E85F /* SCPList.c */,
+                               15CB698E05C0722B0099E85F /* SCPGet.c */,
+                               15CB699005C0722B0099E85F /* SCPAdd.c */,
+                               15CB699205C0722B0099E85F /* SCPSet.c */,
+                               15CB699405C0722B0099E85F /* SCPRemove.c */,
+                               15CB699605C0722B0099E85F /* SCPCommit.c */,
+                               15CB699805C0722B0099E85F /* SCPApply.c */,
+                               15CB699A05C0722B0099E85F /* SCPPath.c */,
+                               151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */,
+                               15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */,
+                               15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */,
+                               15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */,
+                               15AD7A3D0670A85900BFE03C /* SCNetworkService.c */,
+                               15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */,
+                               15CB699C05C0722B0099E85F /* SCDConsoleUser.c */,
+                               15CB699E05C0722B0099E85F /* SCDHostName.c */,
+                               15CB69A005C0722B0099E85F /* SCLocation.c */,
+                               15CB69A205C0722B0099E85F /* SCNetwork.c */,
+                               15CB69A405C0722B0099E85F /* SCNetworkConnection.c */,
+                               15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */,
+                               15CB69A605C0722B0099E85F /* SCNetworkReachability.c */,
+                               15CB69A805C0722B0099E85F /* SCProxies.c */,
+                               15CB69AC05C0722B0099E85F /* DHCP.c */,
+                               15CB69AE05C0722B0099E85F /* moh.c */,
+                               15CB69B005C0722B0099E85F /* DeviceOnHold.c */,
+                               15CB69B205C0722B0099E85F /* LinkConfiguration.c */,
+                               15CB69B405C0722B0099E85F /* dy_framework.c */,
+                               9EE943F306AF409B00772EB5 /* BondConfiguration.c */,
+                               15CB69B605C0722B0099E85F /* VLANConfiguration.c */,
+                       );
+                       name = Sources;
+                       sourceTree = "<group>";
+               };
+               15CB69C205C0722B0099E85F /* configd */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB69CE05C0722B0099E85F /* Headers */,
+                               15CB69DF05C0722B0099E85F /* Sources */,
+                               15CB6A1805C0722B0099E85F /* Supporting Files */,
+                       );
+                       name = configd;
+                       path = configd.tproj;
+                       sourceTree = "<group>";
+               };
+               15CB69CE05C0722B0099E85F /* Headers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB69CF05C0722B0099E85F /* configd.h */,
+                               15CB69D105C0722B0099E85F /* _SCD.h */,
+                               15CB69D305C0722B0099E85F /* configd_server.h */,
+                               15CB69D505C0722B0099E85F /* notify_server.h */,
+                               15CB69D705C0722B0099E85F /* plugin_support.h */,
+                               15CB69D905C0722B0099E85F /* session.h */,
+                               15CB69DB05C0722B0099E85F /* pattern.h */,
+                       );
+                       name = Headers;
+                       sourceTree = "<group>";
+               };
+               15CB69DF05C0722B0099E85F /* Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB69E005C0722B0099E85F /* configd.m */,
+                               15CB69E205C0722B0099E85F /* _SCD.c */,
+                               15CB69E405C0722B0099E85F /* configd_server.c */,
+                               15CB69E605C0722B0099E85F /* notify_server.c */,
+                               15CB69E805C0722B0099E85F /* plugin_support.c */,
+                               15CB69EA05C0722B0099E85F /* session.c */,
+                               15CB69EC05C0722B0099E85F /* pattern.c */,
+                               15CB69F005C0722B0099E85F /* _configopen.c */,
+                               15CB69F205C0722B0099E85F /* _configclose.c */,
+                               15CB69F405C0722B0099E85F /* _configlock.c */,
+                               15CB69F605C0722B0099E85F /* _configunlock.c */,
+                               15CB69F805C0722B0099E85F /* _configlist.c */,
+                               15CB69FA05C0722B0099E85F /* _configadd.c */,
+                               15CB69FE05C0722B0099E85F /* _configget.c */,
+                               15CB6A0005C0722B0099E85F /* _configset.c */,
+                               15CB6A0205C0722B0099E85F /* _configremove.c */,
+                               15CB6A0405C0722B0099E85F /* _configtouch.c */,
+                               15CB6A0605C0722B0099E85F /* _confignotify.c */,
+                               15CB6A0805C0722B0099E85F /* _notifyadd.c */,
+                               15CB6A0A05C0722B0099E85F /* _notifyremove.c */,
+                               15CB6A0C05C0722B0099E85F /* _notifychanges.c */,
+                               15CB6A0E05C0722B0099E85F /* _notifyviaport.c */,
+                               15CB6A1005C0722B0099E85F /* _notifyviafd.c */,
+                               15CB6A1205C0722B0099E85F /* _notifyviasignal.c */,
+                               15CB6A1405C0722B0099E85F /* _notifycancel.c */,
+                               15CB6A1605C0722B0099E85F /* _snapshot.c */,
+                       );
+                       name = Sources;
+                       sourceTree = "<group>";
+               };
+               15CB6A1805C0722B0099E85F /* Supporting Files */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1540E3600987DA9500157C07 /* com.apple.configd.plist */,
+                               15CB6A2005C0722B0099E85F /* configd.8 */,
+                       );
+                       name = "Supporting Files";
+                       sourceTree = "<group>";
+               };
+               15CB6A2205C0722B0099E85F /* scselect */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB6A2D05C0722B0099E85F /* Sources */,
+                               15CB6A3005C0722B0099E85F /* Supporting Files */,
+                       );
+                       name = scselect;
+                       path = scselect.tproj;
+                       sourceTree = "<group>";
+               };
+               15CB6A2D05C0722B0099E85F /* Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB6A2E05C0722B0099E85F /* scselect.c */,
+                       );
+                       name = Sources;
+                       sourceTree = "<group>";
+               };
+               15CB6A3005C0722B0099E85F /* Supporting Files */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB6A3605C0722B0099E85F /* scselect.8 */,
+                       );
+                       name = "Supporting Files";
+                       sourceTree = "<group>";
+               };
+               15CB6A3705C0722B0099E85F /* scutil */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB6A4205C0722B0099E85F /* Headers */,
+                               15CB6A5305C0722B0099E85F /* Sources */,
+                               15CB6A6405C0722B0099E85F /* Supporting Files */,
+                       );
+                       name = scutil;
+                       path = scutil.tproj;
+                       sourceTree = "<group>";
+               };
+               15CB6A4205C0722B0099E85F /* Headers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB6A4305C0722B0099E85F /* scutil.h */,
+                               15CB6A4505C0722B0099E85F /* commands.h */,
+                               15CB6A4705C0722B0099E85F /* dictionary.h */,
+                               15CB6A4905C0722B0099E85F /* session.h */,
+                               15CB6A4B05C0722B0099E85F /* cache.h */,
+                               15CB6A4D05C0722B0099E85F /* notifications.h */,
+                               15CB6A4F05C0722B0099E85F /* tests.h */,
+                               15CB6A5105C0722B0099E85F /* prefs.h */,
+                               15A509A406C2518F001F0AB7 /* net.h */,
+                               15DC34680711D49400A3311C /* net_interface.h */,
+                               15DC346A0711D49400A3311C /* net_protocol.h */,
+                               15DC346C0711D49400A3311C /* net_service.h */,
+                               15DC346E0711D49400A3311C /* net_set.h */,
+                       );
+                       name = Headers;
+                       sourceTree = "<group>";
+               };
+               15CB6A5305C0722B0099E85F /* Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB6A5405C0722B0099E85F /* scutil.c */,
+                               15CB6A5605C0722B0099E85F /* commands.c */,
+                               15CB6A5805C0722B0099E85F /* dictionary.c */,
+                               15CB6A5A05C0722B0099E85F /* session.c */,
+                               15CB6A5C05C0722B0099E85F /* cache.c */,
+                               15CB6A5E05C0722B0099E85F /* notifications.c */,
+                               15CB6A6005C0722B0099E85F /* tests.c */,
+                               15CB6A6205C0722B0099E85F /* prefs.c */,
+                               15A509A306C2518F001F0AB7 /* net.c */,
+                               15DC34670711D49400A3311C /* net_interface.c */,
+                               15DC34690711D49400A3311C /* net_protocol.c */,
+                               15DC346B0711D49400A3311C /* net_service.c */,
+                               15DC346D0711D49400A3311C /* net_set.c */,
+                       );
+                       name = Sources;
+                       sourceTree = "<group>";
+               };
+               15CB6A6405C0722B0099E85F /* Supporting Files */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB6A6A05C0722B0099E85F /* scutil.8 */,
+                       );
+                       name = "Supporting Files";
+                       sourceTree = "<group>";
+               };
+               15CB6A6E05C0722B0099E85F /* External Frameworks and Libraries */ = {
+                       isa = PBXGroup;
+                       children = (
+                               158AD9F80754EA2F00124717 /* AppleTalk.framework */,
+                               15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */,
+                               1543636A0752D03C00A8EC6C /* IOKit.framework */,
+                               1520A3DE0846B2DC0010B584 /* Security.framework */,
+                               15BAA32207F0699A00D9EC95 /* libbsm.dylib */,
+                               152CEED0070CF6640050F23C /* libedit.dylib */,
+                               1587A31F0B6AACD70063104A /* libicucore.dylib */,
+                       );
+                       name = "External Frameworks and Libraries";
+                       sourceTree = "<group>";
+               };
+               15CB6A8305C072410099E85F /* Schema */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB69BF05C0722B0099E85F /* genSCPreferences.c */,
+                       );
+                       name = Schema;
+                       sourceTree = "<group>";
+               };
+               15CB6A8605C072500099E85F /* MiG */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15CB69BE05C0722B0099E85F /* config.defs */,
+                               1514D76D05C08A5F00757DC9 /* config_types.h */,
+                               15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */,
+                               15FCAACF05FD0EBF00CB79E6 /* shared_dns_info_types.h */,
+                               23C1E2B8062DD45900835B54 /* pppcontroller.defs */,
+                               23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */,
+                       );
+                       name = MiG;
+                       sourceTree = "<group>";
+               };
+               F95B8A660B03F97800993BA3 /* NetworkIdentification */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F95B8A670B03F97800993BA3 /* Info.plist */,
+                               F95B8A680B03F97800993BA3 /* NetworkIdentification.c */,
+                       );
+                       name = NetworkIdentification;
+                       path = Plugins/NetworkIdentification;
+                       sourceTree = "<group>";
+               };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+               1547001908455B98006787CE /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15DAF2DF08466D4900D1B2BD /* helper_comm.h in Headers */,
+                               155B7BF70847776D00F0E262 /* SCHelper_client.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               155847460754FDCD0046C2E9 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               155847470754FDCD0046C2E9 /* scutil.h in Headers */,
+                               155847480754FDCD0046C2E9 /* commands.h in Headers */,
+                               155847490754FDCD0046C2E9 /* dictionary.h in Headers */,
+                               1558474A0754FDCD0046C2E9 /* session.h in Headers */,
+                               1558474B0754FDCD0046C2E9 /* cache.h in Headers */,
+                               1558474C0754FDCD0046C2E9 /* notifications.h in Headers */,
+                               1558474D0754FDCD0046C2E9 /* tests.h in Headers */,
+                               1558474E0754FDCD0046C2E9 /* prefs.h in Headers */,
+                               1558474F0754FDCD0046C2E9 /* net.h in Headers */,
+                               155847500754FDCD0046C2E9 /* net_interface.h in Headers */,
+                               155847510754FDCD0046C2E9 /* net_protocol.h in Headers */,
+                               155847520754FDCD0046C2E9 /* net_service.h in Headers */,
+                               155847530754FDCD0046C2E9 /* net_set.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1558481407550EC10046C2E9 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53D007528BDA004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D540A07528D3B004F8947 /* cache.h in Headers */,
+                               159D540C07528DAA004F8947 /* ev_appletalk.h in Headers */,
+                               159D540E07528DAE004F8947 /* ev_dlil.h in Headers */,
+                               159D541007528DB1004F8947 /* ev_ipv4.h in Headers */,
+                               159D541207528DB3004F8947 /* ev_ipv6.h in Headers */,
+                               159D541407528DB5004F8947 /* eventmon.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53DA07528C2E004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53E107528C4A004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53E807528C61004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               155D223B0AF13A7300D52ED0 /* dns-configuration.h in Headers */,
+                               155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */,
+                               155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53EF07528C79004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53F607528C95004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D54A307529FFF004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D54A407529FFF004F8947 /* configd.h in Headers */,
+                               159D54A507529FFF004F8947 /* _SCD.h in Headers */,
+                               159D54A607529FFF004F8947 /* configd_server.h in Headers */,
+                               159D54A707529FFF004F8947 /* notify_server.h in Headers */,
+                               159D54A807529FFF004F8947 /* plugin_support.h in Headers */,
+                               159D54A907529FFF004F8947 /* session.h in Headers */,
+                               159D54AA07529FFF004F8947 /* pattern.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD5E0075913CE0084A6ED /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15DAD5E1075913CE0084A6ED /* dnsinfo.h in Headers */,
+                               15DAD5E2075913CE0084A6ED /* dnsinfo_private.h in Headers */,
+                               15DAD5E3075913CE0084A6ED /* dnsinfo_create.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD64107591A1A0084A6ED /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1506081A075A00A300B147BA /* SCSchemaDefinitions.h in Headers */,
+                               15DAD64307591A1A0084A6ED /* SystemConfiguration.h in Headers */,
+                               15DAD64407591A1A0084A6ED /* SCPrivate.h in Headers */,
+                               15DAD64507591A1A0084A6ED /* SCDPlugin.h in Headers */,
+                               15DAD64607591A1A0084A6ED /* SCDynamicStoreInternal.h in Headers */,
+                               15DAD64707591A1A0084A6ED /* SCDynamicStore.h in Headers */,
+                               15DAD64807591A1A0084A6ED /* SCDynamicStorePrivate.h in Headers */,
+                               15DAD64907591A1A0084A6ED /* SCDynamicStoreKey.h in Headers */,
+                               15DAD64A07591A1A0084A6ED /* SCDynamicStoreCopySpecific.h in Headers */,
+                               15DAD64B07591A1A0084A6ED /* SCDynamicStoreCopySpecificPrivate.h in Headers */,
+                               15DAD64C07591A1A0084A6ED /* SCDynamicStoreSetSpecificPrivate.h in Headers */,
+                               15DAD64D07591A1A0084A6ED /* SCPreferencesInternal.h in Headers */,
+                               15DAD64E07591A1A0084A6ED /* SCPreferences.h in Headers */,
+                               15DAD64F07591A1A0084A6ED /* SCPreferencesPrivate.h in Headers */,
+                               15DAD65007591A1A0084A6ED /* SCPreferencesPath.h in Headers */,
+                               15DAD65107591A1A0084A6ED /* SCPreferencesSetSpecific.h in Headers */,
+                               15DAD65207591A1A0084A6ED /* SCNetworkConfiguration.h in Headers */,
+                               15DAD65307591A1A0084A6ED /* SCNetworkConfigurationInternal.h in Headers */,
+                               15DAD65407591A1A0084A6ED /* SCNetwork.h in Headers */,
+                               15DAD65507591A1A0084A6ED /* SCNetworkConnection.h in Headers */,
+                               15DAD65607591A1A0084A6ED /* SCNetworkReachability.h in Headers */,
+                               15DAD65707591A1A0084A6ED /* SCValidation.h in Headers */,
+                               15DAD65807591A1A0084A6ED /* DHCPClientPreferences.h in Headers */,
+                               15DAD65907591A1A0084A6ED /* SCDynamicStoreCopyDHCPInfo.h in Headers */,
+                               15DAD65A07591A1A0084A6ED /* moh_msg.h in Headers */,
+                               15DAD65B07591A1A0084A6ED /* moh.h in Headers */,
+                               15DAD65C07591A1A0084A6ED /* DeviceOnHold.h in Headers */,
+                               15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */,
+                               15DAD65E07591A1A0084A6ED /* dy_framework.h in Headers */,
+                               15DAD65F07591A1A0084A6ED /* VLANConfiguration.h in Headers */,
+                               15DAD66107591A1A0084A6ED /* SCPreferencesPathKey.h in Headers */,
+                               15DAD66207591A1A0084A6ED /* dnsinfo.h in Headers */,
+                               15DAD66307591A1A0084A6ED /* dnsinfo_private.h in Headers */,
+                               15DAD66407591A1A0084A6ED /* pppcontroller_types.h in Headers */,
+                               15DAD66507591A1A0084A6ED /* pppcontroller.h in Headers */,
+                               15DAD66607591A1A0084A6ED /* BondConfiguration.h in Headers */,
+                               15DAD66707591A1A0084A6ED /* BondConfigurationPrivate.h in Headers */,
+                               156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */,
+                               154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */,
+                               155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */,
+                               15DAF2DB08466D4900D1B2BD /* helper_comm.h in Headers */,
+                               155B7BF80847776D00F0E262 /* SCHelper_client.h in Headers */,
+                               15A297300A13C08C009879B3 /* SCNetworkConnectionPrivate.h in Headers */,
+                               152E68C10A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h in Headers */,
+                               157A88890A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h in Headers */,
+                               F95B8A460B03E09300993BA3 /* SCNetworkSignature.h in Headers */,
+                               F95B8A470B03E09300993BA3 /* SCNetworkSignaturePrivate.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD733C0754DBDA001CC321 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               F95B8A5B0B03F81400993BA3 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+               151F63DA09328A3C0096DCC9 /* Schema */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 151F63DC09328A3C0096DCC9 /* Build configuration list for PBXNativeTarget "Schema" */;
+                       buildPhases = (
+                               151F63DB09328A3C0096DCC9 /* ShellScript */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Schema;
+                       productInstallPath = /usr/local/bin;
+                       productName = Schema;
+                       productReference = 151F63EC09328A3C0096DCC9 /* genSCPreferences */;
+                       productType = "com.apple.product-type.tool";
+               };
+               1547001808455B98006787CE /* SCHelper */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5E20905594A00EEF749 /* Build configuration list for PBXNativeTarget "SCHelper" */;
+                       buildPhases = (
+                               1547001908455B98006787CE /* Headers */,
+                               1547001A08455B98006787CE /* Sources */,
+                               1547001B08455B98006787CE /* Frameworks */,
+                               1547001C08455B98006787CE /* Rez */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = SCHelper;
+                       productInstallPath = /usr/local/bin;
+                       productName = SCPreferencesHelper;
+                       productReference = 1547001D08455B98006787CE /* SCHelper */;
+                       productType = "com.apple.product-type.tool";
+               };
+               155847430754FDCD0046C2E9 /* scutil */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB62A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "scutil" */;
+                       buildPhases = (
+                               155847460754FDCD0046C2E9 /* Headers */,
+                               155847540754FDCD0046C2E9 /* Sources */,
+                               155847620754FDCD0046C2E9 /* Frameworks */,
+                               155847670754FDCD0046C2E9 /* Rez */,
+                               155847680754FDCD0046C2E9 /* CopyFiles */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = scutil;
+                       productInstallPath = /usr/sbin;
+                       productName = "scutil (Tool)";
+                       productReference = 1558476A0754FDCD0046C2E9 /* scutil */;
+                       productType = "com.apple.product-type.tool";
+               };
+               1558481207550EC10046C2E9 /* scselect */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6260905594A00EEF749 /* Build configuration list for PBXNativeTarget "scselect" */;
+                       buildPhases = (
+                               1558481407550EC10046C2E9 /* Headers */,
+                               1558481507550EC10046C2E9 /* Sources */,
+                               1558481707550EC10046C2E9 /* Frameworks */,
+                               1558481A07550EC10046C2E9 /* Rez */,
+                               1558481B07550EC10046C2E9 /* CopyFiles */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = scselect;
+                       productInstallPath = /usr/sbin;
+                       productName = "scselect (Tool)";
+                       productReference = 1558481D07550EC10046C2E9 /* scselect */;
+                       productType = "com.apple.product-type.tool";
+               };
+               15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */;
+                       buildPhases = (
+                               15828AE30753B5F900AD4710 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = KernelEventMonitor.bundle;
+                       productName = KernelEventMonitor.bundle;
+                       productReference = 15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               159D53D307528BDA004F8947 /* KernelEventMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */;
+                       buildPhases = (
+                               159D53D007528BDA004F8947 /* Headers */,
+                               159D53D107528BDA004F8947 /* Sources */,
+                               159D53D207528BDA004F8947 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = KernelEventMonitor;
+                       productName = KernelEventMonitor;
+                       productReference = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53DD07528C2E004F8947 /* Kicker */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6060905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker" */;
+                       buildPhases = (
+                               159D53DA07528C2E004F8947 /* Headers */,
+                               159D53DB07528C2E004F8947 /* Sources */,
+                               159D53DC07528C2E004F8947 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Kicker;
+                       productName = Kicker;
+                       productReference = 159D53DE07528C2E004F8947 /* libKicker.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53E407528C4A004F8947 /* InterfaceNamer */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */;
+                       buildPhases = (
+                               159D53E107528C4A004F8947 /* Headers */,
+                               159D53E207528C4A004F8947 /* Sources */,
+                               159D53E307528C4A004F8947 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = InterfaceNamer;
+                       productName = InterfaceNamer;
+                       productReference = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53EB07528C61004F8947 /* IPMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */;
+                       buildPhases = (
+                               159D53E807528C61004F8947 /* Headers */,
+                               159D53E907528C61004F8947 /* Sources */,
+                               159D53EA07528C61004F8947 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = IPMonitor;
+                       productName = IPMonitor;
+                       productReference = 159D53EC07528C61004F8947 /* libIPMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53F207528C79004F8947 /* LinkConfiguration */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */;
+                       buildPhases = (
+                               159D53EF07528C79004F8947 /* Headers */,
+                               159D53F007528C79004F8947 /* Sources */,
+                               159D53F107528C79004F8947 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = LinkConfiguration;
+                       productName = LinkConfiguration;
+                       productReference = 159D53F307528C79004F8947 /* libLinkConfiguration.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53F907528C95004F8947 /* PreferencesMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */;
+                       buildPhases = (
+                               159D53F607528C95004F8947 /* Headers */,
+                               159D53F707528C95004F8947 /* Sources */,
+                               159D53F807528C95004F8947 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = PreferencesMonitor;
+                       productName = PreferencesMonitor;
+                       productReference = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D549F07529FFF004F8947 /* configd */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6220905594A00EEF749 /* Build configuration list for PBXNativeTarget "configd" */;
+                       buildPhases = (
+                               159D54A307529FFF004F8947 /* Headers */,
+                               159D54AB07529FFF004F8947 /* Sources */,
+                               159D54CA07529FFF004F8947 /* Frameworks */,
+                               159D54D407529FFF004F8947 /* Rez */,
+                               159D54D507529FFF004F8947 /* CopyFiles */,
+                               159D54D707529FFF004F8947 /* CopyFiles */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = configd;
+                       productInstallPath = /usr/sbin;
+                       productName = "configd (Tool)";
+                       productReference = 159D54D907529FFF004F8947 /* configd */;
+                       productType = "com.apple.product-type.tool";
+               };
+               15DAD5DF075913CE0084A6ED /* DNSConfiguration */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */;
+                       buildPhases = (
+                               15DAD5E0075913CE0084A6ED /* Headers */,
+                               15DAD5E4075913CE0084A6ED /* Sources */,
+                               15DAD5E9075913CE0084A6ED /* Frameworks */,
+                               15DAD5EA075913CE0084A6ED /* Rez */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = DNSConfiguration;
+                       productInstallPath = /usr/local/lib;
+                       productName = DNSConfiguration;
+                       productReference = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5DE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework" */;
+                       buildPhases = (
+                               15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */,
+                               15DAD64107591A1A0084A6ED /* Headers */,
+                               15DAD66807591A1A0084A6ED /* Resources */,
+                               15DAD66C07591A1A0084A6ED /* Sources */,
+                               15DAD6AD07591A1A0084A6ED /* Frameworks */,
+                               15DAD6AF07591A1A0084A6ED /* Rez */,
+                               15DAD6B007591A1A0084A6ED /* get-mobility-info */,
+                               15DAD6B107591A1A0084A6ED /* preferences.plist */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = SystemConfiguration.framework;
+                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                       productName = "SystemConfiguration (Framework)";
+                       productReference = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */;
+                       productType = "com.apple.product-type.framework";
+               };
+               15FD70FF0754D627001CC321 /* Kicker.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */;
+                       buildPhases = (
+                               15FD71010754D627001CC321 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Kicker.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = Kicker.bundle;
+                       productReference = 15FD71090754D628001CC321 /* Kicker.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5FA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle" */;
+                       buildPhases = (
+                               15FD72940754DA2B001CC321 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = InterfaceNamer.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = Kicker.bundle;
+                       productReference = 15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               15FD72A10754DA4C001CC321 /* IPMonitor.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5F20905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle" */;
+                       buildPhases = (
+                               15FD72A20754DA4C001CC321 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = IPMonitor.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = Kicker.bundle;
+                       productReference = 15FD72A50754DA4C001CC321 /* IPMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6120905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle" */;
+                       buildPhases = (
+                               15FD72B20754DA69001CC321 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = LinkConfiguration.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = Kicker.bundle;
+                       productReference = 15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB61A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle" */;
+                       buildPhases = (
+                               15FD72C60754DA7E001CC321 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = PreferencesMonitor.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = Kicker.bundle;
+                       productReference = 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               15FD731E0754DB9F001CC321 /* ATconfig.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */;
+                       buildPhases = (
+                               15FD731F0754DB9F001CC321 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = ATconfig.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = Kicker.bundle;
+                       productReference = 15FD73220754DB9F001CC321 /* ATconfig.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               15FD733A0754DBDA001CC321 /* ATconfig */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB63A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig" */;
+                       buildPhases = (
+                               15FD733C0754DBDA001CC321 /* Headers */,
+                               15FD733D0754DBDA001CC321 /* Sources */,
+                               15FD733F0754DBDA001CC321 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = ATconfig;
+                       productName = InterfaceNamer;
+                       productReference = 15FD73400754DBDA001CC321 /* libATconfig.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               F95B8A5E0B03F81400993BA3 /* NetworkIdentification */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */;
+                       buildPhases = (
+                               F95B8A5B0B03F81400993BA3 /* Headers */,
+                               F95B8A5C0B03F81400993BA3 /* Sources */,
+                               F95B8A5D0B03F81400993BA3 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = NetworkIdentification;
+                       productName = NetworkIdentification;
+                       productReference = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = F95B8A6C0B03F9D100993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle" */;
+                       buildPhases = (
+                               F95B8A6B0B03F9D100993BA3 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = NetworkIdentification.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = Kicker.bundle;
+                       productReference = F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+               15CB6A7705C0722B0099E85F /* Project object */ = {
+                       isa = PBXProject;
+                       buildConfigurationList = 156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */;
+                       compatibilityVersion = "Xcode 2.4";
+                       hasScannedForEncodings = 1;
+                       mainGroup = 15CB68FC05C072220099E85F /* configd */;
+                       productRefGroup = 15CB690F05C0722B0099E85F /* Products */;
+                       projectDirPath = "";
+                       projectRoot = "";
+                       targets = (
+                               15CB690005C0722A0099E85F /* All */,
+                               157BB8AE075924360025DA7A /* configd_base */,
+                               159D542007528E7C004F8947 /* configd_plugins */,
+                               155847FA07550D210046C2E9 /* configd_executables */,
+                               15DAD5DF075913CE0084A6ED /* DNSConfiguration */,
+                               151F63DA09328A3C0096DCC9 /* Schema */,
+                               15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */,
+                               1547001808455B98006787CE /* SCHelper */,
+                               159D549F07529FFF004F8947 /* configd */,
+                               1558481207550EC10046C2E9 /* scselect */,
+                               155847430754FDCD0046C2E9 /* scutil */,
+                               15FD733A0754DBDA001CC321 /* ATconfig */,
+                               15FD731E0754DB9F001CC321 /* ATconfig.bundle */,
+                               159D53EB07528C61004F8947 /* IPMonitor */,
+                               15FD72A10754DA4C001CC321 /* IPMonitor.bundle */,
+                               159D53E407528C4A004F8947 /* InterfaceNamer */,
+                               15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */,
+                               159D53D307528BDA004F8947 /* KernelEventMonitor */,
+                               15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */,
+                               159D53DD07528C2E004F8947 /* Kicker */,
+                               15FD70FF0754D627001CC321 /* Kicker.bundle */,
+                               159D53F207528C79004F8947 /* LinkConfiguration */,
+                               15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */,
+                               F95B8A5E0B03F81400993BA3 /* NetworkIdentification */,
+                               F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */,
+                               159D53F907528C95004F8947 /* PreferencesMonitor */,
+                               15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+               15828AE30753B5F900AD4710 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD66807591A1A0084A6ED /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */,
+                               15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */,
+                               15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */,
+                               15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD71010754D627001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               158ADD190754F1F100124717 /* Kicker.xml in Resources */,
+                               158ADD1B0754F1F400124717 /* enable-network in Resources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD72940754DA2B001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD72A20754DA4C001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               158ADD0E0754F1A000124717 /* Resolvers.plist in Resources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD72B20754DA69001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD72C60754DA7E001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD731F0754DB9F001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               F95B8A6B0B03F9D100993BA3 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+               1547001C08455B98006787CE /* Rez */ = {
+                       isa = PBXRezBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               155847670754FDCD0046C2E9 /* Rez */ = {
+                       isa = PBXRezBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1558481A07550EC10046C2E9 /* Rez */ = {
+                       isa = PBXRezBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D54D407529FFF004F8947 /* Rez */ = {
+                       isa = PBXRezBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD5EA075913CE0084A6ED /* Rez */ = {
+                       isa = PBXRezBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD6AF07591A1A0084A6ED /* Rez */ = {
+                       isa = PBXRezBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+               151F63DB09328A3C0096DCC9 /* ShellScript */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               SystemConfiguration.fproj/genSCPreferences.c,
+                       );
+                       outputPaths = (
+                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h",
+                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitionsPrivate.h",
+                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c",
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "echo ${BUILT_PRODUCTS_DIR}\ncc -o ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} ${SRCROOT}/SystemConfiguration.fproj/genSCPreferences.c || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} header   > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h        || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} private  > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitionsPrivate.h || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} cfile    > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c        || exit 1\nexit 0";
+               };
+               15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               /usr/local/lib/OrderFiles/SystemConfiguration.order,
+                       );
+                       name = SystemConfiguration.order;
+                       outputPaths = (
+                               "${OBJROOT}/SystemConfiguration.order",
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "if [ -r /usr/local/lib/OrderFiles/SystemConfiguration.order ]; then\n\tcp /usr/local/lib/OrderFiles/SystemConfiguration.order ${OBJROOT}/SystemConfiguration.order\nelse\n\ttouch ${OBJROOT}/SystemConfiguration.order\nfi";
+               };
+               15DAD6B007591A1A0084A6ED /* get-mobility-info */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "get-mobility-info";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/sh;
+                       shellScript = "mkdir -p \"${DSTROOT}/usr/local/bin\"\nln -fs \"${INSTALL_PATH}/${TARGET_NAME}/Resources/get-mobility-info\" \"${DSTROOT}/usr/local/bin/\"\n";
+               };
+               15DAD6B107591A1A0084A6ED /* preferences.plist */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                               preferences.xml,
+                       );
+                       name = preferences.plist;
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/sh;
+                       shellScript = "PREFS_DIR=\"/Library/Preferences/SystemConfiguration\"\nmkdir -p ${DSTROOT}${PREFS_DIR}\nchmod 755 ${DSTROOT}${PREFS_DIR}\n#install -c -m 644 preferences.xml ${DSTROOT}${PREFS_DIR}/preferences.plist";
+               };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+               1547001A08455B98006787CE /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15DAF2E108466D4900D1B2BD /* SCHelper_server.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               155847540754FDCD0046C2E9 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               155847550754FDCD0046C2E9 /* scutil.c in Sources */,
+                               155847560754FDCD0046C2E9 /* commands.c in Sources */,
+                               155847570754FDCD0046C2E9 /* dictionary.c in Sources */,
+                               155847580754FDCD0046C2E9 /* session.c in Sources */,
+                               155847590754FDCD0046C2E9 /* cache.c in Sources */,
+                               1558475A0754FDCD0046C2E9 /* notifications.c in Sources */,
+                               1558475B0754FDCD0046C2E9 /* tests.c in Sources */,
+                               1558475C0754FDCD0046C2E9 /* prefs.c in Sources */,
+                               1558475D0754FDCD0046C2E9 /* net.c in Sources */,
+                               1558475E0754FDCD0046C2E9 /* net_interface.c in Sources */,
+                               1558475F0754FDCD0046C2E9 /* net_protocol.c in Sources */,
+                               155847600754FDCD0046C2E9 /* net_service.c in Sources */,
+                               155847610754FDCD0046C2E9 /* net_set.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1558481507550EC10046C2E9 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1558481607550EC10046C2E9 /* scselect.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53D107528BDA004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D540907528D3A004F8947 /* cache.c in Sources */,
+                               159D540B07528DA9004F8947 /* ev_appletalk.c in Sources */,
+                               159D540D07528DAE004F8947 /* ev_dlil.c in Sources */,
+                               159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */,
+                               159D541107528DB2004F8947 /* ev_ipv6.c in Sources */,
+                               159D541307528DB5004F8947 /* eventmon.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53DB07528C2E004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541507528DDE004F8947 /* kicker.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53E207528C4A004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541607528DF1004F8947 /* ifnamer.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53E907528C61004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541707528E05004F8947 /* ip_plugin.c in Sources */,
+                               159D541807528E09004F8947 /* dns-configuration.c in Sources */,
+                               154361E00752C81800A8EC6C /* set-hostname.c in Sources */,
+                               1572EB7B0A506D3B00D02459 /* smb-configuration.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53F007528C79004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541B07528E4A004F8947 /* linkconfig.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53F707528C95004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541C07528E58004F8947 /* prefsmon.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D54AB07529FFF004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D54AC07529FFF004F8947 /* configd.m in Sources */,
+                               159D54AD07529FFF004F8947 /* _SCD.c in Sources */,
+                               159D54AE07529FFF004F8947 /* configd_server.c in Sources */,
+                               159D54AF07529FFF004F8947 /* notify_server.c in Sources */,
+                               159D54B007529FFF004F8947 /* plugin_support.c in Sources */,
+                               159D54B107529FFF004F8947 /* session.c in Sources */,
+                               159D54B207529FFF004F8947 /* pattern.c in Sources */,
+                               159D54B307529FFF004F8947 /* _configopen.c in Sources */,
+                               159D54B407529FFF004F8947 /* _configclose.c in Sources */,
+                               159D54B507529FFF004F8947 /* _configlock.c in Sources */,
+                               159D54B607529FFF004F8947 /* _configunlock.c in Sources */,
+                               159D54B707529FFF004F8947 /* _configlist.c in Sources */,
+                               159D54B807529FFF004F8947 /* _configadd.c in Sources */,
+                               159D54B907529FFF004F8947 /* _configget.c in Sources */,
+                               159D54BA07529FFF004F8947 /* _configset.c in Sources */,
+                               159D54BB07529FFF004F8947 /* _configremove.c in Sources */,
+                               159D54BC07529FFF004F8947 /* _configtouch.c in Sources */,
+                               159D54BD07529FFF004F8947 /* _confignotify.c in Sources */,
+                               159D54BE07529FFF004F8947 /* _notifyadd.c in Sources */,
+                               159D54BF07529FFF004F8947 /* _notifyremove.c in Sources */,
+                               159D54C007529FFF004F8947 /* _notifychanges.c in Sources */,
+                               159D54C107529FFF004F8947 /* _notifyviaport.c in Sources */,
+                               159D54C207529FFF004F8947 /* _notifyviafd.c in Sources */,
+                               159D54C307529FFF004F8947 /* _notifyviasignal.c in Sources */,
+                               159D54C407529FFF004F8947 /* _notifycancel.c in Sources */,
+                               159D54C507529FFF004F8947 /* _snapshot.c in Sources */,
+                               159D54C607529FFF004F8947 /* config.defs in Sources */,
+                               159D54C707529FFF004F8947 /* dnsinfo_private.c in Sources */,
+                               159D54C807529FFF004F8947 /* dnsinfo_server.c in Sources */,
+                               159D54C907529FFF004F8947 /* shared_dns_info.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD5E4075913CE0084A6ED /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */,
+                               15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */,
+                               15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */,
+                               15DAD5E8075913CE0084A6ED /* dnsinfo_create.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD66C07591A1A0084A6ED /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15060818075A00A300B147BA /* SCSchemaDefinitions.c in Sources */,
+                               15DAD66D07591A1A0084A6ED /* SCD.c in Sources */,
+                               15DAD66E07591A1A0084A6ED /* SCDKeys.c in Sources */,
+                               15DAD66F07591A1A0084A6ED /* SCDPrivate.c in Sources */,
+                               15DAD67007591A1A0084A6ED /* SCDPlugin.c in Sources */,
+                               15DAD67107591A1A0084A6ED /* SCDOpen.c in Sources */,
+                               15DAD67207591A1A0084A6ED /* SCDLock.c in Sources */,
+                               15DAD67307591A1A0084A6ED /* SCDUnlock.c in Sources */,
+                               15DAD67407591A1A0084A6ED /* SCDList.c in Sources */,
+                               15DAD67507591A1A0084A6ED /* SCDAdd.c in Sources */,
+                               15DAD67607591A1A0084A6ED /* SCDGet.c in Sources */,
+                               15DAD67707591A1A0084A6ED /* SCDSet.c in Sources */,
+                               15DAD67807591A1A0084A6ED /* SCDRemove.c in Sources */,
+                               15DAD67907591A1A0084A6ED /* SCDTouch.c in Sources */,
+                               15DAD67A07591A1A0084A6ED /* SCDNotify.c in Sources */,
+                               15DAD67B07591A1A0084A6ED /* SCDNotifierSetKeys.c in Sources */,
+                               15DAD67C07591A1A0084A6ED /* SCDNotifierAdd.c in Sources */,
+                               15DAD67D07591A1A0084A6ED /* SCDNotifierRemove.c in Sources */,
+                               15DAD67E07591A1A0084A6ED /* SCDNotifierGetChanges.c in Sources */,
+                               15DAD67F07591A1A0084A6ED /* SCDNotifierWait.c in Sources */,
+                               15DAD68007591A1A0084A6ED /* SCDNotifierInformViaCallback.c in Sources */,
+                               15DAD68107591A1A0084A6ED /* SCDNotifierInformViaMachPort.c in Sources */,
+                               15DAD68207591A1A0084A6ED /* SCDNotifierInformViaFD.c in Sources */,
+                               15DAD68307591A1A0084A6ED /* SCDNotifierInformViaSignal.c in Sources */,
+                               15DAD68407591A1A0084A6ED /* SCDNotifierCancel.c in Sources */,
+                               15DAD68507591A1A0084A6ED /* SCDSnapshot.c in Sources */,
+                               15DAD68607591A1A0084A6ED /* SCP.c in Sources */,
+                               15DAD68707591A1A0084A6ED /* SCPOpen.c in Sources */,
+                               15DAD68807591A1A0084A6ED /* SCPLock.c in Sources */,
+                               15DAD68907591A1A0084A6ED /* SCPUnlock.c in Sources */,
+                               15DAD68A07591A1A0084A6ED /* SCPList.c in Sources */,
+                               15DAD68B07591A1A0084A6ED /* SCPGet.c in Sources */,
+                               15DAD68C07591A1A0084A6ED /* SCPAdd.c in Sources */,
+                               15DAD68D07591A1A0084A6ED /* SCPSet.c in Sources */,
+                               15DAD68E07591A1A0084A6ED /* SCPRemove.c in Sources */,
+                               15DAD68F07591A1A0084A6ED /* SCPCommit.c in Sources */,
+                               15DAD69007591A1A0084A6ED /* SCPApply.c in Sources */,
+                               15DAD69107591A1A0084A6ED /* SCPPath.c in Sources */,
+                               15DAD69207591A1A0084A6ED /* SCDConsoleUser.c in Sources */,
+                               15DAD69307591A1A0084A6ED /* SCDHostName.c in Sources */,
+                               15DAD69407591A1A0084A6ED /* SCLocation.c in Sources */,
+                               15DAD69507591A1A0084A6ED /* SCNetwork.c in Sources */,
+                               15DAD69607591A1A0084A6ED /* pppcontroller.defs in Sources */,
+                               15DAD69707591A1A0084A6ED /* SCNetworkConnection.c in Sources */,
+                               15A2972F0A13C08C009879B3 /* SCNetworkConnectionPrivate.c in Sources */,
+                               15DAD69807591A1A0084A6ED /* SCNetworkReachability.c in Sources */,
+                               15DAD69907591A1A0084A6ED /* SCProxies.c in Sources */,
+                               15DAD69A07591A1A0084A6ED /* DHCP.c in Sources */,
+                               15DAD69B07591A1A0084A6ED /* moh.c in Sources */,
+                               15DAD69C07591A1A0084A6ED /* DeviceOnHold.c in Sources */,
+                               15DAD69D07591A1A0084A6ED /* LinkConfiguration.c in Sources */,
+                               15DAD69E07591A1A0084A6ED /* dy_framework.c in Sources */,
+                               15DAD69F07591A1A0084A6ED /* VLANConfiguration.c in Sources */,
+                               15DAD6A007591A1A0084A6ED /* config.defs in Sources */,
+                               15DAD6A207591A1A0084A6ED /* SCPreferencesPathKey.c in Sources */,
+                               15DAD6A307591A1A0084A6ED /* dnsinfo_private.c in Sources */,
+                               15DAD6A407591A1A0084A6ED /* dnsinfo_copy.c in Sources */,
+                               15DAD6A507591A1A0084A6ED /* shared_dns_info.defs in Sources */,
+                               15DAD6A607591A1A0084A6ED /* SCNetworkConfigurationInternal.c in Sources */,
+                               15DAD6A707591A1A0084A6ED /* SCNetworkInterface.c in Sources */,
+                               15DAD6A807591A1A0084A6ED /* SCNetworkProtocol.c in Sources */,
+                               15DAD6A907591A1A0084A6ED /* SCNetworkService.c in Sources */,
+                               15DAD6AA07591A1A0084A6ED /* SCNetworkSet.c in Sources */,
+                               15DAD6AB07591A1A0084A6ED /* BondConfiguration.c in Sources */,
+                               15DAF2DA08466D4900D1B2BD /* helper_comm.c in Sources */,
+                               15DAF2DC08466D4900D1B2BD /* SCHelper_client.c in Sources */,
+                               152E68C30A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c in Sources */,
+                               F95B8A430B03E07A00993BA3 /* SCNetworkSignature.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD733D0754DBDA001CC321 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1508E39F07552B6A0062B350 /* atconfig.c in Sources */,
+                               1508E3A007552B6B0062B350 /* cfManager.c in Sources */,
+                               1508E3A107552B720062B350 /* cache.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               F95B8A5C0B03F81400993BA3 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               F95B8A690B03F9B500993BA3 /* NetworkIdentification.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+               1520A386084681350010B584 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1547001808455B98006787CE /* SCHelper */;
+                       targetProxy = 1520A385084681350010B584 /* PBXContainerItemProxy */;
+               };
+               1533B94109731A9600F2B34A /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD733A0754DBDA001CC321 /* ATconfig */;
+                       targetProxy = 1533B94009731A9600F2B34A /* PBXContainerItemProxy */;
+               };
+               1558480607550D470046C2E9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D549F07529FFF004F8947 /* configd */;
+                       targetProxy = 1558480507550D470046C2E9 /* PBXContainerItemProxy */;
+               };
+               1558480807550D470046C2E9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1558481207550EC10046C2E9 /* scselect */;
+                       targetProxy = 1558480707550D470046C2E9 /* PBXContainerItemProxy */;
+               };
+               1558480A07550D470046C2E9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 155847430754FDCD0046C2E9 /* scutil */;
+                       targetProxy = 1558480907550D470046C2E9 /* PBXContainerItemProxy */;
+               };
+               1558480F07550DD00046C2E9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 155847FA07550D210046C2E9 /* configd_executables */;
+                       targetProxy = 1558480E07550DD00046C2E9 /* PBXContainerItemProxy */;
+               };
+               157BB8C0075924460025DA7A /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */;
+                       targetProxy = 157BB8BF075924460025DA7A /* PBXContainerItemProxy */;
+               };
+               157BB8C2075924470025DA7A /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15DAD5DF075913CE0084A6ED /* DNSConfiguration */;
+                       targetProxy = 157BB8C1075924470025DA7A /* PBXContainerItemProxy */;
+               };
+               157BB8C40759244B0025DA7A /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157BB8AE075924360025DA7A /* configd_base */;
+                       targetProxy = 157BB8C30759244B0025DA7A /* PBXContainerItemProxy */;
+               };
+               15828B070753B77E00AD4710 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */;
+                       targetProxy = 15828B060753B77E00AD4710 /* PBXContainerItemProxy */;
+               };
+               158AD9860754E72500124717 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD72A10754DA4C001CC321 /* IPMonitor.bundle */;
+                       targetProxy = 158AD9850754E72500124717 /* PBXContainerItemProxy */;
+               };
+               158AD9880754E72500124717 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */;
+                       targetProxy = 158AD9870754E72500124717 /* PBXContainerItemProxy */;
+               };
+               158AD98C0754E72500124717 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */;
+                       targetProxy = 158AD98B0754E72500124717 /* PBXContainerItemProxy */;
+               };
+               158AD98E0754E72500124717 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */;
+                       targetProxy = 158AD98D0754E72500124717 /* PBXContainerItemProxy */;
+               };
+               159D542207528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53D307528BDA004F8947 /* KernelEventMonitor */;
+                       targetProxy = 159D542107528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542607528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53E407528C4A004F8947 /* InterfaceNamer */;
+                       targetProxy = 159D542507528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542807528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53EB07528C61004F8947 /* IPMonitor */;
+                       targetProxy = 159D542707528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542A07528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53F207528C79004F8947 /* LinkConfiguration */;
+                       targetProxy = 159D542907528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542C07528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53F907528C95004F8947 /* PreferencesMonitor */;
+                       targetProxy = 159D542B07528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542E07529008004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D542007528E7C004F8947 /* configd_plugins */;
+                       targetProxy = 159D542D07529008004F8947 /* PBXContainerItemProxy */;
+               };
+               15DAD5740759115F0084A6ED /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD731E0754DB9F001CC321 /* ATconfig.bundle */;
+                       targetProxy = 15DAD5730759115F0084A6ED /* PBXContainerItemProxy */;
+               };
+               F95B8A770B03FB9100993BA3 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */;
+                       targetProxy = F95B8A760B03FB9100993BA3 /* PBXContainerItemProxy */;
+               };
+               F95B8A790B03FB9100993BA3 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = F95B8A5E0B03F81400993BA3 /* NetworkIdentification */;
+                       targetProxy = F95B8A780B03FB9100993BA3 /* PBXContainerItemProxy */;
+               };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+               1577253606EFBF3100D7B52B /* NetworkInterface.strings */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               1577252F06EFB96700D7B52B /* English */,
+                       );
+                       name = NetworkInterface.strings;
+                       sourceTree = "<group>";
+               };
+               15A6F7C20A4B266D00B907EA /* Localizable.strings */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               15A6F7C30A4B266D00B907EA /* English */,
+                       );
+                       name = Localizable.strings;
+                       sourceTree = "<group>";
+               };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+               151F63DD09328A3C0096DCC9 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
+                               OTHER_CFLAGS = "";
+                               OTHER_LDFLAGS = "";
+                               PRODUCT_NAME = genSCPreferences;
+                               SECTORDER_FLAGS = "";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-four-char-constants",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               151F63DE09328A3C0096DCC9 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
+                               OTHER_CFLAGS = "";
+                               OTHER_LDFLAGS = "";
+                               PRODUCT_NAME = genSCPreferences;
+                               SECTORDER_FLAGS = "";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-four-char-constants",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               151F63DF09328A3C0096DCC9 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
+                               OTHER_CFLAGS = "";
+                               OTHER_LDFLAGS = "";
+                               PRODUCT_NAME = genSCPreferences;
+                               SECTORDER_FLAGS = "";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-four-char-constants",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB5DB0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = 204;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = dnsinfo;
+                               SECTORDER_FLAGS = "";
+                               UNSTRIPPED_PRODUCT = YES;
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB5DC0905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = 204;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = dnsinfo;
+                               SECTORDER_FLAGS = "";
+                               UNSTRIPPED_PRODUCT = YES;
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB5DD0905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = 204;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = dnsinfo;
+                               SECTORDER_FLAGS = "";
+                               UNSTRIPPED_PRODUCT = YES;
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB5DF0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = 204;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               OTHER_LDFLAGS = (
+                                       "-seg_addr_table",
+                                       "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table",
+                               );
+                               PRODUCT_NAME = SystemConfiguration;
+                               SECTORDER_FLAGS = (
+                                       "-sectorder",
+                                       __TEXT,
+                                       __text,
+                                       "$(OBJROOT)/SystemConfiguration.order",
+                               );
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                               WRAPPER_EXTENSION = framework;
+                       };
+                       name = Development;
+               };
+               156EB5E00905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = 204;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               OTHER_LDFLAGS = (
+                                       "-seg_addr_table",
+                                       "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table",
+                               );
+                               PRODUCT_NAME = SystemConfiguration;
+                               SECTORDER_FLAGS = (
+                                       "-sectorder",
+                                       __TEXT,
+                                       __text,
+                                       "$(OBJROOT)/SystemConfiguration.order",
+                               );
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                               WRAPPER_EXTENSION = framework;
+                       };
+                       name = Deployment;
+               };
+               156EB5E10905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = 204;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               OTHER_LDFLAGS = (
+                                       "-seg_addr_table",
+                                       "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table",
+                               );
+                               PRODUCT_NAME = SystemConfiguration;
+                               SECTORDER_FLAGS = (
+                                       "-sectorder",
+                                       __TEXT,
+                                       __text,
+                                       "$(OBJROOT)/SystemConfiguration.order",
+                               );
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                               WRAPPER_EXTENSION = framework;
+                       };
+                       name = Default;
+               };
+               156EB5E30905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = SCHelper;
+                               STRIPFLAGS = "-S";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB5E40905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = SCHelper;
+                               STRIPFLAGS = "-S";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB5E50905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = SCHelper;
+                               STRIPFLAGS = "-S";
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB5E70905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               PRODUCT_NAME = Frameworks;
+                               WARNING_CFLAGS = (
+                                       "-Wmost",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB5E80905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               PRODUCT_NAME = Frameworks;
+                               WARNING_CFLAGS = (
+                                       "-Wmost",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB5E90905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = Frameworks;
+                               WARNING_CFLAGS = (
+                                       "-Wmost",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB5EB0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = ATconfig;
+                       };
+                       name = Development;
+               };
+               156EB5EC0905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = ATconfig;
+                       };
+                       name = Deployment;
+               };
+               156EB5ED0905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = ATconfig;
+                       };
+                       name = Default;
+               };
+               156EB5EF0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = IPMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB5F00905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = IPMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB5F10905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = IPMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB5F30905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = IPMonitor;
+                       };
+                       name = Development;
+               };
+               156EB5F40905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = IPMonitor;
+                       };
+                       name = Deployment;
+               };
+               156EB5F50905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = IPMonitor;
+                       };
+                       name = Default;
+               };
+               156EB5F70905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = InterfaceNamer;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB5F80905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = InterfaceNamer;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB5F90905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = InterfaceNamer;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB5FB0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = InterfaceNamer;
+                       };
+                       name = Development;
+               };
+               156EB5FC0905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = InterfaceNamer;
+                       };
+                       name = Deployment;
+               };
+               156EB5FD0905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = InterfaceNamer;
+                       };
+                       name = Default;
+               };
+               156EB5FF0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
+                       };
+                       name = Development;
+               };
+               156EB6000905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
+                       };
+                       name = Deployment;
+               };
+               156EB6010905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
+                       };
+                       name = Default;
+               };
+               156EB6030905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = KernelEventMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6040905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = KernelEventMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6050905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = KernelEventMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB6070905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = Kicker;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6080905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = Kicker;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6090905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = Kicker;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB60B0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/Kicker/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Kicker;
+                       };
+                       name = Development;
+               };
+               156EB60C0905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/Kicker/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Kicker;
+                       };
+                       name = Deployment;
+               };
+               156EB60D0905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/Kicker/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Kicker;
+                       };
+                       name = Default;
+               };
+               156EB60F0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = LinkConfiguration;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6100905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = LinkConfiguration;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6110905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = LinkConfiguration;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB6130905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = LinkConfiguration;
+                       };
+                       name = Development;
+               };
+               156EB6140905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = LinkConfiguration;
+                       };
+                       name = Deployment;
+               };
+               156EB6150905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = LinkConfiguration;
+                       };
+                       name = Default;
+               };
+               156EB6170905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = PreferencesMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6180905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = PreferencesMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6190905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = PreferencesMonitor;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB61B0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = PreferencesMonitor;
+                       };
+                       name = Development;
+               };
+               156EB61C0905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = PreferencesMonitor;
+                       };
+                       name = Deployment;
+               };
+               156EB61D0905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = PreferencesMonitor;
+                       };
+                       name = Default;
+               };
+               156EB61F0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               PRODUCT_NAME = Plugins;
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6200905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               PRODUCT_NAME = Plugins;
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6210905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = Plugins;
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB6230905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               OTHER_LDFLAGS = "-prebind_all_twolevel_modules";
+                               PRODUCT_NAME = configd;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6240905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               OTHER_LDFLAGS = "-prebind_all_twolevel_modules";
+                               PRODUCT_NAME = configd;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6250905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               OTHER_LDFLAGS = "-prebind_all_twolevel_modules";
+                               PRODUCT_NAME = configd;
+                               STRIPFLAGS = "-S";
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB6270905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = scselect;
+                               STRIPFLAGS = "-S";
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6280905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = scselect;
+                               STRIPFLAGS = "-S";
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6290905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = scselect;
+                               STRIPFLAGS = "-S";
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB62B0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               MACOSX_DEPLOYMENT_TARGET = 10.5;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = scutil;
+                               STRIPFLAGS = "-S";
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB62C0905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PREBINDING = YES;
+                               PRODUCT_NAME = scutil;
+                               STRIPFLAGS = "-S";
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB62D0905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PREBINDING = YES;
+                               PRODUCT_NAME = scutil;
+                               STRIPFLAGS = "-S";
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB62F0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               PRODUCT_NAME = configd_executables;
+                               STRIPFLAGS = "-S";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6300905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DEAD_CODE_STRIPPING = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               PRODUCT_NAME = configd_executables;
+                               STRIPFLAGS = "-S";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6310905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEAD_CODE_STRIPPING = YES;
+                               PRODUCT_NAME = configd_executables;
+                               STRIPFLAGS = "-S";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB6330905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               PRODUCT_NAME = "configd (Aggregate)";
+                       };
+                       name = Development;
+               };
+               156EB6340905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               PRODUCT_NAME = "configd (Aggregate)";
+                       };
+                       name = Deployment;
+               };
+               156EB6350905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd (Aggregate)";
+                       };
+                       name = Default;
+               };
+               156EB63B0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = ATconfig;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB63C0905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = ATconfig;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB63D0905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = ATconfig;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               156EB63F0905594A00EEF749 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               CURRENT_PROJECT_VERSION = 204;
+                               DEAD_CODE_STRIPPING = YES;
+                               INSTALL_GROUP = wheel;
+                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
+                               INSTALL_OWNER = root;
+                               INSTALL_PATH = /usr/sbin;
+                               MACOSX_DEPLOYMENT_TARGET = 10.5;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               STRIPFLAGS = "-S";
+                               VERSIONING_SYSTEM = "apple-generic";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-four-char-constants",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               156EB6400905594A00EEF749 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               CURRENT_PROJECT_VERSION = 204;
+                               DEAD_CODE_STRIPPING = YES;
+                               INSTALL_GROUP = wheel;
+                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
+                               INSTALL_OWNER = root;
+                               INSTALL_PATH = /usr/sbin;
+                               MACOSX_DEPLOYMENT_TARGET = 10.5;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               STRIPFLAGS = "-S";
+                               VERSIONING_SYSTEM = "apple-generic";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-four-char-constants",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               156EB6410905594A00EEF749 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               CURRENT_PROJECT_VERSION = 204;
+                               DEAD_CODE_STRIPPING = YES;
+                               INSTALL_GROUP = wheel;
+                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
+                               INSTALL_OWNER = root;
+                               INSTALL_PATH = /usr/sbin;
+                               MACOSX_DEPLOYMENT_TARGET = 10.5;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               STRIPFLAGS = "-S";
+                               VERSIONING_SYSTEM = "apple-generic";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-four-char-constants",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               F95B8A620B03F83200993BA3 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = NetworkIdentification;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Development;
+               };
+               F95B8A630B03F83200993BA3 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = NetworkIdentification;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Deployment;
+               };
+               F95B8A640B03F83200993BA3 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS = "-fconstant-cfstrings";
+                               PRODUCT_NAME = NetworkIdentification;
+                               VALID_ARCHS = "ppc i386";
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Default;
+               };
+               F95B8A6D0B03F9D100993BA3 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = NetworkIdentification;
+                       };
+                       name = Development;
+               };
+               F95B8A6E0B03F9D100993BA3 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = NetworkIdentification;
+                       };
+                       name = Deployment;
+               };
+               F95B8A6F0B03F9D100993BA3 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = NetworkIdentification;
+                       };
+                       name = Default;
+               };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+               151F63DC09328A3C0096DCC9 /* Build configuration list for PBXNativeTarget "Schema" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               151F63DD09328A3C0096DCC9 /* Development */,
+                               151F63DE09328A3C0096DCC9 /* Deployment */,
+                               151F63DF09328A3C0096DCC9 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5DB0905594A00EEF749 /* Development */,
+                               156EB5DC0905594A00EEF749 /* Deployment */,
+                               156EB5DD0905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5DE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5DF0905594A00EEF749 /* Development */,
+                               156EB5E00905594A00EEF749 /* Deployment */,
+                               156EB5E10905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5E20905594A00EEF749 /* Build configuration list for PBXNativeTarget "SCHelper" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5E30905594A00EEF749 /* Development */,
+                               156EB5E40905594A00EEF749 /* Deployment */,
+                               156EB5E50905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5E60905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_base" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5E70905594A00EEF749 /* Development */,
+                               156EB5E80905594A00EEF749 /* Deployment */,
+                               156EB5E90905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5EB0905594A00EEF749 /* Development */,
+                               156EB5EC0905594A00EEF749 /* Deployment */,
+                               156EB5ED0905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5EF0905594A00EEF749 /* Development */,
+                               156EB5F00905594A00EEF749 /* Deployment */,
+                               156EB5F10905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5F20905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5F30905594A00EEF749 /* Development */,
+                               156EB5F40905594A00EEF749 /* Deployment */,
+                               156EB5F50905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5F70905594A00EEF749 /* Development */,
+                               156EB5F80905594A00EEF749 /* Deployment */,
+                               156EB5F90905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5FA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5FB0905594A00EEF749 /* Development */,
+                               156EB5FC0905594A00EEF749 /* Deployment */,
+                               156EB5FD0905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB5FF0905594A00EEF749 /* Development */,
+                               156EB6000905594A00EEF749 /* Deployment */,
+                               156EB6010905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB6030905594A00EEF749 /* Development */,
+                               156EB6040905594A00EEF749 /* Deployment */,
+                               156EB6050905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB6060905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB6070905594A00EEF749 /* Development */,
+                               156EB6080905594A00EEF749 /* Deployment */,
+                               156EB6090905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB60B0905594A00EEF749 /* Development */,
+                               156EB60C0905594A00EEF749 /* Deployment */,
+                               156EB60D0905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB60F0905594A00EEF749 /* Development */,
+                               156EB6100905594A00EEF749 /* Deployment */,
+                               156EB6110905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB6120905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB6130905594A00EEF749 /* Development */,
+                               156EB6140905594A00EEF749 /* Deployment */,
+                               156EB6150905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB6170905594A00EEF749 /* Development */,
+                               156EB6180905594A00EEF749 /* Deployment */,
+                               156EB6190905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB61A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB61B0905594A00EEF749 /* Development */,
+                               156EB61C0905594A00EEF749 /* Deployment */,
+                               156EB61D0905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB61F0905594A00EEF749 /* Development */,
+                               156EB6200905594A00EEF749 /* Deployment */,
+                               156EB6210905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB6220905594A00EEF749 /* Build configuration list for PBXNativeTarget "configd" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB6230905594A00EEF749 /* Development */,
+                               156EB6240905594A00EEF749 /* Deployment */,
+                               156EB6250905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB6260905594A00EEF749 /* Build configuration list for PBXNativeTarget "scselect" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB6270905594A00EEF749 /* Development */,
+                               156EB6280905594A00EEF749 /* Deployment */,
+                               156EB6290905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB62A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "scutil" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB62B0905594A00EEF749 /* Development */,
+                               156EB62C0905594A00EEF749 /* Deployment */,
+                               156EB62D0905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB62E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_executables" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB62F0905594A00EEF749 /* Development */,
+                               156EB6300905594A00EEF749 /* Deployment */,
+                               156EB6310905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB6320905594A00EEF749 /* Build configuration list for PBXAggregateTarget "All" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB6330905594A00EEF749 /* Development */,
+                               156EB6340905594A00EEF749 /* Deployment */,
+                               156EB6350905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB63A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB63B0905594A00EEF749 /* Development */,
+                               156EB63C0905594A00EEF749 /* Deployment */,
+                               156EB63D0905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156EB63F0905594A00EEF749 /* Development */,
+                               156EB6400905594A00EEF749 /* Deployment */,
+                               156EB6410905594A00EEF749 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               F95B8A620B03F83200993BA3 /* Development */,
+                               F95B8A630B03F83200993BA3 /* Deployment */,
+                               F95B8A640B03F83200993BA3 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               F95B8A6C0B03F9D100993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               F95B8A6D0B03F9D100993BA3 /* Development */,
+                               F95B8A6E0B03F9D100993BA3 /* Deployment */,
+                               F95B8A6F0B03F9D100993BA3 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+/* End XCConfigurationList section */
+       };
+       rootObject = 15CB6A7705C0722B0099E85F /* Project object */;
+}
index 89b7401236e192fe43bbe12759d953b61afaa92c..82e0c30286ad5093aaf2d651d655d3308b0cae89 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 #define DEFAULT_SEARCH_ORDER    200000   /* search order for the "default" resolver domain name */
 
 
 #define DEFAULT_SEARCH_ORDER    200000   /* search order for the "default" resolver domain name */
 
+#define        DNS_PTR(type, name)                             \
+       union {                                         \
+               type            name;                   \
+               uint64_t        _ ## name ## _p;        \
+       }
 
 
+#define        DNS_VAR(type, name)                             \
+       type    name
+
+
+#pragma pack(4)
 typedef struct {
        struct in_addr  address;
        struct in_addr  mask;
 } dns_sortaddr_t;
 typedef struct {
        struct in_addr  address;
        struct in_addr  mask;
 } dns_sortaddr_t;
+#pragma pack()
 
 
 
 
+#pragma pack(4)
 typedef struct {
 typedef struct {
-       char            *domain;        /* domain */
-       int32_t         n_nameserver;   /* # nameserver */
-       struct sockaddr **nameserver;
-       uint16_t        port;           /* port (in host byte order) */
-       int32_t         n_search;       /* # search */
-       char            **search;
-       int32_t         n_sortaddr;     /* # sortaddr */
-       dns_sortaddr_t  **sortaddr;
-       char            *options;       /* options */
-       uint32_t        timeout;        /* timeout */
-       uint32_t        search_order;   /* search_order */
-       void            *reserved[8];
+       DNS_PTR(char *,                 domain);        /* domain */
+       DNS_VAR(int32_t,                n_nameserver);  /* # nameserver */
+       DNS_PTR(struct sockaddr **,     nameserver);
+       DNS_VAR(uint16_t,               port);          /* port (in host byte order) */
+       DNS_VAR(int32_t,                n_search);      /* # search */
+       DNS_PTR(char **,                search);
+       DNS_VAR(int32_t,                n_sortaddr);    /* # sortaddr */
+       DNS_PTR(dns_sortaddr_t **,      sortaddr);
+       DNS_PTR(char *,                 options);       /* options */
+       DNS_VAR(uint32_t,               timeout);       /* timeout */
+       DNS_VAR(uint32_t,               search_order);  /* search_order */
+       DNS_VAR(uint32_t,               reserved[8]);
 } dns_resolver_t;
 } dns_resolver_t;
+#pragma pack()
 
 
 
 
+#pragma pack(4)
 typedef struct {
 typedef struct {
-       int32_t         n_resolver;     /* resolver configurations */
-       dns_resolver_t  **resolver;
-       void            *reserved[8];
+       DNS_VAR(int32_t,                n_resolver);    /* resolver configurations */
+       DNS_PTR(dns_resolver_t **,      resolver);
+       DNS_VAR(uint32_t,               reserved[8]);
 } dns_config_t;
 } dns_config_t;
+#pragma pack()
 
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
@@ -74,8 +89,8 @@ __BEGIN_DECLS
 /*
  * DNS configuration access APIs
  */
 /*
  * DNS configuration access APIs
  */
-const char *   dns_configuration_notify_key    ()                      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-dns_config_t * dns_configuration_copy          ()                      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+const char *   dns_configuration_notify_key    (void)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+dns_config_t * dns_configuration_copy          (void)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 void           dns_configuration_free          (dns_config_t *config)  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
 __END_DECLS
 void           dns_configuration_free          (dns_config_t *config)  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
 __END_DECLS
index 882b697b9d83b6e729b63c0a9e5bd0d186ad8676..b5ed70d3242c5fb4af556c0e75222c3e694cc1c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -123,7 +123,7 @@ expand_resolver(_dns_resolver_buf_t *buf, uint32_t n_buf, void **padding, uint32
        if (!add_list(padding,
                      n_padding,
                      resolver->n_nameserver,
        if (!add_list(padding,
                      n_padding,
                      resolver->n_nameserver,
-                     sizeof(struct sockaddr *),
+                     sizeof(DNS_PTR(struct sockaddr *, x)),
                      (void **)&resolver->nameserver)) {
                goto error;
        }
                      (void **)&resolver->nameserver)) {
                goto error;
        }
@@ -138,7 +138,7 @@ expand_resolver(_dns_resolver_buf_t *buf, uint32_t n_buf, void **padding, uint32
        if (!add_list(padding,
                      n_padding,
                      resolver->n_search,
        if (!add_list(padding,
                      n_padding,
                      resolver->n_search,
-                     sizeof(char *),
+                     sizeof(DNS_PTR(char *, x)),
                      (void **)&resolver->search)) {
                goto error;
        }
                      (void **)&resolver->search)) {
                goto error;
        }
@@ -149,7 +149,7 @@ expand_resolver(_dns_resolver_buf_t *buf, uint32_t n_buf, void **padding, uint32
        if (!add_list(padding,
                      n_padding,
                      resolver->n_sortaddr,
        if (!add_list(padding,
                      n_padding,
                      resolver->n_sortaddr,
-                     sizeof(dns_sortaddr_t *),
+                     sizeof(DNS_PTR(dns_sortaddr_t *, x)),
                      (void **)&resolver->sortaddr)) {
                goto error;
        }
                      (void **)&resolver->sortaddr)) {
                goto error;
        }
@@ -241,7 +241,7 @@ expand_config(_dns_config_buf_t *buf)
        if (!add_list(&padding,
                      &n_padding,
                      config->n_resolver,
        if (!add_list(&padding,
                      &n_padding,
                      config->n_resolver,
-                     sizeof(dns_resolver_t *),
+                     sizeof(DNS_PTR(dns_resolver_t *, x)),
                      (void **)&config->resolver)) {
                goto error;
        }
                      (void **)&config->resolver)) {
                goto error;
        }
index 6ff9bb3c5de2044a4c0a9c6f4f6f10e3e18c2ade..f26efafd7acb002dd9f33aaf82c5dc4cb5850c2d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -123,15 +123,15 @@ _dns_configuration_add_resolver(dns_create_config_t     *_config,
         * pointers to the resolver, the nameservers, the search
         * list, and the sortaddr list.
         */
         * pointers to the resolver, the nameservers, the search
         * list, and the sortaddr list.
         */
-       padding += sizeof(dns_resolver_t *);
+       padding += sizeof(DNS_PTR(dns_resolver_t *, x));
        if (resolver->resolver.n_nameserver != 0) {
        if (resolver->resolver.n_nameserver != 0) {
-               padding += ntohl(resolver->resolver.n_nameserver) * sizeof(struct sockaddr *);
+               padding += ntohl(resolver->resolver.n_nameserver) * sizeof(DNS_PTR(struct sockaddr *, x));
        }
        if (resolver->resolver.n_search != 0) {
        }
        if (resolver->resolver.n_search != 0) {
-               padding += ntohl(resolver->resolver.n_search) * sizeof(char *);
+               padding += ntohl(resolver->resolver.n_search) * sizeof(DNS_PTR(char *, x));
        }
        if (resolver->resolver.n_sortaddr != 0) {
        }
        if (resolver->resolver.n_sortaddr != 0) {
-               padding += ntohl(resolver->resolver.n_sortaddr) * sizeof(dns_sortaddr_t *);
+               padding += ntohl(resolver->resolver.n_sortaddr) * sizeof(DNS_PTR(dns_sortaddr_t *, x));
        }
 
        config->config.n_resolver = htonl(ntohl(config->config.n_resolver) + 1);
        }
 
        config->config.n_resolver = htonl(ntohl(config->config.n_resolver) + 1);
@@ -170,7 +170,7 @@ _dns_configuration_store(dns_create_config_t *_config)
        }
 
        status = shared_dns_infoSet(server, dataRef, dataLen);
        }
 
        status = shared_dns_infoSet(server, dataRef, dataLen);
-       (void)mach_port_deallocate(mach_task_self(), server);
+       (void) mach_port_deallocate(mach_task_self(), server);
        if (status != KERN_SUCCESS) {
                mach_error("shared_dns_infoSet():", status);
                return FALSE;
        if (status != KERN_SUCCESS) {
                mach_error("shared_dns_infoSet():", status);
                return FALSE;
@@ -274,7 +274,7 @@ _dns_resolver_add_nameserver(dns_create_resolver_t *_resolver, struct sockaddr *
 
 __private_extern__
 void
 
 __private_extern__
 void
-_dns_resolver_set_port(dns_create_resolver_t *_resolver, uint32_t port)
+_dns_resolver_set_port(dns_create_resolver_t *_resolver, uint16_t port)
 {
        _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
 
 {
        _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
 
index f8d019a20e6515d83bd7e3615b9b6d1e73ac87fe..77840dbc7bb22c56df4d926ea6dd9830581dbc35 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -47,7 +47,7 @@ __BEGIN_DECLS
 /*
  * DNS configuration creation APIs
  */
 /*
  * DNS configuration creation APIs
  */
-dns_create_config_t     _dns_configuration_create       ();
+dns_create_config_t     _dns_configuration_create       (void);
 void                   _dns_configuration_add_resolver (dns_create_config_t *_config, dns_create_resolver_t _resolver);
 _Bool                  _dns_configuration_store        (dns_create_config_t *_config);
 void                   _dns_configuration_free         (dns_create_config_t *_config);
 void                   _dns_configuration_add_resolver (dns_create_config_t *_config, dns_create_resolver_t _resolver);
 _Bool                  _dns_configuration_store        (dns_create_config_t *_config);
 void                   _dns_configuration_free         (dns_create_config_t *_config);
@@ -55,10 +55,10 @@ void                        _dns_configuration_free         (dns_create_config_t *_config);
 /*
  * DNS [resolver] configuration creation APIs
  */
 /*
  * DNS [resolver] configuration creation APIs
  */
-dns_create_resolver_t   _dns_resolver_create();
+dns_create_resolver_t   _dns_resolver_create           (void);
 void                   _dns_resolver_set_domain        (dns_create_resolver_t *_resolver, const char *domain);
 void                   _dns_resolver_add_nameserver    (dns_create_resolver_t *_resolver, struct sockaddr *nameserver);
 void                   _dns_resolver_set_domain        (dns_create_resolver_t *_resolver, const char *domain);
 void                   _dns_resolver_add_nameserver    (dns_create_resolver_t *_resolver, struct sockaddr *nameserver);
-void                   _dns_resolver_set_port          (dns_create_resolver_t *_resolver, uint32_t port);      // host byte order
+void                   _dns_resolver_set_port          (dns_create_resolver_t *_resolver, uint16_t port);      // host byte order
 void                   _dns_resolver_add_search        (dns_create_resolver_t *_resolver, const char *search);
 void                   _dns_resolver_add_sortaddr      (dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr);
 void                   _dns_resolver_set_options       (dns_create_resolver_t *_resolver, const char *options);
 void                   _dns_resolver_add_search        (dns_create_resolver_t *_resolver, const char *search);
 void                   _dns_resolver_add_sortaddr      (dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr);
 void                   _dns_resolver_set_options       (dns_create_resolver_t *_resolver, const char *options);
index 96663693ab9e75771473272effef464daf0aa384..d2156520d78348c3443685ff2db980c3f552ba38 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -28,6 +28,7 @@
  * - initial revision
  */
 
  * - initial revision
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <stdlib.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
@@ -67,7 +68,9 @@ _dns_configuration_server_port()
                        /* service not currently registered, try again later */
                        return MACH_PORT_NULL;
                default :
                        /* service not currently registered, try again later */
                        return MACH_PORT_NULL;
                default :
-                       mach_error("could not lookup DNS configuration info service:", status);
+                       fprintf(stderr,
+                               "could not lookup DNS configuration info service: %s\n",
+                               bootstrap_strerror(status));
                        return MACH_PORT_NULL;
        }
 
                        return MACH_PORT_NULL;
        }
 
index 5e6ac0e5a04f8c2622eebd4e052ec4d7edf8cfed..03d50f3cc57bb560923deb49b3648c2c75d500b8 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -159,32 +159,38 @@ enum {
 };
 
 
 };
 
 
+#pragma pack(4)
 typedef struct {
        uint32_t        type;
        uint32_t        length;
        uint8_t         attribute[0];
 } dns_attribute_t;
 typedef struct {
        uint32_t        type;
        uint32_t        length;
        uint8_t         attribute[0];
 } dns_attribute_t;
+#pragma pack()
 
 
 
 
+#pragma pack(4)
 typedef struct {
        dns_config_t    config;
        uint32_t        n_attribute;
        uint32_t        n_padding;
        uint8_t         attribute[0];
 } _dns_config_buf_t;
 typedef struct {
        dns_config_t    config;
        uint32_t        n_attribute;
        uint32_t        n_padding;
        uint8_t         attribute[0];
 } _dns_config_buf_t;
+#pragma pack()
 
 
 
 
+#pragma pack(4)
 typedef struct {
        dns_resolver_t  resolver;
        uint32_t        n_attribute;
        uint8_t         attribute[0];
 } _dns_resolver_buf_t;
 typedef struct {
        dns_resolver_t  resolver;
        uint32_t        n_attribute;
        uint8_t         attribute[0];
 } _dns_resolver_buf_t;
+#pragma pack()
 
 
 __BEGIN_DECLS
 
 
 
 __BEGIN_DECLS
 
-const char *    _dns_configuration_notify_key()                AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-mach_port_t    _dns_configuration_server_port()        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+const char *    _dns_configuration_notify_key  (void)  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+mach_port_t    _dns_configuration_server_port  (void)  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
 
 __END_DECLS
 
 
 __END_DECLS
 
index a87dd5877dfc4f6e959c64680dc1d4ec3f287dc3..17c5560cc3f95b870177a8f7f234d0ee418a3f21 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <servers/bootstrap.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <servers/bootstrap.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
+#include <bsm/libbsm.h>
+
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include "dnsinfo_server.h"
 #include "dnsinfo_private.h"
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include "dnsinfo_server.h"
 #include "dnsinfo_private.h"
 
-#include "session.h"
-
 static CFDataRef       shared_dns_info         = NULL;
 
 __private_extern__
 static CFDataRef       shared_dns_info         = NULL;
 
 __private_extern__
@@ -65,11 +65,14 @@ _shared_dns_infoGet(mach_port_t server, dnsDataOut_t *dataRef, mach_msg_type_num
 
 __private_extern__
 kern_return_t
 
 __private_extern__
 kern_return_t
-_shared_dns_infoSet(mach_port_t server, dnsData_t dataRef, mach_msg_type_number_t dataLen)
+_shared_dns_infoSet(mach_port_t                        server,
+                   dnsData_t                   dataRef,
+                   mach_msg_type_number_t      dataLen,
+                   audit_token_t               audit_token)
 {
 {
+       uid_t                   euid            = 0;
        CFDataRef               new_dns_info    = NULL;
        const char              *notify_key;
        CFDataRef               new_dns_info    = NULL;
        const char              *notify_key;
-       serverSessionRef        mySession       = getSession(server);
 
        if ((dataRef != NULL) && (dataLen > 0)) {
                if (!_SCUnserializeData(&new_dns_info, (void *)dataRef, dataLen)) {
 
        if ((dataRef != NULL) && (dataLen > 0)) {
                if (!_SCUnserializeData(&new_dns_info, (void *)dataRef, dataLen)) {
@@ -77,10 +80,26 @@ _shared_dns_infoSet(mach_port_t server, dnsData_t dataRef, mach_msg_type_number_
                }
        }
 
                }
        }
 
-       if (mySession->callerEUID != 0) {
+       audit_token_to_au32(audit_token,
+                           NULL,       // auidp
+                           &euid,      // euid
+                           NULL,       // egid
+                           NULL,       // ruid
+                           NULL,       // rgid
+                           NULL,       // pid
+                           NULL,       // asid
+                           NULL);      // tid
+       if (euid != 0) {
                goto error;
        }
 
                goto error;
        }
 
+       if ((shared_dns_info != NULL) &&
+           (new_dns_info    != NULL) &&
+           CFEqual(shared_dns_info, new_dns_info)) {
+               CFRelease(new_dns_info);
+               return KERN_SUCCESS;
+       }
+
        if (shared_dns_info != NULL) CFRelease(shared_dns_info);
        shared_dns_info = new_dns_info;
 
        if (shared_dns_info != NULL) CFRelease(shared_dns_info);
        shared_dns_info = new_dns_info;
 
index 9bddeb0680f110cf8f749361c78e82b70660aee5..d3f12836a1bcabce24cb4727c38838235faaf2be 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -38,8 +38,9 @@ kern_return_t _shared_dns_infoGet     (mach_port_t            server,
 
 kern_return_t  _shared_dns_infoSet     (mach_port_t            server,
                                         dnsData_t              dataRef,
 
 kern_return_t  _shared_dns_infoSet     (mach_port_t            server,
                                         dnsData_t              dataRef,
-                                        mach_msg_type_number_t dataLen);
+                                        mach_msg_type_number_t dataLen,
+                                        audit_token_t          audit_token);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* !_S_DNSINFO_SERVER_H */
+#endif /* !_S_DNSINFO_SERVER_H */
index 9f12a185de37443a6eca7222bbbf334abd670152..fa22f5d813cc2127fb5122b0e027b3b0c520952b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -56,4 +56,5 @@ routine shared_dns_infoGet    (       server          : mach_port_t;
                                 out    data            : dnsDataOut, dealloc);
 
 routine shared_dns_infoSet     (       server          : mach_port_t;
                                 out    data            : dnsDataOut, dealloc);
 
 routine shared_dns_infoSet     (       server          : mach_port_t;
-                                       data            : dnsData);
+                                       data            : dnsData;
+                   ServerAuditToken    audit_token     : audit_token_t);
index e4fe4b679524303c20fd15580a999a963b2091da..f28f2c3375c4529fead08680a4be51d3195a4ae1 100644 (file)
@@ -32,6 +32,9 @@
 #endif
 #define mig_external __private_extern__
 
 #endif
 #define mig_external __private_extern__
 
+/* Turn MIG type checking on by default */
+#define __MigTypeCheck 1
+
 /*
  * Mach server port name
  */
 /*
  * Mach server port name
  */
@@ -48,4 +51,4 @@ typedef const char * dnsData_t;
  */
 typedef char * dnsDataOut_t;
 
  */
 typedef char * dnsDataOut_t;
 
-#endif /* !_SHARED_DNS_INFO_TYPES_H */
+#endif /* !_SHARED_DNS_INFO_TYPES_H */
index 403b317c8515d53f21c853bc00e01197ddb43cbe..c7e15964a1479f6d26b277a8d91b633aefa1af78 100755 (executable)
@@ -1,11 +1,11 @@
 #!/bin/sh
 #!/bin/sh
+# Copyright (c) 2004-2007 Apple Inc.
+#
 # get-mobility-info
 #
 # Collect system & network configuration information.
 #
 
 # get-mobility-info
 #
 # Collect system & network configuration information.
 #
 
-OUT=mobility-config-$$
-
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
 PRIV=""
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
 PRIV=""
@@ -13,23 +13,43 @@ if [ ${EUID} -ne 0 ]; then
        PRIV="sudo"
 fi
 
        PRIV="sudo"
 fi
 
-cd /tmp
-mkdir ${OUT}
+OUT="mobility-info-`date +'%m.%d.%Y.%H%M%S'`"
+OUTDIR="/var/tmp"
+if [ -d ~/Desktop ]; then
+       OUTDIR=~/Desktop
+fi
+
+umask 077
+
+WORKDIR=`mktemp -d -q "/tmp/${OUT}"`
+if [ $? -ne 0 ]; then
+       echo "Could not create snapshot directory"
+       exit 1
+fi
+
+ARCHIVE=`mktemp -q "${OUTDIR}/${OUT}.tar.gz"`
+if [ $? -ne 0 ]; then
+       echo "Could not create snapshot archive"
+       rm -rf "${WORKDIR}"
+       exit 1
+fi
+
+cd "${WORKDIR}"
 
 #
 # processes
 #
 
 #
 # processes
 #
-ps axlww                                               > ${OUT}/ps                     2>&1
+ps axlww                                               > ps                    2>&1
 
 #
 # network interface configuration
 #
 
 #
 # network interface configuration
 #
-ifconfig -a -b                                         > ${OUT}/ifconfig               2>&1
+ifconfig -a -b                                         > ifconfig              2>&1
 
 #
 # network route configuration
 #
 
 #
 # network route configuration
 #
-netstat -n -r                                          >> ${OUT}/netstat               2>&1
+netstat -n -r -a -l                                    > netstat               2>&1
 
 #
 # DHCP configuration
 
 #
 # DHCP configuration
@@ -38,54 +58,64 @@ for if in `ifconfig -l`
 do
        case ${if} in
        lo* )   ;;
 do
        case ${if} in
        lo* )   ;;
-       en* )   ipconfig getpacket ${if}                > ${OUT}/ipconfig-${if}         2>&1
+       en* )   ipconfig getpacket ${if}                > ipconfig-${if}        2>&1
                ;;
        esac
 done
 
                ;;
        esac
 done
 
+#
+# AirPort info
+#
+if [ -x /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport ]; then
+       /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --getinfo      \
+                                                       > airport               2>&1
+fi
+
 #
 # OS info
 #
 if [ -e /System/Library/CoreServices/SystemVersion.plist ]; then
        cat /System/Library/CoreServices/SystemVersion.plist    \
 #
 # OS info
 #
 if [ -e /System/Library/CoreServices/SystemVersion.plist ]; then
        cat /System/Library/CoreServices/SystemVersion.plist    \
-                                                       > ${OUT}/SystemVersion.plist    2>&1
+                                                       > SystemVersion.plist   2>&1
 fi
 if [ -e /System/Library/CoreServices/ServerVersion.plist ]; then
        cat /System/Library/CoreServices/ServerVersion.plist    \
 fi
 if [ -e /System/Library/CoreServices/ServerVersion.plist ]; then
        cat /System/Library/CoreServices/ServerVersion.plist    \
-                                                       > ${OUT}/ServerVersion.plist    2>&1
+                                                       > ServerVersion.plist   2>&1
 fi
 
 #
 # IOKit info
 #
 fi
 
 #
 # IOKit info
 #
-ioreg -l                                               > ${OUT}/ioreg                  2>&1
+ioreg -i -l -w 0                                       > ioreg                 2>&1
+
+#
+# Host name
+#
+hostname                                               > hostname              2>&1
 
 #
 # Host configuration
 #
 
 #
 # Host configuration
 #
-hostinfo                                               > ${OUT}/hostinfo               2>&1
+hostinfo                                               > hostinfo              2>&1
 if [ -e /etc/hostconfig ]; then
 if [ -e /etc/hostconfig ]; then
-       cat /etc/hostconfig                             > ${OUT}/etc.hostconfig         2>&1
+       cat /etc/hostconfig                             > etc.hostconfig        2>&1
 fi
 
 #
 # DNS configuration
 #
 fi
 
 #
 # DNS configuration
 #
-scutil --dns                                           > ${OUT}/dns-configuration      2>&1
+scutil --dns                                           > dns-configuration     2>&1
 if [ -e /etc/resolv.conf ]; then
 if [ -e /etc/resolv.conf ]; then
-       cat /etc/resolv.conf                            > ${OUT}/etc.resolv.conf        2>&1
+       cat /etc/resolv.conf                            > etc.resolv.conf       2>&1
 fi
 if [ -e /var/run/resolv.conf ]; then
 fi
 if [ -e /var/run/resolv.conf ]; then
-       cat /var/run/resolv.conf                        > ${OUT}/var.run.resolv.conf    2>&1
+       cat /var/run/resolv.conf                        > var.run.resolv.conf   2>&1
 fi
 
 #
 fi
 
 #
-# NetInfo configuration
+# Proxy configuration
 #
 #
-niutil -statistics .                                   > ${OUT}/netinfo-statistics     2>&1
-if [ -f /var/run/niconfig_local.xml ]; then
-       cat /var/run/niconfig_local.xml                 > ${OUT}/niconfig_local.xml     2>&1
-fi
+scutil --proxy                                         > proxy-configuration   2>&1
 
 #
 # System / network preferences
 
 #
 # System / network preferences
@@ -95,13 +125,15 @@ for f in                                                                           \
        /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist        \
        /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist    \
        /Library/Preferences/SystemConfiguration/com.apple.nat.plist                    \
        /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist        \
        /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist    \
        /Library/Preferences/SystemConfiguration/com.apple.nat.plist                    \
+       /Library/Preferences/SystemConfiguration/com.apple.network.identification.plist \
+       /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist             \
        /Library/Preferences/SystemConfiguration/preferences.plist                      \
        /Library/Preferences/com.apple.sharing.firewall.plist                           \
 
 do
        /Library/Preferences/SystemConfiguration/preferences.plist                      \
        /Library/Preferences/com.apple.sharing.firewall.plist                           \
 
 do
-       if [ -e ${f} ]; then
-               b=`basename $f`
-               cat ${f}                                > ${OUT}/${b}                   2>&1
+       if [ -e "${f}" ]; then
+               b="`basename ${f}`"
+               cat "${f}"                              > "${b}"                2>&1
        fi
 done
 
        fi
 done
 
@@ -114,123 +146,355 @@ snapshot
 quit
 _END_OF_INPUT
 if [ -f /var/tmp/configd-store.xml ]; then
 quit
 _END_OF_INPUT
 if [ -f /var/tmp/configd-store.xml ]; then
-       cp /var/tmp/configd-store.xml                   ${OUT}/configd-store.xml
+       cat /var/tmp/configd-store.xml                  > configd-store.xml     2>&1
 fi
 if [ -f /var/tmp/configd-pattern.xml ]; then
 fi
 if [ -f /var/tmp/configd-pattern.xml ]; then
-       cp /var/tmp/configd-pattern.xml                 ${OUT}/configd-pattern.xml
+       cat /var/tmp/configd-pattern.xml                > configd-pattern.xml   2>&1
 fi
 if [ -f /var/tmp/configd-session.xml ]; then
 fi
 if [ -f /var/tmp/configd-session.xml ]; then
-       cp /var/tmp/configd-session.xml                 ${OUT}/configd-session.xml
+       cat /var/tmp/configd-session.xml                > configd-session.xml   2>&1
+fi
+if [ -f /var/tmp/configd-state ]; then
+       cat /var/tmp/configd-state                      > configd-state         2>&1
 fi
 
 #
 # network reachability
 #
 fi
 
 #
 # network reachability
 #
-scutil -d -v -r www.apple.com                          > ${OUT}/reachability-info      2>&1
-if [ -f /usr/bin/dig ]; then
-       dig -t any -c any www.apple.com                 > ${OUT}/dig-results            2>&1
+scutil -d -v -r www.apple.com                          > reachability-info     2>&1
+if [ -x /usr/bin/dig ]; then
+       dig -t any -c any www.apple.com                 > dig-results           2>&1
 fi
 
 #
 # mounted filesystems
 #
 fi
 
 #
 # mounted filesystems
 #
-mount                                                  > ${OUT}/mounted-filesystems    2>&1
+mount                                                  > mounted-filesystems   2>&1
 
 #
 
 #
-# system log
+# mDNSResponder info
 #
 #
-tail -1000 /var/log/system.log                         > ${OUT}/system.log
+if [ -f /var/run/mDNSResponder.pid ]; then
+       ${PRIV} kill -INFO `cat /var/run/mDNSResponder.pid`
+fi
 
 #
 
 #
-# ppp log
+# system log, early boot log messages
 #
 #
-if [ -f /var/log/ppp.log ]; then
-       cp /var/log/ppp.log                             ${OUT}/ppp.log
+${PRIV} tail -n 2000 /var/log/system.log               > system.log
+${PRIV} dmesg                                          > dmesg
+
+#
+# ppp log file(s)
+#
+scutil <<_END_OF_INPUT                         \
+| awk -F' *: *'                                        \
+    '                                          \
+     /Logfile : / {                            \
+       if (index($2, "/") == 1) { print $2 }   \
+       else { print "/var/log/ppp/" $2 }       \
+     }                                         \
+     END {                                     \
+       print "/tmp/pppotcp.log"                        \
+     }                                         \
+    '                                          \
+| sort -u                                      \
+| while read logFile
+open
+show Setup:/Network/Service/[^/]+/PPP pattern
+quit
+_END_OF_INPUT
+do
+       if [ -f "${logFile}" ]; then
+               b="`basename ${logFile}`"
+               cat "${logFile}"                        > "${b}"                2>&1
+       fi                                      
+done
+
+#
+# application firewall log
+#
+if [ -f /var/log/appfirewall.log ]; then
+       ${PRIV} tail -n 2000 /var/log/appfirewall.log   > appfirewall.log
 fi
 
 #
 # kernel extensions statistic
 #
 fi
 
 #
 # kernel extensions statistic
 #
-if   [ -f /usr/sbin/kextstat ]; then
-       kextstat                                        > ${OUT}/kextstat               2>&1
-elif [ -f /usr/sbin/kmodstat ]; then
-       kmodstat                                        > ${OUT}/kmodstat               2>&1
+if   [ -x /usr/sbin/kextstat ]; then
+       kextstat                                        > kextstat              2>&1
+elif [ -x /usr/sbin/kmodstat ]; then
+       kmodstat                                        > kmodstat              2>&1
 fi
 
 #
 # network statistics
 #
 fi
 
 #
 # network statistics
 #
-echo "#"                                               >> ${OUT}/network-statistics
-echo "# netstat -n -a -A -f inet"                      >> ${OUT}/network-statistics
-echo "#"                                               >> ${OUT}/network-statistics
-netstat -n -a -A -f inet                               >> ${OUT}/network-statistics    2>&1
-echo "#"                                               >> ${OUT}/network-statistics
-echo "# lsof -n -i -P"                                 >> ${OUT}/network-statistics
-echo "#"                                               >> ${OUT}/network-statistics
-lsof -n -i -P                                          >> ${OUT}/network-statistics    2>&1
-echo "#"                                               >> ${OUT}/network-statistics
-echo "# netstat -s"                                    >> ${OUT}/network-statistics
-echo "#"                                               >> ${OUT}/network-statistics
-netstat -s                                             >> ${OUT}/network-statistics    2>&1
-echo "#"                                               >> ${OUT}/network-statistics
-echo "# netstat -m"                                    >> ${OUT}/network-statistics
-echo "#"                                               >> ${OUT}/network-statistics
-netstat -m                                             >> ${OUT}/network-statistics    2>&1
-echo "#"                                               >> ${OUT}/network-statistics
-echo "# netstat -i -n -d"                              >> ${OUT}/network-statistics
-echo "#"                                               >> ${OUT}/network-statistics
-netstat -i -n -d                                       >> ${OUT}/network-statistics    2>&1
-echo "#"                                               >> ${OUT}/network-statistics
-echo "# ipfw -at show"                                 >> ${OUT}/network-statistics
-echo "#"                                               >> ${OUT}/network-statistics
-ipfw -at show                                          >> ${OUT}/network-statistics    2>&1
-echo "#"                                               >> ${OUT}/network-statistics
-echo "# appletalk -s"                                  >> ${OUT}/network-statistics
-echo "#"                                               >> ${OUT}/network-statistics
-appletalk -s                                           >> ${OUT}/network-statistics    2>&1
+echo "#"                                               >  network-statistics
+echo "# netstat -n -a -A -f inet"                      >> network-statistics
+echo "#"                                               >> network-statistics
+netstat -n -a -A -f inet                               >> network-statistics   2>&1
+
+echo "#"                                               >> network-statistics
+echo "# lsof -i -n -P"                                 >> network-statistics
+echo "#"                                               >> network-statistics
+${PRIV} lsof -i -n -P                                  >> network-statistics   2>&1
+
+echo "#"                                               >> network-statistics
+echo "# netstat -s"                                    >> network-statistics
+echo "#"                                               >> network-statistics
+netstat -s                                             >> network-statistics   2>&1
+
+echo "#"                                               >> network-statistics
+echo "# netstat -mmm"                                  >> network-statistics
+echo "#"                                               >> network-statistics
+netstat -mmm                                           >> network-statistics   2>&1
+
+echo "#"                                               >> network-statistics
+echo "# netstat -i -n -d"                              >> network-statistics
+echo "#"                                               >> network-statistics
+netstat -i -n -d                                       >> network-statistics   2>&1
+
+echo "#"                                               >> network-statistics
+echo "# ipfw -at show"                                 >> network-statistics
+echo "#"                                               >> network-statistics
+ipfw -at show                                          >> network-statistics   2>&1
+
+echo "#"                                               >> network-statistics
+echo "# appletalk -s"                                  >> network-statistics
+echo "#"                                               >> network-statistics
+appletalk -s                                           >> network-statistics   2>&1
 
 #
 # system usage statistics
 #
 
 #
 # system usage statistics
 #
-echo "#"                                               >  ${OUT}/system-statistics
-echo "# uptime"                                                >> ${OUT}/system-statistics
-echo "#"                                               >> ${OUT}/system-statistics
-uptime                                                 >> ${OUT}/system-statistics     2>&1
-echo "#"                                               >> ${OUT}/system-statistics
-echo "# pstat -t"                                      >> ${OUT}/system-statistics
-echo "#"                                               >> ${OUT}/system-statistics
-pstat -t                                               >> ${OUT}/system-statistics     2>&1
-echo "#"                                               >> ${OUT}/system-statistics
-echo "# sysctl -a"                                     >> ${OUT}/system-statistics
-echo "#"                                               >> ${OUT}/system-statistics
-sysctl -a                                              >> ${OUT}/system-statistics     2>&1
-echo "#"                                               >> ${OUT}/system-statistics
-echo "# zprint"                                                >> ${OUT}/system-statistics
-echo "#"                                               >> ${OUT}/system-statistics
-zprint                                                 >> ${OUT}/system-statistics     2>&1
-echo "#"                                               >> ${OUT}/system-statistics
-echo "# top -l5 -s2"                                   >> ${OUT}/system-statistics
-echo "#"                                               >> ${OUT}/system-statistics
-  echo ""
-  echo "Please wait, collecting statistics"
-  echo ""
-top -s 2 -l 5                                          >> ${OUT}/system-statistics     2>&1
+echo "#"                                               >  system-statistics
+echo "# uptime"                                                >> system-statistics
+echo "#"                                               >> system-statistics
+uptime                                                 >> system-statistics    2>&1
+
+echo "#"                                               >> system-statistics
+echo "# sysctl -a"                                     >> system-statistics
+echo "#"                                               >> system-statistics
+sysctl -a                                              >> system-statistics    2>&1
+
+echo "#"                                               >> system-statistics
+echo "# zprint"                                                >> system-statistics
+echo "#"                                               >> system-statistics
+zprint                                                 >> system-statistics    2>&1
+
+echo "#"                                               >> system-statistics
+echo "# top -l5 -s2"                                   >> system-statistics
+echo "#"                                               >> system-statistics
+echo ""
+echo "Please wait, collecting statistics"
+echo ""
+top -s 2 -l 5                                          >> system-statistics    2>&1
+
+#
+# DirectoryService info
+#
+if [ -x /usr/bin/dscacheutil ]; then
+       echo "#"                                        >  ds-info
+       echo "# dscacheutil -configuration"             >> ds-info
+       echo "#"                                        >> ds-info
+       dscacheutil -configuration                      >> ds-info              2>&1
+
+       echo "#"                                        >> ds-info
+       echo "# dscacheutil -statistics"                >> ds-info
+       echo "#"                                        >> ds-info
+       dscacheutil -statistics                         >> ds-info              2>&1
+
+       echo "#"                                        >> ds-info
+       echo "# dscacheutil -cachedump -entries"        >> ds-info
+       echo "#"                                        >> ds-info
+       dscacheutil -cachedump -entries                 >> ds-info              2>&1
+fi
+
+#
+# IPsec configuration
+#
+echo "#"                                               >  ipsec
+echo "# setkey -D"                                     >> ipsec
+echo "#"                                               >> ipsec
+${PRIV} setkey -D                                      \
+| perl -nle '
+       if (/^(\s+[AE]:\s+\S+\s+)"?(.*)"?\s*$/) {
+               chop($sha1=`echo "$2" | openssl sha1`);
+               printf "%s[SHA-1:%s]\n", $1, $sha1;
+       } else {
+               printf "%s\n", $_;
+       }
+'                                                      >> ipsec
+
+echo ""                                                        >> ipsec
+echo "#"                                               >> ipsec
+echo "# setkey -Pp -D"                                 >> ipsec
+echo "#"                                               >> ipsec
+${PRIV} setkey -Pp -D                                  >> ipsec
+
+for CF in /etc/racoon/remote/*.conf
+do
+       echo ""                                         >> ipsec
+       echo "#"                                        >> ipsec
+       echo "# ${CF}"                                  >> ipsec
+       echo "#"                                        >> ipsec
+       ${PRIV} cat ${CF}                               \
+       | perl -nle '
+               if (/^(\s+shared_secret\s+use\s+)"?([^\s;"]+)"?(.*)/) {
+                       chop($sha1=`echo "$2" | openssl sha1`);
+                       printf "%s[SHA-1:%s]%s\n", $1, $sha1, $3;
+               } else {
+                       printf "%s\n", $_;
+               }
+       '                                               >> ipsec
+done
+
+#
+# Kerberos configuration
+#
+echo "#"                                               >  kerberos
+echo "# klist -e -c -A -f -a -n"                       >> kerberos
+echo "#"                                               >> kerberos
+${PRIV} klist -e -c -A -f -a -n                                >> kerberos
+
+echo "#"                                               >> kerberos
+echo "# klist -e -k -t -K"                             >> kerberos
+echo "#"                                               >> kerberos
+${PRIV} klist -e -k -t -K                              >> kerberos
+
+#
+# BTMM configuration
+#
+DIG()
+{
+       /usr/bin/dig @pm-members.mac.com -y "${DOMAIN}:${TSIG}" +short "${1}" "${2}"
+}
+
+scutil <<_END_OF_INPUT                                 \
+| sed -n 's@.* : *\(.*\.members\.mac\.com\)$@\1@p'     \
+| sort                                                 \
+| while read DOMAIN
+open
+show Setup:/Network/BackToMyMac
+quit
+_END_OF_INPUT
+do
+       echo ""                                                 >> btmm
+       echo "${DOMAIN}"                                        >> btmm
+
+       # lookup TSIG in base64 format
+       TSIG=`                                                          \
+               ${PRIV} security find-generic-password                  \
+                       -a ${DOMAIN}                                    \
+                       -g /Library/Keychains/System.keychain 2>&1      \
+               | grep "^password: "                                    \
+               | cut -d '"' -f 2                                       \
+               | cut -d '\' -f 1                                       \
+            `
+       if [ -z "$TSIG" ]; then
+               echo "  No TSIG in system keychain."            >> btmm
+               continue
+       fi
+       if [ `echo "$TSIG" | wc -l` -ne 1 ] ; then
+               echo "  More than one TSIG in system keychain." >> btmm
+               continue
+       fi
+
+       for TYPE in                     \
+               _afpovertcp._tcp        \
+               _airport._tcp           \
+               _adisk._tcp             \
+               _rfb._tcp               \
+               _smb._tcp               \
+               _ssh._tcp
+       do
+               DIG "${TYPE}.${DOMAIN}" ptr     \
+               | while read -r REG
+               do
+                       echo ""                                 >> btmm
+                       /bin/echo "  ${REG}"                    >> btmm
+                       echo ""                                 >> btmm
+
+                       INF_Q=`/bin/echo "${REG}" | sed -e "s/${TYPE}/_device-info._tcp/"`
+                       INF=`DIG "${INF_Q}" txt`
+                       echo "    INF: ${INF}"                  >> btmm
+
+                       SRV=`DIG ${REG} srv`
+                       SRV1=`/bin/echo "${SRV}" | head -1`
+                       echo "    SRV: ${SRV1}"                 >> btmm
+                       SRV2=`/bin/echo "${SRV}" | tail +2`
+                       if [ -n "${SRV2}" ]; then
+                               SRV="${SRV1}"
+                               /bin/echo "${SRV2}"             \
+                               | sed -e 's/^/  *****: /'       >> btmm
+                       fi
+
+                       TXT=`DIG ${REG} txt`
+                       TXT1=`/bin/echo "${TXT}" | head -1`
+                       echo "    TXT: ${TXT1}"                 >> btmm
+                       TXT2=`/bin/echo "${TXT}" | tail +2`
+                       if [ -n "${TXT2}" ]; then
+                               /bin/echo "${TXT2}"             \
+                               | sed -e 's/^/  *****: /'       >> btmm
+                       fi
+
+                       HOST=`/bin/echo "${SRV}" | cut -d ' ' -f 4-`
+                       V4=`DIG ${HOST} a`
+                       if [ -n "${V4}" ]; then
+                               echo "     v4: ${V4}"           >> btmm
+                       fi
+                       V6=`DIG ${HOST} aaaa`
+                       if [ -n "${V6}" ]; then
+                               echo "     v6: ${V6}"           >> btmm
+                       fi
+
+                       KRB=`DIG _kerberos.${HOST} txt`
+                       echo "    KRB: ${KRB}"                  >> btmm
+
+                       TUN=`DIG _autotunnel._udp.${HOST} srv`
+                       echo "    TUN: ${TUN}"                  >> btmm
+
+                       HOST=`/bin/echo "${TUN}" | cut -d ' ' -f 4-`
+                       V4=`DIG ${HOST} a`
+                       if [ -n "${V4}" ]; then
+                               echo "     v4: ${V4}"           >> btmm
+                       fi
+                       V6=`DIG ${HOST} aaaa`
+                       if [ -n "${V6}" ]; then
+                               echo "     v6: ${V6}"           >> btmm
+                       fi
+               done
+       done
+done
 
 #
 # collect crash reports
 #
 
 #
 # collect crash reports
 #
+CRASH_DIR=/Library/Logs/CrashReporter
 for daemon in bootpd configd pppd
 do
 for daemon in bootpd configd pppd
 do
-       LOG=${daemon}.crash.log
-       if [ -e /Library/Logs/CrashReporter/${LOG} ]; then
-               cat /Library/Logs/CrashReporter/${LOG}  > ${OUT}/${LOG}                 2>&1
-       fi
+       /bin/ls -1 ${CRASH_DIR}/${daemon}_*.crash 2>/dev/null   \
+       | while read log
+       do
+               b="`basename ${log}`"
+               ${PRIV} cat "${log}"                    > "${b}"                2>&1
+       done
 done
 
 #
 # collect everything into a single archive
 #
 done
 
 #
 # collect everything into a single archive
 #
-tar cfz ${OUT}.tar.gz ${OUT}
-rm -rf ${OUT}
+cd "${WORKDIR}/.."
+tar cfz "${ARCHIVE}" "${OUT}"
+rm -rf "${WORKDIR}"
+
+if [ ${UID} -eq 0 ]; then
+       if [ -n "${SUDO_UID}" -a -n "${SUDO_GID}" ]; then
+               if [ ${UID} -ne ${SUDO_UID} ]; then
+                       chown ${SUDO_UID}:${SUDO_GID} "${ARCHIVE}"
+               fi
+       fi
+fi
 
 
-echo "Network data collected to /tmp/${OUT}.tar.gz"
+echo "Network data collected to \"${ARCHIVE}\""
index d25e57a7762ef98a246a76cab4bb99eb890d7ef3..11d7d027754710daeff07c6fdd9bb53230e0426e 100644 (file)
                                                        <string>0</string>
                                                </array>
                                        </dict>
                                                        <string>0</string>
                                                </array>
                                        </dict>
-                                       <key>NetInfo</key>
-                                       <dict>
-                                               <key>BindingMethods</key>
-                                               <array>
-                                                       <string>DHCP</string>
-                                               </array>
-                                       </dict>
                                </dict>
                                <key>Service</key>
                                <dict>
                                </dict>
                                <key>Service</key>
                                <dict>
index c4c56457dd15f96dcc7544c97c552de2cb137fa4..e0f3edad262e0a2dc2092c8d5a719d254176b632 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .Dd November 4, 2003
 .Dt SCSELECT 8
 .\"
 .Dd November 4, 2003
 .Dt SCSELECT 8
-.Os Mac OS X
+.Os "Mac OS X"
 .Sh NAME
 .Nm scselect
 .Nd Select system configuration
 .Sh NAME
 .Nm scselect
 .Nd Select system configuration
index 9dac36a4dd0f3c1f357554c345764db73fd5b634..e490e832797932cd83abfa1c6585ea8c402da2fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -41,9 +41,8 @@
 #include <sysexits.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sysexits.h>
 #include <sys/param.h>
 #include <sys/types.h>
-#include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
-#include <mach-o/dyld.h>
+#include <dlfcn.h>
 #include <grp.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <grp.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
@@ -106,19 +105,19 @@ isAdmin()
 
 static void *
 __loadSecurity(void) {
 
 static void *
 __loadSecurity(void) {
-       static const void *image = NULL;
+       static void *image = NULL;
        if (NULL == image) {
        if (NULL == image) {
-               const char      *framework              = "/System/Library/Frameworks/Security.framework/Security";
+               const char      *framework              = "/System/Library/Frameworks/Security.framework/Versions/A/Security";
                struct stat     statbuf;
                const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
                char            path[MAXPATHLEN];
 
                struct stat     statbuf;
                const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
                char            path[MAXPATHLEN];
 
-               strcpy(path, framework);
-               if (suffix) strcat(path, suffix);
+               strlcpy(path, framework, sizeof(path));
+               if (suffix) strlcat(path, suffix, sizeof(path));
                if (0 <= stat(path, &statbuf)) {
                if (0 <= stat(path, &statbuf)) {
-                       image = NSAddImage(path, NSADDIMAGE_OPTION_NONE);
+                       image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
                } else {
                } else {
-                       image = NSAddImage(framework, NSADDIMAGE_OPTION_NONE);
+                       image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
                }
        }
        return (void *)image;
                }
        }
        return (void *)image;
@@ -128,10 +127,11 @@ __loadSecurity(void) {
 static OSStatus
 _SessionGetInfo(SecuritySessionId session, SecuritySessionId *sessionId, SessionAttributeBits *attributes)
 {
 static OSStatus
 _SessionGetInfo(SecuritySessionId session, SecuritySessionId *sessionId, SessionAttributeBits *attributes)
 {
-       static OSStatus (*dyfunc)(SecuritySessionId, SecuritySessionId *, SessionAttributeBits *) = NULL;
+       #undef SessionGetInfo
+       static typeof (SessionGetInfo) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
        if (!dyfunc) {
                void *image = __loadSecurity();
-               if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_SessionGetInfo", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND));
+               if (image) dyfunc = dlsym(image, "SessionGetInfo");
        }
        return dyfunc ? dyfunc(session, sessionId, attributes) : -1;
 }
        }
        return dyfunc ? dyfunc(session, sessionId, attributes) : -1;
 }
index 74a71274f3516a8ddc819123c08dc1c9b73ebef3..84d96d28e633c337a5127a484ca50b880a91d267 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -61,7 +61,7 @@ do_list(int argc, char **argv)
 
        list = SCDynamicStoreCopyKeyList(store, pattern);
        CFRelease(pattern);
 
        list = SCDynamicStoreCopyKeyList(store, pattern);
        CFRelease(pattern);
-       if (!list) {
+       if (list == NULL) {
                if (SCError() != kSCStatusOK) {
                        SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
                } else {
                if (SCError() != kSCStatusOK) {
                        SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
                } else {
@@ -128,7 +128,7 @@ do_get(int argc, char **argv)
        key      = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        newValue = SCDynamicStoreCopyValue(store, key);
        CFRelease(key);
        key      = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        newValue = SCDynamicStoreCopyValue(store, key);
        CFRelease(key);
-       if (!newValue) {
+       if (newValue == NULL) {
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
                return;
        }
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
                return;
        }
@@ -148,7 +148,7 @@ do_set(int argc, char **argv)
 {
        CFStringRef     key;
 
 {
        CFStringRef     key;
 
-       key    = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+       key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        if (!SCDynamicStoreSetValue(store, key, value)) {
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
        }
        if (!SCDynamicStoreSetValue(store, key, value)) {
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
        }
@@ -177,7 +177,7 @@ do_show(int argc, char **argv)
        }
 
        CFRelease(key);
        }
 
        CFRelease(key);
-       if (!newValue) {
+       if (newValue == NULL) {
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
                return;
        }
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
                return;
        }
@@ -194,7 +194,7 @@ do_remove(int argc, char **argv)
 {
        CFStringRef     key;
 
 {
        CFStringRef     key;
 
-       key    = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+       key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        if (!SCDynamicStoreRemoveValue(store, key)) {
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
        }
        if (!SCDynamicStoreRemoveValue(store, key)) {
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
        }
@@ -209,7 +209,7 @@ do_notify(int argc, char **argv)
 {
        CFStringRef     key;
 
 {
        CFStringRef     key;
 
-       key    = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+       key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        if (!SCDynamicStoreNotifyValue(store, key)) {
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
        }
        if (!SCDynamicStoreNotifyValue(store, key)) {
                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
        }
index ed4be7e95962b22cd27060a0464307abc03fa1ee..acace785088d5ebd5787f1e6a5d37fc7f7c5b765 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 5a9046546c75c74658a8c85793a90a8ff6c7d945..0b20ebfcb11f28077d35b1dc6e629203aee287e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -43,6 +43,7 @@
 #include "notifications.h"
 #include "tests.h"
 #include "net.h"
 #include "notifications.h"
 #include "tests.h"
 #include "net.h"
+#include "prefs.h"
 
 #include "SCDynamicStoreInternal.h"
 
 
 #include "SCDynamicStoreInternal.h"
 
@@ -82,7 +83,7 @@ const cmdInfo commands_store[] = {
        { "d.remove",   1,      1,      do_dictRemoveKey,       1,      0,
                " d.remove key                  : remove key from dictionary"                   },
 
        { "d.remove",   1,      1,      do_dictRemoveKey,       1,      0,
                " d.remove key                  : remove key from dictionary"                   },
 
-       /* data store manipulation commands */
+       /* dynamic store manipulation commands */
 
        { "open",       0,      1,      do_open,                2,      1,
                " open [\"temporary\"]            : open a session with \"configd\""            },
 
        { "open",       0,      1,      do_open,                2,      1,
                " open [\"temporary\"]            : open a session with \"configd\""            },
@@ -91,10 +92,10 @@ const cmdInfo commands_store[] = {
                " close                         : close current \"configd\" session"            },
 
        { "lock",       0,      0,      do_lock,                3,      1,
                " close                         : close current \"configd\" session"            },
 
        { "lock",       0,      0,      do_lock,                3,      1,
-               " lock                          : secures write access to data store"           },
+               " lock                          : locks write access to data store"             },
 
        { "unlock",     0,      0,      do_unlock,              3,      1,
 
        { "unlock",     0,      0,      do_unlock,              3,      1,
-               " unlock                        : secures write access to data store"           },
+               " unlock                        : unlocks write access to data store"           },
 
        { "list",       0,      2,      do_list,                4,      0,
                " list [pattern]                : list keys in data store"                      },
 
        { "list",       0,      2,      do_list,                4,      0,
                " list [pattern]                : list keys in data store"                      },
@@ -106,7 +107,7 @@ const cmdInfo commands_store[] = {
                " get key                       : get dict from data store w/key"               },
 
        { "set",        1,      1,      do_set,                 4,      0,
                " get key                       : get dict from data store w/key"               },
 
        { "set",        1,      1,      do_set,                 4,      0,
-               " set key                         : set key in data store w/current dict"       },
+               " set key                       : set key in data store w/current dict"         },
 
        { "show",       1,      2,      do_show,                4,      0,
                " show key [\"pattern\"]          : show values in data store w/key"            },
 
        { "show",       1,      2,      do_show,                4,      0,
                " show key [\"pattern\"]          : show values in data store w/key"            },
@@ -158,7 +159,7 @@ const int nCommands_store = (sizeof(commands_store)/sizeof(cmdInfo));
 
 
 __private_extern__
 
 
 __private_extern__
-const cmdInfo commands_prefs[] = {
+const cmdInfo commands_net[] = {
        /* cmd          minArgs maxArgs func                    group   ctype                   */
        /*      usage                                                                           */
 
        /* cmd          minArgs maxArgs func                    group   ctype                   */
        /*      usage                                                                           */
 
@@ -197,11 +198,11 @@ const cmdInfo commands_prefs[] = {
                " create service [ <interfaceName> | <interface#> [ <serviceName> ]]\n"
                " create set [setName]"                                                         },
 
                " create service [ <interfaceName> | <interface#> [ <serviceName> ]]\n"
                " create set [setName]"                                                         },
 
-       { "disable",    1,      2,      do_net_disable,         5,      0,
+       { "disable",    1,      2,      do_net_disable,         4,      0,
                " disable protocol [ <protocolType> ]\n"
                " disable service  [ <serviceName> | <service#> ]"                              },
 
                " disable protocol [ <protocolType> ]\n"
                " disable service  [ <serviceName> | <service#> ]"                              },
 
-       { "enable",     1,      2,      do_net_enable,          4,      0,
+       { "enable",     1,      2,      do_net_enable,          5,      0,
                " enable protocol  [ <protocolType> ]\n"
                " enable service   [ <serviceName> | <service#> ]"                              },
 
                " enable protocol  [ <protocolType> ]\n"
                " enable service   [ <serviceName> | <service#> ]"                              },
 
@@ -232,11 +233,86 @@ const cmdInfo commands_prefs[] = {
                " show sets\n\n"
                " show set       [ <setName> | <set#> ]"                                        },
 
                " show sets\n\n"
                " show set       [ <setName> | <set#> ]"                                        },
 
+       { "update",     0,      1,      do_net_update,          10,     0,
+               " update                        : update the network configuration"             },
+
        { "snapshot",   0,      0,      do_net_snapshot,        99,     2,
                " snapshot"                                                                     }
 
 };
 __private_extern__
        { "snapshot",   0,      0,      do_net_snapshot,        99,     2,
                " snapshot"                                                                     }
 
 };
 __private_extern__
+const int nCommands_net = (sizeof(commands_net)/sizeof(cmdInfo));
+
+
+__private_extern__
+const cmdInfo commands_prefs[] = {
+       /* cmd          minArgs maxArgs func                    group   ctype                   */
+       /*      usage                                                                           */
+
+       { "help",       0,      0,      do_help,                0,      0,
+               " help                          : list available commands"                      },
+
+       { "f.read",     1,      1,      do_readFile,            0,      0,
+               " f.read file                   : process commands from file"                   },
+
+       { "quit",       0,      1,      do_prefs_quit,          0,      0,
+               " quit [!]                      : quit"                                         },
+
+       { "q",          0,      1,      do_prefs_quit,          0,      -1,
+               NULL                                                                            },
+
+       { "exit",       0,      1,      do_prefs_quit,          0,      -1,
+               NULL                                                                            },
+
+       /* local dictionary manipulation commands */
+
+       { "d.init",     0,      0,      do_dictInit,            1,      0,
+               " d.init                        : initialize (empty) dictionary"                },
+
+       { "d.show",     0,      0,      do_dictShow,            1,      0,
+               " d.show                        : show dictionary contents"                     },
+
+       { "d.add",      2,      101,    do_dictSetKey,          1,      0,
+               " d.add key [*#?] val [v2 ...]  : add information to dictionary\n"
+               "       (*=array, #=number, ?=boolean)"                                         },
+
+       { "d.remove",   1,      1,      do_dictRemoveKey,       1,      0,
+               " d.remove key                  : remove key from dictionary"                   },
+
+       /* data store manipulation commands */
+
+       { "open",       0,      1,      do_prefs_open,          2,      1,
+               " open [\"prefsID\"]            : open a \"preferences\" session"                       },
+
+       { "lock",       0,      1,      do_prefs_lock,          3,      1,
+               " lock [wait]                   : locks write access to preferences"            },
+
+       { "commit",     0,      0,      do_prefs_commit,        2,      0,
+               " commit                        : commit any changes"                           },
+
+       { "apply",      0,      0,      do_prefs_apply,         2,      0,
+               " apply                         : apply any changes"                            },
+
+       { "unlock",     0,      0,      do_prefs_unlock,        3,      1,
+               " unlock                        : unlocks write access to preferences"          },
+
+       { "close",      0,      1,      do_prefs_close,         2,      1,
+               " close [!]                     : close current \"preference\" session"         },
+
+       { "list",       0,      1,      do_prefs_list,          4,      0,
+               " list [path]                   : list preference paths"                        },
+
+       { "get",        1,      1,      do_prefs_get,           4,      0,
+               " get path                      : get dict from preferences w/path"             },
+
+       { "set",        1,      2,      do_prefs_set,           4,      0,
+               " set path                      : set path in preferences w/current dict\n"
+               " set path link                 : set path in preferences w/link"               },
+
+       { "remove",     1,      1,      do_prefs_remove,        4,      0,
+               " remove path                   : remove path from preferences"                 }
+};
+__private_extern__
 const int nCommands_prefs = (sizeof(commands_prefs)/sizeof(cmdInfo));
 
 
 const int nCommands_prefs = (sizeof(commands_prefs)/sizeof(cmdInfo));
 
 
index f1fd33299a1536d6030975b881c21f9815fcb22c..4eb0cf0bff07d4d26a449fa9e9aa2450cd04c81a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -40,7 +40,7 @@ typedef struct {
        char    *cmd;
        int     minArgs;
        int     maxArgs;
        char    *cmd;
        int     minArgs;
        int     maxArgs;
-       void    (*func)();
+       void    (*func)(int argc, char **argv);
        int     group;
        int     ctype;  /* -1==normal/hidden, 0==normal, 1==limited, 2==private */
        char    *usage;
        int     group;
        int     ctype;  /* -1==normal/hidden, 0==normal, 1==limited, 2==private */
        char    *usage;
@@ -49,6 +49,9 @@ typedef struct {
 extern const cmdInfo   commands_store[];
 extern const int       nCommands_store;
 
 extern const cmdInfo   commands_store[];
 extern const int       nCommands_store;
 
+extern const cmdInfo   commands_net[];
+extern const int       nCommands_net;
+
 extern const cmdInfo   commands_prefs[];
 extern const int       nCommands_prefs;
 
 extern const cmdInfo   commands_prefs[];
 extern const int       nCommands_prefs;
 
index 234c4e2f48dd75c3fb07a88c2b285e9c0fc7343b..ec17cd8a93e2e073db940028917c482ee14d7935 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index cad9a29d7fa3fabf37f398c16a5c18620f3ce47b..d580a8936e24cb5be939a7079e671380b79ab130 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index c28dd55341a72da8c38ff4a7423dceded7bf2fc8..31ff83161d839206d430a2586ff45da6c9fbdf06 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,6 +31,7 @@
 
 #include "scutil.h"
 #include "commands.h"
 
 #include "scutil.h"
 #include "commands.h"
+#include "prefs.h"
 #include "net.h"
 #include "net_interface.h"
 #include "net_protocol.h"
 #include "net.h"
 #include "net_interface.h"
 #include "net_protocol.h"
@@ -40,8 +41,6 @@
 #include <unistd.h>
 
 
 #include <unistd.h>
 
 
-__private_extern__ Boolean                     net_changed     = FALSE;
-
 __private_extern__ CFMutableArrayRef           new_interfaces  = NULL;
 
 __private_extern__ CFArrayRef                  interfaces      = NULL;
 __private_extern__ CFMutableArrayRef           new_interfaces  = NULL;
 
 __private_extern__ CFArrayRef                  interfaces      = NULL;
@@ -251,9 +250,11 @@ _process_options(optionsRef options, int nOptions, int argc, char **argv, CFMuta
                                }
 
                                if        ((strcasecmp(argv[0], "disable") == 0) ||
                                }
 
                                if        ((strcasecmp(argv[0], "disable") == 0) ||
+                                          (strcasecmp(argv[0], "no"     ) == 0) ||
                                           (strcasecmp(argv[0], "0"      ) == 0)) {
                                        CFDictionarySetValue(newConfiguration, *(options[optionIndex].key), CFNumberRef_0);
                                } else if ((strcasecmp(argv[0], "enable") == 0) ||
                                           (strcasecmp(argv[0], "0"      ) == 0)) {
                                        CFDictionarySetValue(newConfiguration, *(options[optionIndex].key), CFNumberRef_0);
                                } else if ((strcasecmp(argv[0], "enable") == 0) ||
+                                          (strcasecmp(argv[0], "yes"   ) == 0) ||
                                           (strcasecmp(argv[0], "1"     ) == 0)) {
                                        CFDictionarySetValue(newConfiguration, *(options[optionIndex].key), CFNumberRef_1);
                                } else {
                                           (strcasecmp(argv[0], "1"     ) == 0)) {
                                        CFDictionarySetValue(newConfiguration, *(options[optionIndex].key), CFNumberRef_1);
                                } else {
@@ -423,30 +424,55 @@ _show_entity(CFDictionaryRef entity, CFStringRef prefix)
 /* -------------------- */
 
 
 /* -------------------- */
 
 
-static Boolean
-commitRequired(int argc, char **argv, const char *command)
+static void
+_net_close()
 {
 {
-       if (net_changed) {
-               if ((currentInput != NULL)                      &&
-                   isatty(fileno(currentInput->fp))            &&
-                   ((argc < 1) || (strcmp(argv[0], "!") != 0))
-                  ) {
-                       SCPrint(TRUE, stdout,
-                               CFSTR("configuration changes have not been committed\n"
-                                     "use \"commit\" to save changes"));
-                       if (command != NULL) {
-                               SCPrint(TRUE, stdout,
-                                       CFSTR(" or \"%s !\" to abandon changes"),
-                                       command);
-                       }
-                       SCPrint(TRUE, stdout, CFSTR("\n"));
-                       return TRUE;
-               }
+       if (net_interface != NULL) {
+               CFRelease(net_interface);
+               net_interface = NULL;
+       }
+
+       if (net_service != NULL) {
+               CFRelease(net_service);
+               net_service = NULL;
+       }
+
+       if (net_protocol != NULL) {
+               CFRelease(net_protocol);
+               net_protocol = NULL;
+       }
 
 
-               SCPrint(TRUE, stdout, CFSTR("configuration changes abandoned\n"));
+       if (net_set != NULL) {
+               CFRelease(net_set);
+               net_set = NULL;
+       }
+
+       if (interfaces != NULL) {
+               CFRelease(interfaces);
+               interfaces = NULL;
+       }
+
+       if (services != NULL) {
+               CFRelease(services);
+               services = NULL;
+       }
+
+       if (protocols != NULL) {
+               CFRelease(protocols);
+               protocols = NULL;
        }
 
        }
 
-       return FALSE;
+       if (sets != NULL) {
+               CFRelease(sets);
+               sets = NULL;
+       }
+
+       if (new_interfaces != NULL) {
+               CFRelease(new_interfaces);
+               new_interfaces = NULL;
+       }
+
+       return;
 }
 
 
 }
 
 
@@ -468,29 +494,32 @@ __private_extern__
 void
 do_net_open(int argc, char **argv)
 {
 void
 do_net_open(int argc, char **argv)
 {
+       Boolean         ok;
        CFStringRef     prefsID = NULL;
 
        if (prefs != NULL) {
        CFStringRef     prefsID = NULL;
 
        if (prefs != NULL) {
-               if (commitRequired(argc, argv, "close")) {
+               if (_prefs_commitRequired(argc, argv, "close")) {
                        return;
                }
                        return;
                }
-               do_net_close(0, NULL);
+
+               _net_close();
+               _prefs_close();
        }
 
        if (argc > 0) {
                prefsID = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        }
 
        }
 
        if (argc > 0) {
                prefsID = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        }
 
-       prefs = SCPreferencesCreate(NULL, CFSTR("scutil --net"), prefsID);
+       ok = _prefs_open(CFSTR("scutil --net"), prefsID);
        if (prefsID != NULL) CFRelease(prefsID);
        if (prefsID != NULL) CFRelease(prefsID);
-
-       if (prefs == NULL) {
-               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+       if (!ok) {
+               SCPrint(TRUE,
+                       stdout,
+                       CFSTR("Could not open prefs: %s\n"),
+                       SCErrorString(SCError()));
                return;
        }
 
                return;
        }
 
-       net_changed = FALSE;
-
        net_set = SCNetworkSetCopyCurrent(prefs);
        if (net_set != NULL) {
                CFStringRef     setName;
        net_set = SCNetworkSetCopyCurrent(prefs);
        if (net_set != NULL) {
                CFStringRef     setName;
@@ -518,8 +547,7 @@ do_net_commit(int argc, char **argv)
                return;
        }
 
                return;
        }
 
-       net_changed = FALSE;
-
+       _prefs_changed = FALSE;
        return;
 }
 
        return;
 }
 
@@ -539,61 +567,12 @@ __private_extern__
 void
 do_net_close(int argc, char **argv)
 {
 void
 do_net_close(int argc, char **argv)
 {
-       if (commitRequired(argc, argv, "close")) {
+       if (_prefs_commitRequired(argc, argv, "close")) {
                return;
        }
 
                return;
        }
 
-       if (net_interface != NULL) {
-               CFRelease(net_interface);
-               net_interface = NULL;
-       }
-
-       if (net_service != NULL) {
-               CFRelease(net_service);
-               net_service = NULL;
-       }
-
-       if (net_protocol != NULL) {
-               CFRelease(net_protocol);
-               net_protocol = NULL;
-       }
-
-       if (net_set != NULL) {
-               CFRelease(net_set);
-               net_set = NULL;
-       }
-
-       if (interfaces != NULL) {
-               CFRelease(interfaces);
-               interfaces = NULL;
-       }
-
-       if (services != NULL) {
-               CFRelease(services);
-               services = NULL;
-       }
-
-       if (protocols != NULL) {
-               CFRelease(protocols);
-               protocols = NULL;
-       }
-
-       if (sets != NULL) {
-               CFRelease(sets);
-               sets = NULL;
-       }
-
-       if (new_interfaces != NULL) {
-               CFRelease(new_interfaces);
-               new_interfaces = NULL;
-       }
-
-       if (prefs != NULL) {
-               CFRelease(prefs);
-               prefs = NULL;
-       }
-
-       net_changed = FALSE;
+       _net_close();
+       _prefs_close();
 
        return;
 }
 
        return;
 }
@@ -603,10 +582,13 @@ __private_extern__
 void
 do_net_quit(int argc, char **argv)
 {
 void
 do_net_quit(int argc, char **argv)
 {
-       if (commitRequired(argc, argv, "quit")) {
+       if (_prefs_commitRequired(argc, argv, "quit")) {
                return;
        }
 
                return;
        }
 
+       _net_close();
+       _prefs_close();
+
        termRequested = TRUE;
        return;
 }
        termRequested = TRUE;
        return;
 }
@@ -856,6 +838,114 @@ do_net_show(int argc, char **argv)
 }
 
 
 }
 
 
+__private_extern__
+void
+do_net_update(int argc, char **argv)
+{
+       SCNetworkSetRef set;
+       Boolean         setCreated      = FALSE;
+       Boolean         setUpdated      = FALSE;
+
+       if (prefs == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("network configuration not open\n"));
+               return;
+       }
+
+       if (net_set != NULL) {
+               set = CFRetain(net_set);
+       } else {
+               set = SCNetworkSetCopyCurrent(prefs);
+               if (set == NULL) {
+                       CFBundleRef     bundle;
+                       Boolean         ok;
+                       CFArrayRef      sets;
+                       CFStringRef     setName = NULL;
+
+                       sets = SCNetworkSetCopyAll(prefs);
+                       if (sets != NULL) {
+                               CFIndex n;
+
+                               n = CFArrayGetCount(sets);
+                               CFRelease(sets);
+                               if (n > 0) {
+                                       SCPrint(TRUE, stdout, CFSTR("no current set\n"));
+                                       return;
+                               }
+                       }
+
+                       bundle = _SC_CFBundleGet();
+                       if (bundle != NULL) {
+                               setName = CFBundleCopyLocalizedString(bundle,
+                                                                     CFSTR("DEFAULT_SET_NAME"),
+                                                                     CFSTR("Automatic"),
+                                                                     NULL);
+                       }
+                       if (setName == NULL) {
+                               setName = CFSTR("Automatic");
+                               CFRetain(setName);
+                       }
+
+                       set = SCNetworkSetCreate(prefs);
+                       if (set == NULL) {
+                               SCPrint(TRUE, stdout,
+                                       CFSTR("could not initialize \"%@\": %s\n"),
+                                       setName,
+                                       SCErrorString(SCError()));
+                               CFRelease(setName);
+                               return;
+                       }
+
+                       (void) SCNetworkSetSetName(set, setName);
+
+                       ok = SCNetworkSetSetCurrent(set);
+                       if (!ok) {
+                               SCPrint(TRUE, stdout,
+                                       CFSTR("could not initialize \"%@\": %s\n"),
+                                       setName,
+                                       SCErrorString(SCError()));
+                               (void) SCNetworkSetRemove(set);
+                               CFRelease(setName);
+                               CFRelease(set);
+                               return;
+                       }
+
+                       if (net_set != NULL) CFRelease(net_set);
+                       net_set = set;
+
+                       setCreated = TRUE;
+                       setUpdated = TRUE;
+
+                       CFRelease(setName);
+                       CFRetain(set);
+               }
+       }
+
+       setUpdated = SCNetworkSetEstablishDefaultConfiguration(set);
+       if (setUpdated) {
+               CFStringRef     setName;
+
+               _prefs_changed = TRUE;
+
+               setName = SCNetworkSetGetName(set);
+               if (setName != NULL) {
+                       SCPrint(TRUE, stdout,
+                               CFSTR("set \"%@\" (%@) %supdated\n"),
+                               setName,
+                               SCNetworkSetGetSetID(set),
+                               setCreated ? "created, selected, and " : "");
+               } else {
+                       SCPrint(TRUE, stdout,
+                               CFSTR("set ID \"%@\" %supdated\n"),
+                               SCNetworkSetGetSetID(set),
+                               setCreated ? "created, selected, and " : "");
+               }
+       }
+
+       CFRelease(set);
+       return;
+}
+
+
 #include "SCPreferencesInternal.h"
 #include <fcntl.h>
 #include <unistd.h>
 #include "SCPreferencesInternal.h"
 #include <fcntl.h>
 #include <unistd.h>
@@ -878,15 +968,20 @@ do_net_snapshot(int argc, char **argv)
                        CFDataRef       xmlData;
 
                        asprintf(&path, "/tmp/prefs_snapshot_%d", n_snapshot++);
                        CFDataRef       xmlData;
 
                        asprintf(&path, "/tmp/prefs_snapshot_%d", n_snapshot++);
-                       fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+                       (void)unlink(path);
+                       fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
                        free(path);
                        free(path);
+                       if (fd == -1) {
+                               SCPrint(TRUE, stdout, CFSTR("could not write snapshot: open() failed : %s\n"), strerror(errno));
+                               return;
+                       }
 
                        xmlData = CFPropertyListCreateXMLData(NULL, prefsPrivate->prefs);
                        if (xmlData != NULL) {
                                (void) write(fd, CFDataGetBytePtr(xmlData), CFDataGetLength(xmlData));
                                CFRelease(xmlData);
                        } else {
 
                        xmlData = CFPropertyListCreateXMLData(NULL, prefsPrivate->prefs);
                        if (xmlData != NULL) {
                                (void) write(fd, CFDataGetBytePtr(xmlData), CFDataGetLength(xmlData));
                                CFRelease(xmlData);
                        } else {
-                               SCLog(TRUE, LOG_ERR, CFSTR("CFPropertyListCreateXMLData() failed"));
+                               SCPrint(TRUE, stdout, CFSTR("could not write snapshot: CFPropertyListCreateXMLData() failed\n"));
                        }
 
                        (void) close(fd);
                        }
 
                        (void) close(fd);
index ad4a56af141de131e45954047b69c4a607ef9969..05bbb8e8e931ed727542bdd02252b7bae0261335 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -72,8 +72,6 @@ typedef const struct {
 } options, *optionsRef;
 
 
 } options, *optionsRef;
 
 
-extern Boolean                 net_changed;
-                              
 extern CFMutableArrayRef       new_interfaces;
 
 extern CFArrayRef              interfaces;
 extern CFMutableArrayRef       new_interfaces;
 
 extern CFArrayRef              interfaces;
@@ -110,8 +108,8 @@ CFIndex             _find_selection (CFStringRef    choice,
 
 void           _show_entity    (CFDictionaryRef entity, CFStringRef prefix);
 
 
 void           _show_entity    (CFDictionaryRef entity, CFStringRef prefix);
 
-void   do_net_init             ();
-void   do_net_quit             ();
+void   do_net_init             (void);
+void   do_net_quit             (int argc, char **argv);
 
 void   do_net_open             (int argc, char **argv);
 void   do_net_commit           (int argc, char **argv);
 
 void   do_net_open             (int argc, char **argv);
 void   do_net_commit           (int argc, char **argv);
@@ -125,6 +123,7 @@ void        do_net_remove           (int argc, char **argv);
 void   do_net_select           (int argc, char **argv);
 void   do_net_set              (int argc, char **argv);
 void   do_net_show             (int argc, char **argv);
 void   do_net_select           (int argc, char **argv);
 void   do_net_set              (int argc, char **argv);
 void   do_net_show             (int argc, char **argv);
+void   do_net_update           (int argc, char **argv);
 
 void   do_net_snapshot         (int argc, char **argv);
 
 
 void   do_net_snapshot         (int argc, char **argv);
 
index f6133eb0263fe80fecdf6504650a635e4041392f..c42c4b892e28d6b7b3d79bcc138145730b7fb465 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,6 +31,7 @@
 
 #include "scutil.h"
 #include "net.h"
 
 #include "scutil.h"
 #include "net.h"
+#include "prefs.h"
 
 #include <SystemConfiguration/LinkConfiguration.h>
 
 
 #include <SystemConfiguration/LinkConfiguration.h>
 
@@ -150,12 +151,12 @@ _find_interface(char *match)
                CFStringRef             bsd_name        = NULL;
 
                interface = CFArrayGetValueAtIndex(interfaces, i);
                CFStringRef             bsd_name        = NULL;
 
                interface = CFArrayGetValueAtIndex(interfaces, i);
-                while ((interface != NULL) && (bsd_name == NULL)) {
-                        bsd_name = SCNetworkInterfaceGetBSDName(interface);
-                        if (bsd_name == NULL) {
-                                interface = SCNetworkInterfaceGetInterface(interface);
-                        }
-                }
+               while ((interface != NULL) && (bsd_name == NULL)) {
+                       bsd_name = SCNetworkInterfaceGetBSDName(interface);
+                       if (bsd_name == NULL) {
+                               interface = SCNetworkInterfaceGetInterface(interface);
+                       }
+               }
 
                if ((bsd_name != NULL) && CFEqual(select_name, bsd_name)) {
                        if (selected == NULL) {
 
                if ((bsd_name != NULL) && CFEqual(select_name, bsd_name)) {
                        if (selected == NULL) {
@@ -392,7 +393,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
                int             mtu_min;
                int             mtu_max;
 
                int             mtu_min;
                int             mtu_max;
 
-               if (NetworkInterfaceCopyMTU(if_bsd_name, &mtu_cur, &mtu_min, &mtu_max)) {
+               if (SCNetworkInterfaceCopyMTU(interface, &mtu_cur, &mtu_min, &mtu_max)) {
                        char    isCurrent       = '*';
 
                        if (configuration != NULL) {
                        char    isCurrent       = '*';
 
                        if (configuration != NULL) {
@@ -417,7 +418,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
                                mtu_max);
                }
 
                                mtu_max);
                }
 
-               if (NetworkInterfaceCopyMediaOptions(if_bsd_name, NULL, &active, &available, TRUE)) {
+               if (SCNetworkInterfaceCopyMediaOptions(interface, NULL, &active, &available, TRUE)) {
                        char            isCurrent       = ' ';
                        CFArrayRef      options         = NULL;
                        CFArrayRef      options_req     = NULL;
                        char            isCurrent       = ' ';
                        CFArrayRef      options         = NULL;
                        CFArrayRef      options_req     = NULL;
@@ -480,7 +481,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
                                CFIndex         n_subtypes;
                                CFArrayRef      subtypes;
 
                                CFIndex         n_subtypes;
                                CFArrayRef      subtypes;
 
-                               subtypes   = NetworkInterfaceCopyMediaSubTypes(available);
+                               subtypes   = SCNetworkInterfaceCopyMediaSubTypes(available);
                                n_subtypes = (subtypes != NULL) ? CFArrayGetCount(subtypes) : 0;
                                for (i = 0; i < n_subtypes; i++) {
                                        CFIndex         j;
                                n_subtypes = (subtypes != NULL) ? CFArrayGetCount(subtypes) : 0;
                                for (i = 0; i < n_subtypes; i++) {
                                        CFIndex         j;
@@ -489,7 +490,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
                                        CFArrayRef      subtype_options;
 
                                        subtype = CFArrayGetValueAtIndex(subtypes, i);
                                        CFArrayRef      subtype_options;
 
                                        subtype = CFArrayGetValueAtIndex(subtypes, i);
-                                       subtype_options = NetworkInterfaceCopyMediaSubTypeOptions(available, subtype);
+                                       subtype_options = SCNetworkInterfaceCopyMediaSubTypeOptions(available, subtype);
                                        n_subtype_options = (subtype_options != NULL) ? CFArrayGetCount(subtype_options) : 0;
                                        for (j = 0; j < n_subtype_options; j++) {
                                                char            isCurrent       = ' ';
                                        n_subtype_options = (subtype_options != NULL) ? CFArrayGetCount(subtype_options) : 0;
                                        for (j = 0; j < n_subtype_options; j++) {
                                                char            isCurrent       = ' ';
@@ -575,7 +576,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
 
                if (CFDictionaryGetCount(effective) > 0) {
                        SCPrint(TRUE, stdout, CFSTR("\n%@  per-interface configuration\n"), prefix);
 
                if (CFDictionaryGetCount(effective) > 0) {
                        SCPrint(TRUE, stdout, CFSTR("\n%@  per-interface configuration\n"), prefix);
-                       _show_entity(configuration, prefix);
+                       _show_entity(effective, prefix);
                }
 
                CFRelease(effective);
                }
 
                CFRelease(effective);
@@ -603,7 +604,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
 
 
 static Boolean
 
 
 static Boolean
-validateMediaOptions(CFStringRef interfaceName, CFMutableDictionaryRef newConfiguration)
+validateMediaOptions(SCNetworkInterfaceRef interface, CFMutableDictionaryRef newConfiguration)
 {
        Boolean         ok      = TRUE;
        CFNumberRef     mtu;
 {
        Boolean         ok      = TRUE;
        CFNumberRef     mtu;
@@ -616,7 +617,7 @@ validateMediaOptions(CFStringRef interfaceName, CFMutableDictionaryRef newConfig
                int     mtu_min;
                int     mtu_val;
 
                int     mtu_min;
                int     mtu_val;
 
-               if (!NetworkInterfaceCopyMTU(interfaceName, NULL, &mtu_min, &mtu_max)) {
+               if (!SCNetworkInterfaceCopyMTU(interface, NULL, &mtu_min, &mtu_max)) {
                        SCPrint(TRUE, stdout, CFSTR("cannot set MTU\n"));
                        return FALSE;
                }
                        SCPrint(TRUE, stdout, CFSTR("cannot set MTU\n"));
                        return FALSE;
                }
@@ -644,12 +645,7 @@ validateMediaOptions(CFStringRef interfaceName, CFMutableDictionaryRef newConfig
                        config_options = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
                }
 
                        config_options = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
                }
 
-               if (interfaceName == NULL) {
-                       SCPrint(TRUE, stdout, CFSTR("media type / options not available\n"));
-                       goto checked;
-               }
-
-               if (!NetworkInterfaceCopyMediaOptions(interfaceName, NULL, NULL, &available, FALSE)) {
+               if (!SCNetworkInterfaceCopyMediaOptions(interface, NULL, NULL, &available, FALSE)) {
                        SCPrint(TRUE, stdout, CFSTR("media type / options not available\n"));
                        goto checked;
                }
                        SCPrint(TRUE, stdout, CFSTR("media type / options not available\n"));
                        goto checked;
                }
@@ -658,7 +654,7 @@ validateMediaOptions(CFStringRef interfaceName, CFMutableDictionaryRef newConfig
                        goto checked;
                }
 
                        goto checked;
                }
 
-               subtypes = NetworkInterfaceCopyMediaSubTypes(available);
+               subtypes = SCNetworkInterfaceCopyMediaSubTypes(available);
                if ((subtypes == NULL) ||
                    !CFArrayContainsValue(subtypes,
                                         CFRangeMake(0, CFArrayGetCount(subtypes)),
                if ((subtypes == NULL) ||
                    !CFArrayContainsValue(subtypes,
                                         CFRangeMake(0, CFArrayGetCount(subtypes)),
@@ -667,7 +663,7 @@ validateMediaOptions(CFStringRef interfaceName, CFMutableDictionaryRef newConfig
                        goto checked;
                }
 
                        goto checked;
                }
 
-               subtype_options = NetworkInterfaceCopyMediaSubTypeOptions(available, subtype);
+               subtype_options = SCNetworkInterfaceCopyMediaSubTypeOptions(available, subtype);
                if ((subtype_options == NULL) ||
                    !CFArrayContainsValue(subtype_options,
                                          CFRangeMake(0, CFArrayGetCount(subtype_options)),
                if ((subtype_options == NULL) ||
                    !CFArrayContainsValue(subtype_options,
                                          CFRangeMake(0, CFArrayGetCount(subtype_options)),
@@ -763,12 +759,40 @@ show_interfaces(int argc, char **argv)
 /* -------------------- */
 
 
 /* -------------------- */
 
 
+static options bondOptions[] = {
+       { "mtu"       , NULL, isNumber     , &kSCPropNetEthernetMTU         , NULL, NULL },
+// xxx  { "+device"   , ... },
+// xxx  { "-device"   , ... },
+
+       { "?"         , NULL , isHelp     , NULL                            , NULL,
+           "\nBond configuration commands\n\n"
+           " set interface [mtu n] [media type] [mediaopts opts]\n"
+       }
+};
+#define        N_BOND_OPTIONS  (sizeof(bondOptions) / sizeof(bondOptions[0]))
+
+
 static Boolean
 set_interface_bond(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
 {
 static Boolean
 set_interface_bond(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
 {
-// xxxxx ("+device", "-device")
-SCPrint(TRUE, stdout, CFSTR("bond interface management not yet supported\n"));
-       return FALSE;
+       CFStringRef     interfaceName;
+       Boolean         ok;
+
+       interfaceName = SCNetworkInterfaceGetBSDName(net_interface);
+       if (interfaceName == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("no BSD interface\n"));
+               return FALSE;
+       }
+
+       ok = _process_options(bondOptions, N_BOND_OPTIONS, argc, argv, newConfiguration);
+       if (ok) {
+               // validate configuration
+               if (!validateMediaOptions(net_interface, newConfiguration)) {
+                       return FALSE;
+               }
+       }
+
+       return ok;
 }
 
 
 }
 
 
@@ -803,7 +827,7 @@ set_interface_airport(int argc, char **argv, CFMutableDictionaryRef newConfigura
        ok = _process_options(airportOptions, N_AIRPORT_OPTIONS, argc, argv, newConfiguration);
        if (ok) {
                // validate configuration
        ok = _process_options(airportOptions, N_AIRPORT_OPTIONS, argc, argv, newConfiguration);
        if (ok) {
                // validate configuration
-               if (!validateMediaOptions(interfaceName, newConfiguration)) {
+               if (!validateMediaOptions(net_interface, newConfiguration)) {
                        return FALSE;
                }
        }
                        return FALSE;
                }
        }
@@ -843,7 +867,7 @@ set_interface_ethernet(int argc, char **argv, CFMutableDictionaryRef newConfigur
        ok = _process_options(ethernetOptions, N_ETHERNET_OPTIONS, argc, argv, newConfiguration);
        if (ok) {
                // validate configuration
        ok = _process_options(ethernetOptions, N_ETHERNET_OPTIONS, argc, argv, newConfiguration);
        if (ok) {
                // validate configuration
-               if (!validateMediaOptions(interfaceName, newConfiguration)) {
+               if (!validateMediaOptions(net_interface, newConfiguration)) {
                        return FALSE;
                }
        }
                        return FALSE;
                }
        }
@@ -883,7 +907,7 @@ set_interface_firewire(int argc, char **argv, CFMutableDictionaryRef newConfigur
        ok = _process_options(firewireOptions, N_FIREWIRE_OPTIONS, argc, argv, newConfiguration);
        if (ok) {
                // validate configuration
        ok = _process_options(firewireOptions, N_FIREWIRE_OPTIONS, argc, argv, newConfiguration);
        if (ok) {
                // validate configuration
-               if (!validateMediaOptions(interfaceName, newConfiguration)) {
+               if (!validateMediaOptions(net_interface, newConfiguration)) {
                        return FALSE;
                }
        }
                        return FALSE;
                }
        }
@@ -1196,7 +1220,7 @@ set_interface(int argc, char **argv)
                        goto done;
                }
 
                        goto done;
                }
 
-               net_changed = TRUE;
+               _prefs_changed = TRUE;
        }
 
     done :
        }
 
     done :
index 49a3329446817cfa921a0deb3fb641dd7975133a..77e2752686e57c02118b7e2b94bd14b153569d53 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -32,7 +32,7 @@
 #include "scutil.h"
 #include "net.h"
 #include "net_protocol.h"
 #include "scutil.h"
 #include "net.h"
 #include "net_protocol.h"
-
+#include "prefs.h"
 
 #include <sys/types.h>
 #include <sys/socket.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -94,7 +94,7 @@ __copyIPv6Address(const char *arg)
 
        p = strchr(arg, '%');
        if (p != NULL) {
 
        p = strchr(arg, '%');
        if (p != NULL) {
-               sin6.sin6_scope_id = if_nametoindex(p+1);
+               sin6.sin6_scope_id = if_nametoindex(p + 1);
        }
 
        _SC_sockaddr_to_string((struct sockaddr *)&sin6, buf, sizeof(buf));
        }
 
        _SC_sockaddr_to_string((struct sockaddr *)&sin6, buf, sizeof(buf));
@@ -237,7 +237,7 @@ create_protocol(int argc, char **argv)
                goto done;
        }
 
                goto done;
        }
 
-       net_changed = TRUE;
+       _prefs_changed = TRUE;
 
        if (protocols != NULL) {
                CFRelease(protocols);
 
        if (protocols != NULL) {
                CFRelease(protocols);
@@ -293,7 +293,7 @@ disable_protocol(int argc, char **argv)
                return;
        }
 
                return;
        }
 
-       net_changed = TRUE;
+       _prefs_changed = TRUE;
 
        return;
 }
 
        return;
 }
@@ -328,7 +328,7 @@ enable_protocol(int argc, char **argv)
                return;
        }
 
                return;
        }
 
-       net_changed = TRUE;
+       _prefs_changed = TRUE;
 
        return;
 }
 
        return;
 }
@@ -367,7 +367,7 @@ remove_protocol(int argc, char **argv)
                goto done;
        }
 
                goto done;
        }
 
-       net_changed = TRUE;
+       _prefs_changed = TRUE;
 
        SCPrint(TRUE, stdout,
                CFSTR("protocol \"%@\" removed\n"),
 
        SCPrint(TRUE, stdout,
                CFSTR("protocol \"%@\" removed\n"),
@@ -417,7 +417,8 @@ select_protocol(int argc, char **argv)
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark AppleTalk
 
 
 static selections appletalkConfigMethods[] = {
 
 
 static selections appletalkConfigMethods[] = {
@@ -498,7 +499,9 @@ static options appletalkOptions[] = {
                                       , isChooseOne  , &kSCPropNetAppleTalkConfigMethod    , __doAppleTalkConfigMethod, (void *)appletalkConfigMethods },
        { "DefaultZone"     , "zone"   , isString     , &kSCPropNetAppleTalkDefaultZone     , NULL                     , NULL                           },
        { "NodeID"          , "node"   , isNumber     , &kSCPropNetAppleTalkNodeID          , NULL                     , NULL                           },
                                       , isChooseOne  , &kSCPropNetAppleTalkConfigMethod    , __doAppleTalkConfigMethod, (void *)appletalkConfigMethods },
        { "DefaultZone"     , "zone"   , isString     , &kSCPropNetAppleTalkDefaultZone     , NULL                     , NULL                           },
        { "NodeID"          , "node"   , isNumber     , &kSCPropNetAppleTalkNodeID          , NULL                     , NULL                           },
+       {   "node"          , "node"   , isNumber     , &kSCPropNetAppleTalkNodeID          , NULL                     , NULL                           },
        { "NetworkID"       , "network", isNumber     , &kSCPropNetAppleTalkNetworkID       , NULL                     , NULL                           },
        { "NetworkID"       , "network", isNumber     , &kSCPropNetAppleTalkNetworkID       , NULL                     , NULL                           },
+       {   "network"       , "network", isNumber     , &kSCPropNetAppleTalkNetworkID       , NULL                     , NULL                           },
        { "SeedNetworkRange", "range"  , isOther      , &kSCPropNetAppleTalkSeedNetworkRange, __doAppleTalkNetworkRange, NULL                           },
        { "SeedZones"       , "zone"   , isStringArray, &kSCPropNetAppleTalkSeedZones       , NULL                     , NULL                           },
 
        { "SeedNetworkRange", "range"  , isOther      , &kSCPropNetAppleTalkSeedNetworkRange, __doAppleTalkNetworkRange, NULL                           },
        { "SeedZones"       , "zone"   , isStringArray, &kSCPropNetAppleTalkSeedZones       , NULL                     , NULL                           },
 
@@ -530,7 +533,8 @@ set_protocol_appletalk(int argc, char **argv, CFMutableDictionaryRef newConfigur
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark DNS
 
 
 static CFStringRef
 
 
 static CFStringRef
@@ -640,7 +644,7 @@ __doDNSServerAddresses(CFStringRef key, const char *description, void *info, int
        CFMutableArrayRef       servers;
 
        if (argc < 1) {
        CFMutableArrayRef       servers;
 
        if (argc < 1) {
-               SCPrint(TRUE, stdout, CFSTR("DNS search domain name(s) not specified\n"));
+               SCPrint(TRUE, stdout, CFSTR("DNS name server address(es) not specified\n"));
                return -1;
        }
 
                return -1;
        }
 
@@ -724,7 +728,8 @@ set_protocol_dns(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark IPv4
 
 
 #define allowIPv4Address       1<<1    // allow address
 
 
 #define allowIPv4Address       1<<1    // allow address
@@ -887,7 +892,8 @@ set_protocol_ipv4(int argc, char **argv, CFMutableDictionaryRef newConfiguration
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark IPv6
 
 
 #define allowIPv6Address       1<<1    // allow address
 
 
 #define allowIPv6Address       1<<1    // allow address
@@ -1048,7 +1054,8 @@ set_protocol_ipv6(int argc, char **argv, CFMutableDictionaryRef newConfiguration
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark Proxies
 
 
 typedef const struct {
 
 
 typedef const struct {
@@ -1370,7 +1377,191 @@ set_protocol_proxies(int argc, char **argv, CFMutableDictionaryRef newConfigurat
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark SMB
+
+
+static CFStringRef
+__cleanupName(CFStringRef name)
+{
+       CFMutableStringRef      newName;
+
+       newName = CFStringCreateMutableCopy(NULL, 0, name);
+       CFStringTrimWhitespace(newName);
+       if (CFStringGetLength(newName) == 0) {
+               CFRelease(newName);
+               newName = NULL;
+       }
+
+       return newName;
+}
+
+
+static int
+__doSMBName(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("NetBIOS name not specified\n"));
+               return -1;
+       }
+
+       if (strlen(argv[0]) > 0) {
+               CFStringRef     name;
+               CFStringRef     str;
+
+               str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+               name = __cleanupName(str);
+               CFRelease(str);
+
+               if (name != NULL) {
+                       CFDictionarySetValue(newConfiguration, key, name);
+                       CFRelease(name);
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("invalid NetBIOS name\n"));
+                       return -1;
+               }
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       return 1;
+}
+
+
+static int
+__doSMBWorkgroup(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("Workgroup not specified\n"));
+               return -1;
+       }
+
+       if (strlen(argv[0]) > 0) {
+               CFStringRef     name;
+               CFStringRef     str;
+
+               str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+               name = __cleanupName(str);
+               CFRelease(str);
+
+               if (name != NULL) {
+                       CFDictionarySetValue(newConfiguration, key, name);
+                       CFRelease(name);
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("invalid Workgroup\n"));
+                       return -1;
+               }
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       return 1;
+}
+
+
+static int
+__doSMBWINSAddresses(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       CFMutableArrayRef       servers;
+
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("WINS address(es) not specified\n"));
+               return -1;
+       }
+
+       servers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       if (strlen(argv[0]) > 0) {
+               CFArrayRef      array;
+               CFIndex         i;
+               CFIndex         n;
+               CFStringRef     str;
+
+               str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+               array = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR(","));
+               CFRelease(str);
+
+               n = (array != NULL) ? CFArrayGetCount(array) : 0;
+               for (i = 0; i < n; i++) {
+                       char    str[32];
+
+                       if (_SC_cfstring_to_cstring(CFArrayGetValueAtIndex(array, i),
+                                                   str,
+                                                   sizeof(str),
+                                                   kCFStringEncodingUTF8) != NULL) {
+                               CFStringRef     server;
+
+                               server = __copyIPv4Address(str);
+                               //if (server == NULL) {
+                               //      server = __copyIPv6Address(str);
+                               //}
+                               if (server != NULL) {
+                                       CFArrayAppendValue(servers, server);
+                                       CFRelease(server);
+                                       continue;
+                               }
+                       }
+
+                       SCPrint(TRUE, stdout, CFSTR("invalid WINS address\n"));
+                       CFRelease(array);
+                       CFRelease(servers);
+                       return -1;
+               }
+               if (array != NULL) CFRelease(array);
+       }
+
+       if (CFArrayGetCount(servers) > 0) {
+               CFDictionarySetValue(newConfiguration, key, servers);
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       CFRelease(servers);
+       return 1;
+}
+
+
+static selections smbNodeTypes[] = {
+       { CFSTR("Broadcast"), &kSCValNetSMBNetBIOSNodeTypeBroadcast, 0 },
+       { CFSTR("Peer")     , &kSCValNetSMBNetBIOSNodeTypePeer     , 0 },
+       { CFSTR("Mixed")    , &kSCValNetSMBNetBIOSNodeTypeMixed    , 0 },
+       { CFSTR("Hybrid")   , &kSCValNetSMBNetBIOSNodeTypeHybrid   , 0 },
+       { NULL              , NULL                                 , 0 }
+};
+
+
+static options smbOptions[] = {
+       { "NetBIOSName"    , "name"     , isOther    , &kSCPropNetSMBNetBIOSName    , __doSMBName         , NULL },
+       {   "name"         , "name"     , isOther    , &kSCPropNetSMBNetBIOSName    , __doSMBName         , NULL },
+       { "NetBIOSNodeType", "type"     , isChooseOne, &kSCPropNetSMBNetBIOSNodeType, NULL                , (void *)smbNodeTypes },
+       {   "type",          "type"     , isChooseOne, &kSCPropNetSMBNetBIOSNodeType, NULL                , (void *)smbNodeTypes },
+       { "Workgroup"      , "workgroup", isOther    , &kSCPropNetSMBWorkgroup      , __doSMBWorkgroup    , NULL },
+       { "WINSAddresses"  , "wins"     , isOther    , &kSCPropNetSMBWINSAddresses  , __doSMBWINSAddresses, NULL },
+       {   "wins"         , "wins"     , isOther    , &kSCPropNetSMBWINSAddresses  , __doSMBWINSAddresses, NULL },
+
+       { "?"              , NULL       , isHelp     , NULL                         , NULL,
+           "\nSMB configuration commands\n\n"
+           " set protocol name NetBIOS-name\n"
+           " set protocol type (Broadcast|Peer|Mixed|Hybrid)\n"
+           " set protocol workgroup SMB-workgroup\n"
+           " set protocol wins x1.x1.x1.x1[,x2.x2.x2.x2]"
+       }
+};
+#define        N_SMB_OPTIONS   (sizeof(smbOptions) / sizeof(smbOptions[0]))
+
+
+static Boolean
+set_protocol_smb(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       Boolean ok;
+
+       ok = _process_options(smbOptions, N_SMB_OPTIONS, argc, argv, newConfiguration);
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark *Protocol*
 
 
 __private_extern__
 
 
 __private_extern__
@@ -1414,6 +1605,8 @@ set_protocol(int argc, char **argv)
                ok = set_protocol_ipv6(argc, argv, newConfiguration);
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeProxies)) {
                ok = set_protocol_proxies(argc, argv, newConfiguration);
                ok = set_protocol_ipv6(argc, argv, newConfiguration);
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeProxies)) {
                ok = set_protocol_proxies(argc, argv, newConfiguration);
+       } else if (CFEqual(protocolType, kSCNetworkProtocolTypeSMB)) {
+               ok = set_protocol_smb(argc, argv, newConfiguration);
        } else {
                SCPrint(TRUE, stdout, CFSTR("this protocols configuration cannot be changed\n"));
        }
        } else {
                SCPrint(TRUE, stdout, CFSTR("this protocols configuration cannot be changed\n"));
        }
@@ -1429,7 +1622,7 @@ set_protocol(int argc, char **argv)
                        goto done;
                }
 
                        goto done;
                }
 
-               net_changed = TRUE;
+               _prefs_changed = TRUE;
        }
 
     done :
        }
 
     done :
@@ -1687,6 +1880,39 @@ _protocol_description(SCNetworkProtocolRef protocol, Boolean skipEmpty)
                                             CFStringGetLength(description) > 0 ? ", " : "",
                                             currentProxy->proxy);
                }
                                             CFStringGetLength(description) > 0 ? ", " : "",
                                             currentProxy->proxy);
                }
+       } else if (CFEqual(protocolType, kSCNetworkProtocolTypeSMB)) {
+               CFStringRef     name;
+               CFArrayRef      servers;
+               CFStringRef     workgroup;
+
+               name  = CFDictionaryGetValue(configuration, kSCPropNetSMBNetBIOSName);
+               if (isA_CFString(name)) {
+                       CFStringAppendFormat(description,
+                                            NULL,
+                                            CFSTR("NetBIOS name=%@"),
+                                            name);
+               }
+
+               workgroup  = CFDictionaryGetValue(configuration, kSCPropNetSMBWorkgroup);
+               if (isA_CFString(workgroup)) {
+                       CFStringAppendFormat(description,
+                                            NULL,
+                                            CFSTR("Workgroup=%@"),
+                                            workgroup);
+               }
+
+               servers = CFDictionaryGetValue(configuration, kSCPropNetSMBWINSAddresses);
+               if (isA_CFArray(servers)) {
+                       CFStringRef     str;
+
+                       str = CFStringCreateByCombiningStrings(NULL, servers, CFSTR(","));
+                       CFStringAppendFormat(description,
+                                            NULL,
+                                            CFSTR("%sWINS servers=%@"),
+                                            CFStringGetLength(description) > 0 ? ", " : "",
+                                            str);
+                       CFRelease(str);
+               }
        }
 
     done :
        }
 
     done :
index 30c00b3e7af8fec624d6d7636b27c3fec5e96742..af198bb0cb738f96d7a860e6bcf5d60b26d3d099 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -34,6 +34,7 @@
 #include "net_service.h"
 #include "net_interface.h"
 #include "net_protocol.h"
 #include "net_service.h"
 #include "net_interface.h"
 #include "net_protocol.h"
+#include "prefs.h"
 
 
 /* -------------------- */
 
 
 /* -------------------- */
@@ -242,8 +243,6 @@ create_service(int argc, char **argv)
        SCNetworkInterfaceRef   interface;
        CFStringRef             interfaceName;
        Boolean                 ok;
        SCNetworkInterfaceRef   interface;
        CFStringRef             interfaceName;
        Boolean                 ok;
-       CFArrayRef              order;
-       CFMutableArrayRef       newOrder;
        SCNetworkServiceRef     service         = NULL;
        CFStringRef             serviceName;
        CFStringRef             setName;
        SCNetworkServiceRef     service         = NULL;
        CFStringRef             serviceName;
        CFStringRef             setName;
@@ -298,54 +297,20 @@ create_service(int argc, char **argv)
                ok = SCNetworkServiceSetName(service, serviceName);
                CFRelease(serviceName);
                if (!ok) {
                ok = SCNetworkServiceSetName(service, serviceName);
                CFRelease(serviceName);
                if (!ok) {
-                       SCPrint(TRUE, stdout, CFSTR("service not created: %s\n"), SCErrorString(SCError()));
-                       CFRelease(service);
-                       return;
+                       SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+                       (void)SCNetworkServiceRemove(service);
+                       goto done;
                }
        }
 
        ok = SCNetworkSetAddService(net_set, service);
        if (!ok) {
                }
        }
 
        ok = SCNetworkSetAddService(net_set, service);
        if (!ok) {
-               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
-               (void)SCNetworkServiceRemove(service);
-               goto done;
-       }
-
-       net_changed = TRUE;
-
-       order = SCNetworkSetGetServiceOrder(net_set);
-       if (order == NULL) {
-               newOrder = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-       } else {
-               newOrder = CFArrayCreateMutableCopy(NULL, 0, order);
-       }
-       CFArrayAppendValue(newOrder, SCNetworkServiceGetServiceID(service));
-       ok = SCNetworkSetSetServiceOrder(net_set, newOrder);
-       CFRelease(newOrder);
-       if (!ok) {
-               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+               SCPrint(TRUE, stdout, CFSTR("service not created: %s\n"), SCErrorString(SCError()));
                (void)SCNetworkServiceRemove(service);
                goto done;
        }
 
                (void)SCNetworkServiceRemove(service);
                goto done;
        }
 
-       interfaceName = SCNetworkInterfaceGetLocalizedDisplayName(interface);
-       if (interfaceName == NULL) {
-               interfaceName = SCNetworkInterfaceGetBSDName(interface);
-       }
-       if (interfaceName != NULL) {
-               if (!SCNetworkServiceSetName(service, interfaceName)) {
-                       CFIndex         i;
-
-                       for (i = 2; i < 100; i++) {
-                               serviceName = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@ %d"), interfaceName, i);
-                               ok = SCNetworkServiceSetName(service, serviceName);
-                               CFRelease(serviceName);
-                               if (ok) {
-                                       break;
-                               }
-                       }
-               }
-       }
+       _prefs_changed = TRUE;
 
        if (net_service != NULL) CFRelease(net_service);
        net_service = CFRetain(service);
 
        if (net_service != NULL) CFRelease(net_service);
        net_service = CFRetain(service);
@@ -434,8 +399,7 @@ disable_service(int argc, char **argv)
                return;
        }
 
                return;
        }
 
-       net_changed = TRUE;
-
+       _prefs_changed = TRUE;
        return;
 }
 
        return;
 }
 
@@ -466,8 +430,7 @@ enable_service(int argc, char **argv)
                return;
        }
 
                return;
        }
 
-       net_changed = TRUE;
-
+       _prefs_changed = TRUE;
        return;
 }
 
        return;
 }
 
@@ -498,7 +461,7 @@ remove_service(int argc, char **argv)
                goto done;
        }
 
                goto done;
        }
 
-       net_changed = TRUE;
+       _prefs_changed = TRUE;
 
        serviceName = SCNetworkServiceGetName(service);
        if (serviceName != NULL) {
 
        serviceName = SCNetworkServiceGetName(service);
        if (serviceName != NULL) {
@@ -655,7 +618,7 @@ set_service(int argc, char **argv)
                                return;
                        }
 
                                return;
                        }
 
-                       net_changed = TRUE;
+                       _prefs_changed = TRUE;
                } else if (strcmp(command, "order") == 0) {
 
                        char            *end;
                } else if (strcmp(command, "order") == 0) {
 
                        char            *end;
@@ -718,7 +681,7 @@ set_service(int argc, char **argv)
                                                return;
                                        }
 
                                                return;
                                        }
 
-                                       net_changed = TRUE;
+                                       _prefs_changed = TRUE;
                                } else {
                                        SCPrint(TRUE, stdout, CFSTR("set order to what?\n"));
                                        return;
                                } else {
                                        SCPrint(TRUE, stdout, CFSTR("set order to what?\n"));
                                        return;
index d346ada81e055bde22ac64cd842327bd5f21ce03..6043472d45d89607251901007441126fa944b211 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 0e0082ee21518759794cb51cb2fafddf9bb79011..7677279f2b8efc27ea1174b03b714352230e0a99 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -33,6 +33,7 @@
 #include "net.h"
 #include "net_set.h"
 #include "net_service.h"
 #include "net.h"
 #include "net_set.h"
 #include "net_service.h"
+#include "prefs.h"
 
 
 /* -------------------- */
 
 
 /* -------------------- */
@@ -254,7 +255,7 @@ create_set(int argc, char **argv)
                }
        }
 
                }
        }
 
-       net_changed = TRUE;
+       _prefs_changed = TRUE;
 
        if (net_set != NULL) CFRelease(net_set);
        net_set = set;
 
        if (net_set != NULL) CFRelease(net_set);
        net_set = set;
@@ -324,7 +325,7 @@ remove_set(int argc, char **argv)
                goto done;
        }
 
                goto done;
        }
 
-       net_changed = TRUE;
+       _prefs_changed = TRUE;
 
        setName = SCNetworkSetGetName(set);
        if (setName != NULL) {
 
        setName = SCNetworkSetGetName(set);
        if (setName != NULL) {
@@ -458,7 +459,7 @@ set_set(int argc, char **argv)
                                return;
                        }
 
                                return;
                        }
 
-                       net_changed = TRUE;
+                       _prefs_changed = TRUE;
 
                        if (sets != NULL) {
                                /*
 
                        if (sets != NULL) {
                                /*
index aa3715d74e844f849ea03731f006c5ca5dac02a9..8cb779ff109c224125ea287184259c3c819815a1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index a0f47354b83527bae09065230115f00e94343348..ec73edf534515f5a3c888d2ad52d39279e4002dd 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 208f89b45d3e20028702434060c3d6dc14541817..361cbc37a3a2f2fc9f46eb2a0b1ca07177978f35 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - initial revision
  */
 
  * - initial revision
  */
 
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dlfcn.h>
+
+#include <SystemConfiguration/SCPreferencesSetSpecific.h>
+#include <Security/Authorization.h>
+
 #include "scutil.h"
 #include "scutil.h"
+#include "commands.h"
 #include "prefs.h"
 
 #include "prefs.h"
 
-#include <SCPreferencesSetSpecific.h>
+
+/* -------------------- */
+
+
+static void *
+__loadSecurity(void) {
+       static void *image = NULL;
+       if (NULL == image) {
+               const char      *framework              = "/System/Library/Frameworks/Security.framework/Versions/A/Security";
+               struct stat     statbuf;
+               const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
+               char            path[MAXPATHLEN];
+
+               strlcpy(path, framework, sizeof(path));
+               if (suffix) strlcat(path, suffix, sizeof(path));
+               if (0 <= stat(path, &statbuf)) {
+                       image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
+               } else {
+                       image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
+               }
+       }
+       return (void *)image;
+}
 
 
 
 
-static SCPreferencesRef
-_open()
+__private_extern__ OSStatus
+_AuthorizationCreate(const AuthorizationRights *rights, const AuthorizationEnvironment *environment, AuthorizationFlags flags, AuthorizationRef *authorization)
 {
 {
-       prefs = SCPreferencesCreate(NULL, CFSTR("scutil"), NULL);
-       if (prefs == NULL) {
+       #undef AuthorizationCreate
+       static typeof (AuthorizationCreate) *dyfunc = NULL;
+       if (dyfunc == NULL) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "AuthorizationCreate");
+       }
+       return dyfunc ? dyfunc(rights, environment, flags, authorization) : -1;
+}
+#define AuthorizationCreate _AuthorizationCreate
+
+
+__private_extern__ OSStatus
+_AuthorizationFree(AuthorizationRef authorization, AuthorizationFlags flags)
+{
+       #undef AuthorizationFree
+       static typeof (AuthorizationFree) *dyfunc = NULL;
+       if (dyfunc == NULL) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "AuthorizationFree");
+       }
+       return dyfunc ? dyfunc(authorization, flags) : -1;
+}
+#define AuthorizationFree _AuthorizationFree
+
+
+/* -------------------- */
+
+
+static AuthorizationRef
+_createAuthorization()
+{
+       AuthorizationRef        authorization   = NULL;
+       AuthorizationFlags      flags           = kAuthorizationFlagDefaults;
+       OSStatus                status;
+
+       status = AuthorizationCreate(NULL,
+                                    kAuthorizationEmptyEnvironment,
+                                    flags,
+                                    &authorization);
+       if (status != errAuthorizationSuccess) {
                SCPrint(TRUE,
                        stdout,
                SCPrint(TRUE,
                        stdout,
-                       CFSTR("SCPreferencesCreate() failed: %s\n"),
-                       SCErrorString(SCError()));
-               exit (1);
+                       CFSTR("AuthorizationCreate() failed: status = %d\n"),
+                       status);
+               return NULL;
        }
 
        }
 
-       return prefs;
+       return authorization;
 }
 
 
 }
 
 
-static void
-_save(SCPreferencesRef prefs)
+/* -------------------- */
+
+
+__private_extern__ Boolean     _prefs_changed  = FALSE;
+
+
+__private_extern__
+Boolean
+_prefs_open(CFStringRef name, CFStringRef prefsID)
+{
+       if (geteuid() == 0) {
+               prefs = SCPreferencesCreate(NULL, name, prefsID);
+       } else {
+               authorization = _createAuthorization();
+               prefs = SCPreferencesCreateWithAuthorization(NULL, name, prefsID, authorization);
+       }
+
+       if (prefs == NULL) {
+               return FALSE;
+       }
+
+       _prefs_changed = FALSE;
+       return TRUE;
+}
+
+
+__private_extern__
+void
+_prefs_save()
 {
        if (!SCPreferencesCommitChanges(prefs)) {
                switch (SCError()) {
 {
        if (!SCPreferencesCommitChanges(prefs)) {
                switch (SCError()) {
@@ -68,6 +165,8 @@ _save(SCPreferencesRef prefs)
                exit (1);
        }
 
                exit (1);
        }
 
+       _prefs_changed = FALSE;
+
        if (!SCPreferencesApplyChanges(prefs)) {
                SCPrint(TRUE,
                        stdout,
        if (!SCPreferencesApplyChanges(prefs)) {
                SCPrint(TRUE,
                        stdout,
@@ -80,6 +179,57 @@ _save(SCPreferencesRef prefs)
 }
 
 
 }
 
 
+__private_extern__
+void
+_prefs_close()
+{
+       if (prefs != NULL) {
+               CFRelease(prefs);
+               prefs = NULL;
+               _prefs_changed = FALSE;
+       }
+
+       if (authorization != NULL) {
+               AuthorizationFree(authorization, kAuthorizationFlagDefaults);
+//             AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
+               authorization = NULL;
+       }
+
+       return;
+}
+
+
+__private_extern__
+Boolean
+_prefs_commitRequired(int argc, char **argv, const char *command)
+{
+       if (_prefs_changed) {
+               if ((currentInput != NULL)                      &&
+                   isatty(fileno(currentInput->fp))            &&
+                   ((argc < 1) || (strcmp(argv[0], "!") != 0))
+                  ) {
+                       SCPrint(TRUE, stdout,
+                               CFSTR("preference changes have not been committed\n"
+                                     "use \"commit\" to save changes"));
+                       if (command != NULL) {
+                               SCPrint(TRUE, stdout,
+                                       CFSTR(" or \"%s !\" to abandon changes"),
+                                       command);
+                       }
+                       SCPrint(TRUE, stdout, CFSTR("\n"));
+                       return TRUE;
+               }
+
+               SCPrint(TRUE, stdout, CFSTR("preference changes abandoned\n"));
+       }
+
+       return FALSE;
+}
+
+
+/* -------------------- */
+
+
 static CFStringRef
 _copyStringFromSTDIN()
 {
 static CFStringRef
 _copyStringFromSTDIN()
 {
@@ -106,10 +256,9 @@ get_ComputerName(int argc, char **argv)
 {
        CFStringEncoding        encoding;
        CFStringRef             hostname;
 {
        CFStringEncoding        encoding;
        CFStringRef             hostname;
-       CFDataRef               utf8;
 
        hostname = SCDynamicStoreCopyComputerName(NULL, &encoding);
 
        hostname = SCDynamicStoreCopyComputerName(NULL, &encoding);
-       if (!hostname) {
+       if (hostname == NULL) {
                int     sc_status       = SCError();
 
                switch (sc_status) {
                int     sc_status       = SCError();
 
                switch (sc_status) {
@@ -128,17 +277,9 @@ get_ComputerName(int argc, char **argv)
                exit (1);
        }
 
                exit (1);
        }
 
-       utf8 = CFStringCreateExternalRepresentation(NULL, hostname, kCFStringEncodingUTF8, 0);
-       if (!utf8) {
-               SCPrint(TRUE,
-                       stderr,
-                       CFSTR("ComputerName: could not convert to external representation\n"));
-               exit(1);
-       }
-       SCPrint(TRUE, stdout, CFSTR("%.*s\n"), CFDataGetLength(utf8), CFDataGetBytePtr(utf8));
-
-       CFRelease(utf8);
+       SCPrint(TRUE, stdout, CFSTR("%@\n"), hostname);
        CFRelease(hostname);
        CFRelease(hostname);
+
        exit(0);
 }
 
        exit(0);
 }
 
@@ -148,6 +289,16 @@ set_ComputerName(int argc, char **argv)
 {
        CFStringEncoding        encoding;
        CFStringRef             hostname;
 {
        CFStringEncoding        encoding;
        CFStringRef             hostname;
+       Boolean                 ok;
+
+       ok = _prefs_open(CFSTR("scutil --set ComputerName"), NULL);
+       if (!ok) {
+               SCPrint(TRUE,
+                       stdout,
+                       CFSTR("Could not open prefs: %s\n"),
+                       SCErrorString(SCError()));
+               exit(1);
+       }
 
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
 
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
@@ -157,17 +308,19 @@ set_ComputerName(int argc, char **argv)
                encoding = kCFStringEncodingASCII;
        }
 
                encoding = kCFStringEncodingASCII;
        }
 
-       prefs = _open();
-       if (!SCPreferencesSetComputerName(prefs, hostname, encoding)) {
+       ok = SCPreferencesSetComputerName(prefs, hostname, encoding);
+       if (hostname != NULL) CFRelease(hostname);
+       if (!ok) {
                SCPrint(TRUE,
                        stdout,
                SCPrint(TRUE,
                        stdout,
-                       CFSTR("SCPreferencesSetComputerName() failed: %s\n"),
+                       CFSTR("Could not open prefs: %s\n"),
                        SCErrorString(SCError()));
                        SCErrorString(SCError()));
+               _prefs_close();
                exit (1);
        }
                exit (1);
        }
-       _save(prefs);
-       CFRelease(prefs);
-       CFRelease(hostname);
+
+       _prefs_save();
+       _prefs_close();
        exit(0);
 }
 
        exit(0);
 }
 
@@ -176,8 +329,17 @@ static void
 get_HostName(int argc, char **argv)
 {
        CFStringRef     hostname;
 get_HostName(int argc, char **argv)
 {
        CFStringRef     hostname;
+       Boolean         ok;
+
+       ok = _prefs_open(CFSTR("scutil --get HostName"), NULL);
+       if (!ok) {
+               SCPrint(TRUE,
+                       stdout,
+                       CFSTR("SCPreferencesCreate() failed: %s\n"),
+                       SCErrorString(SCError()));
+               exit(1);
+       }
 
 
-       prefs = _open();
        hostname = SCPreferencesGetHostName(prefs);
        if (hostname == NULL) {
                int     sc_status       = SCError();
        hostname = SCPreferencesGetHostName(prefs);
        if (hostname == NULL) {
                int     sc_status       = SCError();
@@ -195,12 +357,12 @@ get_HostName(int argc, char **argv)
                                        SCErrorString(SCError()));
                                break;
                }
                                        SCErrorString(SCError()));
                                break;
                }
-               CFRelease(prefs);
+               _prefs_close();
                exit (1);
        }
 
        SCPrint(TRUE, stdout, CFSTR("%@\n"), hostname);
                exit (1);
        }
 
        SCPrint(TRUE, stdout, CFSTR("%@\n"), hostname);
-       CFRelease(hostname);
+       _prefs_close();
        exit(0);
 }
 
        exit(0);
 }
 
@@ -208,7 +370,17 @@ get_HostName(int argc, char **argv)
 static void
 set_HostName(int argc, char **argv)
 {
 static void
 set_HostName(int argc, char **argv)
 {
-       CFStringRef             hostname = NULL;
+       CFStringRef     hostname = NULL;
+       Boolean         ok;
+
+       ok = _prefs_open(CFSTR("scutil --set HostName"), NULL);
+       if (!ok) {
+               SCPrint(TRUE,
+                       stdout,
+                       CFSTR("Could not open prefs: %s\n"),
+                       SCErrorString(SCError()));
+               exit(1);
+       }
 
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
 
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
@@ -216,19 +388,19 @@ set_HostName(int argc, char **argv)
                hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII);
        }
 
                hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII);
        }
 
-       prefs = _open();
-       if (!SCPreferencesSetHostName(prefs, hostname)) {
+       ok = SCPreferencesSetHostName(prefs, hostname);
+       if (hostname != NULL) CFRelease(hostname);
+       if (!ok) {
                SCPrint(TRUE,
                        stderr,
                        CFSTR("SCPreferencesSetHostName() failed: %s\n"),
                        SCErrorString(SCError()));
                SCPrint(TRUE,
                        stderr,
                        CFSTR("SCPreferencesSetHostName() failed: %s\n"),
                        SCErrorString(SCError()));
-               CFRelease(hostname);
-               CFRelease(prefs);
+               _prefs_close();
                exit (1);
        }
                exit (1);
        }
-       _save(prefs);
-       CFRelease(hostname);
-       CFRelease(prefs);
+
+       _prefs_save();
+       _prefs_close();
        exit(0);
 }
 
        exit(0);
 }
 
@@ -239,7 +411,7 @@ get_LocalHostName(int argc, char **argv)
        CFStringRef     hostname;
 
        hostname = SCDynamicStoreCopyLocalHostName(NULL);
        CFStringRef     hostname;
 
        hostname = SCDynamicStoreCopyLocalHostName(NULL);
-       if (!hostname) {
+       if (hostname == NULL) {
                int     sc_status       = SCError();
 
                switch (sc_status) {
                int     sc_status       = SCError();
 
                switch (sc_status) {
@@ -255,11 +427,13 @@ get_LocalHostName(int argc, char **argv)
                                        SCErrorString(SCError()));
                                break;
                }
                                        SCErrorString(SCError()));
                                break;
                }
+               _prefs_close();
                exit (1);
        }
 
        SCPrint(TRUE, stdout, CFSTR("%@\n"), hostname);
        CFRelease(hostname);
                exit (1);
        }
 
        SCPrint(TRUE, stdout, CFSTR("%@\n"), hostname);
        CFRelease(hostname);
+       _prefs_close();
        exit(0);
 }
 
        exit(0);
 }
 
@@ -267,7 +441,17 @@ get_LocalHostName(int argc, char **argv)
 static void
 set_LocalHostName(int argc, char **argv)
 {
 static void
 set_LocalHostName(int argc, char **argv)
 {
-       CFStringRef             hostname = NULL;
+       CFStringRef     hostname = NULL;
+       Boolean         ok;
+
+       ok = _prefs_open(CFSTR("scutil --set LocalHostName"), NULL);
+       if (!ok) {
+               SCPrint(TRUE,
+                       stdout,
+                       CFSTR("Could not open prefs: %s\n"),
+                       SCErrorString(SCError()));
+               exit(1);
+       }
 
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
 
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
@@ -275,21 +459,26 @@ set_LocalHostName(int argc, char **argv)
                hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII);
        }
 
                hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII);
        }
 
-       prefs = _open();
-       if (!SCPreferencesSetLocalHostName(prefs, hostname)) {
+       ok = SCPreferencesSetLocalHostName(prefs, hostname);
+       if (hostname != NULL) CFRelease(hostname);
+       if (!ok) {
                SCPrint(TRUE,
                        stderr,
                        CFSTR("SCPreferencesSetLocalHostName() failed: %s\n"),
                        SCErrorString(SCError()));
                SCPrint(TRUE,
                        stderr,
                        CFSTR("SCPreferencesSetLocalHostName() failed: %s\n"),
                        SCErrorString(SCError()));
+               _prefs_close();
                exit (1);
        }
                exit (1);
        }
-       _save(prefs);
-       CFRelease(prefs);
-       CFRelease(hostname);
+
+       _prefs_save();
+       _prefs_close();
        exit(0);
 }
 
 
        exit(0);
 }
 
 
+/* -------------------- */
+
+
 typedef void (*pref_func) (int argc, char **argv);
 
 static const struct {
 typedef void (*pref_func) (int argc, char **argv);
 
 static const struct {
@@ -346,3 +535,360 @@ do_setPref(char *pref, int argc, char **argv)
        }
        return;
 }
        }
        return;
 }
+
+
+/* -------------------- */
+
+
+__private_extern__
+void
+do_prefs_init()
+{
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_open(int argc, char **argv)
+{
+       Boolean         ok;
+       CFStringRef     prefsID = NULL;
+
+       if (prefs != NULL) {
+               if (_prefs_commitRequired(argc, argv, "close")) {
+                       return;
+               }
+
+               do_prefs_close(0, NULL);
+       }
+
+       if (argc > 0) {
+               prefsID = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+       }
+
+       ok = _prefs_open(CFSTR("scutil --prefs"), prefsID);
+       if (prefsID != NULL) CFRelease(prefsID);
+       if (!ok) {
+               SCPrint(TRUE,
+                       stdout,
+                       CFSTR("Could not open prefs: %s\n"),
+                       SCErrorString(SCError()));
+               return;
+       }
+
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_lock(int argc, char **argv)
+{
+       Boolean wait    = (argc > 0) ? TRUE : FALSE;
+
+       if (!SCPreferencesLock(prefs, wait)) {
+               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+               return;
+       }
+
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_unlock(int argc, char **argv)
+{
+       if (!SCPreferencesUnlock(prefs)) {
+               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+               return;
+       }
+
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_commit(int argc, char **argv)
+{
+       if (!SCPreferencesCommitChanges(prefs)) {
+               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+               return;
+       }
+
+       _prefs_changed = FALSE;
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_apply(int argc, char **argv)
+{
+       if (!SCPreferencesApplyChanges(prefs)) {
+               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+       }
+
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_close(int argc, char **argv)
+{
+       if (_prefs_commitRequired(argc, argv, "close")) {
+               return;
+       }
+
+       _prefs_close();
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_quit(int argc, char **argv)
+{
+       if (_prefs_commitRequired(argc, argv, "quit")) {
+               return;
+       }
+
+       _prefs_close();
+
+       termRequested = TRUE;
+       return;
+}
+
+
+static CFComparisonResult
+sort_paths(const void *p1, const void *p2, void *context) {
+       CFStringRef path1 = (CFStringRef)p1;
+       CFStringRef path2 = (CFStringRef)p2;
+       return CFStringCompare(path1, path2, 0);
+}
+
+
+__private_extern__
+void
+do_prefs_list(int argc, char **argv)
+{
+       int                     i;
+       CFIndex                 n;
+       CFMutableArrayRef       paths           = NULL;
+       CFStringRef             prefix;
+       CFDictionaryRef         entity;
+
+       prefix = CFStringCreateWithCString(NULL,
+                                          (argc >= 1) ? argv[0] : "/",
+                                          kCFStringEncodingUTF8);
+
+       entity = SCPreferencesPathGetValue(prefs, prefix);
+       if (entity == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       paths = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       n = isA_CFDictionary(entity) ? CFDictionaryGetCount(entity) : 0;
+       if (n > 0) {
+               CFIndex         i;
+               const void **   keys;
+               const void **   vals;
+
+               keys = CFAllocatorAllocate(NULL, n * sizeof(CFStringRef), 0);
+               vals = CFAllocatorAllocate(NULL, n * sizeof(CFPropertyListRef), 0);
+               CFDictionaryGetKeysAndValues(entity, keys, vals);
+               for (i = 0; i < n; i++) {
+                       if (isA_CFDictionary(vals[i])) {
+                               CFArrayAppendValue(paths, keys[i]);
+                       }
+               }
+               CFAllocatorDeallocate(NULL, keys);
+               CFAllocatorDeallocate(NULL, vals);
+       }
+
+       n = CFArrayGetCount(paths);
+       CFArraySortValues(paths,
+                         CFRangeMake(0, n),
+                         sort_paths,
+                         NULL);
+
+       if (n > 0) {
+               for (i = 0; i < n; i++) {
+                       SCPrint(TRUE,
+                               stdout,
+                               CFSTR("  path [%d] = %@/%@\n"),
+                               i,
+                               CFEqual(prefix, CFSTR("/")) ? CFSTR("") : prefix,
+                               CFArrayGetValueAtIndex(paths, i));
+               }
+       } else {
+               SCPrint(TRUE, stdout, CFSTR("  no paths.\n"));
+       }
+
+       CFRelease(paths);
+
+    done :
+
+       CFRelease(prefix);
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_get(int argc, char **argv)
+{
+       CFDictionaryRef         dict;
+       CFStringRef             link;
+       CFIndex                 n;
+       CFMutableDictionaryRef  newDict;
+       CFStringRef             path;
+
+       path = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+
+       link = SCPreferencesPathGetLink(prefs, path);
+       if (link != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("  --> %@\n"), link);
+       }
+
+       dict = SCPreferencesPathGetValue(prefs, path);
+       CFRelease(path);
+       if (dict == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+               return;
+       }
+
+       newDict = CFDictionaryCreateMutable(NULL,
+                                            0,
+                                            &kCFTypeDictionaryKeyCallBacks,
+                                            &kCFTypeDictionaryValueCallBacks);
+
+       // remove [path] children
+       n = isA_CFDictionary(dict) ? CFDictionaryGetCount(dict) : 0;
+       if (n > 0) {
+               CFIndex         i;
+               const void **   keys;
+               const void **   vals;
+
+               keys = CFAllocatorAllocate(NULL, n * sizeof(CFStringRef), 0);
+               vals = CFAllocatorAllocate(NULL, n * sizeof(CFPropertyListRef), 0);
+               CFDictionaryGetKeysAndValues(dict, keys, vals);
+               for (i = 0; i < n; i++) {
+                       if (!isA_CFDictionary(vals[i])) {
+                               CFDictionaryAddValue(newDict, keys[i], vals[i]);
+                       }
+               }
+               CFAllocatorDeallocate(NULL, keys);
+               CFAllocatorDeallocate(NULL, vals);
+       }
+
+       if (value != NULL) {
+               CFRelease(value);               /* we have new information, release the old */
+       }
+
+       value = newDict;
+
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_set(int argc, char **argv)
+{
+       CFDictionaryRef         dict;
+       CFMutableDictionaryRef  newDict = NULL;
+       CFStringRef             path;
+
+       path    = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+       newDict = CFDictionaryCreateMutableCopy(NULL, 0, value);
+
+       dict = SCPreferencesPathGetValue(prefs, path);
+       if (dict != NULL) {
+               CFIndex n;
+
+               // retain [path] children
+               n = CFDictionaryGetCount(dict);
+               if (n > 0) {
+                       CFIndex         i;
+                       const void **   keys;
+                       const void **   vals;
+
+                       keys = CFAllocatorAllocate(NULL, n * sizeof(CFStringRef), 0);
+                       vals = CFAllocatorAllocate(NULL, n * sizeof(CFPropertyListRef), 0);
+                       CFDictionaryGetKeysAndValues(dict, keys, vals);
+                       for (i = 0; i < n; i++) {
+                               if (isA_CFDictionary(vals[i])) {
+                                       if (CFDictionaryContainsKey(newDict, keys[i])) {
+                                               SCPrint(TRUE, stdout, CFSTR("  key %@ is already a path component and cannot be replaced\n"), keys[i]);
+                                               goto done;
+                                       }
+                                       CFDictionaryAddValue(newDict, keys[i], vals[i]);
+                               }
+                       }
+                       CFAllocatorDeallocate(NULL, keys);
+                       CFAllocatorDeallocate(NULL, vals);
+               }
+       } else if (SCError() == kSCStatusInvalidArgument) {
+               SCPrint(TRUE, stdout, CFSTR("  a path component is not a dictionary\n"));
+               goto done;
+       } else if (SCError() != kSCStatusNoKey) {
+               SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       if (argc > 1) {
+               CFStringRef     link;
+               Boolean         ok;
+
+               // set link
+               link = CFStringCreateWithCString(NULL, argv[1], kCFStringEncodingUTF8);
+               ok = SCPreferencesPathSetLink(prefs, path, link);
+               CFRelease(link);
+               if (!ok) {
+                       SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+                       goto done;
+               }
+       } else {
+               // set value
+               if (!SCPreferencesPathSetValue(prefs, path, newDict)) {
+                       SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+                       goto done;
+               }
+       }
+
+       _prefs_changed = TRUE;
+
+    done :
+
+       CFRelease(newDict);
+       CFRelease(path);
+       return;
+}
+
+
+__private_extern__
+void
+do_prefs_remove(int argc, char **argv)
+{
+       CFStringRef     path;
+
+       path = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+
+       if (!SCPreferencesPathRemoveValue(prefs, path)) {
+               SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       _prefs_changed = TRUE;
+
+    done :
+
+       CFRelease(path);
+       return;
+}
index 190ba475b499a658c7e76d608d6f9aa20af8fb51..27ae2cfb0ed8d053af525e0528aee83b01c39a2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003, 2005, 2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #define _PREFS_H
 
 #include <sys/cdefs.h>
 #define _PREFS_H
 
 #include <sys/cdefs.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+
+Boolean        _prefs_changed;
+
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
+Boolean        _prefs_open             (CFStringRef name, CFStringRef prefsID);
+void   _prefs_save             (void);
+void   _prefs_close            (void);
+Boolean        _prefs_commitRequired   (int argc, char **argv, const char *command);
+
 int    findPref                (char *pref);
 void   do_getPref              (char *pref, int argc, char **argv);
 void   do_setPref              (char *pref, int argc, char **argv);
 
 int    findPref                (char *pref);
 void   do_getPref              (char *pref, int argc, char **argv);
 void   do_setPref              (char *pref, int argc, char **argv);
 
+void   do_prefs_init           (void);
+void   do_prefs_quit           (int argc, char **argv);
+
+void   do_prefs_open           (int argc, char **argv);
+void   do_prefs_lock           (int argc, char **argv);
+void   do_prefs_unlock         (int argc, char **argv);
+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_list           (int argc, char **argv);
+void   do_prefs_get            (int argc, char **argv);
+void   do_prefs_set            (int argc, char **argv);
+void   do_prefs_remove         (int argc, char **argv);
+
 __END_DECLS
 
 #endif /* !_PREFS_H */
 __END_DECLS
 
 #endif /* !_PREFS_H */
index 215ec8fe131d03920daf4c8ef454b0ac2ad2c06e..3db9c7c8043241e1fc4bde258a1b8421e9047e44 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .Dd November 4, 2003
 .Dt SCUTIL 8
 .\"
 .Dd November 4, 2003
 .Dt SCUTIL 8
-.Os Mac OS X
+.Os "Mac OS X"
 .Sh NAME
 .Nm scutil
 .Nd Manage system configuration parameters
 .Sh NAME
 .Nm scutil
 .Nd Manage system configuration parameters
@@ -11,6 +11,9 @@
 .Nm
 .Br
 .Nm
 .Nm
 .Br
 .Nm
+.Fl -prefs Op preference-file
+.Br
+.Nm
 .Fl r Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc
 .Br
 .Nm
 .Fl r Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc
 .Br
 .Nm
 .Br
 .Nm
 .Fl -set Ar pref Op Ar newval
 .Br
 .Nm
 .Fl -set Ar pref Op Ar newval
+.Br
+.Nm
+.Fl -dns
+.Br
+.Nm
+.Fl -proxy
 .\".Br
 .\".Nm
 .\".Fl -net
 .\".Br
 .\".Nm
 .\".Fl -net
@@ -39,6 +48,17 @@ A list of the available commands is available by entering the
 directive.
 .Pp
 The
 directive.
 .Pp
 The
+.Fl -prefs
+option provides a command line interface to the [raw] stored
+preference data.
+Interaction with this data (using the SystemConfiguration.framework
+SCPreferences APIs) is handled with a set of commands read from
+standard input.
+A list of the available commands is availble by entering the
+.Ar help
+directive.
+.Pp
+The
 .Fl r
 option provides a means of checking the network reachability of a host, an IP
 address, or a pair of local and remote IP addresses.
 .Fl r
 option provides a means of checking the network reachability of a host, an IP
 address, or a pair of local and remote IP addresses.
@@ -58,6 +78,27 @@ and
 .Fl -set
 options provide a means of reporting and updating a select group of
 persistent system preferences.
 .Fl -set
 options provide a means of reporting and updating a select group of
 persistent system preferences.
+.Pp
+The
+.Fl -dns
+option reports the current DNS configuration.
+The first listed
+.Xr resolver 5 
+configuration is considered to be the
+.Qq default
+configuration.
+Additional
+.Qq supplemental
+configurations follow.  Those containing a
+.Qq domain
+name will be used for queries matching the specified domain.
+Those without will be used as a
+.Qq default
+configuration in addition to the first listed.
+.Pp
+The
+.Fl -proxy
+option reports the current system proxy configuration.
 .\".Pp
 .\"Lastly, the
 .\".Fl -net
 .\".Pp
 .\"Lastly, the
 .\".Fl -net
@@ -120,8 +161,17 @@ The default timeout is 15 seconds.
 Retrieves the specified preference.  The current value will be reported on standard output.
 .Pp
 Supported preferences include:
 Retrieves the specified preference.  The current value will be reported on standard output.
 .Pp
 Supported preferences include:
-ComputerName
-LocalHostName
+.Bl -tag -width "LocalHostName" -offset indent
+.It ComputerName
+The user-friendly name for the system.
+.It LocalHostName
+The local (Bonjour) host name.
+.It HostName
+The name associated with
+.Xr hostname 1 
+and
+.Xr gethostname 3 .
+.El
 .It Fl -set Ar pref Op Ar newval
 Updates the specified preference with the new value.
 If the new value is not specified on the command line then it will be read from standard input.
 .It Fl -set Ar pref Op Ar newval
 Updates the specified preference with the new value.
 If the new value is not specified on the command line then it will be read from standard input.
@@ -129,10 +179,15 @@ If the new value is not specified on the command line then it will be read from
 Supported preferences include:
 ComputerName
 LocalHostName
 Supported preferences include:
 ComputerName
 LocalHostName
+HostName
 .Pp
 The
 .Fl -set
 option requires super-user access.
 .Pp
 The
 .Fl -set
 option requires super-user access.
+.It Fl -dns
+Reports the current DNS configuration.
+.It Fl -proxy
+Reports the current proxy configuration.
 .\".It Fl -net
 .\"Provides a command line interface to the
 .\".Qq network configuration .
 .\".It Fl -net
 .\"Provides a command line interface to the
 .\".Qq network configuration .
index 8909745fda74e39ab7f684b6a48c4e06f9eccc0b..9776c29aa984df160b68c653263cf48ff7caf60e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -24,6 +24,9 @@
 /*
  * Modification History
  *
 /*
  * Modification History
  *
+ * June 13, 2005               Allan Nathanson <ajn@apple.com>
+ * - added SCPreferences support
+ *
  * August 4, 2004              Allan Nathanson <ajn@apple.com>
  * - added network configuration (prefs) support
  *
  * August 4, 2004              Allan Nathanson <ajn@apple.com>
  * - added network configuration (prefs) support
  *
@@ -70,6 +73,7 @@
 #define LINE_LENGTH 256
 
 
 #define LINE_LENGTH 256
 
 
+__private_extern__ AuthorizationRef    authorization   = NULL;
 __private_extern__ InputRef            currentInput    = NULL;
 __private_extern__ int                 nesting         = 0;
 __private_extern__ CFRunLoopRef                notifyRl        = NULL;
 __private_extern__ InputRef            currentInput    = NULL;
 __private_extern__ int                 nesting         = 0;
 __private_extern__ CFRunLoopRef                notifyRl        = NULL;
@@ -91,6 +95,7 @@ static const struct option longopts[] = {
        { "get",                required_argument,      NULL,   0       },
        { "help",               no_argument,            NULL,   '?'     },
        { "net",                no_argument,            NULL,   0       },
        { "get",                required_argument,      NULL,   0       },
        { "help",               no_argument,            NULL,   '?'     },
        { "net",                no_argument,            NULL,   0       },
+       { "prefs",              no_argument,            NULL,   0       },
        { "proxy",              no_argument,            NULL,   0       },
        { "set",                required_argument,      NULL,   0       },
        { NULL,                 0,                      NULL,   0       }
        { "proxy",              no_argument,            NULL,   0       },
        { "set",                required_argument,      NULL,   0       },
        { NULL,                 0,                      NULL,   0       }
@@ -244,6 +249,9 @@ usage(const char *command)
        SCPrint(TRUE, stderr, CFSTR("usage: %s\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\tinteractive access to the dynamic store.\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
        SCPrint(TRUE, stderr, CFSTR("usage: %s\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\tinteractive access to the dynamic store.\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
+       SCPrint(TRUE, stderr, CFSTR("   or: %s --prefs\n"), command);
+       SCPrint(TRUE, stderr, CFSTR("\tinteractive access to the [raw] stored preferences.\n"));
+       SCPrint(TRUE, stderr, CFSTR("\n"));
        SCPrint(TRUE, stderr, CFSTR("   or: %s -r nodename\n"), command);
        SCPrint(TRUE, stderr, CFSTR("   or: %s -r address\n"), command);
        SCPrint(TRUE, stderr, CFSTR("   or: %s -r local-address remote-address\n"), command);
        SCPrint(TRUE, stderr, CFSTR("   or: %s -r nodename\n"), command);
        SCPrint(TRUE, stderr, CFSTR("   or: %s -r address\n"), command);
        SCPrint(TRUE, stderr, CFSTR("   or: %s -r local-address remote-address\n"), command);
@@ -257,7 +265,7 @@ usage(const char *command)
        SCPrint(TRUE, stderr, CFSTR("   or: %s --set pref [newval]\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\tpref\tdisplay (or set) the specified preference.  Valid preferences\n"));
        SCPrint(TRUE, stderr, CFSTR("\t\tinclude:\n"));
        SCPrint(TRUE, stderr, CFSTR("   or: %s --set pref [newval]\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\tpref\tdisplay (or set) the specified preference.  Valid preferences\n"));
        SCPrint(TRUE, stderr, CFSTR("\t\tinclude:\n"));
-       SCPrint(TRUE, stderr, CFSTR("\t\t\tComputerName, LocalHostName\n"));
+       SCPrint(TRUE, stderr, CFSTR("\t\t\tComputerName, LocalHostName, HostName\n"));
        SCPrint(TRUE, stderr, CFSTR("\tnewval\tNew preference value to be set.  If not specified,\n"));
        SCPrint(TRUE, stderr, CFSTR("\t\tthe new value will be read from standard input.\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
        SCPrint(TRUE, stderr, CFSTR("\tnewval\tNew preference value to be set.  If not specified,\n"));
        SCPrint(TRUE, stderr, CFSTR("\t\tthe new value will be read from standard input.\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
@@ -287,15 +295,16 @@ prompt(EditLine *el)
 int
 main(int argc, char * const argv[])
 {
 int
 main(int argc, char * const argv[])
 {
-       Boolean                 dns     = FALSE;
+       Boolean                 doDNS   = FALSE;
+       Boolean                 doNet   = FALSE;
+       Boolean                 doPrefs = FALSE;
+       Boolean                 doProxy = FALSE;
+       Boolean                 doReach = FALSE;
        char                    *get    = NULL;
        char                    *get    = NULL;
-       Boolean                 net     = FALSE;
        extern int              optind;
        int                     opt;
        int                     opti;
        const char              *prog   = argv[0];
        extern int              optind;
        int                     opt;
        int                     opti;
        const char              *prog   = argv[0];
-       Boolean                 proxy   = FALSE;
-       Boolean                 reach   = FALSE;
        char                    *set    = NULL;
        InputRef                src;
        int                     timeout = 15;   /* default timeout (in seconds) */
        char                    *set    = NULL;
        InputRef                src;
        int                     timeout = 15;   /* default timeout (in seconds) */
@@ -318,7 +327,7 @@ main(int argc, char * const argv[])
                        enablePrivateAPI = TRUE;
                        break;
                case 'r':
                        enablePrivateAPI = TRUE;
                        break;
                case 'r':
-                       reach = TRUE;
+                       doReach = TRUE;
                        xStore++;
                        break;
                case 't':
                        xStore++;
                        break;
                case 't':
@@ -330,16 +339,19 @@ main(int argc, char * const argv[])
                        break;
                case 0:
                        if        (strcmp(longopts[opti].name, "dns") == 0) {
                        break;
                case 0:
                        if        (strcmp(longopts[opti].name, "dns") == 0) {
-                               dns = TRUE;
+                               doDNS = TRUE;
                                xStore++;
                        } else if (strcmp(longopts[opti].name, "get") == 0) {
                                get = optarg;
                                xStore++;
                        } else if (strcmp(longopts[opti].name, "net") == 0) {
                                xStore++;
                        } else if (strcmp(longopts[opti].name, "get") == 0) {
                                get = optarg;
                                xStore++;
                        } else if (strcmp(longopts[opti].name, "net") == 0) {
-                               net = TRUE;
+                               doNet = TRUE;
+                               xStore++;
+                       } else if (strcmp(longopts[opti].name, "prefs") == 0) {
+                               doPrefs = TRUE;
                                xStore++;
                        } else if (strcmp(longopts[opti].name, "proxy") == 0) {
                                xStore++;
                        } else if (strcmp(longopts[opti].name, "proxy") == 0) {
-                               proxy = TRUE;
+                               doProxy = TRUE;
                                xStore++;
                        } else if (strcmp(longopts[opti].name, "set") == 0) {
                                set = optarg;
                                xStore++;
                        } else if (strcmp(longopts[opti].name, "set") == 0) {
                                set = optarg;
@@ -359,7 +371,7 @@ main(int argc, char * const argv[])
        }
 
        /* are we checking the reachability of a host/address */
        }
 
        /* are we checking the reachability of a host/address */
-       if (reach) {
+       if (doReach) {
                if ((argc < 1) || (argc > 2)) {
                        usage(prog);
                }
                if ((argc < 1) || (argc > 2)) {
                        usage(prog);
                }
@@ -374,7 +386,7 @@ main(int argc, char * const argv[])
        }
 
        /* are we looking up the DNS configuration */
        }
 
        /* are we looking up the DNS configuration */
-       if (dns) {
+       if (doDNS) {
                do_showDNSConfiguration(argc, (char **)argv);
                /* NOT REACHED */
        }
                do_showDNSConfiguration(argc, (char **)argv);
                /* NOT REACHED */
        }
@@ -389,7 +401,7 @@ main(int argc, char * const argv[])
        }
 
        /* are we looking up the proxy configuration */
        }
 
        /* are we looking up the proxy configuration */
-       if (proxy) {
+       if (doProxy) {
                do_showProxyConfiguration(argc, (char **)argv);
                /* NOT REACHED */
        }
                do_showProxyConfiguration(argc, (char **)argv);
                /* NOT REACHED */
        }
@@ -403,10 +415,10 @@ main(int argc, char * const argv[])
                /* NOT REACHED */
        }
 
                /* NOT REACHED */
        }
 
-       if (net) {
+       if (doNet) {
                /* if we are going to be managing the network configuration */
                /* if we are going to be managing the network configuration */
-               commands  = (cmdInfo *)commands_prefs;
-               nCommands = nCommands_prefs;
+               commands  = (cmdInfo *)commands_net;
+               nCommands = nCommands_net;
 
                if (!getenv("ENABLE_EXPERIMENTAL_SCUTIL_COMMANDS")) {
                        usage(prog);
 
                if (!getenv("ENABLE_EXPERIMENTAL_SCUTIL_COMMANDS")) {
                        usage(prog);
@@ -414,6 +426,14 @@ main(int argc, char * const argv[])
 
                do_net_init();          /* initialization */
                do_net_open(0, NULL);   /* open default prefs */
 
                do_net_init();          /* initialization */
                do_net_open(0, NULL);   /* open default prefs */
+       } else if (doPrefs) {
+               /* if we are going to be managing the network configuration */
+               commands  = (cmdInfo *)commands_prefs;
+               nCommands = nCommands_prefs;
+
+               do_dictInit(0, NULL);   /* start with an empty dictionary */
+               do_prefs_init();        /* initialization */
+               do_prefs_open(0, NULL); /* open default prefs */
        } else {
                /* if we are going to be managing the dynamic store */
                commands  = (cmdInfo *)commands_store;
        } else {
                /* if we are going to be managing the dynamic store */
                commands  = (cmdInfo *)commands_store;
index cf0125670fb779fbae4aeb39a3435c4b96035b8d..16699f12ade1e6988dd53b0d5a841d9400a60282 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -49,6 +49,7 @@ typedef struct {
 } Input, *InputRef;
 
 
 } Input, *InputRef;
 
 
+extern AuthorizationRef                authorization;
 extern InputRef                        currentInput;
 extern int                     nesting;
 extern CFRunLoopRef            notifyRl;
 extern InputRef                        currentInput;
 extern int                     nesting;
 extern CFRunLoopRef            notifyRl;
index 72ce17d6e5955ad9305263408ba12077c1512776..b26bf4b6f783392d5eb8e49e6f868680858a5b54 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index aa9331f8da6295df1c0e937093e5d72e5fa5ed23..333d2079c151433031cec60904afafc296e7705a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -72,7 +72,7 @@ do_checkReachability(int argc, char **argv)
 
                        p = strchr(argv[0], '%');
                        if (p != NULL) {
 
                        p = strchr(argv[0], '%');
                        if (p != NULL) {
-                               sin6.sin6_scope_id = if_nametoindex(p+1);
+                               sin6.sin6_scope_id = if_nametoindex(p + 1);
                        }
 
                        target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin6);
                        }
 
                        target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin6);
@@ -316,7 +316,7 @@ do_wait(char *waitKey, int timeout)
                signal(SIGALRM, waitTimeout);
                bzero(&itv, sizeof(itv));
                itv.it_value.tv_sec = timeout;
                signal(SIGALRM, waitTimeout);
                bzero(&itv, sizeof(itv));
                itv.it_value.tv_sec = timeout;
-               if (setitimer(ITIMER_REAL, &itv, NULL) < 0) {
+               if (setitimer(ITIMER_REAL, &itv, NULL) == -1) {
                        SCPrint(TRUE, stderr,
                                CFSTR("setitimer() failed: %s\n"), strerror(errno));
                        exit(1);
                        SCPrint(TRUE, stderr,
                                CFSTR("setitimer() failed: %s\n"), strerror(errno));
                        exit(1);
@@ -325,3 +325,18 @@ do_wait(char *waitKey, int timeout)
 
        CFRunLoopRun();
 }
 
        CFRunLoopRun();
 }
+
+#ifdef TEST_DNS_CONFIGURATION_COPY
+
+CFRunLoopSourceRef     notifyRls       = NULL;
+SCDynamicStoreRef      store           = NULL;
+CFPropertyListRef      value           = NULL;
+       
+int
+main(int argc, char **argv)
+{
+       do_showDNSConfiguration(argc, argv);
+       exit(0);
+}
+
+#endif // TEST_DNS_CONFIGURATION_COPY
index 236e90f994269ddab4c96b36959def6f589fcfc6..f1ea81925771fe954777c687876b099b1f75846e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  *