Bug 2721937 change the way PutInROT property is used so that applets no longer throw security violation

This commit is contained in:
clay_shooter
2009-08-23 14:41:15 +00:00
parent a79a1a08ca
commit 1a651776d5
3 changed files with 57 additions and 7 deletions

View File

@@ -1,11 +1,14 @@
<HTML> <HTML>
<BODY> <BODY>
<!-- --------- --> <!-- --------- -->
<h2>JACOB 1.15 M1</h2> <h2>JACOB 1.15 M2</h2>
<h3>What's New</h3> <h3>What's New</h3>
<ul> <ul>
<li> <li>
MS Libraries are now statically linked using /MT instead of /MD to reduce issues library compatability issues, especially on older platforms. MS Libraries are now statically linked using /MT instead of /MD to
reduce issues library compatibility issues, especially on older platforms.
The VC++ redistributable library no longer needs to be installed
as a stand alone product.
</li> </li>
</ul> </ul>
<h3>Tracked Changes</h3> <h3>Tracked Changes</h3>
@@ -13,6 +16,14 @@
<tr> <tr>
<td colspan="2"><b>Bugs</b></td> <td colspan="2"><b>Bugs</b></td>
</tr> </tr>
<tr>
<td width="13%" valign="top">2721937</td>
<td width="87%" valign="top">System.getProperties call caused security exception in applet.
<i>com.jacob.includeAllClassesInROT</i> now acts as master switch for class/ROT control.
This change also has the side benefit that the PutInROT property is not
checked on every object creation for users who run in the standard
<i>all classes in ROT</i> mode. (M2)</td>
</tr>
<tr> <tr>
<td width="13%" valign="top">&nbsp;</td> <td width="13%" valign="top">&nbsp;</td>
<td width="87%" valign="top">&nbsp;</td> <td width="87%" valign="top">&nbsp;</td>

View File

@@ -71,14 +71,21 @@ should be fixed in some future release, fix method and time not yet determined.
<p> <p>
<hr> <hr>
<h2>Microsoft Visual C++ library dependencies.</h2> <h2>Microsoft Visual C++ library dependencies.</h2>
<p>
Jacob 1.15 is build with VC++ 2005 staticly linked into the DLL. This
removes the need for a separate msvcr80.dll installation.
</p>
<p>
Jacob 1.13 is built with VC++ 2005 that creates a dependency on msvcr80.dll. Jacob 1.13 is built with VC++ 2005 that creates a dependency on msvcr80.dll.
Windows XP and later seem to already include the necessary components. Windows XP and later seem to already include the necessary components.
NT/2000 and Server/2003 require that you download the Visual C 2005 redistributable NT/2000 and Server/2003 require that you download the Visual C 2005 redistributable
package, vcredist_x86.exe from the microsoft web site. package, vcredist_x86.exe from the microsoft web site.
Microsoft has a download available that supplies the necessary components. Microsoft has a download available that supplies the necessary components.
It is distributed as a redistributable package. It is distributed as a redistributable package.
</p>
<p> <p>
If you see the following message then you probably don't have the right C++ libraries. If you see the following message then you probably don't have the right C++ libraries.
</p>
<pre> <pre>
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\apps\...\jacob.dll: This application has fa Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\apps\...\jacob.dll: This application has fa
iled to start because the application configuration is incorrect. Reinstalling the application may fix this pr iled to start because the application configuration is incorrect. Reinstalling the application may fix this pr
@@ -162,6 +169,20 @@ This library supports several different command line options:
</td></tr> </td></tr>
<tr><td>&nbsp;&nbsp;&nbsp;</td><td valign="top">
<h4>com.jacob.includeAllClassesInROT</h4>
</td><td>
Acts as master switch for and &ltclass_name&gt.PutInROT.
This property determines if the (experimental) PutInROT property is even
checked. It was added in version 1.15 because the property check in
PutInROT brok applets because they are not allowed to check system properties
at run time. com.jacob.includeAllClassesInROT is checked at class initialization
which is allowed.
<p>The default value of this flag is <i>true</i> which matches all behvior
prior to 1.13 and the default behvior for 1.13 on</p>
<p>Setting this flag to false causes Jacob to check the and &ltclass_name&gt.PutInROT
property for every Jacob object that is created.</p>
</td></tr>
<tr><td>&nbsp;&nbsp;&nbsp;</td><td valign="top"> <tr><td>&nbsp;&nbsp;&nbsp;</td><td valign="top">
<h4>&ltclass_name&gt.PutInROT</h4> <h4>&ltclass_name&gt.PutInROT</h4>
</td><td> </td><td>

View File

@@ -49,6 +49,20 @@ public abstract class ROT {
protected static final boolean USE_AUTOMATIC_GARBAGE_COLLECTION = "true" protected static final boolean USE_AUTOMATIC_GARBAGE_COLLECTION = "true"
.equalsIgnoreCase(System.getProperty("com.jacob.autogc")); .equalsIgnoreCase(System.getProperty("com.jacob.autogc"));
/**
* If the code is ran from an applet that is called from javascript the Java
* Plugin does not give full permissions to the code and thus System
* properties cannot be accessed. They can be accessed at class
* initialization time.
*
* The default behavior is to include all classes in the ROT, setting a
* boolean here to indicate this prevents a call to System.getProperty as
* part of the general call flow.
*/
protected static final Boolean INCLUDE_ALL_CLASSES_IN_ROT = Boolean
.valueOf(System.getProperty("com.jacob.includeAllClassesInROT",
"true"));
/** /**
* Suffix added to class name to make up property name that determines if * Suffix added to class name to make up property name that determines if
* this object should be stored in the ROT. This 1.13 "feature" makes it * this object should be stored in the ROT. This 1.13 "feature" makes it
@@ -217,11 +231,15 @@ public abstract class ROT {
* @param o * @param o
*/ */
protected static void addObject(JacobObject o) { protected static void addObject(JacobObject o) {
// check the system property to see if this class is put in the ROT String shouldIncludeClassInROT = "true";
// the default value is "true" which simulates the old behavior // only call System.getProperty if we are not including all classes in
String shouldIncludeClassInROT = System.getProperty(o.getClass() // the ROT. This lets us run with standard Jacob behavior in Applets
.getName() // without the security exception raised by System.getProperty in the
+ PUT_IN_ROT_SUFFIX, "true"); // flow
if (!ROT.INCLUDE_ALL_CLASSES_IN_ROT) {
shouldIncludeClassInROT = System.getProperty(o.getClass().getName()
+ PUT_IN_ROT_SUFFIX, "true");
}
if (shouldIncludeClassInROT.equalsIgnoreCase("false")) { if (shouldIncludeClassInROT.equalsIgnoreCase("false")) {
if (JacobObject.isDebugEnabled()) { if (JacobObject.isDebugEnabled()) {
JacobObject.debug("JacobObject: New instance of " JacobObject.debug("JacobObject: New instance of "