From b121ba32fcbec6aca0caa05f1283d0fb317f92fb Mon Sep 17 00:00:00 2001 From: David McKnight Date: Mon, 18 Aug 2008 12:52:53 +0000 Subject: [PATCH] [233160] [dstore] SSL/non-SSL alert are not appropriate --- .../dstore/DStoreConnectorService.java | 51 +++++++++++++++---- .../ui/operations/SystemFetchOperation.java | 11 ++-- 2 files changed, 47 insertions(+), 15 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 f13b391e39a..fc8f5091799 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 @@ -33,6 +33,7 @@ * David McKnight (IBM) - [228334][api][breaking][dstore] Default DataStore connection timeout is too short * David McKnight (IBM) - [235756] [dstore] Unable to connect to host with SSL via REXEC * David McKnight (IBM) - [244116] [dstore][daemon][ssl] Connecting to RSE server doesn't complete when the connection is SSL + * David McKnight (IBM) - [233160] [dstore] SSL/non-SSL alert are not appropriate *******************************************************************************/ package org.eclipse.rse.connectorservice.dstore; @@ -530,6 +531,7 @@ public class DStoreConnectorService extends StandardConnectorService implements } _isConnecting = true; + boolean alertedNONSSL = false; // set A_PLUGIN_PATH so that dstore picks up the property setPluginPathProperty(); @@ -697,7 +699,32 @@ public class DStoreConnectorService extends StandardConnectorService implements if (setSSLProperties(false)) { usedSSL = false; - launchStatus = launchServer(clientConnection, info, daemonPort, monitor, timeout); + + boolean allowNonSSL = true; + // warning before launch without SSL + IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore(); + if (store.getBoolean(ISystemPreferencesConstants.ALERT_NONSSL)) + { + String cmsg = NLS.bind(ConnectorServiceResources.MSG_COMM_NOT_USING_SSL, getHostName()); + msg = createSystemMessage(IConnectorServiceMessageIds.MSG_COMM_NOT_USING_SSL, IStatus.INFO, cmsg); + + DisplayHidableSystemMessageAction msgAction = new DisplayHidableSystemMessageAction(msg, store, ISystemPreferencesConstants.ALERT_NONSSL); + Display.getDefault().syncExec(msgAction); + if (msgAction.getReturnCode() != IDialogConstants.YES_ID){ + allowNonSSL = false; + } else { + alertedNONSSL = true; + } + } + if (allowNonSSL){ + launchStatus = launchServer(clientConnection, info, daemonPort, monitor, timeout); + } + else { + _isConnecting = false; + clientConnection = null; + + throw new OperationCanceledException(); + } } } @@ -896,16 +923,18 @@ public class DStoreConnectorService extends StandardConnectorService implements } else if (!clientConnection.getDataStore().usingSSL() && store.getBoolean(ISystemPreferencesConstants.ALERT_NONSSL)) { - String cmsg = NLS.bind(ConnectorServiceResources.MSG_COMM_NOT_USING_SSL, getHostName()); - msg = createSystemMessage(IConnectorServiceMessageIds.MSG_COMM_NOT_USING_SSL, IStatus.INFO, cmsg); - - DisplayHidableSystemMessageAction msgAction = new DisplayHidableSystemMessageAction(msg, store, ISystemPreferencesConstants.ALERT_NONSSL); - Display.getDefault().syncExec(msgAction); - if (msgAction.getReturnCode() != IDialogConstants.YES_ID) - { - internalDisconnect(monitor); - _isConnecting = false; - throw new InterruptedException(); + if (!alertedNONSSL){ // only alert if we haven't already + String cmsg = NLS.bind(ConnectorServiceResources.MSG_COMM_NOT_USING_SSL, getHostName()); + msg = createSystemMessage(IConnectorServiceMessageIds.MSG_COMM_NOT_USING_SSL, IStatus.INFO, cmsg); + + DisplayHidableSystemMessageAction msgAction = new DisplayHidableSystemMessageAction(msg, store, ISystemPreferencesConstants.ALERT_NONSSL); + Display.getDefault().syncExec(msgAction); + if (msgAction.getReturnCode() != IDialogConstants.YES_ID) + { + internalDisconnect(monitor); + _isConnecting = false; + throw new InterruptedException(); + } } } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java index 27997e20fed..352b63f3c49 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java @@ -20,6 +20,8 @@ * David McKnight (IBM) - [231964] [ssh] SSH login dialog appears twice after cancel, when doing Refresh on a node * David McKnight (IBM) - [235164] SystemView should allow to create filter in disconnected mode * David McKnight (IBM) - [239368] Expand to action ignores the filter string + * David McKnight (IBM) - [244270] Explicit check for isOffline and just returning block implementing a cache for Work Offline + * David McKnight (IBM) - [233160] [dstore] SSL/non-SSL alert are not appropriate *******************************************************************************/ package org.eclipse.rse.ui.operations; @@ -245,9 +247,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW { ss = (SubSystem)_adapter.getSubSystem(_remoteObject); } - if (ss.isOffline() ){ - return; - } + boolean isPromptable = false; @@ -260,7 +260,8 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW synchronized (ss.getConnectorService()) { - if (!ss.isConnected() && !isPromptable) + if (!ss.isConnected() && !isPromptable && + !ss.isOffline()) // skip the connect if offline, but still follow through because we need to follow through in the subsystem { Display dis = Display.getDefault(); @@ -283,10 +284,12 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW catch (InvocationTargetException exc) { showOperationErrorMessage(null, exc, ss); + return; } catch (Exception e) { showOperationErrorMessage(null, e, ss); + return; } dis.asyncExec(new UpdateRegistry(ss));