changeset 6956:e935cd4139c6

8028293: Check local configuration for actual ephemeral port range Reviewed-by: alanb, chegar, smarks
author michaelm
date Fri, 22 Nov 2013 00:08:17 +0000
parents 216138d587a7
children 4a6e31d94b29
files make/java/net/FILES_c.gmk make/java/net/Makefile make/java/net/mapfile-vers make/sun/net/FILES_java.gmk src/share/classes/java/net/SocketPermission.java src/share/classes/sun/rmi/registry/RegistryImpl.java src/share/lib/security/java.security-linux src/share/lib/security/java.security-macosx src/share/lib/security/java.security-solaris src/share/lib/security/java.security-windows src/solaris/classes/sun/net/PortConfig.java src/solaris/native/java/net/net_util_md.c src/solaris/native/java/net/net_util_md.h src/solaris/native/sun/net/portconfig.c src/windows/classes/sun/net/PortConfig.java src/windows/native/sun/net/portconfig.c test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java test/java/rmi/registry/readTest/readTest.sh test/java/rmi/testlibrary/TestLibrary.java
diffstat 19 files changed, 647 insertions(+), 312 deletions(-) [+]
line wrap: on
line diff
--- a/make/java/net/FILES_c.gmk	Wed Nov 27 08:24:31 2013 -0800
+++ b/make/java/net/FILES_c.gmk	Fri Nov 22 00:08:17 2013 +0000
@@ -24,20 +24,21 @@
 #
 
 FILES_c = \
-	DatagramPacket.c \
-	InetAddress.c \
-	Inet4Address.c \
-	Inet6Address.c \
-	NetworkInterface.c \
-	InetAddressImplFactory.c \
-	Inet4AddressImpl.c \
-	Inet6AddressImpl.c \
-	SocketInputStream.c \
-	SocketOutputStream.c \
-	net_util.c \
-	net_util_md.c \
-	ResolverConfigurationImpl.c \
-	DefaultProxySelector.c
+        DatagramPacket.c \
+        InetAddress.c \
+        Inet4Address.c \
+        Inet6Address.c \
+        NetworkInterface.c \
+        InetAddressImplFactory.c \
+        Inet4AddressImpl.c \
+        Inet6AddressImpl.c \
+        SocketInputStream.c \
+        SocketOutputStream.c \
+        net_util.c \
+        net_util_md.c \
+        portconfig.c \
+        ResolverConfigurationImpl.c \
+        DefaultProxySelector.c
 
 ifeq ($(PLATFORM), linux)
     FILES_c += linux_close.c
--- a/make/java/net/Makefile	Wed Nov 27 08:24:31 2013 -0800
+++ b/make/java/net/Makefile	Fri Nov 22 00:08:17 2013 +0000
@@ -69,7 +69,7 @@
     java/net/ProtocolException.java \
     sun/net/spi/DefaultProxySelector.java
 
-ifeq ($(PLATFORM), windows) 
+ifeq ($(PLATFORM), windows)
     FILES_export += java/net/TwoStacksPlainSocketImpl.java
     FILES_export += java/net/DualStackPlainSocketImpl.java
     FILES_export += java/net/TwoStacksPlainDatagramSocketImpl.java
@@ -83,7 +83,8 @@
 # Find platform specific native code
 #
 vpath %.c $(PLATFORM_SRC)/native/sun/net/dns $(PLATFORM_SRC)/native/sun/net/www/protocol/http/ntlm \
-    $(PLATFORM_SRC)/native/sun/net/sdp $(PLATFORM_SRC)/native/sun/net/spi
+    $(PLATFORM_SRC)/native/sun/net/sdp $(PLATFORM_SRC)/native/sun/net/spi \
+    $(PLATFORM_SRC)/native/sun/net
 
 #
 # Include rules
@@ -120,17 +121,17 @@
 MISC_FILES = $(LIBDIR) $(LIBDIR)/net.properties
 
 $(LIBDIR)/net.properties: $(SHARE_SRC)/lib/net.properties
-	$(install-file)
+        $(install-file)
 
-# 
+#
 # SDP configuration template
 #
 ifeq ($(PLATFORM), solaris)
 SDP_PATH = sdp/sdp.conf.template
 SDP_CONF = $(LIBDIR)/$(SDP_PATH)
 $(SDP_CONF): $(PLATFORM_SRC)/lib/$(SDP_PATH)
-	@$(RM) $*
-	$(install-file)
+        @$(RM) $*
+        $(install-file)
 
 MISC_FILES += $(SDP_CONF)
 endif
--- a/make/java/net/mapfile-vers	Wed Nov 27 08:24:31 2013 -0800
+++ b/make/java/net/mapfile-vers	Fri Nov 22 00:08:17 2013 +0000
@@ -26,84 +26,86 @@
 # Define public interface.
 
 SUNWprivate_1.1 {
-	global:
-		JNI_OnLoad;
-		Java_java_net_PlainSocketImpl_socketListen;
-		Java_java_net_PlainDatagramSocketImpl_getTTL;
-		Java_java_net_PlainDatagramSocketImpl_init;
-		Java_java_net_SocketOutputStream_socketWrite0;
-		Java_java_net_PlainSocketImpl_socketCreate;
-		Java_java_net_PlainSocketImpl_socketAvailable;
-		Java_java_net_PlainDatagramSocketImpl_join;
-		Java_java_net_PlainDatagramSocketImpl_socketGetOption;
-		Java_java_net_InetAddress_init;
-		Java_java_net_Inet4Address_init;
-		Java_java_net_Inet6Address_init;
-		Java_java_net_PlainDatagramSocketImpl_setTTL;
-		Java_java_net_PlainDatagramSocketImpl_socketSetOption;
-		Java_java_net_PlainDatagramSocketImpl_bind0;
-		Java_java_net_PlainSocketImpl_socketAccept;
-		Java_java_net_DatagramPacket_init;
-		Java_java_net_PlainDatagramSocketImpl_leave;
-		Java_java_net_SocketInputStream_socketRead0;
-		Java_java_net_InetAddressImplFactory_isIPv6Supported;
-		Java_java_net_Inet4AddressImpl_getLocalHostName;
-		Java_java_net_Inet4AddressImpl_lookupAllHostAddr;
-		Java_java_net_Inet4AddressImpl_getHostByAddr;
-		Java_java_net_Inet4AddressImpl_isReachable0;
-		Java_java_net_Inet6AddressImpl_getLocalHostName;
-		Java_java_net_Inet6AddressImpl_lookupAllHostAddr;
-		Java_java_net_Inet6AddressImpl_getHostByAddr;
-		Java_java_net_Inet6AddressImpl_isReachable0;
-		Java_java_net_NetworkInterface_init;
-		Java_java_net_NetworkInterface_getByName0;
-		Java_java_net_NetworkInterface_getByIndex0;
-		Java_java_net_NetworkInterface_getByInetAddress0;
-		Java_java_net_NetworkInterface_getAll;
-		Java_java_net_NetworkInterface_isUp0;
-		Java_java_net_NetworkInterface_isLoopback0;
-		Java_java_net_NetworkInterface_isP2P0;
-		Java_java_net_NetworkInterface_supportsMulticast0;
-		Java_java_net_NetworkInterface_getMacAddr0;
-		Java_java_net_NetworkInterface_getMTU0;
-		Java_java_net_PlainDatagramSocketImpl_send;
-		Java_java_net_PlainSocketImpl_socketClose0;
-		Java_java_net_SocketOutputStream_init;
-		Java_java_net_PlainDatagramSocketImpl_peek;
-		Java_java_net_PlainDatagramSocketImpl_peekData;
-		Java_java_net_PlainSocketImpl_socketSetOption;
-		Java_java_net_PlainSocketImpl_socketSendUrgentData;
-		Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate;
-		Java_java_net_PlainSocketImpl_socketGetOption;
-		Java_java_net_PlainDatagramSocketImpl_receive0;
-		Java_java_net_PlainDatagramSocketImpl_connect0;
-		Java_java_net_PlainDatagramSocketImpl_disconnect0;
-		Java_java_net_PlainDatagramSocketImpl_datagramSocketClose;
-		Java_java_net_PlainSocketImpl_initProto;
-		Java_java_net_PlainSocketImpl_socketBind;
-		Java_java_net_PlainSocketImpl_socketShutdown;
-		Java_java_net_SocketInputStream_init;
-		Java_java_net_PlainSocketImpl_socketConnect;
-		Java_java_net_PlainDatagramSocketImpl_getTimeToLive;
-		Java_java_net_PlainDatagramSocketImpl_setTimeToLive;
-		Java_sun_net_dns_ResolverConfigurationImpl_localDomain0;
-		Java_sun_net_dns_ResolverConfigurationImpl_fallbackDomain0;
-		Java_sun_net_sdp_SdpSupport_convert0;
-		Java_sun_net_sdp_SdpSupport_create0;
-		Java_sun_net_spi_DefaultProxySelector_init;
-		Java_sun_net_spi_DefaultProxySelector_getSystemProxy;
-		NET_AllocSockaddr;
-		NET_SockaddrToInetAddress;
+        global:
+                JNI_OnLoad;
+                Java_java_net_PlainSocketImpl_socketListen;
+                Java_java_net_PlainDatagramSocketImpl_getTTL;
+                Java_java_net_PlainDatagramSocketImpl_init;
+                Java_java_net_SocketOutputStream_socketWrite0;
+                Java_java_net_PlainSocketImpl_socketCreate;
+                Java_java_net_PlainSocketImpl_socketAvailable;
+                Java_java_net_PlainDatagramSocketImpl_join;
+                Java_java_net_PlainDatagramSocketImpl_socketGetOption;
+                Java_java_net_InetAddress_init;
+                Java_java_net_Inet4Address_init;
+                Java_java_net_Inet6Address_init;
+                Java_java_net_PlainDatagramSocketImpl_setTTL;
+                Java_java_net_PlainDatagramSocketImpl_socketSetOption;
+                Java_java_net_PlainDatagramSocketImpl_bind0;
+                Java_java_net_PlainSocketImpl_socketAccept;
+                Java_java_net_DatagramPacket_init;
+                Java_java_net_PlainDatagramSocketImpl_leave;
+                Java_java_net_SocketInputStream_socketRead0;
+                Java_java_net_InetAddressImplFactory_isIPv6Supported;
+                Java_java_net_Inet4AddressImpl_getLocalHostName;
+                Java_java_net_Inet4AddressImpl_lookupAllHostAddr;
+                Java_java_net_Inet4AddressImpl_getHostByAddr;
+                Java_java_net_Inet4AddressImpl_isReachable0;
+                Java_java_net_Inet6AddressImpl_getLocalHostName;
+                Java_java_net_Inet6AddressImpl_lookupAllHostAddr;
+                Java_java_net_Inet6AddressImpl_getHostByAddr;
+                Java_java_net_Inet6AddressImpl_isReachable0;
+                Java_java_net_NetworkInterface_init;
+                Java_java_net_NetworkInterface_getByName0;
+                Java_java_net_NetworkInterface_getByIndex0;
+                Java_java_net_NetworkInterface_getByInetAddress0;
+                Java_java_net_NetworkInterface_getAll;
+                Java_java_net_NetworkInterface_isUp0;
+                Java_java_net_NetworkInterface_isLoopback0;
+                Java_java_net_NetworkInterface_isP2P0;
+                Java_java_net_NetworkInterface_supportsMulticast0;
+                Java_java_net_NetworkInterface_getMacAddr0;
+                Java_java_net_NetworkInterface_getMTU0;
+                Java_java_net_PlainDatagramSocketImpl_send;
+                Java_java_net_PlainSocketImpl_socketClose0;
+                Java_java_net_SocketOutputStream_init;
+                Java_java_net_PlainDatagramSocketImpl_peek;
+                Java_java_net_PlainDatagramSocketImpl_peekData;
+                Java_java_net_PlainSocketImpl_socketSetOption;
+                Java_java_net_PlainSocketImpl_socketSendUrgentData;
+                Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate;
+                Java_java_net_PlainSocketImpl_socketGetOption;
+                Java_java_net_PlainDatagramSocketImpl_receive0;
+                Java_java_net_PlainDatagramSocketImpl_connect0;
+                Java_java_net_PlainDatagramSocketImpl_disconnect0;
+                Java_java_net_PlainDatagramSocketImpl_datagramSocketClose;
+                Java_java_net_PlainSocketImpl_initProto;
+                Java_java_net_PlainSocketImpl_socketBind;
+                Java_java_net_PlainSocketImpl_socketShutdown;
+                Java_java_net_SocketInputStream_init;
+                Java_java_net_PlainSocketImpl_socketConnect;
+                Java_java_net_PlainDatagramSocketImpl_getTimeToLive;
+                Java_java_net_PlainDatagramSocketImpl_setTimeToLive;
+                Java_sun_net_PortConfig_getLower0;
+                Java_sun_net_PortConfig_getUpper0;
+                Java_sun_net_dns_ResolverConfigurationImpl_localDomain0;
+                Java_sun_net_dns_ResolverConfigurationImpl_fallbackDomain0;
+                Java_sun_net_sdp_SdpSupport_convert0;
+                Java_sun_net_sdp_SdpSupport_create0;
+                Java_sun_net_spi_DefaultProxySelector_init;
+                Java_sun_net_spi_DefaultProxySelector_getSystemProxy;
+                NET_AllocSockaddr;
+                NET_SockaddrToInetAddress;
                 NET_SockaddrEqualsInetAddress;
-		NET_InetAddressToSockaddr;
-		NET_GetPortFromSockaddr;
-		NET_SetSockOpt;
-		NET_GetSockOpt;
-		NET_Bind;
-		NET_MapSocketOption;
-		NET_Wait;
+                NET_InetAddressToSockaddr;
+                NET_GetPortFromSockaddr;
+                NET_SetSockOpt;
+                NET_GetSockOpt;
+                NET_Bind;
+                NET_MapSocketOption;
+                NET_Wait;
                 ipv6_available;
 
-	local:
-		*;
+        local:
+                *;
 };
--- a/make/sun/net/FILES_java.gmk	Wed Nov 27 08:24:31 2013 -0800
+++ b/make/sun/net/FILES_java.gmk	Fri Nov 22 00:08:17 2013 +0000
@@ -24,122 +24,123 @@
 #
 
 FILES_java = \
-	sun/net/InetAddressCachePolicy.java \
-	sun/net/URLCanonicalizer.java \
-	sun/net/NetworkClient.java \
-	sun/net/NetworkServer.java \
-	sun/net/ProgressMonitor.java \
-	sun/net/ProgressSource.java \
-	sun/net/ProgressEvent.java \
-	sun/net/ProgressListener.java \
-	sun/net/ProgressMeteringPolicy.java \
-	sun/net/SocksProxy.java \
-	sun/net/ResourceManager.java \
-	sun/net/TelnetInputStream.java \
-	sun/net/TelnetOutputStream.java \
-	sun/net/TelnetProtocolException.java \
-	sun/net/TransferProtocolClient.java \
-	sun/net/ConnectionResetException.java \
-	sun/net/NetProperties.java \
-	sun/net/NetHooks.java \
-	sun/net/util/IPAddressUtil.java \
-	sun/net/util/URLUtil.java \
-	sun/net/dns/ResolverConfiguration.java \
-	sun/net/dns/ResolverConfigurationImpl.java \
-	sun/net/ftp/FtpClient.java \
-	sun/net/ftp/FtpClientProvider.java \
-	sun/net/ftp/FtpDirEntry.java \
-	sun/net/ftp/FtpReplyCode.java \
-	sun/net/ftp/FtpDirParser.java \
-	sun/net/ftp/FtpLoginException.java \
-	sun/net/ftp/FtpProtocolException.java \
-	sun/net/ftp/impl/FtpClient.java \
-	sun/net/ftp/impl/DefaultFtpClientProvider.java \
-	sun/net/sdp/SdpSupport.java \
-	sun/net/spi/DefaultProxySelector.java \
-	sun/net/spi/nameservice/NameServiceDescriptor.java \
-	sun/net/spi/nameservice/NameService.java \
-	sun/net/smtp/SmtpClient.java \
-	sun/net/smtp/SmtpProtocolException.java \
-	sun/net/www/content/text/Generic.java \
-	sun/net/www/content/text/plain.java \
-	sun/net/www/content/text/PlainTextInputStream.java \
-	sun/net/www/MessageHeader.java \
-	sun/net/www/HeaderParser.java \
-	sun/net/www/MeteredStream.java \
-	sun/net/www/MimeEntry.java \
-	sun/net/www/MimeLauncher.java \
-	sun/net/www/ApplicationLaunchException.java \
-	sun/net/www/MimeTable.java \
-	sun/net/www/URLConnection.java \
-	sun/net/www/ParseUtil.java \
-	sun/net/www/protocol/file/Handler.java \
-	sun/net/www/protocol/file/FileURLConnection.java \
-	sun/net/www/http/HttpClient.java \
-	sun/net/www/http/HttpCapture.java \
-	sun/net/www/http/HttpCaptureInputStream.java \
-	sun/net/www/http/HttpCaptureOutputStream.java \
-	sun/net/www/http/PosterOutputStream.java \
-	sun/net/www/http/ChunkedInputStream.java \
-	sun/net/www/http/ChunkedOutputStream.java \
-	sun/net/www/http/KeepAliveCache.java \
-	sun/net/www/http/KeepAliveStream.java \
-	sun/net/www/http/KeepAliveStreamCleaner.java \
-	sun/net/www/http/Hurryable.java \
-	sun/net/www/protocol/http/Handler.java \
-	sun/net/www/protocol/http/HttpURLConnection.java \
-	sun/net/www/protocol/http/HttpAuthenticator.java \
-	sun/net/www/protocol/http/AuthenticationHeader.java \
-	sun/net/www/protocol/http/AuthenticationInfo.java \
-	sun/net/www/protocol/http/AuthCache.java \
-	sun/net/www/protocol/http/AuthCacheImpl.java \
-	sun/net/www/protocol/http/AuthCacheValue.java \
-	sun/net/www/protocol/http/AuthScheme.java \
-	sun/net/www/protocol/http/BasicAuthentication.java \
-	sun/net/www/protocol/http/DigestAuthentication.java \
-	sun/net/www/protocol/http/NTLMAuthenticationProxy.java \
-	sun/net/www/protocol/http/NegotiateAuthentication.java \
-	sun/net/www/protocol/http/Negotiator.java \
-	sun/net/www/protocol/http/ntlm/NTLMAuthentication.java \
-	sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java \
-	sun/net/www/protocol/http/spnego/NegotiatorImpl.java \
-	sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java \
-	sun/net/www/protocol/http/logging/HttpLogFormatter.java \
-	sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java \
-	sun/net/www/protocol/https/HttpsClient.java \
-	sun/net/www/protocol/https/DefaultHostnameVerifier.java \
-	sun/net/www/protocol/https/HttpsURLConnectionImpl.java \
-	sun/net/www/protocol/https/DelegateHttpsURLConnection.java \
-	sun/net/www/protocol/https/Handler.java \
-	sun/net/www/protocol/jar/Handler.java \
-	sun/net/www/protocol/jar/URLJarFile.java \
-	sun/net/www/protocol/jar/JarFileFactory.java \
-	sun/net/www/protocol/jar/JarURLConnection.java \
-	sun/net/www/protocol/netdoc/Handler.java \
-	sun/net/www/content/image/gif.java \
-	sun/net/www/content/image/jpeg.java \
-	sun/net/www/content/image/x_xbitmap.java \
-	sun/net/www/content/image/x_xpixmap.java \
-	sun/net/www/content/image/png.java \
-	sun/net/www/content/audio/aiff.java \
-	sun/net/www/content/audio/basic.java \
-	sun/net/www/content/audio/wav.java \
-	sun/net/www/content/audio/x_aiff.java \
-	sun/net/www/content/audio/x_wav.java \
-	sun/net/www/protocol/ftp/Handler.java \
-	sun/net/www/protocol/ftp/FtpURLConnection.java \
-	sun/net/www/protocol/gopher/GopherClient.java \
-	sun/net/www/protocol/gopher/Handler.java \
-	sun/net/www/protocol/mailto/Handler.java \
-	sun/net/www/protocol/mailto/MailToURLConnection.java \
-	sun/net/idn/Punycode.java \
-	sun/net/idn/UCharacterEnums.java \
-	sun/net/idn/UCharacterDirection.java \
-	sun/net/idn/StringPrepDataReader.java \
-	sun/net/idn/StringPrep.java
+        sun/net/InetAddressCachePolicy.java \
+        sun/net/URLCanonicalizer.java \
+        sun/net/NetworkClient.java \
+        sun/net/NetworkServer.java \
+        sun/net/PortConfig.java \
+        sun/net/ProgressMonitor.java \
+        sun/net/ProgressSource.java \
+        sun/net/ProgressEvent.java \
+        sun/net/ProgressListener.java \
+        sun/net/ProgressMeteringPolicy.java \
+        sun/net/SocksProxy.java \
+        sun/net/ResourceManager.java \
+        sun/net/TelnetInputStream.java \
+        sun/net/TelnetOutputStream.java \
+        sun/net/TelnetProtocolException.java \
+        sun/net/TransferProtocolClient.java \
+        sun/net/ConnectionResetException.java \
+        sun/net/NetProperties.java \
+        sun/net/NetHooks.java \
+        sun/net/util/IPAddressUtil.java \
+        sun/net/util/URLUtil.java \
+        sun/net/dns/ResolverConfiguration.java \
+        sun/net/dns/ResolverConfigurationImpl.java \
+        sun/net/ftp/FtpClient.java \
+        sun/net/ftp/FtpClientProvider.java \
+        sun/net/ftp/FtpDirEntry.java \
+        sun/net/ftp/FtpReplyCode.java \
+        sun/net/ftp/FtpDirParser.java \
+        sun/net/ftp/FtpLoginException.java \
+        sun/net/ftp/FtpProtocolException.java \
+        sun/net/ftp/impl/FtpClient.java \
+        sun/net/ftp/impl/DefaultFtpClientProvider.java \
+        sun/net/sdp/SdpSupport.java \
+        sun/net/spi/DefaultProxySelector.java \
+        sun/net/spi/nameservice/NameServiceDescriptor.java \
+        sun/net/spi/nameservice/NameService.java \
+        sun/net/smtp/SmtpClient.java \
+        sun/net/smtp/SmtpProtocolException.java \
+        sun/net/www/content/text/Generic.java \
+        sun/net/www/content/text/plain.java \
+        sun/net/www/content/text/PlainTextInputStream.java \
+        sun/net/www/MessageHeader.java \
+        sun/net/www/HeaderParser.java \
+        sun/net/www/MeteredStream.java \
+        sun/net/www/MimeEntry.java \
+        sun/net/www/MimeLauncher.java \
+        sun/net/www/ApplicationLaunchException.java \
+        sun/net/www/MimeTable.java \
+        sun/net/www/URLConnection.java \
+        sun/net/www/ParseUtil.java \
+        sun/net/www/protocol/file/Handler.java \
+        sun/net/www/protocol/file/FileURLConnection.java \
+        sun/net/www/http/HttpClient.java \
+        sun/net/www/http/HttpCapture.java \
+        sun/net/www/http/HttpCaptureInputStream.java \
+        sun/net/www/http/HttpCaptureOutputStream.java \
+        sun/net/www/http/PosterOutputStream.java \
+        sun/net/www/http/ChunkedInputStream.java \
+        sun/net/www/http/ChunkedOutputStream.java \
+        sun/net/www/http/KeepAliveCache.java \
+        sun/net/www/http/KeepAliveStream.java \
+        sun/net/www/http/KeepAliveStreamCleaner.java \
+        sun/net/www/http/Hurryable.java \
+        sun/net/www/protocol/http/Handler.java \
+        sun/net/www/protocol/http/HttpURLConnection.java \
+        sun/net/www/protocol/http/HttpAuthenticator.java \
+        sun/net/www/protocol/http/AuthenticationHeader.java \
+        sun/net/www/protocol/http/AuthenticationInfo.java \
+        sun/net/www/protocol/http/AuthCache.java \
+        sun/net/www/protocol/http/AuthCacheImpl.java \
+        sun/net/www/protocol/http/AuthCacheValue.java \
+        sun/net/www/protocol/http/AuthScheme.java \
+        sun/net/www/protocol/http/BasicAuthentication.java \
+        sun/net/www/protocol/http/DigestAuthentication.java \
+        sun/net/www/protocol/http/NTLMAuthenticationProxy.java \
+        sun/net/www/protocol/http/NegotiateAuthentication.java \
+        sun/net/www/protocol/http/Negotiator.java \
+        sun/net/www/protocol/http/ntlm/NTLMAuthentication.java \
+        sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java \
+        sun/net/www/protocol/http/spnego/NegotiatorImpl.java \
+        sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java \
+        sun/net/www/protocol/http/logging/HttpLogFormatter.java \
+        sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java \
+        sun/net/www/protocol/https/HttpsClient.java \
+        sun/net/www/protocol/https/DefaultHostnameVerifier.java \
+        sun/net/www/protocol/https/HttpsURLConnectionImpl.java \
+        sun/net/www/protocol/https/DelegateHttpsURLConnection.java \
+        sun/net/www/protocol/https/Handler.java \
+        sun/net/www/protocol/jar/Handler.java \
+        sun/net/www/protocol/jar/URLJarFile.java \
+        sun/net/www/protocol/jar/JarFileFactory.java \
+        sun/net/www/protocol/jar/JarURLConnection.java \
+        sun/net/www/protocol/netdoc/Handler.java \
+        sun/net/www/content/image/gif.java \
+        sun/net/www/content/image/jpeg.java \
+        sun/net/www/content/image/x_xbitmap.java \
+        sun/net/www/content/image/x_xpixmap.java \
+        sun/net/www/content/image/png.java \
+        sun/net/www/content/audio/aiff.java \
+        sun/net/www/content/audio/basic.java \
+        sun/net/www/content/audio/wav.java \
+        sun/net/www/content/audio/x_aiff.java \
+        sun/net/www/content/audio/x_wav.java \
+        sun/net/www/protocol/ftp/Handler.java \
+        sun/net/www/protocol/ftp/FtpURLConnection.java \
+        sun/net/www/protocol/gopher/GopherClient.java \
+        sun/net/www/protocol/gopher/Handler.java \
+        sun/net/www/protocol/mailto/Handler.java \
+        sun/net/www/protocol/mailto/MailToURLConnection.java \
+        sun/net/idn/Punycode.java \
+        sun/net/idn/UCharacterEnums.java \
+        sun/net/idn/UCharacterDirection.java \
+        sun/net/idn/StringPrepDataReader.java \
+        sun/net/idn/StringPrep.java
 
 ifeq ($(PLATFORM), windows)
-    FILES_java += sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java 
+    FILES_java += sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
 else
     FILES_java += sun/net/sdp/SdpProvider.java
 endif
--- a/src/share/classes/java/net/SocketPermission.java	Wed Nov 27 08:24:31 2013 -0800
+++ b/src/share/classes/java/net/SocketPermission.java	Fri Nov 22 00:08:17 2013 +0000
@@ -44,6 +44,7 @@
 import java.io.IOException;
 import sun.net.util.IPAddressUtil;
 import sun.net.RegisteredDomain;
+import sun.net.PortConfig;
 import sun.security.util.SecurityConstants;
 import sun.security.util.Debug;
 
@@ -1213,17 +1214,9 @@
                     if (val != -1) {
                         return val;
                     } else {
-                        String prop = Security.getProperty(
-                            "network.ephemeralPortRange."+suffix
-                        );
-                        try {
-                                val = Integer.parseInt(prop);
-                        } catch (NumberFormatException e) {
-                            // shouldn't happen
-                            return defval;
-                        }
+                        return suffix.equals("low") ?
+                            PortConfig.getLower() : PortConfig.getUpper();
                     }
-                    return val;
                 }
             }
         );
--- a/src/share/classes/sun/rmi/registry/RegistryImpl.java	Wed Nov 27 08:24:31 2013 -0800
+++ b/src/share/classes/sun/rmi/registry/RegistryImpl.java	Fri Nov 22 00:08:17 2013 +0000
@@ -352,7 +352,7 @@
                         public RegistryImpl run() throws RemoteException {
                             return new RegistryImpl(regPort);
                         }
-                    }, getAccessControlContext());
+                    }, getAccessControlContext(regPort));
             } catch (PrivilegedActionException ex) {
                 throw (RemoteException) ex.getException();
             }
@@ -382,7 +382,7 @@
      * The approach used here is taken from the similar method
      * getAccessControlContext() in the sun.applet.AppletPanel class.
      */
-    private static AccessControlContext getAccessControlContext() {
+    private static AccessControlContext getAccessControlContext(int port) {
         // begin with permissions granted to all code in current policy
         PermissionCollection perms = AccessController.doPrivileged(
             new java.security.PrivilegedAction<PermissionCollection>() {
@@ -404,6 +404,7 @@
          * related classes themselves are more tightly limited by RMI.
          */
         perms.add(new SocketPermission("*", "connect,accept"));
+        perms.add(new SocketPermission("localhost:"+port, "listen,accept"));
 
         perms.add(new RuntimePermission("accessClassInPackage.sun.jvmstat.*"));
         perms.add(new RuntimePermission("accessClassInPackage.sun.jvm.hotspot.*"));
--- a/src/share/lib/security/java.security-linux	Wed Nov 27 08:24:31 2013 -0800
+++ b/src/share/lib/security/java.security-linux	Fri Nov 22 00:08:17 2013 +0000
@@ -429,20 +429,3 @@
 #
 # Example:
 #   jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048
-
-#
-# Default ephemeral port ranges (operating system specific)
-# used by java.net.SocketPermission to interpret the meaning of the special
-# port value zero, as in the following example:
-#
-#       SocketPermission("localhost:0" , "listen");
-#
-# These can be overridden by the system properties:
-#
-#       jdk.net.ephemeralPortRange.low and
-#       jdk.net.ephemeralPortRange.high
-#
-# respectively.
-#
-network.ephemeralPortRange.low=32768
-network.ephemeralPortRange.high=65535
--- a/src/share/lib/security/java.security-macosx	Wed Nov 27 08:24:31 2013 -0800
+++ b/src/share/lib/security/java.security-macosx	Fri Nov 22 00:08:17 2013 +0000
@@ -434,22 +434,3 @@
 #
 # Example:
 #   jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048
-
-
-#
-# Default ephemeral port ranges (operating system specific)
-# used by java.net.SocketPermission to interpret the meaning of the special
-# port value zero, as in the following example:
-#
-#        SocketPermission("localhost:0" , "listen");
-#
-# These can be overridden by the system properties:
-#
-#       jdk.net.ephemeralPortRange.low and
-#       jdk.net.ephemeralPortRange.high
-#
-# respectively.
-#
-network.ephemeralPortRange.low=49152
-network.ephemeralPortRange.high=65535
-
--- a/src/share/lib/security/java.security-solaris	Wed Nov 27 08:24:31 2013 -0800
+++ b/src/share/lib/security/java.security-solaris	Fri Nov 22 00:08:17 2013 +0000
@@ -433,21 +433,3 @@
 #
 # Example:
 #   jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048
-
-
-#
-# Default ephemeral port ranges (operating system specific)
-# used by java.net.SocketPermission to interpret the meaning of the special
-# port value zero, as in the following example:
-#
-#        SocketPermission("localhost:0" , "listen");
-#
-# These can be overridden by the system properties:
-#
-#       jdk.net.ephemeralPortRange.low and
-#       jdk.net.ephemeralPortRange.high
-#
-# respectively.
-#
-network.ephemeralPortRange.low=32768
-network.ephemeralPortRange.high=65535
--- a/src/share/lib/security/java.security-windows	Wed Nov 27 08:24:31 2013 -0800
+++ b/src/share/lib/security/java.security-windows	Fri Nov 22 00:08:17 2013 +0000
@@ -434,20 +434,3 @@
 #
 # Example:
 #   jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048
-
-#
-# Default ephemeral port ranges (operating system specific)
-# used by java.net.SocketPermission to interpret the meaning of the special
-# port value zero, as in the following example:
-#
-#        SocketPermission("localhost:0" , "listen");
-#
-# These can be overridden by the system properties:
-#
-#       jdk.net.ephemeralPortRange.low and
-#       jdk.net.ephemeralPortRange.high
-#
-# respectively.
-#
-network.ephemeralPortRange.low=49152
-network.ephemeralPortRange.high=65535
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/sun/net/PortConfig.java	Fri Nov 22 00:08:17 2013 +0000
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.net;
+
+import java.security.AccessController;
+
+/**
+ * Determines the ephemeral port range in use on this system.
+ * If this cannot be determined, then the default settings
+ * of the OS are returned.
+ */
+
+public final class PortConfig {
+
+    private static int defaultUpper, defaultLower;
+    private final static int upper, lower;
+
+    private PortConfig() {}
+
+    static {
+        AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Void>() {
+                public Void run() {
+                    System.loadLibrary("net");
+                    String os = System.getProperty("os.name");
+                    if (os.startsWith("Linux")) {
+                        defaultLower = 32768;
+                        defaultUpper = 61000;
+                    } else if (os.startsWith("SunOS")) {
+                        defaultLower = 32768;
+                        defaultUpper = 65535;
+                    } else if (os.contains("OS X")) {
+                        defaultLower = 49152;
+                        defaultUpper = 65535;
+                    } else {
+                        throw new InternalError(
+                            "sun.net.PortConfig: unknown OS");
+                    }
+                    return null;
+                }
+            });
+
+        int v = getLower0();
+        if (v == -1) {
+            v = defaultLower;
+        }
+        lower = v;
+
+        v = getUpper0();
+        if (v == -1) {
+            v = defaultUpper;
+        }
+        upper = v;
+    }
+
+    static native int getLower0();
+    static native int getUpper0();
+
+    public static int getLower() {
+        return lower;
+    }
+
+    public static int getUpper() {
+        return upper;
+    }
+}
--- a/src/solaris/native/java/net/net_util_md.c	Wed Nov 27 08:24:31 2013 -0800
+++ b/src/solaris/native/java/net/net_util_md.c	Fri Nov 22 00:08:17 2013 +0000
@@ -138,8 +138,7 @@
  * of the parameter is assumed to be an 'int'. If the parameter
  * cannot be obtained return -1
  */
-static int
-getParam(char *driver, char *param)
+int net_getParam(char *driver, char *param)
 {
     struct strioctl stri;
     char buf [64];
@@ -166,7 +165,7 @@
 
 /*
  * Iterative way to find the max value that SO_SNDBUF or SO_RCVBUF
- * for Solaris versions that do not support the ioctl() in getParam().
+ * for Solaris versions that do not support the ioctl() in net_getParam().
  * Ugly, but only called once (for each sotype).
  *
  * As an optimisation, we make a guess using the default values for Solaris
@@ -1407,7 +1406,7 @@
              * If that fails, we use the search algorithm in findMaxBuf()
              */
             if (!init_tcp_max_buf && sotype == SOCK_STREAM) {
-                tcp_max_buf = getParam("/dev/tcp", "tcp_max_buf");
+                tcp_max_buf = net_getParam("/dev/tcp", "tcp_max_buf");
                 if (tcp_max_buf == -1) {
                     tcp_max_buf = findMaxBuf(fd, opt, SOCK_STREAM);
                     if (tcp_max_buf == -1) {
@@ -1416,7 +1415,7 @@
                 }
                 init_tcp_max_buf = 1;
             } else if (!init_udp_max_buf && sotype == SOCK_DGRAM) {
-                udp_max_buf = getParam("/dev/udp", "udp_max_buf");
+                udp_max_buf = net_getParam("/dev/udp", "udp_max_buf");
                 if (udp_max_buf == -1) {
                     udp_max_buf = findMaxBuf(fd, opt, SOCK_DGRAM);
                     if (udp_max_buf == -1) {
--- a/src/solaris/native/java/net/net_util_md.h	Wed Nov 27 08:24:31 2013 -0800
+++ b/src/solaris/native/java/net/net_util_md.h	Fri Nov 22 00:08:17 2013 +0000
@@ -81,6 +81,9 @@
 int getDefaultIPv6Interface(struct in6_addr *target_addr);
 #endif
 
+#ifdef __solaris__
+extern int net_getParam(char *driver, char *param);
+#endif
 
 /* needed from libsocket on Solaris 8 */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/native/sun/net/portconfig.c	Fri Nov 22 00:08:17 2013 +0000
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+#if defined(_ALLBSD_SOURCE)
+#include <sys/sysctl.h>
+#endif
+
+#include "jni.h"
+#include "net_util.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct portrange {
+    int lower;
+    int higher;
+};
+
+static int getPortRange(struct portrange *range)
+{
+#ifdef __linux__
+    {
+        int ret;
+        FILE *f;
+
+        f = fopen("/proc/sys/net/ipv4/ip_local_port_range", "r");
+        if (f != NULL) {
+            ret = fscanf(f, "%d %d", &range->lower, &range->higher);
+            fclose(f);
+            return ret == 2 ? 0 : -1;
+        }
+        return -1;
+    }
+
+#elif defined(__solaris__)
+    {
+        range->lower = net_getParam("/dev/tcp", "tcp_smallest_anon_port");
+        range->higher = net_getParam("/dev/tcp", "tcp_largest_anon_port");
+        return 0;
+    }
+#elif defined(_ALLBSD_SOURCE)
+    {
+        int ret;
+        size_t size = sizeof(range->lower);
+        ret = sysctlbyname(
+            "net.inet.ip.portrange.first", &range->lower, &size, 0, 0
+        );
+        if (ret == -1) {
+            return -1;
+        }
+        size = sizeof(range->higher);
+        ret = sysctlbyname(
+            "net.inet.ip.portrange.last", &range->higher, &size, 0, 0
+        );
+        return ret;
+    }
+#else
+    return -1;
+#endif
+}
+
+/*
+ * Class:     sun_net_PortConfig
+ * Method:    getLower0
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_sun_net_PortConfig_getLower0
+  (JNIEnv *env, jclass clazz)
+{
+    struct portrange range;
+    if (getPortRange(&range) < 0) {
+        return -1;
+    }
+    return range.lower;
+}
+
+/*
+ * Class:     sun_net_PortConfig
+ * Method:    getUpper
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_sun_net_PortConfig_getUpper0
+  (JNIEnv *env, jclass clazz)
+{
+    struct portrange range;
+    if (getPortRange(&range) < 0) {
+        return -1;
+    }
+    return range.higher;
+}
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/windows/classes/sun/net/PortConfig.java	Fri Nov 22 00:08:17 2013 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.net;
+
+import java.security.AccessController;
+
+/**
+ * Determines the ephemeral port range in use on this system.
+ * If this cannot be determined, then the default settings
+ * of the OS are returned.
+ */
+
+public final class PortConfig {
+
+    private final static int upper, lower;
+
+    private PortConfig() {}
+
+    static {
+        AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Void>() {
+                public Void run() {
+                    System.loadLibrary("net");
+                    return null;
+                }
+            });
+
+        lower = getLower0();
+        upper = getUpper0();
+    }
+
+    static native int getLower0();
+    static native int getUpper0();
+
+    public static int getLower() {
+        return lower;
+    }
+
+    public static int getUpper() {
+        return upper;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/windows/native/sun/net/portconfig.c	Fri Nov 22 00:08:17 2013 +0000
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <windows.h>
+#include "jni.h"
+#include "net_util.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct portrange {
+    int lower;
+    int higher;
+};
+
+static int getPortRange(struct portrange *range)
+{
+    OSVERSIONINFO ver;
+    ver.dwOSVersionInfoSize = sizeof(ver);
+    GetVersionEx(&ver);
+
+    /* Check for major version 5 or less = Windows XP/2003 or older */
+    if (ver.dwMajorVersion <= 5) {
+        LONG ret;
+        HKEY hKey;
+        range->lower = 1024;
+        range->higher = 4999;
+
+        /* check registry to see if upper limit was raised */
+        ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                   "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
+                   0, KEY_READ, (PHKEY)&hKey
+        );
+        if (ret == ERROR_SUCCESS) {
+            DWORD maxuserport;
+            ULONG ulType;
+            DWORD dwLen = sizeof(maxuserport);
+            ret = RegQueryValueEx(hKey, "MaxUserPort",  NULL, &ulType,
+                             (LPBYTE)&maxuserport, &dwLen);
+            RegCloseKey(hKey);
+            if (ret == ERROR_SUCCESS) {
+                range->higher = maxuserport;
+            }
+        }
+    } else {
+        /* There doesn't seem to be an API to access this. "MaxUserPort"
+          * is affected, but is not sufficient to determine.
+         * so we just use the defaults, which are less likely to change
+          */
+        range->lower = 49152;
+        range->higher = 65535;
+    }
+    return 0;
+}
+
+/*
+ * Class:     sun_net_PortConfig
+ * Method:    getLower0
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_sun_net_PortConfig_getLower0
+  (JNIEnv *env, jclass clazz)
+{
+    struct portrange range;
+    getPortRange(&range);
+    return range.lower;
+}
+
+/*
+ * Class:     sun_net_PortConfig
+ * Method:    getUpper0
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_sun_net_PortConfig_getUpper0
+  (JNIEnv *env, jclass clazz)
+{
+    struct portrange range;
+    getPortRange(&range);
+    return range.higher;
+}
+#ifdef __cplusplus
+}
+#endif
--- a/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java	Wed Nov 27 08:24:31 2013 -0800
+++ b/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java	Fri Nov 22 00:08:17 2013 +0000
@@ -88,6 +88,17 @@
                                    TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
             rmid.addOptions(new String[]{
                 "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
+            if (System.getProperty("os.name").startsWith("Windows") &&
+                System.getProperty("os.version").startsWith("5."))
+            {
+                /* Windows XP/2003 or older
+                 * Need to expand ephemeral range to include RMI test ports
+                 */
+                rmid.addOptions(new String[]{
+                    "-Djdk.net.ephemeralPortRange.low=1024",
+                    "-Djdk.net.ephemeralPortRange.high=64000"
+                });
+            }
             rmid.start();
 
             /*
--- a/test/java/rmi/registry/readTest/readTest.sh	Wed Nov 27 08:24:31 2013 -0800
+++ b/test/java/rmi/registry/readTest/readTest.sh	Fri Nov 22 00:08:17 2013 +0000
@@ -29,6 +29,10 @@
 # @run shell readTest.sh
 
 OS=`uname -s`
+VER=`uname -r`
+ARGS=""
+REGARGS=""
+
 case "$OS" in
   SunOS | Linux | Darwin )
     PS=":"
@@ -39,11 +43,19 @@
     PS=";"
     FS="\\"
     FILEURL="file:/"
+    if [ "$VER" -eq "5" ]; then
+        ARGS="-Djdk.net.ephemeralPortRange.low=1024 -Djdk.net.ephemeralPortRange.high=65000"
+        REGARGS="-J-Djdk.net.ephemeralPortRange.low=1024 -J-Djdk.net.ephemeralPortRange.high=65000"
+    fi
     ;;
   CYGWIN* )
     PS=";"
     FS="/"
     FILEURL="file:/"
+    if [ "${VER}" -eq "5" ]; then
+        ARGS="-Djdk.net.ephemeralPortRange.low=1024 -Djdk.net.ephemeralPortRange.high=65000"
+        REGARGS="-J-Djdk.net.ephemeralPortRange.low=1024 -J-Djdk.net.ephemeralPortRange.high=65000"
+    fi
     ;;
   * )
     echo "Unrecognized system!"
@@ -61,8 +73,8 @@
 #start rmiregistry without any local classes on classpath
 cd rmi_tmp
 # NOTE: This RMI Registry port must match TestLibrary.READTEST_REGISTRY_PORT
-${TESTJAVA}${FS}bin${FS}rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false \
-    ${TESTTOOLVMOPTS} 64005 > ..${FS}${RMIREG_OUT} 2>&1 &
+${TESTJAVA}${FS}bin${FS}rmiregistry ${REGARGS} -J-Djava.rmi.server.useCodebaseOnly=false \
+    ${TESTTOOLVMOPTS} 60005 > ..${FS}${RMIREG_OUT} 2>&1 &
 RMIREG_PID=$!
 # allow some time to start
 sleep 3
@@ -74,10 +86,10 @@
     ;;
   * )
     CODEBASE=`pwd`
-    ;;  
+    ;;
 esac
 # trailing / after code base is important for rmi codebase property.
-${TESTJAVA}${FS}bin${FS}java -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 &
+${TESTJAVA}${FS}bin${FS}java -cp $TEST_CLASSPATH ${ARGS} -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 &
 TEST_PID=$!
 #bulk of testcase - let it run for a while
 sleep 5
@@ -100,7 +112,7 @@
 result2=$?
 
 if [ $result1 -eq 0  -a $result2 -eq 0 ]
-then 
+then
     echo "Passed"
     exitCode=0;
 else
@@ -108,6 +120,6 @@
     exitCode=1
 fi
 rm -rf OUT.TXT ${RMIREG_OUT} rmi_tmp
-exit ${exitCode}    
+exit ${exitCode}
 
 
--- a/test/java/rmi/testlibrary/TestLibrary.java	Wed Nov 27 08:24:31 2013 -0800
+++ b/test/java/rmi/testlibrary/TestLibrary.java	Fri Nov 22 00:08:17 2013 +0000
@@ -86,13 +86,13 @@
      * FIXED_PORT_MIN or above FIXED_PORT_MAX, then adjust
      * FIXED_PORT_MIN/MAX appropriately.
      */
-    public final static int FIXED_PORT_MIN = 64001;
-    public final static int FIXED_PORT_MAX = 64010;
-    public final static int RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT = 64001;
-    public final static int RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT = 64002;
-    public final static int INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT = 64003;
-    public final static int INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT = 64004;
-    public final static int READTEST_REGISTRY_PORT = 64005;
+    public final static int FIXED_PORT_MIN = 60001;
+    public final static int FIXED_PORT_MAX = 60010;
+    public final static int RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT = 60001;
+    public final static int RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT = 60002;
+    public final static int INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT = 60003;
+    public final static int INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT = 60004;
+    public final static int READTEST_REGISTRY_PORT = 60005;
     private final static int MAX_SERVER_SOCKET_TRIES = 2*(FIXED_PORT_MAX-FIXED_PORT_MIN+1);
 
     static void mesg(Object mesg) {