Blame SOURCES/pr3655-toggle_system_crypto_policy.patch

cdbd41
# HG changeset patch
cdbd41
# User andrew
cdbd41
# Date 1545198926 0
cdbd41
#      Wed Dec 19 05:55:26 2018 +0000
cdbd41
# Node ID f2cbd688824c128db7fa848c8732fb0ab3507776
cdbd41
# Parent  81f07f6d1f8b7b51b136d3974c61bc8bb513770c
cdbd41
PR3655: Allow use of system crypto policy to be disabled by the user
cdbd41
Summary: Read user overrides first so security.useSystemPropertiesFile can be disabled and add -Djava.security.disableSystemPropertiesFile
cdbd41
cdbd41
diff --git a/src/share/classes/javopenjdk.orig/jdk/security/Security.java openjdk/jdk/src/share/classes/java/security/Security.java
cdbd41
--- openjdk.orig/jdk/src/share/classes/java/security/Security.java
cdbd41
+++ openjdk/jdk/src/share/classes/java/security/Security.java
cdbd41
@@ -122,31 +122,6 @@
cdbd41
         }
cdbd41
 
cdbd41
         if ("true".equalsIgnoreCase(props.getProperty
cdbd41
-                ("security.useSystemPropertiesFile"))) {
cdbd41
-
cdbd41
-            // now load the system file, if it exists, so its values
cdbd41
-            // will win if they conflict with the earlier values
cdbd41
-            try (BufferedInputStream bis =
cdbd41
-                 new BufferedInputStream(new FileInputStream(SYSTEM_PROPERTIES))) {
cdbd41
-                props.load(bis);
cdbd41
-                loadedProps = true;
cdbd41
-
cdbd41
-                if (sdebug != null) {
cdbd41
-                    sdebug.println("reading system security properties file " +
cdbd41
-                                   SYSTEM_PROPERTIES);
cdbd41
-                    sdebug.println(props.toString());
cdbd41
-                }
cdbd41
-            } catch (IOException e) {
cdbd41
-                if (sdebug != null) {
cdbd41
-                    sdebug.println
cdbd41
-                        ("unable to load security properties from " +
cdbd41
-                         SYSTEM_PROPERTIES);
cdbd41
-                    e.printStackTrace();
cdbd41
-                }
cdbd41
-            }
cdbd41
-        }
cdbd41
-
cdbd41
-        if ("true".equalsIgnoreCase(props.getProperty
cdbd41
                 ("security.overridePropertiesFile"))) {
cdbd41
 
cdbd41
             String extraPropFile = System.getProperty
cdbd41
@@ -212,6 +187,33 @@
cdbd41
             }
cdbd41
         }
cdbd41
 
cdbd41
+        String disableSystemProps = System.getProperty("java.security.disableSystemPropertiesFile");
cdbd41
+        if (disableSystemProps == null &&
cdbd41
+            "true".equalsIgnoreCase(props.getProperty
cdbd41
+                ("security.useSystemPropertiesFile"))) {
cdbd41
+
cdbd41
+            // now load the system file, if it exists, so its values
cdbd41
+            // will win if they conflict with the earlier values
cdbd41
+            try (BufferedInputStream bis =
cdbd41
+                 new BufferedInputStream(new FileInputStream(SYSTEM_PROPERTIES))) {
cdbd41
+                props.load(bis);
cdbd41
+                loadedProps = true;
cdbd41
+
cdbd41
+                if (sdebug != null) {
cdbd41
+                    sdebug.println("reading system security properties file " +
cdbd41
+                                   SYSTEM_PROPERTIES);
cdbd41
+                    sdebug.println(props.toString());
cdbd41
+                }
cdbd41
+            } catch (IOException e) {
cdbd41
+                if (sdebug != null) {
cdbd41
+                    sdebug.println
cdbd41
+                        ("unable to load security properties from " +
cdbd41
+                         SYSTEM_PROPERTIES);
cdbd41
+                    e.printStackTrace();
cdbd41
+                }
cdbd41
+            }
cdbd41
+        }
cdbd41
+
cdbd41
         if (!loadedProps) {
cdbd41
             initializeStatic();
cdbd41
             if (sdebug != null) {