From 0590f6e4b095b27ac6edeeb3e800f65ae2a7d1e7 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Tue, 1 Aug 2006 15:45:34 +0000 Subject: [PATCH] support case where daemon and server use differnet keystores --- .../dstore/DStoreConnectorService.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java b/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java index c271f4a74c1..d19a67165c4 100644 --- a/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java +++ b/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java @@ -22,6 +22,7 @@ import java.security.cert.X509Certificate; import java.util.List; import java.util.Vector; +import javax.net.ssl.SSLException; import javax.net.ssl.SSLHandshakeException; import org.eclipse.core.runtime.FileLocator; @@ -638,12 +639,34 @@ public class DStoreConnectorService extends AbstractConnectorService implements } // connect to launched server connectStatus = clientConnection.connect(launchStatus.getTicket(), timeout); - + Throwable conE = connectStatus.getException(); if (!connectStatus.isConnected() && (connectStatus.getMessage().startsWith(ClientConnection.CANNOT_CONNECT) || - connectStatus.getException() instanceof SSLHandshakeException) + conE instanceof SSLException + ) ) { + if (conE instanceof SSLHandshakeException) + { + List certs = connectStatus.getUntrustedCertificates(); + if (certs != null && certs.size() > 0) + { + ISystemKeystoreProvider provider = SystemKeystoreProviderManager.getInstance().getDefaultProvider(); + if (provider != null) + { + if (provider.importCertificates(certs, getHostName())) + { + connect(monitor); + return; + } + else + { + throw new InterruptedException(); + } + } + } + + } launchStatus = launchServer(clientConnection, info, daemonPort, monitor); if (!launchStatus.isConnected()) {