Blame SOURCES/pr3655-toggle_system_crypto_policy.patch

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