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 rh...@apache.org on 2007/11/21 17:12:39 UTC
svn commit: r597131 -
/db/derby/code/branches/10.3/java/drda/org/apache/derby/drda/NetworkServerControl.java
Author: rhillegas
Date: Wed Nov 21 08:12:39 2007
New Revision: 597131
URL: http://svn.apache.org/viewvc?rev=597131&view=rev
Log:
DERBY-3083: Ported 597125 from trunk to 10.3 branch.
Modified:
db/derby/code/branches/10.3/java/drda/org/apache/derby/drda/NetworkServerControl.java
Modified: db/derby/code/branches/10.3/java/drda/org/apache/derby/drda/NetworkServerControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/drda/org/apache/derby/drda/NetworkServerControl.java?rev=597131&r1=597130&r2=597131&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/drda/org/apache/derby/drda/NetworkServerControl.java (original)
+++ db/derby/code/branches/10.3/java/drda/org/apache/derby/drda/NetworkServerControl.java Wed Nov 21 08:12:39 2007
@@ -545,6 +545,7 @@
* <li>The command must be "start".</li>
* <li>The customer didn't specify the -noSecurityManager flag on the startup command
* line.</li>
+ * <li>Classes live in the jar files which we expect..</li>
* </ul>
*/
private static boolean needsSecurityManager( NetworkServerControlImpl server, int command )
@@ -554,10 +555,28 @@
(
(System.getSecurityManager() == null) &&
(command == NetworkServerControlImpl.COMMAND_START) &&
- (!server.runningUnsecure())
+ (!server.runningUnsecure()) &&
+ (packagingLooksGood())
);
}
+ /**
+ * Return true if the server lives in the expected jar file. This
+ * is meant to address DERBY-3083. We expect that the URL of
+ * the jar which contains NetworkServerControl will end with the
+ * string "derbynet.jar". If this is true, then getCodeSourcePrefix()
+ * will return a prefix which can be substituted into the default
+ * server policy file and so end up granting permissions to the server jar file.
+ */
+ private static boolean packagingLooksGood()
+ throws Exception
+ {
+ String derbyNetURL = NetworkServerControl.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm();
+
+ return derbyNetURL.endsWith( DERBYNET_JAR );
+ }
+
+
/**
* Verify that all prerequisites are met before bringing up a security
* manager. See DERBY-2196. If prerequisites aren't met, raise an