< prev index next >

src/java.base/unix/classes/sun/net/PortConfig.java

Print this page
rev 55657 : 8227587: Add internal privileged System.loadLibrary
Reviewed-by: rriggs

*** 1,7 **** /* ! * 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 --- 1,7 ---- /* ! * Copyright (c) 2013, 2019, 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
*** 23,33 **** * 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. --- 23,33 ---- * questions. */ package sun.net; ! import sun.security.action.GetPropertyAction; /** * Determines the ephemeral port range in use on this system. * If this cannot be determined, then the default settings * of the OS are returned.
*** 39,53 **** private static final int upper, lower; private PortConfig() {} static { ! AccessController.doPrivileged( ! new java.security.PrivilegedAction<>() { ! 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; --- 39,50 ---- private static final int upper, lower; private PortConfig() {} static { ! jdk.internal.access.SharedSecrets.getJavaLangAccess().loadLibrary("net"); ! String os = GetPropertyAction.privilegedGetProperty("os.name"); if (os.startsWith("Linux")) { defaultLower = 32768; defaultUpper = 61000; } else if (os.startsWith("SunOS")) { defaultLower = 32768;
*** 65,77 **** defaultUpper = 65535; } else { throw new InternalError( "sun.net.PortConfig: unknown OS"); } - return null; - } - }); int v = getLower0(); if (v == -1) { v = defaultLower; } --- 62,71 ----
< prev index next >