Blame SOURCES/pr3655-toggle_system_crypto_policy.patch

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