summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2008-04-28 18:02:33 -0400
committerBernard Normier <bernard@zeroc.com>2008-04-28 18:02:33 -0400
commit2c37c63aa859779a7291fd23fc5c7df9294e67f7 (patch)
treecabd45b2a55106493067fce993dd22f590d914d0 /java/src
parentAdded mcpp 2.7 patch (diff)
downloadice-2c37c63aa859779a7291fd23fc5c7df9294e67f7.tar.bz2
ice-2c37c63aa859779a7291fd23fc5c7df9294e67f7.tar.xz
ice-2c37c63aa859779a7291fd23fc5c7df9294e67f7.zip
Fixed SSL-related bugs
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Ice/PluginManagerI.java5
-rwxr-xr-xjava/src/IceGridGUI/Coordinator.java12
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/Root.java20
-rwxr-xr-xjava/src/IceGridGUI/Main.java22
-rwxr-xr-xjava/src/IceGridGUI/SessionKeeper.java89
5 files changed, 112 insertions, 36 deletions
diff --git a/java/src/Ice/PluginManagerI.java b/java/src/Ice/PluginManagerI.java
index bf7a7e75c1c..e97444bc412 100644
--- a/java/src/Ice/PluginManagerI.java
+++ b/java/src/Ice/PluginManagerI.java
@@ -205,6 +205,11 @@ public final class PluginManagerI implements PluginManager
name = name.substring(0, dotPos);
loadPlugin(name, entry.getValue(), cmdArgs, false);
p.remove();
+
+ //
+ // Don't want to load this one if it's there!
+ //
+ plugins.remove("Ice.Plugin." + name);
}
else
{
diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java
index 494f742effc..f915ee680c2 100755
--- a/java/src/IceGridGUI/Coordinator.java
+++ b/java/src/IceGridGUI/Coordinator.java
@@ -623,17 +623,7 @@ public class Coordinator
{
if(_communicator == null)
{
- try
- {
- _communicator = Ice.Util.initialize(_initData);
- }
- catch(Ice.LocalException e)
- {
- JOptionPane.showMessageDialog(null,
- e.toString(),
- "Communicator initialization failed",
- JOptionPane.ERROR_MESSAGE);
- }
+ _communicator = Ice.Util.initialize(_initData);
}
return _communicator;
}
diff --git a/java/src/IceGridGUI/LiveDeployment/Root.java b/java/src/IceGridGUI/LiveDeployment/Root.java
index be4557922ce..3eedf9032cf 100755
--- a/java/src/IceGridGUI/LiveDeployment/Root.java
+++ b/java/src/IceGridGUI/LiveDeployment/Root.java
@@ -37,7 +37,7 @@ public class Root extends ListArrayTreeNode
_coordinator = coordinator;
_childrenArray[0] = _slaves;
_childrenArray[1] = _nodes;
- _messageSizeMax = Ice.Util.getInstance(_coordinator.getCommunicator()).messageSizeMax();
+ _messageSizeMax = computeMessageSizeMax(_coordinator.getProperties().getPropertyAsInt("Ice.MessageSizeMax"));
_tree = new JTree(this, true);
_treeModel = (DefaultTreeModel)_tree.getModel();
@@ -1061,6 +1061,24 @@ public class Root extends ListArrayTreeNode
_treeModel.nodesWereRemoved(this, toRemoveIndices, toRemove.toArray());
}
}
+
+ public static int computeMessageSizeMax(int num)
+ {
+ if(num <= 0)
+ {
+ num = 1024;
+ }
+
+ if(num > 0x7fffffff / 1024)
+ {
+ return 0x7fffffff;
+ }
+ else
+ {
+ return num * 1024; // num is in kilobytes, returned value in bytes
+ }
+ }
+
private final Coordinator _coordinator;
private String _instanceName = "";
diff --git a/java/src/IceGridGUI/Main.java b/java/src/IceGridGUI/Main.java
index c92aa76799f..e951c8c64a2 100755
--- a/java/src/IceGridGUI/Main.java
+++ b/java/src/IceGridGUI/Main.java
@@ -15,6 +15,7 @@ import java.awt.event.WindowEvent;
import javax.swing.Icon;
import javax.swing.JFrame;
+import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
@@ -80,12 +81,21 @@ public class Main extends JFrame
{
System.err.println(e.toString());
}
-
- //
- // Create and set up the window.
- //
- new Main(args);
-
+
+ try
+ {
+ //
+ // Create and set up the window.
+ //
+ new Main(args);
+ }
+ catch(Ice.LocalException e)
+ {
+ JOptionPane.showMessageDialog(null,
+ e.toString(),
+ "Initialization failed",
+ JOptionPane.ERROR_MESSAGE);
+ }
}
private Coordinator _coordinator;
diff --git a/java/src/IceGridGUI/SessionKeeper.java b/java/src/IceGridGUI/SessionKeeper.java
index 1168731f2af..63e1fb9985d 100755
--- a/java/src/IceGridGUI/SessionKeeper.java
+++ b/java/src/IceGridGUI/SessionKeeper.java
@@ -354,17 +354,6 @@ class SessionKeeper
{
_connectionPrefs = connectionPrefs;
- String prop = System.getProperty("java.net.ssl.keyStorePassword");
- if(prop != null)
- {
- keystorePassword = prop.toCharArray();
- }
- prop = System.getProperty("java.net.ssl.trustStorePassword");
- if(prop != null)
- {
- truststorePassword = prop.toCharArray();
- }
-
Ice.Properties properties = coordinator.getProperties();
//
@@ -404,7 +393,6 @@ class SessionKeeper
_connectionPrefs.get("registry.endpoints", registryEndpoints);
}
connectToMaster = _connectionPrefs.getBoolean("registry.connectToMaster", connectToMaster);
-
//
// Glacier2 properties
@@ -470,14 +458,52 @@ class SessionKeeper
//
// SSL Configuration
//
+
+ final File defaultDir = new File(properties.getProperty("IceSSL.DefaultDir")).getAbsoluteFile();
+
keystore = properties.getPropertyWithDefault("IceSSL.Keystore",
- _connectionPrefs.get("keystore", keystore));
+ _connectionPrefs.get("keystore", keystore));
+
+ if(keystore != null && keystore.length() > 0)
+ {
+ if(new File(keystore).isAbsolute() == false)
+ {
+ keystore = new File(defaultDir, keystore).getAbsolutePath();
+ }
+ }
+
+ String prop = properties.getProperty("IceSSL.Password");
+ if(prop.length() > 0)
+ {
+ keyPassword = prop.toCharArray();
+ }
+
+ prop = properties.getPropertyWithDefault("IceSSL.KeystorePassword", System.getProperty("java.net.ssl.keyStorePassword"));
+
+ if(prop != null && prop.length() > 0)
+ {
+ keystorePassword = prop.toCharArray();
+ }
+ prop = properties.getPropertyWithDefault("IceSSL.TruststorePassword", System.getProperty("java.net.ssl.trustStorePassword"));
+ if(prop != null && prop.length() > 0)
+ {
+ truststorePassword = prop.toCharArray();
+ }
+
alias = properties.getPropertyWithDefault("IceSSL.Alias",
_connectionPrefs.get("alias", ""));
truststore = properties.getPropertyWithDefault("IceSSL.Truststore",
- _connectionPrefs.get("truststore", truststore));
+ _connectionPrefs.get("truststore", truststore));
+
+ if(truststore != null && truststore.length() > 0)
+ {
+ if(new File(truststore).isAbsolute() == false)
+ {
+ truststore = new File(defaultDir, truststore).getAbsolutePath();
+ }
+ }
}
void save()
@@ -536,6 +562,7 @@ class SessionKeeper
String alias;
String truststore = System.getProperty("java.net.ssl.trustStore");
char[] truststorePassword;
+
private Preferences _connectionPrefs;
}
@@ -546,7 +573,7 @@ class SessionKeeper
super(_coordinator.getMainFrame(), "Login - IceGrid Admin", true);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
- final File defaultDir = new java.io.File(_coordinator.getProperties().getProperty("IceSSL.DefaultDir"));
+ final File defaultDir = new File(_coordinator.getProperties().getProperty("IceSSL.DefaultDir")).getAbsoluteFile();
_keystoreType =
_coordinator.getProperties().getPropertyWithDefault("IceSSL.KeystoreType",
java.security.KeyStore.getDefaultType());
@@ -619,8 +646,8 @@ class SessionKeeper
_routerSSLEnabled = new JCheckBox(routerSSLEnabled);
- _keystore.setEditable(false);
- _advancedKeystore.setEditable(false);
+ _keystore.setEditable(true);
+ _advancedKeystore.setEditable(true);
Action chooseKeystore = new AbstractAction("...")
{
public void actionPerformed(ActionEvent e)
@@ -654,7 +681,7 @@ class SessionKeeper
private JFileChooser _fileChooser = new JFileChooser();
};
- _truststore.setEditable(false);
+ _truststore.setEditable(true);
Action chooseTruststore = new AbstractAction("...")
{
public void actionPerformed(ActionEvent e)
@@ -897,8 +924,23 @@ class SessionKeeper
{
updateAlias(new File(_loginInfo.keystore), _loginInfo.alias);
}
+
+ if(_loginInfo.keyPassword != null)
+ {
+ _keyPassword.setText(new String(_loginInfo.keyPassword));
+ }
+ if(_loginInfo.keystorePassword != null)
+ {
+ _keystorePassword.setText(new String(_loginInfo.keystorePassword));
+ }
+
_truststore.setText(_loginInfo.truststore);
+ if(_loginInfo.truststorePassword != null)
+ {
+ _truststorePassword.setText(new String(_loginInfo.truststorePassword));
+ }
+
if(_loginInfo.routed)
{
routedTabSelected();
@@ -936,7 +978,14 @@ class SessionKeeper
_loginInfo.routerInstanceName = _routerInstanceName.getText();
_loginInfo.routerEndpoints = _routerEndpoints.getText();
+ final File defaultDir = new File(_coordinator.getProperties().getProperty("IceSSL.DefaultDir")).getAbsoluteFile();
+
_loginInfo.keystore = _keystore.getText();
+ if(_loginInfo.keystore != null && _loginInfo.keystore.length() > 0 && new File(_loginInfo.keystore).isAbsolute() == false)
+ {
+ _loginInfo.keystore = new File(defaultDir, _loginInfo.keystore).getAbsolutePath();
+ }
+
_loginInfo.keyPassword = _keyPassword.getPassword();
_loginInfo.keystorePassword = _keystorePassword.getPassword();
if(_alias.getSelectedItem() == null)
@@ -948,6 +997,10 @@ class SessionKeeper
_loginInfo.alias = _alias.getSelectedItem().toString();
}
_loginInfo.truststore = _truststore.getText();
+ if(_loginInfo.truststore != null && _loginInfo.truststore.length() > 0 && new File(_loginInfo.truststore).isAbsolute() == false)
+ {
+ _loginInfo.truststore = new File(defaultDir, _loginInfo.truststore).getAbsolutePath();
+ }
_loginInfo.truststorePassword = _truststorePassword.getPassword();
}