You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2011/10/05 19:07:34 UTC

svn commit: r1179320 - in /db/derby/code/trunk/java: drda/org/apache/derby/drda/NetworkServerControl.java engine/org/apache/derby/iapi/services/io/FileUtil.java

Author: dag
Date: Wed Oct  5 17:07:33 2011
New Revision: 1179320

URL: http://svn.apache.org/viewvc?rev=1179320&view=rev
Log:
DERBY-5363 Tighten permissions of DB files to owner with >= JDK7

Patch derby-5363-limit-to-java7b, which limits the default restrictive permission
for the network server further: only on Java 7 or higher.


Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/FileUtil.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java?rev=1179320&r1=1179319&r2=1179320&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java Wed Oct  5 17:07:33 2011
@@ -29,6 +29,7 @@ import java.security.AccessController;
 import java.security.PrivilegedExceptionAction;
 import java.util.Properties;
 import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.services.info.JVMInfo;
 import org.apache.derby.iapi.services.property.PropertyUtil;
 
 import org.apache.derby.impl.drda.NetworkServerControlImpl;
@@ -304,7 +305,9 @@ public class NetworkServerControl{
             
             int     command = server.parseArgs( args );
 
-            if (command == NetworkServerControlImpl.COMMAND_START) {
+            // Java 7 and above: file permission restriction
+            if (command == NetworkServerControlImpl.COMMAND_START &&
+                    JVMInfo.JDK_ID >= JVMInfo.J2SE_17) {
                 try {
                     AccessController.doPrivileged(new PrivilegedExceptionAction() {
                             public Object run() throws Exception {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/FileUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/FileUtil.java?rev=1179320&r1=1179319&r2=1179320&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/FileUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/FileUtil.java Wed Oct  5 17:07:33 2011
@@ -41,6 +41,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.services.info.JVMInfo;
 import org.apache.derby.iapi.services.property.PropertyUtil;
 import org.apache.derby.shared.common.sanity.SanityManager;
 
@@ -654,9 +655,13 @@ nextFile:	for (int i = 0; i < list.lengt
             }
         } else {
             // The property has not been specified. Only proceed if we are
-            // running with the network server started from the command line.
-            if ( !PropertyUtil.getSystemBoolean(
-                    Property.SERVER_STARTED_FROM_CMD_LINE, false)) {
+            // running with the network server started from the command line
+            // *and* at Java 7 or above
+            if (JVMInfo.JDK_ID >= JVMInfo.J2SE_17 && 
+                    (PropertyUtil.getSystemBoolean(
+                        Property.SERVER_STARTED_FROM_CMD_LINE, false)) ) {
+                // proceed
+            } else {
                 return;
             }
         }