From 4c5e92e2493bdfbbce40e998f3b607c72c47af2c Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 16 Jan 2004 22:21:15 +0000 Subject: [PATCH] configd-84.6.tar.gz --- SystemConfiguration.fproj/CustomInfo.plist | 2 +- SystemConfiguration.fproj/DHCP.c | 2 - .../DHCPClientPreferences.h | 2 - SystemConfiguration.fproj/DeviceOnHold.c | 2 - SystemConfiguration.fproj/DeviceOnHold.h | 2 - SystemConfiguration.fproj/LinkConfiguration.c | 191 +- SystemConfiguration.fproj/LinkConfiguration.h | 2 - SystemConfiguration.fproj/Makefile | 8 +- SystemConfiguration.fproj/Makefile.preamble | 2 + SystemConfiguration.fproj/PB.project | 10 +- SystemConfiguration.fproj/SCD.c | 2 - SystemConfiguration.fproj/SCDAdd.c | 2 - SystemConfiguration.fproj/SCDAddSession.c | 2 - SystemConfiguration.fproj/SCDConsoleUser.c | 2 - SystemConfiguration.fproj/SCDGet.c | 2 - SystemConfiguration.fproj/SCDHostName.c | 2 - SystemConfiguration.fproj/SCDKeys.c | 2 - SystemConfiguration.fproj/SCDList.c | 2 - SystemConfiguration.fproj/SCDLock.c | 2 - SystemConfiguration.fproj/SCDNotifierAdd.c | 2 - SystemConfiguration.fproj/SCDNotifierCancel.c | 2 - .../SCDNotifierGetChanges.c | 2 - .../SCDNotifierInformViaCallback.c | 2 - .../SCDNotifierInformViaFD.c | 2 - .../SCDNotifierInformViaMachPort.c | 2 - .../SCDNotifierInformViaSignal.c | 2 - SystemConfiguration.fproj/SCDNotifierRemove.c | 2 - .../SCDNotifierSetKeys.c | 2 - SystemConfiguration.fproj/SCDNotifierWait.c | 2 - SystemConfiguration.fproj/SCDNotify.c | 2 - SystemConfiguration.fproj/SCDOpen.c | 2 - SystemConfiguration.fproj/SCDPlugin.c | 2 - SystemConfiguration.fproj/SCDPlugin.h | 2 - SystemConfiguration.fproj/SCDPrivate.c | 2 - SystemConfiguration.fproj/SCDRemove.c | 2 - SystemConfiguration.fproj/SCDSet.c | 2 - SystemConfiguration.fproj/SCDSnapshot.c | 2 - SystemConfiguration.fproj/SCDTouch.c | 2 - SystemConfiguration.fproj/SCDUnlock.c | 2 - SystemConfiguration.fproj/SCDynamicStore.h | 2 - .../SCDynamicStoreCopyDHCPInfo.h | 2 - .../SCDynamicStoreCopySpecific.h | 2 - .../SCDynamicStoreCopySpecificPrivate.h | 2 - .../SCDynamicStoreInternal.h | 2 - SystemConfiguration.fproj/SCDynamicStoreKey.h | 2 - .../SCDynamicStorePrivate.h | 2 - .../SCDynamicStoreSetSpecificPrivate.h | 2 - SystemConfiguration.fproj/SCLocation.c | 2 - SystemConfiguration.fproj/SCNetwork.c | 2 - SystemConfiguration.fproj/SCNetwork.h | 2 - .../SCNetworkConnection.c | 2 - .../SCNetworkConnection.h | 2 - .../SCNetworkReachability.c | 8 +- .../SCNetworkReachability.h | 2 - SystemConfiguration.fproj/SCP.c | 2 - SystemConfiguration.fproj/SCPAdd.c | 2 - SystemConfiguration.fproj/SCPApply.c | 2 - SystemConfiguration.fproj/SCPCommit.c | 2 - SystemConfiguration.fproj/SCPGet.c | 2 - SystemConfiguration.fproj/SCPList.c | 2 - SystemConfiguration.fproj/SCPLock.c | 2 - SystemConfiguration.fproj/SCPOpen.c | 2 - SystemConfiguration.fproj/SCPPath.c | 2 - SystemConfiguration.fproj/SCPRemove.c | 2 - SystemConfiguration.fproj/SCPSet.c | 2 - SystemConfiguration.fproj/SCPUnlock.c | 2 - SystemConfiguration.fproj/SCPreferences.h | 2 - .../SCPreferencesInternal.h | 2 - SystemConfiguration.fproj/SCPreferencesPath.h | 2 - .../SCPreferencesPrivate.h | 2 - .../SCPreferencesSetSpecific.h | 2 - SystemConfiguration.fproj/SCPrivate.h | 2 - SystemConfiguration.fproj/SCProxies.c | 2 - SystemConfiguration.fproj/SCValidation.h | 2 - .../SystemConfiguration.h | 2 - SystemConfiguration.fproj/VLANConfiguration.c | 1573 +++++++++++++++++ SystemConfiguration.fproj/VLANConfiguration.h | 99 ++ .../VLANConfigurationPrivate.h | 45 + SystemConfiguration.fproj/config.defs | 2 - SystemConfiguration.fproj/config_types.h | 2 - SystemConfiguration.fproj/dy_framework.c | 2 - SystemConfiguration.fproj/dy_framework.h | 2 - SystemConfiguration.fproj/genSCPreferences.c | 40 +- SystemConfiguration.fproj/moh.c | 2 - SystemConfiguration.fproj/moh.h | 2 - SystemConfiguration.fproj/moh_msg.h | 2 - SystemConfiguration.fproj/ppp.c | 2 - SystemConfiguration.fproj/ppp.h | 2 - configd.tproj/_SCD.c | 2 - configd.tproj/_SCD.h | 2 - configd.tproj/_configadd.c | 2 - configd.tproj/_configadd_s.c | 2 - configd.tproj/_configclose.c | 2 - configd.tproj/_configget.c | 2 - configd.tproj/_configlist.c | 2 - configd.tproj/_configlock.c | 2 - configd.tproj/_confignotify.c | 2 - configd.tproj/_configopen.c | 2 - configd.tproj/_configremove.c | 2 - configd.tproj/_configset.c | 2 - configd.tproj/_configtouch.c | 2 - configd.tproj/_configunlock.c | 2 - configd.tproj/_notifyadd.c | 2 - configd.tproj/_notifycancel.c | 2 - configd.tproj/_notifychanges.c | 2 - configd.tproj/_notifyremove.c | 2 - configd.tproj/_notifyviafd.c | 2 - configd.tproj/_notifyviaport.c | 2 - configd.tproj/_notifyviasignal.c | 2 - configd.tproj/_snapshot.c | 2 - configd.tproj/config.defs | 2 - configd.tproj/configd.h | 2 - configd.tproj/configd.m | 2 - configd.tproj/configd_server.c | 2 - configd.tproj/configd_server.h | 2 - configd.tproj/notify.c | 2 - configd.tproj/notify.h | 2 - configd.tproj/notify_server.c | 2 - configd.tproj/notify_server.h | 2 - configd.tproj/pattern.c | 2 - configd.tproj/pattern.h | 2 - configd.tproj/plugin_support.c | 2 - configd.tproj/plugin_support.h | 2 - configd.tproj/session.c | 2 - configd.tproj/session.h | 2 - scselect.tproj/PB.project | 20 +- scselect.tproj/scselect.c | 108 +- scutil.tproj/cache.c | 2 - scutil.tproj/cache.h | 2 - scutil.tproj/commands.c | 2 - scutil.tproj/commands.h | 2 - scutil.tproj/dictionary.c | 2 - scutil.tproj/dictionary.h | 2 - scutil.tproj/notify.c | 2 - scutil.tproj/notify.h | 2 - scutil.tproj/prefs.c | 2 - scutil.tproj/prefs.h | 2 - scutil.tproj/scutil.c | 2 - scutil.tproj/scutil.h | 2 - scutil.tproj/session.c | 2 - scutil.tproj/session.h | 2 - scutil.tproj/tests.c | 2 - scutil.tproj/tests.h | 2 - 143 files changed, 1985 insertions(+), 383 deletions(-) create mode 100644 SystemConfiguration.fproj/VLANConfiguration.c create mode 100644 SystemConfiguration.fproj/VLANConfiguration.h create mode 100644 SystemConfiguration.fproj/VLANConfigurationPrivate.h diff --git a/SystemConfiguration.fproj/CustomInfo.plist b/SystemConfiguration.fproj/CustomInfo.plist index a1d4577..b2deea5 100644 --- a/SystemConfiguration.fproj/CustomInfo.plist +++ b/SystemConfiguration.fproj/CustomInfo.plist @@ -1,5 +1,5 @@ { CFBundleName = "SystemConfiguration"; CFBundleIdentifier = "com.apple.SystemConfiguration"; - CFBundleShortVersionString = "1.4.1"; + CFBundleShortVersionString = "1.7.1"; } diff --git a/SystemConfiguration.fproj/DHCP.c b/SystemConfiguration.fproj/DHCP.c index 778f9ff..7b6d1d7 100644 --- a/SystemConfiguration.fproj/DHCP.c +++ b/SystemConfiguration.fproj/DHCP.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/DHCPClientPreferences.h b/SystemConfiguration.fproj/DHCPClientPreferences.h index aa30111..7ba074a 100644 --- a/SystemConfiguration.fproj/DHCPClientPreferences.h +++ b/SystemConfiguration.fproj/DHCPClientPreferences.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/DeviceOnHold.c b/SystemConfiguration.fproj/DeviceOnHold.c index 48c93b1..0ee06ce 100644 --- a/SystemConfiguration.fproj/DeviceOnHold.c +++ b/SystemConfiguration.fproj/DeviceOnHold.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/DeviceOnHold.h b/SystemConfiguration.fproj/DeviceOnHold.h index 7d9d1ce..7cd4902 100644 --- a/SystemConfiguration.fproj/DeviceOnHold.h +++ b/SystemConfiguration.fproj/DeviceOnHold.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/LinkConfiguration.c b/SystemConfiguration.fproj/LinkConfiguration.c index 8ea15fa..b88db0e 100644 --- a/SystemConfiguration.fproj/LinkConfiguration.c +++ b/SystemConfiguration.fproj/LinkConfiguration.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 @@ -32,10 +30,13 @@ #include +#define KERNEL_PRIVATE #include +#undef KERNEL_PRIVATE #include #include #include +#include #include #include @@ -434,6 +435,90 @@ NetworkInterfaceCopyMediaSubTypeOptions(CFArrayRef available, } +static Boolean +__getMTULimits(char ifr_name[IFNAMSIZ], + int *mtu_min, + int *mtu_max) +{ + int ifType = 0; + io_iterator_t io_iter = 0; + io_registry_entry_t io_interface = 0; + io_registry_entry_t io_controller = 0; + kern_return_t kr; + mach_port_t masterPort = MACH_PORT_NULL; + CFMutableDictionaryRef matchingDict; + + /* look for a matching interface in the IORegistry */ + + matchingDict = IOBSDNameMatching(masterPort, 0, ifr_name); + if (matchingDict) { + /* Note: IOServiceGetMatchingServices consumes a reference on the 'matchingDict' */ + kr = IOServiceGetMatchingServices(masterPort, matchingDict, &io_iter); + if ((kr == KERN_SUCCESS) && io_iter) { + /* should only have a single match */ + io_interface = IOIteratorNext(io_iter); + } + if (io_iter) IOObjectRelease(io_iter); + } + + if (io_interface) { + CFNumberRef num; + + /* + * found an interface, get the interface type + */ + num = IORegistryEntryCreateCFProperty(io_interface, CFSTR(kIOInterfaceType), NULL, kNilOptions); + if (num) { + if (isA_CFNumber(num)) { + CFNumberGetValue(num, kCFNumberIntType, &ifType); + } + CFRelease(num); + } + + /* + * ...and the property we are REALLY interested is in the controller, + * which is the parent of the interface object. + */ + (void)IORegistryEntryGetParentEntry(io_interface, kIOServicePlane, &io_controller); + IOObjectRelease(io_interface); + } else { + /* if no matching interface */ + return FALSE; + } + + if (io_controller) { + CFNumberRef num; + + num = IORegistryEntryCreateCFProperty(io_controller, CFSTR(kIOMaxPacketSize), NULL, kNilOptions); + if (num) { + if (isA_CFNumber(num)) { + int value; + + /* + * Get the value and subtract the FCS bytes and Ethernet header + * sizes from the maximum frame size reported by the controller + * to get the MTU size. The 14 byte media header can be found + * in the registry, but not the size for the trailing FCS bytes. + */ + CFNumberGetValue(num, kCFNumberIntType, &value); + + if (ifType == IFT_ETHER) { + value -= (ETHER_HDR_LEN + ETHER_CRC_LEN); + } + + if (mtu_min) *mtu_min = IF_MINMTU; + if (mtu_max) *mtu_max = value; + } + CFRelease(num); + } + + IOObjectRelease(io_controller); + } + + return TRUE; +} + + Boolean NetworkInterfaceCopyMTU(CFStringRef interface, int *mtu_cur, @@ -462,88 +547,42 @@ NetworkInterfaceCopyMTU(CFStringRef interface, } if (mtu_cur) *mtu_cur = ifr.ifr_mtu; + if (mtu_min) *mtu_min = ifr.ifr_mtu; + if (mtu_max) *mtu_max = ifr.ifr_mtu; /* get valid MTU range */ if (mtu_min || mtu_max) { - int ifType = 0; - io_iterator_t io_iter = 0; - io_registry_entry_t io_interface = 0; - io_registry_entry_t io_controller = 0; - kern_return_t kr; - mach_port_t masterPort = MACH_PORT_NULL; - CFMutableDictionaryRef matchingDict; - - /* assume that we don't know */ - - if (mtu_min) *mtu_min = -1; - if (mtu_max) *mtu_max = -1; - - /* look for a matching interface in the IORegistry */ - - matchingDict = IOBSDNameMatching(masterPort, 0, ifr.ifr_name); - if (matchingDict) { - /* Note: IOServiceGetMatchingServices consumes a reference on the 'matchingDict' */ - kr = IOServiceGetMatchingServices(masterPort, matchingDict, &io_iter); - if ((kr == KERN_SUCCESS) && io_iter) { - /* should only have a single match */ - io_interface = IOIteratorNext(io_iter); - } - if (io_iter) IOObjectRelease(io_iter); - } - - /* found an interface with the given BSD name, get its parent */ - - if (io_interface) { - CFNumberRef num; - - /* - * get the interface type - */ - num = IORegistryEntryCreateCFProperty(io_interface, CFSTR(kIOInterfaceType), NULL, kNilOptions); - if (num) { - if (isA_CFNumber(num)) { - CFNumberGetValue(num, kCFNumberIntType, &ifType); + ok = __getMTULimits(ifr.ifr_name, mtu_min, mtu_max); + if (!ok) { + struct ifreq vifr; + struct vlanreq vreq; + + // check if this is a vlan + + bzero(&vifr, sizeof(vifr)); + bzero(&vreq, sizeof(vreq)); + strncpy(vifr.ifr_name, ifr.ifr_name, sizeof(vifr.ifr_name)); + vifr.ifr_data = (caddr_t)&vreq; + + if (ioctl(sock, SIOCGETVLAN, (caddr_t)&vifr) == 0) { + /* + * yes, pass parent device MTU settings + * + * min == parent device minimum MTU + * max == parent device current MTU + */ + if (mtu_min) { + (void) __getMTULimits(vreq.vlr_parent, mtu_min, NULL); } - CFRelease(num); - } - - /* - * ...and the property we are REALLY interested is in the controller, - * which is the parent of the interface object. - */ - (void)IORegistryEntryGetParentEntry(io_interface, kIOServicePlane, &io_controller); - - IOObjectRelease(io_interface); - } - - if (io_controller) { - CFNumberRef num; - - num = IORegistryEntryCreateCFProperty(io_controller, CFSTR(kIOMaxPacketSize), NULL, kNilOptions); - if (num) { - if (isA_CFNumber(num)) { - int value; - - /* - * Get the value and subtract the FCS bytes and Ethernet header - * sizes from the maximum frame size reported by the controller - * to get the MTU size. The 14 byte media header can be found - * in the registry, but not the size for the trailing FCS bytes. - */ - CFNumberGetValue(num, kCFNumberIntType, &value); - - if (ifType == IFT_ETHER) { - value -= (ETHER_HDR_LEN + ETHER_CRC_LEN); + if (mtu_max) { + bzero(&vifr, sizeof(vifr)); + strncpy(vifr.ifr_name, vreq.vlr_parent, sizeof(vifr.ifr_name)); + if (ioctl(sock, SIOCGIFMTU, (caddr_t)&vifr) == 0) { + *mtu_max = vifr.ifr_mtu; } - - if (mtu_min) *mtu_min = IF_MINMTU; - if (mtu_max) *mtu_max = value; } - CFRelease(num); } - - IOObjectRelease(io_controller); } } diff --git a/SystemConfiguration.fproj/LinkConfiguration.h b/SystemConfiguration.fproj/LinkConfiguration.h index 09701b3..f33f8c7 100644 --- a/SystemConfiguration.fproj/LinkConfiguration.h +++ b/SystemConfiguration.fproj/LinkConfiguration.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/Makefile b/SystemConfiguration.fproj/Makefile index 01955bb..1b406d4 100644 --- a/SystemConfiguration.fproj/Makefile +++ b/SystemConfiguration.fproj/Makefile @@ -21,7 +21,8 @@ HFILES = SystemConfiguration.h SCPrivate.h SCDPlugin.h config_types.h\ SCPreferencesSetSpecific.h SCNetwork.h SCNetworkConnection.h\ SCNetworkReachability.h SCValidation.h ppp.h\ DHCPClientPreferences.h SCDynamicStoreCopyDHCPInfo.h moh_msg.h\ - moh.h DeviceOnHold.h LinkConfiguration.h dy_framework.h + moh.h DeviceOnHold.h LinkConfiguration.h dy_framework.h\ + VLANConfiguration.h VLANConfigurationPrivate.h CFILES = SCD.c SCDKeys.c SCDPrivate.c SCDPlugin.c SCDOpen.c SCDLock.c\ SCDUnlock.c SCDList.c SCDAdd.c SCDAddSession.c SCDGet.c\ @@ -35,7 +36,8 @@ CFILES = SCD.c SCDKeys.c SCDPrivate.c SCDPlugin.c SCDOpen.c SCDLock.c\ SCPCommit.c SCPApply.c SCPPath.c SCDConsoleUser.c\ SCDHostName.c SCLocation.c SCNetwork.c SCNetworkConnection.c\ SCNetworkReachability.c SCProxies.c ppp.c DHCP.c moh.c\ - DeviceOnHold.c LinkConfiguration.c dy_framework.c + DeviceOnHold.c LinkConfiguration.c dy_framework.c\ + VLANConfiguration.c OTHERSRCS = Makefile.preamble Makefile Makefile.postamble m.template\ h.template config.defs genSCPreferences.c CustomInfo.plist @@ -75,7 +77,7 @@ PROJECT_HEADERS = SystemConfiguration.h SCPrivate.h config_types.h\ SCPreferencesPrivate.h SCPreferencesPath.h\ SCPreferencesSetSpecific.h SCNetwork.h\ SCNetworkConnection.h SCNetworkReachability.h\ - SCValidation.h + SCValidation.h VLANConfigurationPrivate.h diff --git a/SystemConfiguration.fproj/Makefile.preamble b/SystemConfiguration.fproj/Makefile.preamble index 07d79b1..ac111af 100644 --- a/SystemConfiguration.fproj/Makefile.preamble +++ b/SystemConfiguration.fproj/Makefile.preamble @@ -148,6 +148,8 @@ OTHER_PRIVATE_HEADERS += SCValidation.h OTHER_PRIVATE_HEADERS += SCDPlugin.h OTHER_PRIVATE_HEADERS += DeviceOnHold.h OTHER_PRIVATE_HEADERS += LinkConfiguration.h +OTHER_PRIVATE_HEADERS += VLANConfiguration.h +OTHER_PRIVATE_HEADERS += VLANConfigurationPrivate.h # # MiG generated files diff --git a/SystemConfiguration.fproj/PB.project b/SystemConfiguration.fproj/PB.project index 63378a2..3d2e5a7 100644 --- a/SystemConfiguration.fproj/PB.project +++ b/SystemConfiguration.fproj/PB.project @@ -36,7 +36,9 @@ "moh.h", "DeviceOnHold.h", "LinkConfiguration.h", - "dy_framework.h" + "dy_framework.h", + "VLANConfiguration.h", + "VLANConfigurationPrivate.h" ); "OTHER_LIBS" = (); "OTHER_LINKED" = ( @@ -90,7 +92,8 @@ "moh.c", "DeviceOnHold.c", "LinkConfiguration.c", - "dy_framework.c" + "dy_framework.c", + "VLANConfiguration.c" ); "OTHER_SOURCES" = ( "Makefile.preamble", @@ -122,7 +125,8 @@ "SCNetwork.h", "SCNetworkConnection.h", "SCNetworkReachability.h", - "SCValidation.h" + "SCValidation.h", + "VLANConfigurationPrivate.h" ); "PUBLIC_HEADERS" = ( "SystemConfiguration.h", diff --git a/SystemConfiguration.fproj/SCD.c b/SystemConfiguration.fproj/SCD.c index e58d4f9..50c0f86 100644 --- a/SystemConfiguration.fproj/SCD.c +++ b/SystemConfiguration.fproj/SCD.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDAdd.c b/SystemConfiguration.fproj/SCDAdd.c index b643c73..00503ab 100644 --- a/SystemConfiguration.fproj/SCDAdd.c +++ b/SystemConfiguration.fproj/SCDAdd.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDAddSession.c b/SystemConfiguration.fproj/SCDAddSession.c index 9a265fe..7957db1 100644 --- a/SystemConfiguration.fproj/SCDAddSession.c +++ b/SystemConfiguration.fproj/SCDAddSession.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDConsoleUser.c b/SystemConfiguration.fproj/SCDConsoleUser.c index 06c2858..ad97b87 100644 --- a/SystemConfiguration.fproj/SCDConsoleUser.c +++ b/SystemConfiguration.fproj/SCDConsoleUser.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDGet.c b/SystemConfiguration.fproj/SCDGet.c index d691cd1..1d566af 100644 --- a/SystemConfiguration.fproj/SCDGet.c +++ b/SystemConfiguration.fproj/SCDGet.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDHostName.c b/SystemConfiguration.fproj/SCDHostName.c index 6d62ee4..7bd5fe1 100644 --- a/SystemConfiguration.fproj/SCDHostName.c +++ b/SystemConfiguration.fproj/SCDHostName.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDKeys.c b/SystemConfiguration.fproj/SCDKeys.c index a3cb2a1..c52d5ab 100644 --- a/SystemConfiguration.fproj/SCDKeys.c +++ b/SystemConfiguration.fproj/SCDKeys.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDList.c b/SystemConfiguration.fproj/SCDList.c index cee6ec9..4ab3068 100644 --- a/SystemConfiguration.fproj/SCDList.c +++ b/SystemConfiguration.fproj/SCDList.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDLock.c b/SystemConfiguration.fproj/SCDLock.c index 6a08e8d..c478dc8 100644 --- a/SystemConfiguration.fproj/SCDLock.c +++ b/SystemConfiguration.fproj/SCDLock.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierAdd.c b/SystemConfiguration.fproj/SCDNotifierAdd.c index c10977f..85c2969 100644 --- a/SystemConfiguration.fproj/SCDNotifierAdd.c +++ b/SystemConfiguration.fproj/SCDNotifierAdd.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierCancel.c b/SystemConfiguration.fproj/SCDNotifierCancel.c index 25c57d5..41613e0 100644 --- a/SystemConfiguration.fproj/SCDNotifierCancel.c +++ b/SystemConfiguration.fproj/SCDNotifierCancel.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierGetChanges.c b/SystemConfiguration.fproj/SCDNotifierGetChanges.c index 3d37574..8711312 100644 --- a/SystemConfiguration.fproj/SCDNotifierGetChanges.c +++ b/SystemConfiguration.fproj/SCDNotifierGetChanges.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c b/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c index 74096c5..f5cac08 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaFD.c b/SystemConfiguration.fproj/SCDNotifierInformViaFD.c index e91cd8b..7aec221 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaFD.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaFD.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c b/SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c index 42fffca..bef3896 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaSignal.c b/SystemConfiguration.fproj/SCDNotifierInformViaSignal.c index 9672770..4356c6e 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaSignal.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaSignal.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierRemove.c b/SystemConfiguration.fproj/SCDNotifierRemove.c index 1cffd11..06f81b9 100644 --- a/SystemConfiguration.fproj/SCDNotifierRemove.c +++ b/SystemConfiguration.fproj/SCDNotifierRemove.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierSetKeys.c b/SystemConfiguration.fproj/SCDNotifierSetKeys.c index 483e549..c9eb908 100644 --- a/SystemConfiguration.fproj/SCDNotifierSetKeys.c +++ b/SystemConfiguration.fproj/SCDNotifierSetKeys.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotifierWait.c b/SystemConfiguration.fproj/SCDNotifierWait.c index c0992dc..2417fd2 100644 --- a/SystemConfiguration.fproj/SCDNotifierWait.c +++ b/SystemConfiguration.fproj/SCDNotifierWait.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDNotify.c b/SystemConfiguration.fproj/SCDNotify.c index fafcea0..409523b 100644 --- a/SystemConfiguration.fproj/SCDNotify.c +++ b/SystemConfiguration.fproj/SCDNotify.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDOpen.c b/SystemConfiguration.fproj/SCDOpen.c index 39ffade..1ce5cfb 100644 --- a/SystemConfiguration.fproj/SCDOpen.c +++ b/SystemConfiguration.fproj/SCDOpen.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDPlugin.c b/SystemConfiguration.fproj/SCDPlugin.c index d25a14c..a92f51d 100644 --- a/SystemConfiguration.fproj/SCDPlugin.c +++ b/SystemConfiguration.fproj/SCDPlugin.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDPlugin.h b/SystemConfiguration.fproj/SCDPlugin.h index 2daaa0f..24955c4 100644 --- a/SystemConfiguration.fproj/SCDPlugin.h +++ b/SystemConfiguration.fproj/SCDPlugin.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDPrivate.c b/SystemConfiguration.fproj/SCDPrivate.c index 391f504..4248bd6 100644 --- a/SystemConfiguration.fproj/SCDPrivate.c +++ b/SystemConfiguration.fproj/SCDPrivate.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDRemove.c b/SystemConfiguration.fproj/SCDRemove.c index c91f82b..b523f56 100644 --- a/SystemConfiguration.fproj/SCDRemove.c +++ b/SystemConfiguration.fproj/SCDRemove.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDSet.c b/SystemConfiguration.fproj/SCDSet.c index 56cc859..aba8569 100644 --- a/SystemConfiguration.fproj/SCDSet.c +++ b/SystemConfiguration.fproj/SCDSet.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDSnapshot.c b/SystemConfiguration.fproj/SCDSnapshot.c index 851f785..13e069d 100644 --- a/SystemConfiguration.fproj/SCDSnapshot.c +++ b/SystemConfiguration.fproj/SCDSnapshot.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDTouch.c b/SystemConfiguration.fproj/SCDTouch.c index b79c8bb..4450e9e 100644 --- a/SystemConfiguration.fproj/SCDTouch.c +++ b/SystemConfiguration.fproj/SCDTouch.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDUnlock.c b/SystemConfiguration.fproj/SCDUnlock.c index 8d20621..c847c3f 100644 --- a/SystemConfiguration.fproj/SCDUnlock.c +++ b/SystemConfiguration.fproj/SCDUnlock.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDynamicStore.h b/SystemConfiguration.fproj/SCDynamicStore.h index b2cec8b..ea0d504 100644 --- a/SystemConfiguration.fproj/SCDynamicStore.h +++ b/SystemConfiguration.fproj/SCDynamicStore.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h b/SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h index 4eab51c..088b408 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h +++ b/SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h b/SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h index b1baeaa..e95c460 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h +++ b/SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h b/SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h index a47a0ea..5746a81 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h +++ b/SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDynamicStoreInternal.h b/SystemConfiguration.fproj/SCDynamicStoreInternal.h index be5209a..51f28b2 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreInternal.h +++ b/SystemConfiguration.fproj/SCDynamicStoreInternal.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDynamicStoreKey.h b/SystemConfiguration.fproj/SCDynamicStoreKey.h index 25c96a7..18bde7d 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreKey.h +++ b/SystemConfiguration.fproj/SCDynamicStoreKey.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDynamicStorePrivate.h b/SystemConfiguration.fproj/SCDynamicStorePrivate.h index 12c180b..ebf7b28 100644 --- a/SystemConfiguration.fproj/SCDynamicStorePrivate.h +++ b/SystemConfiguration.fproj/SCDynamicStorePrivate.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h b/SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h index ab325a2..76f8c90 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h +++ b/SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCLocation.c b/SystemConfiguration.fproj/SCLocation.c index e60486d..06dd869 100644 --- a/SystemConfiguration.fproj/SCLocation.c +++ b/SystemConfiguration.fproj/SCLocation.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCNetwork.c b/SystemConfiguration.fproj/SCNetwork.c index 550e1fd..e5f1671 100644 --- a/SystemConfiguration.fproj/SCNetwork.c +++ b/SystemConfiguration.fproj/SCNetwork.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCNetwork.h b/SystemConfiguration.fproj/SCNetwork.h index 7ac7168..b9c9ee1 100644 --- a/SystemConfiguration.fproj/SCNetwork.h +++ b/SystemConfiguration.fproj/SCNetwork.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCNetworkConnection.c b/SystemConfiguration.fproj/SCNetworkConnection.c index b50cda0..bd3c331 100644 --- a/SystemConfiguration.fproj/SCNetworkConnection.c +++ b/SystemConfiguration.fproj/SCNetworkConnection.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCNetworkConnection.h b/SystemConfiguration.fproj/SCNetworkConnection.h index 53357bc..74a70d1 100644 --- a/SystemConfiguration.fproj/SCNetworkConnection.h +++ b/SystemConfiguration.fproj/SCNetworkConnection.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCNetworkReachability.c b/SystemConfiguration.fproj/SCNetworkReachability.c index 36be12a..c838bc7 100644 --- a/SystemConfiguration.fproj/SCNetworkReachability.c +++ b/SystemConfiguration.fproj/SCNetworkReachability.c @@ -2,16 +2,14 @@ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ - * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * + * * 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, @@ -19,7 +17,7 @@ * 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@ */ diff --git a/SystemConfiguration.fproj/SCNetworkReachability.h b/SystemConfiguration.fproj/SCNetworkReachability.h index 7ad9962..8efa2d3 100644 --- a/SystemConfiguration.fproj/SCNetworkReachability.h +++ b/SystemConfiguration.fproj/SCNetworkReachability.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCP.c b/SystemConfiguration.fproj/SCP.c index 40f2eda..0d64743 100644 --- a/SystemConfiguration.fproj/SCP.c +++ b/SystemConfiguration.fproj/SCP.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPAdd.c b/SystemConfiguration.fproj/SCPAdd.c index 43de7f2..963c2f0 100644 --- a/SystemConfiguration.fproj/SCPAdd.c +++ b/SystemConfiguration.fproj/SCPAdd.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPApply.c b/SystemConfiguration.fproj/SCPApply.c index 65c9acd..951eb4f 100644 --- a/SystemConfiguration.fproj/SCPApply.c +++ b/SystemConfiguration.fproj/SCPApply.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPCommit.c b/SystemConfiguration.fproj/SCPCommit.c index 18f00f3..8998e4b 100644 --- a/SystemConfiguration.fproj/SCPCommit.c +++ b/SystemConfiguration.fproj/SCPCommit.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPGet.c b/SystemConfiguration.fproj/SCPGet.c index bdbfc41..896d27c 100644 --- a/SystemConfiguration.fproj/SCPGet.c +++ b/SystemConfiguration.fproj/SCPGet.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPList.c b/SystemConfiguration.fproj/SCPList.c index 031c33e..1626811 100644 --- a/SystemConfiguration.fproj/SCPList.c +++ b/SystemConfiguration.fproj/SCPList.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPLock.c b/SystemConfiguration.fproj/SCPLock.c index d69c81e..88bd281 100644 --- a/SystemConfiguration.fproj/SCPLock.c +++ b/SystemConfiguration.fproj/SCPLock.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPOpen.c b/SystemConfiguration.fproj/SCPOpen.c index a748210..47f21f2 100644 --- a/SystemConfiguration.fproj/SCPOpen.c +++ b/SystemConfiguration.fproj/SCPOpen.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPPath.c b/SystemConfiguration.fproj/SCPPath.c index fc27f6b..1fd06ed 100644 --- a/SystemConfiguration.fproj/SCPPath.c +++ b/SystemConfiguration.fproj/SCPPath.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPRemove.c b/SystemConfiguration.fproj/SCPRemove.c index ab52648..1de5c1d 100644 --- a/SystemConfiguration.fproj/SCPRemove.c +++ b/SystemConfiguration.fproj/SCPRemove.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPSet.c b/SystemConfiguration.fproj/SCPSet.c index 2b1357e..c5f6c3f 100644 --- a/SystemConfiguration.fproj/SCPSet.c +++ b/SystemConfiguration.fproj/SCPSet.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPUnlock.c b/SystemConfiguration.fproj/SCPUnlock.c index 5a2ab73..c41ee10 100644 --- a/SystemConfiguration.fproj/SCPUnlock.c +++ b/SystemConfiguration.fproj/SCPUnlock.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPreferences.h b/SystemConfiguration.fproj/SCPreferences.h index 5db981e..aaebc2a 100644 --- a/SystemConfiguration.fproj/SCPreferences.h +++ b/SystemConfiguration.fproj/SCPreferences.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPreferencesInternal.h b/SystemConfiguration.fproj/SCPreferencesInternal.h index 488e5d7..b1f669d 100644 --- a/SystemConfiguration.fproj/SCPreferencesInternal.h +++ b/SystemConfiguration.fproj/SCPreferencesInternal.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPreferencesPath.h b/SystemConfiguration.fproj/SCPreferencesPath.h index 98cd637..e3a85cd 100644 --- a/SystemConfiguration.fproj/SCPreferencesPath.h +++ b/SystemConfiguration.fproj/SCPreferencesPath.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPreferencesPrivate.h b/SystemConfiguration.fproj/SCPreferencesPrivate.h index 076e1af..23c37ef 100644 --- a/SystemConfiguration.fproj/SCPreferencesPrivate.h +++ b/SystemConfiguration.fproj/SCPreferencesPrivate.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPreferencesSetSpecific.h b/SystemConfiguration.fproj/SCPreferencesSetSpecific.h index c4f4fed..4ff04ea 100644 --- a/SystemConfiguration.fproj/SCPreferencesSetSpecific.h +++ b/SystemConfiguration.fproj/SCPreferencesSetSpecific.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCPrivate.h b/SystemConfiguration.fproj/SCPrivate.h index c63ca59..5ee8e13 100644 --- a/SystemConfiguration.fproj/SCPrivate.h +++ b/SystemConfiguration.fproj/SCPrivate.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCProxies.c b/SystemConfiguration.fproj/SCProxies.c index 5606ddc..85f55eb 100644 --- a/SystemConfiguration.fproj/SCProxies.c +++ b/SystemConfiguration.fproj/SCProxies.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SCValidation.h b/SystemConfiguration.fproj/SCValidation.h index 254c0a4..2ff0f04 100644 --- a/SystemConfiguration.fproj/SCValidation.h +++ b/SystemConfiguration.fproj/SCValidation.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/SystemConfiguration.h b/SystemConfiguration.fproj/SystemConfiguration.h index 5278005..5d74bbc 100644 --- a/SystemConfiguration.fproj/SystemConfiguration.h +++ b/SystemConfiguration.fproj/SystemConfiguration.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/VLANConfiguration.c b/SystemConfiguration.fproj/VLANConfiguration.c new file mode 100644 index 0000000..7072892 --- /dev/null +++ b/SystemConfiguration.fproj/VLANConfiguration.c @@ -0,0 +1,1573 @@ +/* + * Copyright (c) 2003 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 + * + * November 14, 2003 Allan Nathanson + * - initial revision + */ + + +#include +#include + +#include +#include +#include + +#include +#include +#include +#define KERNEL_PRIVATE +#include +#undef KERNEL_PRIVATE +#include +#include +#include +#define KERNEL_PRIVATE 1 +#include +#include +#undef KERNEL_PRIVATE +#include +#include +#include + +#include +#include + +/* ---------- VLAN support ---------- */ + +static int +inet_dgram_socket() +{ + int s; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno)); + _SCErrorSet(kSCStatusFailed); + } + + return s; +} + + +static Boolean +_VLAN_create(int s, CFStringRef interface) +{ +#ifdef SIOCIFCREATE + struct ifreq ifr; + + bzero(&ifr, sizeof(ifr)); + (void) _SC_cfstring_to_cstring(interface, + ifr.ifr_name, + sizeof(ifr.ifr_name), + kCFStringEncodingASCII); + + if (ioctl(s, SIOCIFCREATE, &ifr) == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCIFCREATE) failed: %s"), strerror(errno)); + _SCErrorSet(kSCStatusFailed); + return FALSE; + } + + return TRUE; +#else /* SIOCIFCREATE */ + return FALSE; +#endif /* SIOCIFCREATE */ +} + + +static Boolean +_VLAN_destroy(int s, CFStringRef interface) +{ +#ifdef SIOCIFDESTROY + struct ifreq ifr; + + bzero(&ifr, sizeof(ifr)); + (void) _SC_cfstring_to_cstring(interface, + ifr.ifr_name, + sizeof(ifr.ifr_name), + kCFStringEncodingASCII); + + if (ioctl(s, SIOCIFDESTROY, &ifr) == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCIFDESTROY) failed: %s"), strerror(errno)); + _SCErrorSet(kSCStatusFailed); + return FALSE; + } + + return TRUE; +#else /* SIOCIFDESTROY */ + return FALSE; +#endif /* SIOCIFDESTROY */ +} + + +static Boolean +_VLANDevice_set(int s, CFStringRef interface, CFStringRef device, CFNumberRef tag) +{ +#ifdef SIOCSETVLAN + struct ifreq ifr; + int tag_val; + struct vlanreq vreq; + + bzero(&ifr, sizeof(ifr)); + bzero(&vreq, sizeof(vreq)); + + // interface + (void) _SC_cfstring_to_cstring(interface, + ifr.ifr_name, + sizeof(ifr.ifr_name), + kCFStringEncodingASCII); + ifr.ifr_data = (caddr_t)&vreq; + + // parent device + (void) _SC_cfstring_to_cstring(device, + 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, SIOCSETVLAN, (caddr_t)&ifr) == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCSETVLAN) failed: %s"), strerror(errno)); + _SCErrorSet(kSCStatusFailed); + return FALSE; + } + + return TRUE; +#else /* SIOCSETVLAN */ + return FALSE; +#endif /* SIOCSETVLAN */ +} + + +static Boolean +_VLANDevice_unset(int s, CFStringRef interface) +{ +#ifdef SIOCSETVLAN + struct ifreq ifr; + struct vlanreq vreq; + + bzero(&ifr, sizeof(ifr)); + bzero(&vreq, sizeof(vreq)); + + // interface + (void) _SC_cfstring_to_cstring(interface, + ifr.ifr_name, + sizeof(ifr.ifr_name), + kCFStringEncodingASCII); + ifr.ifr_data = (caddr_t)&vreq; + + // clear parent device + bzero(&vreq.vlr_parent, sizeof(vreq.vlr_parent)); + + // clear tag + vreq.vlr_tag = 0; + + // update parent device and tag + if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCSETVLAN) failed: %s"), strerror(errno)); + _SCErrorSet(kSCStatusFailed); + return FALSE; + } + + return TRUE; +#else /* SIOCSETVLAN */ + return FALSE; +#endif /* SIOCSETVLAN */ +} + + +/* ---------- VLAN "device" ---------- */ + +Boolean +IsVLANSupported(CFStringRef device) +{ + 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 */ + + if_name = _SC_cfstring_to_cstring(device, NULL, NULL, 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 device */ + + 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) < 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; + } + + /* 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)) { + isVlan = TRUE; + } +#endif + break; + } + } + + done : + + if (if_name != NULL) CFAllocatorDeallocate(NULL, if_name); + if (buf != NULL) CFAllocatorDeallocate(NULL, buf); + + return isVlan; +} + +/* ---------- VLANInterface ---------- */ + +typedef struct { + + /* base CFType information */ + CFRuntimeBase cfBase; + + /* vlan interface configuration */ + CFStringRef ifname; // e.g. vlan0, vlan1, ... + CFStringRef device; // e.g. en0, en1, ... + CFNumberRef tag; // e.g. 1 <= tag <= 4094 + CFDictionaryRef options; // e.g. UserDefinedName + +} VLANInterfacePrivate, * VLANInterfacePrivateRef; + + +static CFStringRef __VLANInterfaceCopyDescription (CFTypeRef cf); +static void __VLANInterfaceDeallocate (CFTypeRef cf); +static Boolean __VLANInterfaceEqual (CFTypeRef cf1, CFTypeRef cf2); + + +static const CFRuntimeClass __VLANInterfaceClass = { + 0, // version + "VLANInterface", // className + NULL, // init + NULL, // copy + __VLANInterfaceDeallocate, // dealloc + __VLANInterfaceEqual, // equal + NULL, // hash + NULL, // copyFormattingDesc + __VLANInterfaceCopyDescription // copyDebugDesc +}; + + +static CFTypeID __kVLANInterfaceTypeID = _kCFRuntimeNotATypeID; + + +static pthread_once_t vlanInterface_init = PTHREAD_ONCE_INIT; + + +static CFStringRef +__VLANInterfaceCopyDescription(CFTypeRef cf) +{ + CFAllocatorRef allocator = CFGetAllocator(cf); + CFMutableStringRef result; + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)cf; + + result = CFStringCreateMutable(allocator, 0); + CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); + 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(" }")); + + return result; +} + + +static void +__VLANInterfaceDeallocate(CFTypeRef cf) +{ + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)cf; + + SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__VLANInterfaceDeallocate:")); + + /* release resources */ + + CFRelease(vlanPrivate->ifname); + CFRelease(vlanPrivate->device); + CFRelease(vlanPrivate->tag); + if (vlanPrivate->options) CFRelease(vlanPrivate->options); + + return; +} + + +static Boolean +__VLANInterfaceEquiv(CFTypeRef cf1, CFTypeRef cf2) +{ + VLANInterfacePrivateRef vlan1 = (VLANInterfacePrivateRef)cf1; + VLANInterfacePrivateRef vlan2 = (VLANInterfacePrivateRef)cf2; + + if (vlan1 == vlan2) + return TRUE; + + if (!CFEqual(vlan1->ifname, vlan2->ifname)) + return FALSE; // if not the same interface + + if (!CFEqual(vlan1->device, vlan2->device)) + return FALSE; // if not the same device + + if (!CFEqual(vlan1->tag, vlan2->tag)) + return FALSE; // if not the same tag + + return TRUE; +} + + +static Boolean +__VLANInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2) +{ + VLANInterfacePrivateRef vlan1 = (VLANInterfacePrivateRef)cf1; + VLANInterfacePrivateRef vlan2 = (VLANInterfacePrivateRef)cf2; + + if (!__VLANInterfaceEquiv(vlan1, vlan2)) + return FALSE; // if not the same VLAN interface/device/tag + + if (vlan1->options != vlan2->options) { + // if the options may differ + if ((vlan1->options != NULL) && (vlan2->options != NULL)) { + // if both VLANs have options + if (!CFEqual(vlan1->options, vlan2->options)) { + // if the options are not equal + return FALSE; + } + } else { + // if only one VLAN has options + return FALSE; + } + } + + return TRUE; +} + + +static void +__VLANInterfaceInitialize(void) +{ + __kVLANInterfaceTypeID = _CFRuntimeRegisterClass(&__VLANInterfaceClass); + return; +} + + +static __inline__ CFTypeRef +isA_VLANInterface(CFTypeRef obj) +{ + return (isA_CFType(obj, VLANInterfaceGetTypeID())); +} + + +CFTypeID +VLANInterfaceGetTypeID(void) +{ + pthread_once(&vlanInterface_init, __VLANInterfaceInitialize); /* initialize runtime */ + return __kVLANInterfaceTypeID; +} + + +static VLANInterfaceRef +__VLANInterfaceCreatePrivate(CFAllocatorRef allocator, + CFStringRef ifname, + CFStringRef device, + CFNumberRef tag, + CFDictionaryRef options) +{ + VLANInterfacePrivateRef vlanPrivate; + uint32_t size; + + SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__VLANInterfaceCreatePrivate:")); + + /* initialize runtime */ + pthread_once(&vlanInterface_init, __VLANInterfaceInitialize); + + /* allocate vlan */ + size = sizeof(VLANInterfacePrivate) - sizeof(CFRuntimeBase); + vlanPrivate = (VLANInterfacePrivateRef)_CFRuntimeCreateInstance(allocator, + __kVLANInterfaceTypeID, + size, + NULL); + if (!vlanPrivate) { + return NULL; + } + + /* establish the vlan */ + + vlanPrivate->ifname = CFStringCreateCopy(allocator, ifname); + vlanPrivate->device = CFStringCreateCopy(allocator, device); + vlanPrivate->tag = CFRetain(tag); + if (options != NULL) { + vlanPrivate->options = CFDictionaryCreateCopy(allocator, options); + } else { + vlanPrivate->options = NULL; + } + + return (VLANInterfaceRef)vlanPrivate; +} + + +CFStringRef +VLANInterfaceGetInterface(VLANInterfaceRef vlan) +{ + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; + CFStringRef vlan_if = NULL; + + if (isA_VLANInterface(vlan)) { + vlan_if = vlanPrivate->ifname; + } + + return vlan_if; +} + + +CFStringRef +VLANInterfaceGetDevice(VLANInterfaceRef vlan) +{ + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; + CFStringRef vlan_device = NULL; + + if (isA_VLANInterface(vlan)) { + vlan_device = vlanPrivate->device; + } + + return vlan_device; +} + + +static void +VLANInterfaceSetDevice(VLANInterfaceRef vlan, CFStringRef newDevice) +{ + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; + + if (isA_VLANInterface(vlan)) { + CFAllocatorRef allocator = CFGetAllocator(vlan); + + CFRelease(vlanPrivate->device); + vlanPrivate->device = CFStringCreateCopy(allocator, newDevice); + } + + return; +} + + +CFNumberRef +VLANInterfaceGetTag(VLANInterfaceRef vlan) +{ + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; + CFNumberRef vlan_tag = NULL; + + if (isA_VLANInterface(vlan)) { + vlan_tag = vlanPrivate->tag; + } + + return vlan_tag; +} + + +static void +VLANInterfaceSetTag(VLANInterfaceRef vlan, CFNumberRef newTag) +{ + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; + + if (isA_VLANInterface(vlan)) { + CFRelease(vlanPrivate->tag); + vlanPrivate->tag = CFRetain(newTag); + } + + return; +} + + +CFDictionaryRef +VLANInterfaceGetOptions(VLANInterfaceRef vlan) +{ + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; + CFDictionaryRef vlan_options = NULL; + + if (isA_VLANInterface(vlan)) { + vlan_options = vlanPrivate->options; + } + + return vlan_options; +} + + +static void +VLANInterfaceSetOptions(VLANInterfaceRef vlan, CFDictionaryRef newOptions) +{ + VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; + + if (isA_VLANInterface(vlan)) { + CFAllocatorRef allocator = CFGetAllocator(vlan); + + if (vlanPrivate->options) CFRelease(vlanPrivate->options); + if (newOptions != NULL) { + vlanPrivate->options = CFDictionaryCreateCopy(allocator, newOptions); + } else { + vlanPrivate->options = NULL; + } + } + + return; +} + + +/* ---------- 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 */ + CFRuntimeBase cfBase; + + /* lock */ + pthread_mutex_t lock; + + /* underlying preferences */ + SCPreferencesRef prefs; + + /* base VLANs (before any commits) */ + CFArrayRef vlBase; + +} VLANPreferencesPrivate, * VLANPreferencesPrivateRef; + + +static CFStringRef __VLANPreferencesCopyDescription (CFTypeRef cf); +static void __VLANPreferencesDeallocate (CFTypeRef cf); + + +static const CFRuntimeClass __VLANPreferencesClass = { + 0, // version + "VLANPreferences", // className + NULL, // init + NULL, // copy + __VLANPreferencesDeallocate, // dealloc + NULL, // equal + NULL, // hash + NULL, // copyFormattingDesc + __VLANPreferencesCopyDescription // copyDebugDesc +}; + + +static CFTypeID __kVLANPreferencesTypeID = _kCFRuntimeNotATypeID; + + +static pthread_once_t vlanPreferences_init = PTHREAD_ONCE_INIT; + + +static CFStringRef +__VLANPreferencesCopyDescription(CFTypeRef cf) +{ + CFAllocatorRef allocator = CFGetAllocator(cf); + CFIndex i; + CFArrayRef keys; + CFIndex n; + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)cf; + CFMutableStringRef result; + + result = CFStringCreateMutable(allocator, 0); + CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); + + keys = SCPreferencesCopyKeyList(prefsPrivate->prefs); + n = CFArrayGetCount(keys); + for (i = 0; i < n; i++) { + CFStringRef key; + CFPropertyListRef val; + + key = CFArrayGetValueAtIndex(keys, i); + val = SCPreferencesGetValue(prefsPrivate->prefs, key); + + CFStringAppendFormat(result, NULL, CFSTR("%@ : %@"), key, val); + } + CFRelease(keys); + + CFStringAppendFormat(result, NULL, CFSTR(" }")); + + return result; +} + + +#define N_QUICK 8 + + +static void +__VLANPreferencesDeallocate(CFTypeRef cf) +{ + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)cf; + + SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__VLANPreferencesDeallocate:")); + + /* release resources */ + + pthread_mutex_destroy(&prefsPrivate->lock); + + if (prefsPrivate->prefs) CFRelease(prefsPrivate->prefs); + if (prefsPrivate->vlBase) CFRelease(prefsPrivate->vlBase); + + return; +} + + +static void +__VLANPreferencesInitialize(void) +{ + __kVLANPreferencesTypeID = _CFRuntimeRegisterClass(&__VLANPreferencesClass); + return; +} + + +static __inline__ CFTypeRef +isA_VLANPreferences(CFTypeRef obj) +{ + return (isA_CFType(obj, VLANPreferencesGetTypeID())); +} + + +CFArrayRef +_VLANPreferencesCopyActiveInterfaces() +{ + CFArrayCallBacks callbacks; + 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) { + SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno)); + _SCErrorSet(kSCStatusFailed); + goto done; + } + + callbacks = kCFTypeArrayCallBacks; + callbacks.equal = __VLANInterfaceEquiv; + vlans = CFArrayCreateMutable(NULL, 0, &callbacks); + + for (ifp = ifap; ifp != NULL; ifp = ifp->ifa_next) { + switch (ifp->ifa_addr->sa_family) { + case AF_LINK : { + CFStringRef device; + struct if_data *if_data; + struct ifreq ifr; + CFNumberRef tag; + VLANInterfaceRef vlan; + CFStringRef vlan_if; + char vlr_parent[IFNAMSIZ+1]; + int vlr_tag; + struct vlanreq vreq; + + if_data = (struct if_data *)ifp->ifa_data; + if (if_data == NULL) { + break; // if no interface data + } + + if (if_data->ifi_type != IFT_L2VLAN) { + break; // if not VLAN + } + + 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, SIOCGETVLAN, (caddr_t)&ifr) == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("ioctl() failed: %s"), strerror(errno)); + _SCErrorSet(kSCStatusFailed); + CFRelease(vlans); + goto done; + } + vlr_tag = vreq.vlr_tag; + strlcpy(vlr_parent, vreq.vlr_parent, sizeof(vlr_parent)); + + vlan_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII); + device = CFStringCreateWithCString(NULL, vlr_parent, kCFStringEncodingASCII); + tag = CFNumberCreate(NULL, kCFNumberIntType, &vlr_tag); + vlan = __VLANInterfaceCreatePrivate(NULL, vlan_if, device, tag, NULL); + CFArrayAppendValue(vlans, vlan); + CFRelease(vlan_if); + CFRelease(device); + CFRelease(tag); + CFRelease(vlan); + break; + } + + default : + break; + } + } + + done : + + (void) close(s); + freeifaddrs(ifap); + return vlans; +} + + +static CFIndex +findVLAN(CFArrayRef vlans, CFStringRef device, CFNumberRef tag) +{ + CFIndex found = kCFNotFound; + CFIndex i; + CFIndex n; + + n = isA_CFArray(vlans) ? CFArrayGetCount(vlans) : 0; + for (i = 0; i < n; i++) { + CFDictionaryRef vlan_dict; + CFStringRef vlan_device; + CFStringRef vlan_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_device = CFDictionaryGetValue(vlan_dict, __kVLANInterface_device); + if (isA_CFString(vlan_device)) { + if (!CFEqual(device, vlan_device)) { + continue; // if not a match + } + } + + vlan_tag = CFDictionaryGetValue(vlan_dict, __kVLANInterface_tag); + if (isA_CFNumber(vlan_tag)) { + if (!CFEqual(tag, vlan_tag)) { + continue; // if not a match + } + } + + // if we have found a match + found = i; + break; + } + + return found; +} + + +static void +setConfigurationChanged(VLANPreferencesRef prefs) +{ + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; + + /* + * to facilitate device configuration we will take + * a snapshot of the VLAN preferences before any + * changes are made. Then, when the changes are + * applied we can compare what we had to what we + * want and configured the system accordingly. + */ + if (prefsPrivate->vlBase == NULL) { + prefsPrivate->vlBase = VLANPreferencesCopyInterfaces(prefs); + } + + return; +} + + +CFTypeID +VLANPreferencesGetTypeID(void) +{ + pthread_once(&vlanPreferences_init, __VLANPreferencesInitialize); /* initialize runtime */ + return __kVLANPreferencesTypeID; +} + + +VLANPreferencesRef +VLANPreferencesCreate(CFAllocatorRef allocator) +{ + CFBundleRef bundle; + CFStringRef bundleID = NULL; + CFStringRef name = CFSTR("VLANConfiguration"); + VLANPreferencesPrivateRef prefsPrivate; + uint32_t size; + + SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__VLANPreferencesCreate:")); + + /* initialize runtime */ + pthread_once(&vlanPreferences_init, __VLANPreferencesInitialize); + + /* allocate preferences */ + size = sizeof(VLANPreferencesPrivate) - sizeof(CFRuntimeBase); + prefsPrivate = (VLANPreferencesPrivateRef)_CFRuntimeCreateInstance(allocator, + __kVLANPreferencesTypeID, + size, + NULL); + if (!prefsPrivate) { + return NULL; + } + + /* establish the prefs */ + + pthread_mutex_init(&prefsPrivate->lock, NULL); + + bundle = CFBundleGetMainBundle(); + if (bundle) { + bundleID = CFBundleGetIdentifier(bundle); + if (bundleID) { + CFRetain(bundleID); + } else { + CFURLRef url; + + url = CFBundleCopyExecutableURL(bundle); + if (url) { + bundleID = CFURLCopyPath(url); + CFRelease(url); + } + } + } + + if (bundleID) { + CFStringRef fullName; + + if (CFEqual(bundleID, CFSTR("/"))) { + CFRelease(bundleID); + bundleID = CFStringCreateWithFormat(allocator, NULL, CFSTR("(%d)"), getpid()); + } + + fullName = CFStringCreateWithFormat(allocator, NULL, CFSTR("%@:%@"), bundleID, name); + name = fullName; + CFRelease(bundleID); + } else { + CFRetain(name); + } + + prefsPrivate->prefs = SCPreferencesCreate(allocator, name, VLAN_PREFERENCES_ID); + CFRelease(name); + + prefsPrivate->vlBase = NULL; + + return (VLANPreferencesRef)prefsPrivate; +} + + +CFArrayRef +VLANPreferencesCopyInterfaces(VLANPreferencesRef prefs) +{ + CFAllocatorRef allocator; + CFArrayCallBacks callbacks; + CFIndex i; + CFIndex n; + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; + CFMutableArrayRef result; + CFArrayRef vlans; + + if (!isA_VLANPreferences(prefs)) { + _SCErrorSet(kSCStatusInvalidArgument); + return NULL; + } + + allocator = CFGetAllocator(prefs); + callbacks = kCFTypeArrayCallBacks; + callbacks.equal = __VLANInterfaceEquiv; + result = CFArrayCreateMutable(allocator, 0, &callbacks); + + vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS); + n = isA_CFArray(vlans) ? CFArrayGetCount(vlans) : 0; + for (i = 0; i < n; i++) { + CFDictionaryRef vlan_dict; + CFStringRef device; + CFDictionaryRef options; + CFNumberRef tag; + VLANInterfaceRef vlan; + CFStringRef vlan_if; + + 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 + } + + + device = CFDictionaryGetValue(vlan_dict, __kVLANInterface_device); + if (!isA_CFString(device)) { + continue; // if the prefs are confused + } + + tag = CFDictionaryGetValue(vlan_dict, __kVLANInterface_tag); + if (!isA_CFNumber(tag)) { + continue; // if the prefs are confused + } + + options = CFDictionaryGetValue(vlan_dict, __kVLANInterface_options); + if ((options != NULL) && !isA_CFDictionary(options)) { + continue; // if the prefs are confused + } + + vlan = __VLANInterfaceCreatePrivate(allocator, vlan_if, device, tag, options); + CFArrayAppendValue(result, vlan); + CFRelease(vlan); + } + + return result; +} + + +VLANInterfaceRef +VLANPreferencesAddInterface(VLANPreferencesRef prefs, + CFStringRef device, + CFNumberRef tag, + CFDictionaryRef options) +{ + CFArrayRef active_vlans; + CFAllocatorRef allocator; + CFArrayRef config_vlans; + CFIndex dup_if; + CFIndex i; + CFIndex nActive; + CFIndex nConfig; + VLANInterfaceRef newVlan = NULL; + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; + + if (!isA_VLANPreferences(prefs)) { + _SCErrorSet(kSCStatusInvalidArgument); + return NULL; + } + + if (!isA_CFString(device)) { + _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; + } + + if ((options != NULL) && !isA_CFDictionary(options)) { + _SCErrorSet(kSCStatusInvalidArgument); + return NULL; + } + + pthread_mutex_lock(&prefsPrivate->lock); + + /* get "configured" VLANs (and check to ensure we are not creating a duplicate) */ + config_vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS); + nConfig = isA_CFArray(config_vlans) ? CFArrayGetCount(config_vlans) : 0; + + dup_if = findVLAN(config_vlans, device, tag); + if (dup_if != kCFNotFound) { + // sorry, you can't add a vlan using the same device/tag */ + _SCErrorSet(kSCStatusKeyExists); + goto done; + } + + /* get "active" VLANs */ + active_vlans = _VLANPreferencesCopyActiveInterfaces(); + nActive = isA_CFArray(active_vlans) ? CFArrayGetCount(active_vlans) : 0; + + /* create a new vlan using an unused interface name */ + allocator = CFGetAllocator(prefs); + + for (i = 0; newVlan == NULL; i++) { + CFIndex j; + CFMutableDictionaryRef newDict; + CFMutableArrayRef newVlans; + CFStringRef vlan_if; + + vlan_if = CFStringCreateWithFormat(allocator, NULL, CFSTR("vlan%d"), i); + + for (j = 0; j < nActive; j++) { + CFStringRef active_if; + VLANInterfaceRef active_vlan; + + active_vlan = CFArrayGetValueAtIndex(active_vlans, j); + active_if = VLANInterfaceGetInterface(active_vlan); + + if (CFEqual(vlan_if, active_if)) { + goto next_if; // if VLAN interface name not available + } + } + + for (j = 0; j < nConfig; j++) { + CFDictionaryRef config; + CFStringRef config_if; + + config = CFArrayGetValueAtIndex(config_vlans, j); + if (!isA_CFDictionary(config)) { + continue; // if the prefs are confused + } + + config_if = CFDictionaryGetValue(config, __kVLANInterface_interface); + if (!isA_CFString(config_if)) { + continue; // if the prefs are confused + } + + if (CFEqual(vlan_if, config_if)) { + goto next_if; // if VLAN interface name not available + } + } + + /* create the vlan */ + + newDict = CFDictionaryCreateMutable(allocator, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFDictionaryAddValue(newDict, __kVLANInterface_interface, vlan_if); + CFDictionaryAddValue(newDict, __kVLANInterface_device, device); + CFDictionaryAddValue(newDict, __kVLANInterface_tag, tag); + if (options != NULL) { + CFDictionaryAddValue(newDict, __kVLANInterface_options, options); + } + + /* create the accessor handle to be returned */ + + newVlan = __VLANInterfaceCreatePrivate(allocator, vlan_if, device, tag, options); + + /* save in the prefs */ + + if (nConfig == 0) { + newVlans = CFArrayCreateMutable(allocator, 0, &kCFTypeArrayCallBacks); + } else { + newVlans = CFArrayCreateMutableCopy(allocator, 0, config_vlans); + } + CFArrayAppendValue(newVlans, newDict); + CFRelease(newDict); + + (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans); + CFRelease(newVlans); + + /* yes, we've change the configuration */ + setConfigurationChanged(prefs); + + next_if : + CFRelease(vlan_if); + } + + CFRelease(active_vlans); + + done : + + pthread_mutex_unlock(&prefsPrivate->lock); + + return (VLANInterfaceRef) newVlan; +} + + +Boolean +VLANPreferencesUpdateInterface(VLANPreferencesRef prefs, + VLANInterfaceRef vlan, + CFStringRef newDevice, + CFNumberRef newTag, + CFDictionaryRef newOptions) +{ + CFAllocatorRef allocator; + CFIndex cur_if; + CFIndex dup_if; + CFMutableDictionaryRef newDict; + CFMutableArrayRef newVlans; + Boolean ok = FALSE; + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; + CFArrayRef vlans; + CFStringRef vlan_if; + + if (!isA_VLANPreferences(prefs)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + if (!isA_VLANInterface(vlan)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + if ((newDevice != NULL) && !isA_CFString(newDevice)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + if (newTag != NULL) { + if (isA_CFNumber(newTag)) { + int tag_val; + + CFNumberGetValue(newTag, kCFNumberIntType, &tag_val); + if ((tag_val < 1) || (tag_val > 4094)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + } else { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + } + + if ((newOptions != NULL) + && !isA_CFDictionary(newOptions) && (newOptions != (CFDictionaryRef)kCFNull)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + pthread_mutex_lock(&prefsPrivate->lock); + + vlan_if = VLANInterfaceGetInterface(vlan); + + vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS); + if (!isA_CFArray(vlans)) { + goto done; // if the prefs are confused + } + + cur_if = findVLAN(vlans, + VLANInterfaceGetDevice(vlan), + VLANInterfaceGetTag (vlan)); + if (cur_if == kCFNotFound) { + _SCErrorSet(kSCStatusNoKey); + goto done; + } + + dup_if = findVLAN(vlans, + newDevice != NULL ? newDevice : VLANInterfaceGetDevice(vlan), + newTag != NULL ? newTag : VLANInterfaceGetTag (vlan)); + if (dup_if != kCFNotFound) { + // if the same device/tag has already been defined + if (cur_if != dup_if) { + /* + * sorry, you can't update another vlan that is using + * the same device/tag + */ + _SCErrorSet(kSCStatusKeyExists); + goto done; + } + } + + /* update the vlan */ + + if (newDevice != NULL) { + VLANInterfaceSetDevice(vlan, newDevice); + } else { + newDevice = VLANInterfaceGetDevice(vlan); + } + + if (newTag != NULL) { + VLANInterfaceSetTag(vlan, newTag); + } else { + newTag = VLANInterfaceGetTag(vlan); + } + + if (newOptions != NULL) { + if (newOptions != (CFDictionaryRef)kCFNull) { + VLANInterfaceSetOptions(vlan, newOptions); + } else { + VLANInterfaceSetOptions(vlan, NULL); + newOptions = NULL; + } + } else { + newOptions = VLANInterfaceGetOptions(vlan); + } + + /* update the prefs */ + + allocator = CFGetAllocator(prefs); + newDict = CFDictionaryCreateMutable(allocator, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFDictionaryAddValue(newDict, __kVLANInterface_interface, vlan_if); + CFDictionaryAddValue(newDict, __kVLANInterface_device, newDevice); + CFDictionaryAddValue(newDict, __kVLANInterface_tag, newTag); + if (newOptions != NULL) { + CFDictionaryAddValue(newDict, __kVLANInterface_options, newOptions); + } + + /* update the prefs */ + + newVlans = CFArrayCreateMutableCopy(allocator, 0, vlans); + CFArrayRemoveValueAtIndex(newVlans, cur_if); + CFArrayAppendValue(newVlans, newDict); + CFRelease(newDict); + + (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans); + CFRelease(newVlans); + + /* yes, we've change the configuration */ + setConfigurationChanged(prefs); + + ok = TRUE; + + done : + + pthread_mutex_unlock(&prefsPrivate->lock); + + return ok; +} + + +Boolean +VLANPreferencesRemoveInterface(VLANPreferencesRef prefs, + VLANInterfaceRef vlan) +{ + CFAllocatorRef allocator; + CFIndex cur_if; + CFMutableArrayRef newVlans; + Boolean ok = FALSE; + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; + CFArrayRef vlans; + + if (!isA_VLANPreferences(prefs)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + if (!isA_VLANInterface(vlan)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + pthread_mutex_lock(&prefsPrivate->lock); + + vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS); + if (!isA_CFArray(vlans)) { + _SCErrorSet(kSCStatusNoKey); + goto done; // if the prefs are confused + } + + cur_if = findVLAN(vlans, + VLANInterfaceGetDevice(vlan), + VLANInterfaceGetTag (vlan)); + if (cur_if == kCFNotFound) { + _SCErrorSet(kSCStatusNoKey); + goto done; + } + + /* remove the vlan */ + + allocator = CFGetAllocator(prefs); + newVlans = CFArrayCreateMutableCopy(allocator, 0, vlans); + CFArrayRemoveValueAtIndex(newVlans, cur_if); + + (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans); + CFRelease(newVlans); + + /* yes, we've change the configuration */ + setConfigurationChanged(prefs); + + ok = TRUE; + + done : + + pthread_mutex_unlock(&prefsPrivate->lock); + + return ok; +} + + +Boolean +VLANPreferencesCommitChanges(VLANPreferencesRef prefs) +{ + Boolean ok = FALSE; + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; + + if (!isA_VLANPreferences(prefs)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + ok = SCPreferencesCommitChanges(prefsPrivate->prefs); + if (!ok) { + return ok; + } + + if (prefsPrivate->vlBase != NULL) { + CFRelease(prefsPrivate->vlBase); + prefsPrivate->vlBase = NULL; + } + + return TRUE; +} + + +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 = _VLAN_destroy(s, a_vlan_if); + if (!ok) { + 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 = _VLAN_destroy(s, c_vlan_if); + if (!ok) { + 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 = _VLAN_create(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; + } + } + + } + + ok = TRUE; + + done : + + if (active) CFRelease(active); + if (config) CFRelease(config); + if (devices) CFRelease(devices); + if (s != -1) (void) close(s); + + return ok; +} + + +Boolean +VLANPreferencesApplyChanges(VLANPreferencesRef prefs) +{ + Boolean ok = FALSE; + VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; + + if (!isA_VLANPreferences(prefs)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + pthread_mutex_lock(&prefsPrivate->lock); + + /* apply the preferences */ + ok = SCPreferencesApplyChanges(prefsPrivate->prefs); + if (!ok) { + goto done; + } + + /* apply the VLAN configuration */ + ok = _VLANPreferencesUpdateConfiguration(prefs); + if (!ok) { + goto done; + } + + ok = TRUE; + + done : + + pthread_mutex_unlock(&prefsPrivate->lock); + + return ok; +} diff --git a/SystemConfiguration.fproj/VLANConfiguration.h b/SystemConfiguration.fproj/VLANConfiguration.h new file mode 100644 index 0000000..bfa115e --- /dev/null +++ b/SystemConfiguration.fproj/VLANConfiguration.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2003 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 _VLANCONFIGURATION_H +#define _VLANCONFIGURATION_H + + +#include +#include + + +typedef const struct __VLANInterface * VLANInterfaceRef; + +typedef const struct __VLANPreferences * VLANPreferencesRef; + + +__BEGIN_DECLS + +// ---------- + +Boolean +IsVLANSupported (CFStringRef device); // e.g. "en0", "en1", ... + +// ---------- + +CFTypeID +VLANInterfaceGetTypeID (void); + +CFStringRef +VLANInterfaceGetInterface (VLANInterfaceRef vlan); // returns "vlan0", "vlan1", ... + +CFStringRef +VLANInterfaceGetDevice (VLANInterfaceRef vlan); // returns "en0", "en1, ... + +CFNumberRef +VLANInterfaceGetTag (VLANInterfaceRef vlan); // returns 1 <= tag <= 4094 + +CFDictionaryRef +VLANInterfaceGetOptions (VLANInterfaceRef vlan); // e.g. UserDefinedName, ... + +// ---------- + +CFTypeID +VLANPreferencesGetTypeID (void); + +VLANPreferencesRef +VLANPreferencesCreate (CFAllocatorRef allocator); + +CFArrayRef /* of VLANInterfaceRef's */ +VLANPreferencesCopyInterfaces (VLANPreferencesRef prefs); + +VLANInterfaceRef +VLANPreferencesAddInterface (VLANPreferencesRef prefs, + CFStringRef device, // e.g. "en0", "en1", ... + CFNumberRef tag, // e.g. 1 <= tag <= 4094 + CFDictionaryRef options); // e.g. UserDefinedName, ... + +Boolean +VLANPreferencesUpdateInterface (VLANPreferencesRef prefs, + VLANInterfaceRef vlan, + CFStringRef newDevice, + CFNumberRef newTag, + CFDictionaryRef newOptions); + +Boolean +VLANPreferencesRemoveInterface (VLANPreferencesRef prefs, + VLANInterfaceRef vlan); + +Boolean +VLANPreferencesCommitChanges (VLANPreferencesRef prefs); + +Boolean +VLANPreferencesApplyChanges (VLANPreferencesRef prefs); + +// ---------- + +__END_DECLS + +#endif /* _VLANCONFIGURATION_H */ diff --git a/SystemConfiguration.fproj/VLANConfigurationPrivate.h b/SystemConfiguration.fproj/VLANConfigurationPrivate.h new file mode 100644 index 0000000..811e616 --- /dev/null +++ b/SystemConfiguration.fproj/VLANConfigurationPrivate.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2003 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 +#include + + +#define VLAN_PREFERENCES_ID CFSTR("VirtualNetworkInterfaces.plist") + + +__BEGIN_DECLS + +CFArrayRef +_VLANPreferencesCopyActiveInterfaces (); + +Boolean +_VLANPreferencesUpdateConfiguration (VLANPreferencesRef prefs); + +__END_DECLS + +#endif /* _VLANCONFIGURATIONPRIVATE_H */ diff --git a/SystemConfiguration.fproj/config.defs b/SystemConfiguration.fproj/config.defs index 943de07..b1ed4c8 100644 --- a/SystemConfiguration.fproj/config.defs +++ b/SystemConfiguration.fproj/config.defs @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/config_types.h b/SystemConfiguration.fproj/config_types.h index 4508412..2cfa849 100644 --- a/SystemConfiguration.fproj/config_types.h +++ b/SystemConfiguration.fproj/config_types.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/dy_framework.c b/SystemConfiguration.fproj/dy_framework.c index a104dec..33046cd 100644 --- a/SystemConfiguration.fproj/dy_framework.c +++ b/SystemConfiguration.fproj/dy_framework.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/dy_framework.h b/SystemConfiguration.fproj/dy_framework.h index bcc656c..6560839 100644 --- a/SystemConfiguration.fproj/dy_framework.h +++ b/SystemConfiguration.fproj/dy_framework.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/genSCPreferences.c b/SystemConfiguration.fproj/genSCPreferences.c index f6484a2..49d96c4 100644 --- a/SystemConfiguration.fproj/genSCPreferences.c +++ b/SystemConfiguration.fproj/genSCPreferences.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 @@ -58,26 +56,24 @@ char copyright_string[] = "/*\n" " * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.\n" " *\n" -" * @APPLE_LICENSE_HEADER_START@ -" * -" * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. -" * -" * 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@ +" * @APPLE_LICENSE_HEADER_START@\n" +" * \n" +" * This file contains Original Code and/or Modifications of Original Code\n" +" * as defined in and that are subject to the Apple Public Source License\n" +" * Version 2.0 (the 'License'). You may not use this file except in\n" +" * compliance with the License. Please obtain a copy of the License at\n" +" * http://www.opensource.apple.com/apsl/ and read it before using this\n" +" * file.\n" +" * \n" +" * The Original Code and all software distributed under the License are\n" +" * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER\n" +" * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,\n" +" * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,\n" +" * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.\n" +" * Please see the License for the specific language governing rights and\n" +" * limitations under the License.\n" +" * \n" +" * @APPLE_LICENSE_HEADER_END@\n" " */\n"; diff --git a/SystemConfiguration.fproj/moh.c b/SystemConfiguration.fproj/moh.c index 546c70e..31929d7 100644 --- a/SystemConfiguration.fproj/moh.c +++ b/SystemConfiguration.fproj/moh.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/moh.h b/SystemConfiguration.fproj/moh.h index 14b54be..22c39d1 100644 --- a/SystemConfiguration.fproj/moh.h +++ b/SystemConfiguration.fproj/moh.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/moh_msg.h b/SystemConfiguration.fproj/moh_msg.h index 4434db8..f03fe93 100644 --- a/SystemConfiguration.fproj/moh_msg.h +++ b/SystemConfiguration.fproj/moh_msg.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/ppp.c b/SystemConfiguration.fproj/ppp.c index 12e5685..07b9ffc 100644 --- a/SystemConfiguration.fproj/ppp.c +++ b/SystemConfiguration.fproj/ppp.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/SystemConfiguration.fproj/ppp.h b/SystemConfiguration.fproj/ppp.h index 4ef7c40..c7135d5 100644 --- a/SystemConfiguration.fproj/ppp.h +++ b/SystemConfiguration.fproj/ppp.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_SCD.c b/configd.tproj/_SCD.c index 57bdaad..a6a31da 100644 --- a/configd.tproj/_SCD.c +++ b/configd.tproj/_SCD.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_SCD.h b/configd.tproj/_SCD.h index 6cc7046..98cb81e 100644 --- a/configd.tproj/_SCD.h +++ b/configd.tproj/_SCD.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configadd.c b/configd.tproj/_configadd.c index 8c7884b..5e0d501 100644 --- a/configd.tproj/_configadd.c +++ b/configd.tproj/_configadd.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configadd_s.c b/configd.tproj/_configadd_s.c index b4f96e7..7a690d7 100644 --- a/configd.tproj/_configadd_s.c +++ b/configd.tproj/_configadd_s.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configclose.c b/configd.tproj/_configclose.c index b408b89..6b3c72d 100644 --- a/configd.tproj/_configclose.c +++ b/configd.tproj/_configclose.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configget.c b/configd.tproj/_configget.c index b211b6b..fa889fe 100644 --- a/configd.tproj/_configget.c +++ b/configd.tproj/_configget.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configlist.c b/configd.tproj/_configlist.c index bd0277a..a43e889 100644 --- a/configd.tproj/_configlist.c +++ b/configd.tproj/_configlist.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configlock.c b/configd.tproj/_configlock.c index 2e6b33a..02ecc71 100644 --- a/configd.tproj/_configlock.c +++ b/configd.tproj/_configlock.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_confignotify.c b/configd.tproj/_confignotify.c index 0d5b7c6..892d542 100644 --- a/configd.tproj/_confignotify.c +++ b/configd.tproj/_confignotify.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configopen.c b/configd.tproj/_configopen.c index 705b2f6..82630c9 100644 --- a/configd.tproj/_configopen.c +++ b/configd.tproj/_configopen.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configremove.c b/configd.tproj/_configremove.c index 7a37c8c..0b0ad14 100644 --- a/configd.tproj/_configremove.c +++ b/configd.tproj/_configremove.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configset.c b/configd.tproj/_configset.c index e2a41f6..08747c3 100644 --- a/configd.tproj/_configset.c +++ b/configd.tproj/_configset.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configtouch.c b/configd.tproj/_configtouch.c index 8a082b8..8c62cf4 100644 --- a/configd.tproj/_configtouch.c +++ b/configd.tproj/_configtouch.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_configunlock.c b/configd.tproj/_configunlock.c index 253a26d..c00fa5d 100644 --- a/configd.tproj/_configunlock.c +++ b/configd.tproj/_configunlock.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_notifyadd.c b/configd.tproj/_notifyadd.c index 739171f..55a6ec2 100644 --- a/configd.tproj/_notifyadd.c +++ b/configd.tproj/_notifyadd.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_notifycancel.c b/configd.tproj/_notifycancel.c index 1352d6a..66673a3 100644 --- a/configd.tproj/_notifycancel.c +++ b/configd.tproj/_notifycancel.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_notifychanges.c b/configd.tproj/_notifychanges.c index 87a7de1..80be213 100644 --- a/configd.tproj/_notifychanges.c +++ b/configd.tproj/_notifychanges.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_notifyremove.c b/configd.tproj/_notifyremove.c index 710d2e0..9463d39 100644 --- a/configd.tproj/_notifyremove.c +++ b/configd.tproj/_notifyremove.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_notifyviafd.c b/configd.tproj/_notifyviafd.c index dda1bb1..4f6b317 100644 --- a/configd.tproj/_notifyviafd.c +++ b/configd.tproj/_notifyviafd.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_notifyviaport.c b/configd.tproj/_notifyviaport.c index 08ee0d7..a0d1f7b 100644 --- a/configd.tproj/_notifyviaport.c +++ b/configd.tproj/_notifyviaport.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_notifyviasignal.c b/configd.tproj/_notifyviasignal.c index 29cd45b..7bd5553 100644 --- a/configd.tproj/_notifyviasignal.c +++ b/configd.tproj/_notifyviasignal.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/_snapshot.c b/configd.tproj/_snapshot.c index d07fa1f..60869d5 100644 --- a/configd.tproj/_snapshot.c +++ b/configd.tproj/_snapshot.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/config.defs b/configd.tproj/config.defs index 12c6e0c..3b28e89 100644 --- a/configd.tproj/config.defs +++ b/configd.tproj/config.defs @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/configd.h b/configd.tproj/configd.h index cb7ddf8..c49cf8a 100644 --- a/configd.tproj/configd.h +++ b/configd.tproj/configd.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/configd.m b/configd.tproj/configd.m index 925dc7b..af823c4 100644 --- a/configd.tproj/configd.m +++ b/configd.tproj/configd.m @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/configd_server.c b/configd.tproj/configd_server.c index 642d748..a55f400 100644 --- a/configd.tproj/configd_server.c +++ b/configd.tproj/configd_server.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/configd_server.h b/configd.tproj/configd_server.h index 9104deb..af388a1 100644 --- a/configd.tproj/configd_server.h +++ b/configd.tproj/configd_server.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/notify.c b/configd.tproj/notify.c index 0a75827..7ebc7ab 100644 --- a/configd.tproj/notify.c +++ b/configd.tproj/notify.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/notify.h b/configd.tproj/notify.h index 7050f40..014da25 100644 --- a/configd.tproj/notify.h +++ b/configd.tproj/notify.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/notify_server.c b/configd.tproj/notify_server.c index 4ddc272..b914891 100644 --- a/configd.tproj/notify_server.c +++ b/configd.tproj/notify_server.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/notify_server.h b/configd.tproj/notify_server.h index 18a3e5b..704eedd 100644 --- a/configd.tproj/notify_server.h +++ b/configd.tproj/notify_server.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/pattern.c b/configd.tproj/pattern.c index 444fb86..fa3bf86 100644 --- a/configd.tproj/pattern.c +++ b/configd.tproj/pattern.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/pattern.h b/configd.tproj/pattern.h index 89535c4..549d8ef 100644 --- a/configd.tproj/pattern.h +++ b/configd.tproj/pattern.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/plugin_support.c b/configd.tproj/plugin_support.c index c9e1177..80e5b85 100644 --- a/configd.tproj/plugin_support.c +++ b/configd.tproj/plugin_support.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/plugin_support.h b/configd.tproj/plugin_support.h index 9664ef2..0891ca6 100644 --- a/configd.tproj/plugin_support.h +++ b/configd.tproj/plugin_support.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/session.c b/configd.tproj/session.c index d2175fc..6c299bb 100644 --- a/configd.tproj/session.c +++ b/configd.tproj/session.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/configd.tproj/session.h b/configd.tproj/session.h index 896a3a7..d4921ed 100644 --- a/configd.tproj/session.h +++ b/configd.tproj/session.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scselect.tproj/PB.project b/scselect.tproj/PB.project index 7521741..f5d4f31 100644 --- a/scselect.tproj/PB.project +++ b/scselect.tproj/PB.project @@ -1,13 +1,19 @@ { DYNAMIC_CODE_GEN = YES; FILESTABLE = { - FRAMEWORKS = (CoreFoundation.framework, SystemConfiguration.framework); - H_FILES = (); - OTHER_LINKED = (scselect.c); - OTHER_SOURCES = (Makefile.preamble, Makefile, Makefile.postamble, m.template, h.template); - PRECOMPILED_HEADERS = (); - PROJECT_HEADERS = (); - PUBLIC_HEADERS = (); + FRAMEWORKS = ("CoreFoundation.framework", "SystemConfiguration.framework"); + "H_FILES" = (); + "OTHER_LINKED" = ("scselect.c"); + "OTHER_SOURCES" = ( + "Makefile.preamble", + Makefile, + "Makefile.postamble", + "m.template", + "h.template" + ); + "PRECOMPILED_HEADERS" = (); + "PROJECT_HEADERS" = (); + "PUBLIC_HEADERS" = (); SUBPROJECTS = (); }; LANGUAGE = English; diff --git a/scselect.tproj/scselect.c b/scselect.tproj/scselect.c index 2e29fe2..04a241e 100644 --- a/scselect.tproj/scselect.c +++ b/scselect.tproj/scselect.c @@ -1,10 +1,8 @@ /* - * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 @@ -26,6 +24,11 @@ /* * Modification History * + * January 15, 2004 Allan Nathanson + * - limit location changes to "root" (uid==0), users who are + * a member of group "admin", and processses which have access + * to a local graphics console. + * * June 1, 2001 Allan Nathanson * - public API conversion * @@ -36,10 +39,19 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include +#include +#include + Boolean apply = TRUE; @@ -53,7 +65,7 @@ static struct option longopts[] = { }; -void +static void usage(const char *command) { SCPrint(TRUE, stderr, CFSTR("usage: %s [-n] new-set-name\n"), command); @@ -61,6 +73,88 @@ usage(const char *command) } +static Boolean +isAdmin() +{ + gid_t groups[NGROUPS_MAX]; + int ngroups; + + if (getuid() == 0) { + return TRUE; // if "root" + } + + ngroups = getgroups(NGROUPS_MAX, groups); + if(ngroups > 0) { + struct group *adminGroup; + + adminGroup = getgrnam("admin"); + if (adminGroup != NULL) { + gid_t adminGid = adminGroup->gr_gid; + int i; + + for (i = 0; i < ngroups; i++) { + if (groups[i] == adminGid) { + return TRUE; // if a member of group "admin" + } + } + } + } + + return FALSE; +} + + +static void * +__loadSecurity(void) { + static const void *image = NULL; + if (NULL == image) { + const char *framework = "/System/Library/Frameworks/Security.framework/Security"; + struct stat statbuf; + const char *suffix = getenv("DYLD_IMAGE_SUFFIX"); + char path[MAXPATHLEN]; + + strcpy(path, framework); + if (suffix) strcat(path, suffix); + if (0 <= stat(path, &statbuf)) { + image = NSAddImage(path, NSADDIMAGE_OPTION_NONE); + } else { + image = NSAddImage(framework, NSADDIMAGE_OPTION_NONE); + } + } + return (void *)image; +} + + +static OSStatus +_SessionGetInfo(SecuritySessionId session, SecuritySessionId *sessionId, SessionAttributeBits *attributes) +{ + static OSStatus (*dyfunc)(SecuritySessionId, SecuritySessionId *, SessionAttributeBits *) = NULL; + if (!dyfunc) { + void *image = __loadSecurity(); + if (image) dyfunc = NSAddressOfSymbol(NSLookupSymbolInImage(image, "_SessionGetInfo", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND)); + } + return dyfunc ? dyfunc(session, sessionId, attributes) : -1; +} +#define SessionGetInfo _SessionGetInfo + + +static Boolean +hasLocalConsoleAccess() +{ + OSStatus error; + SecuritySessionId sessionID = 0; + SessionAttributeBits attributeBits = 0; + + error = SessionGetInfo(callerSecuritySession, &sessionID, &attributeBits); + if (error != noErr) { + /* Security check failed, must not permit access */ + return FALSE; + } + + return (attributeBits & (sessionHasGraphicAccess|sessionIsRemote)) == sessionHasGraphicAccess; +} + + int main(int argc, char **argv) { @@ -229,6 +323,12 @@ main(int argc, char **argv) found : + if (!(isAdmin() || hasLocalConsoleAccess())) { + SCPrint(TRUE, stderr, + CFSTR("Only local console users and administrators can change locations\n")); + exit (EX_NOPERM); + } + if (!SCPreferencesSetValue(session, kSCPrefCurrentSet, current)) { SCPrint(TRUE, stderr, CFSTR("SCPreferencesSetValue(...,%@,%@) failed\n"), diff --git a/scutil.tproj/cache.c b/scutil.tproj/cache.c index 15d1d67..8407454 100644 --- a/scutil.tproj/cache.c +++ b/scutil.tproj/cache.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/cache.h b/scutil.tproj/cache.h index 3f1ad92..ed4be7e 100644 --- a/scutil.tproj/cache.h +++ b/scutil.tproj/cache.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/commands.c b/scutil.tproj/commands.c index 7288d1b..561f15c 100644 --- a/scutil.tproj/commands.c +++ b/scutil.tproj/commands.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/commands.h b/scutil.tproj/commands.h index e5eb65f..a0a0821 100644 --- a/scutil.tproj/commands.h +++ b/scutil.tproj/commands.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/dictionary.c b/scutil.tproj/dictionary.c index 1261a5c..8507dda 100644 --- a/scutil.tproj/dictionary.c +++ b/scutil.tproj/dictionary.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/dictionary.h b/scutil.tproj/dictionary.h index 1f8d63a..cad9a29 100644 --- a/scutil.tproj/dictionary.h +++ b/scutil.tproj/dictionary.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/notify.c b/scutil.tproj/notify.c index 492b6e7..9b0d9cc 100644 --- a/scutil.tproj/notify.c +++ b/scutil.tproj/notify.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/notify.h b/scutil.tproj/notify.h index dbea67c..72bf1f2 100644 --- a/scutil.tproj/notify.h +++ b/scutil.tproj/notify.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/prefs.c b/scutil.tproj/prefs.c index 5354839..f522a42 100644 --- a/scutil.tproj/prefs.c +++ b/scutil.tproj/prefs.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/prefs.h b/scutil.tproj/prefs.h index 49c8f82..190ba47 100644 --- a/scutil.tproj/prefs.h +++ b/scutil.tproj/prefs.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/scutil.c b/scutil.tproj/scutil.c index ecea776..b538711 100644 --- a/scutil.tproj/scutil.c +++ b/scutil.tproj/scutil.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/scutil.h b/scutil.tproj/scutil.h index 98be196..794530b 100644 --- a/scutil.tproj/scutil.h +++ b/scutil.tproj/scutil.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/session.c b/scutil.tproj/session.c index 246e917..9c5d2cb 100644 --- a/scutil.tproj/session.c +++ b/scutil.tproj/session.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/session.h b/scutil.tproj/session.h index ed80b8e..72ce17d 100644 --- a/scutil.tproj/session.h +++ b/scutil.tproj/session.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/tests.c b/scutil.tproj/tests.c index 3afd472..74a4049 100644 --- a/scutil.tproj/tests.c +++ b/scutil.tproj/tests.c @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 diff --git a/scutil.tproj/tests.h b/scutil.tproj/tests.h index 867f2c8..c13c99f 100644 --- a/scutil.tproj/tests.h +++ b/scutil.tproj/tests.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * 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 -- 2.45.2