+ * A PasswordPersistenceManager is sensitive to the "rse.enableSecureStoreAccess" property.
+ * If absent it defaults to true
.
+ * If present then the value must be true
to enable access to the secure store.
+ * The following code disables access to the secure store.
+ *
+ * System.setProperty("rse.enableSecureStoreAccess", "false");
*
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients. Use
@@ -382,7 +390,8 @@ public class PasswordPersistenceManager {
/**
* Returns the preferences node that matches the system type.
- * It will not return null but will create the node if it does not exist.
+ * It will only return null if secure store access is disallowed.
+ * If secure store access is allowed it will create the node if it does not exist.
* If the node does not previous exist then an attempt will be made
* to migrate the values from the old map form to this newly created node
* of the secure preferences tree.
@@ -390,14 +399,17 @@ public class PasswordPersistenceManager {
* @return the matching secure preferences node.
*/
private ISecurePreferences getNode(IRSESystemType systemType) {
- String id = systemType.getId();
- ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
- ISecurePreferences rseNode = preferences.node("org.eclipse.rse.core.security"); //$NON-NLS-1$
ISecurePreferences systemTypeNode = null;
- if (!rseNode.nodeExists(id)) {
- migrateMap(rseNode, id);
+ String enableSecureStoreAccess = System.getProperty("rse.enableSecureStoreAccess", "true"); //$NON-NLS-1$//$NON-NLS-2$
+ if (enableSecureStoreAccess.equals("true")) { //$NON-NLS-1$
+ String id = systemType.getId();
+ ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
+ ISecurePreferences rseNode = preferences.node("org.eclipse.rse.core.security"); //$NON-NLS-1$
+ if (!rseNode.nodeExists(id)) {
+ migrateMap(rseNode, id);
+ }
+ systemTypeNode = rseNode.node(id);
}
- systemTypeNode = rseNode.node(id);
return systemTypeNode;
}
@@ -473,20 +485,24 @@ public class PasswordPersistenceManager {
* @return the number of passwords removed.
*/
private int removePassword(IRSESystemType systemType, String hostName, String userId) {
+ int result = 0;
ISecurePreferences passwords = getNode(systemType);
- boolean respectCase = isUserIDCaseSensitive(systemType);
- String keys[] = getMatchingKeys(passwords.keys(), hostName, userId, respectCase, false);
- if (keys.length == 0) {
- keys = getMatchingKeys(passwords.keys(), hostName, userId, respectCase, true);
+ if (passwords != null) {
+ boolean respectCase = isUserIDCaseSensitive(systemType);
+ String keys[] = getMatchingKeys(passwords.keys(), hostName, userId, respectCase, false);
+ if (keys.length == 0) {
+ keys = getMatchingKeys(passwords.keys(), hostName, userId, respectCase, true);
+ }
+ for (int i = 0; i < keys.length; i++) {
+ String key = keys[i];
+ basicRemove(passwords, key);
+ }
+ if (keys.length > 0) {
+ basicSave(passwords);
+ }
+ result = keys.length;
}
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- basicRemove(passwords, key);
- }
- if (keys.length > 0) {
- basicSave(passwords);
- }
- return keys.length;
+ return result;
}
/**
@@ -502,14 +518,16 @@ public class PasswordPersistenceManager {
private String findPassword(IRSESystemType systemType, String hostName, String userId) {
String password = null;
ISecurePreferences passwords = getNode(systemType);
- boolean respectCase = isUserIDCaseSensitive(systemType);
- String keys[] = getMatchingKeys(passwords.keys(), hostName, userId, respectCase, false);
- if (keys.length == 0) {
- keys = getMatchingKeys(passwords.keys(), hostName, userId, respectCase, true);
- }
- if (keys.length > 0) {
- String key = keys[0];
- password = basicGet(passwords, key);
+ if (passwords != null) {
+ boolean respectCase = isUserIDCaseSensitive(systemType);
+ String keys[] = getMatchingKeys(passwords.keys(), hostName, userId, respectCase, false);
+ if (keys.length == 0) {
+ keys = getMatchingKeys(passwords.keys(), hostName, userId, respectCase, true);
+ }
+ if (keys.length > 0) {
+ String key = keys[0];
+ password = basicGet(passwords, key);
+ }
}
return password;
}
@@ -522,12 +540,18 @@ public class PasswordPersistenceManager {
* @param hostName the name of the host we are examining for a password.
* @param userId the user id to find passwords for.
* @param password the password to save for this entry.
+ * @return RC_OK if the password was updated, RC_DENIED if the password was not updated.
*/
- private void updatePassword(IRSESystemType systemType, String hostName, String userId, String password) {
+ private int updatePassword(IRSESystemType systemType, String hostName, String userId, String password) {
+ int result = RC_DENIED;
ISecurePreferences passwords = getNode(systemType);
- String key = getKey(hostName, userId);
- basicPut(passwords, key, password);
- basicSave(passwords);
+ if (passwords != null) {
+ String key = getKey(hostName, userId);
+ basicPut(passwords, key, password);
+ basicSave(passwords);
+ result = RC_OK;
+ }
+ return result;
}
/**
@@ -551,8 +575,9 @@ public class PasswordPersistenceManager {
* @param info The signon information to store
* @param overwrite Whether to overwrite any existing entry
* @return
- * RC_OK if the password was successfully stored
- * RC_ALREADY_EXISTS if the password already exists and overwrite was false
+ * RC_OK if the password was successfully stored
+ * RC_ALREADY_EXISTS if the password already exists and overwrite was false
+ * RC_DENIED if passwords may not be saved for this system type and host
*/
public int add(SystemSignonInformation info, boolean overwrite) {
return add(info, overwrite, false);
@@ -587,7 +612,7 @@ public class PasswordPersistenceManager {
}
String oldPassword = findPassword(systemType, hostName, userId);
if (oldPassword == null || (overwrite && !newPassword.equals(oldPassword))) {
- updatePassword(systemType, hostName, userId, newPassword);
+ result = updatePassword(systemType, hostName, userId, newPassword);
} else if (oldPassword != null) {
result = RC_ALREADY_EXISTS;
}
@@ -629,7 +654,7 @@ public class PasswordPersistenceManager {
* @param systemType the IRSESystemType instance to find a password for.
* @param hostName the name of the host we are examining for a password.
* @param userId the user id to find passwords for.
- * @return the {@link SystemSignonInformation} for the specified criteria.
+ * @return the {@link SystemSignonInformation} for the specified criteria or null if no such password can be found.
*/
public SystemSignonInformation find(IRSESystemType systemType, String hostName, String userId) {
return find(systemType, hostName, userId, true);
@@ -644,7 +669,7 @@ public class PasswordPersistenceManager {
* @param hostName the name of the host we are examining for a password.
* @param userId the user id to find passwords for.
* @param checkDefault true if the default system type should be checked if the specified system type is not found
- * @return the {@link SystemSignonInformation} for the specified criteria.
+ * @return the {@link SystemSignonInformation} for the specified criteria or null if no such password can be found.
*/
public SystemSignonInformation find(IRSESystemType systemType, String hostName, String userId, boolean checkDefault) {
SystemSignonInformation result = null;
@@ -729,13 +754,15 @@ public class PasswordPersistenceManager {
for (int i = 0; i < systemTypes.length; i++) {
IRSESystemType systemType = systemTypes[i];
ISecurePreferences node = getNode(systemType);
- String[] keys = node.keys();
- for (int j = 0; j < keys.length; j++) {
- String key = keys[j];
- String hostName = getHostNameFromKey(key);
- String userId = getUserIdFromKey(key);
- SystemSignonInformation info = new SystemSignonInformation(hostName, userId, systemType);
- savedUserIDs.add(info);
+ if (node != null) {
+ String[] keys = node.keys();
+ for (int j = 0; j < keys.length; j++) {
+ String key = keys[j];
+ String hostName = getHostNameFromKey(key);
+ String userId = getUserIdFromKey(key);
+ SystemSignonInformation info = new SystemSignonInformation(hostName, userId, systemType);
+ savedUserIDs.add(info);
+ }
}
}
return savedUserIDs;
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java
index bf736666085..6c755f45961 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2007, 2012 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -12,6 +12,7 @@
* David Dykstal (IBM) - [210474] Deny save password function missing
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
* David McKnight (IBM) [323648] SSH Terminals subsystem should re-use user id and password for the Files subsystem
+ * David McKnight (IBM) [398234] Connect from host doesn't always propagate id/password to multiple contained connector services
********************************************************************************/
package org.eclipse.rse.core.subsystems;
@@ -122,14 +123,34 @@ public abstract class AuthenticatingConnectorService extends AbstractConnectorSe
* @see org.eclipse.rse.core.subsystems.IConnectorService#setPassword(java.lang.String, java.lang.String, boolean, boolean)
*/
public final void setPassword(String userId, String password, boolean persist, boolean propagate) {
- if (getPrimarySubSystem().forceUserIdToUpperCase()) {
+ ISubSystem ss = getPrimarySubSystem();
+ if (ss.forceUserIdToUpperCase()) {
userId = userId.toUpperCase();
}
+
String myUserId = credentialsProvider.getUserId();
+
IHost host = getHost();
if (host.compareUserIds(userId, myUserId)) {
credentialsProvider.setPassword(password);
}
+ else {
+ String hostName = host.getHostName();
+ SystemSignonInformation existingSignon = null;
+ // check if there are any uid credentials saved here - if not, then use the new userID/password
+ List signonsWithIDs = PasswordPersistenceManager.getInstance().getSavedUserIDs();
+ for (int i = 0 ; i < signonsWithIDs.size() && existingSignon != null; i++){
+ SystemSignonInformation signon = (SystemSignonInformation)signonsWithIDs.get(i);
+ if (hostName.equals(signon.getHostname())){
+ existingSignon = signon;
+ }
+ }
+ if (existingSignon == null){
+ // update with propagated id/password
+ credentialsProvider.setUserId(userId);
+ credentialsProvider.setPassword(password);
+ }
+ }
if (sharesCredentials() && propagate) {
updatePasswordForOtherSystemsInConnection(userId, password, persist);
}
diff --git a/rse/plugins/org.eclipse.rse.ui/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.ui/META-INF/MANIFEST.MF
index 25bfe4e4cbc..9cf142dfd21 100644
--- a/rse/plugins/org.eclipse.rse.ui/META-INF/MANIFEST.MF
+++ b/rse/plugins/org.eclipse.rse.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.rse.ui;singleton:=true
-Bundle-Version: 3.3.2.qualifier
+Bundle-Version: 3.3.3.qualifier
Bundle-Activator: org.eclipse.rse.ui.RSEUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewSorter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewSorter.java
index 0e4d58e3fc1..a2c1045d715 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewSorter.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewSorter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2011 IBM Corporation and others.
+ * Copyright (c) 2002, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,13 +15,16 @@
* David McKnight (IBM) - [331986] Sort in Remote System Details view shows wrong results
* David McKnight (IBM) - [355467] The result of sorting resources that contains null blank cells is not correct in Remote System Details view.
* David McKnight (IBM) - [357587] Custom sorter is changed to SystemTableViewSorter
+ * David McKnight (IBM) - [398306] table sorting of RSE table views inconsistent with Eclipse
*******************************************************************************/
package org.eclipse.rse.internal.ui.view;
+import java.util.Comparator;
import java.util.Date;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.util.Policy;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
@@ -44,14 +47,16 @@ public class SystemTableViewSorter extends ViewerSorter
private StructuredViewer _view;
private SystemTableViewColumnManager _columnManager;
+ private Comparator _comparator;
public SystemTableViewSorter(int columnNumber, StructuredViewer view, SystemTableViewColumnManager columnManager)
{
super();
- _reverseSort = false;
+ _reverseSort = true; // reverse sort means ascending order
_columnNumber = columnNumber;
_view = view;
_columnManager = columnManager;
+ _comparator = Policy.getComparator();
}
public void setColumnNumber(int columnNumber){
@@ -112,12 +117,7 @@ public class SystemTableViewSorter extends ViewerSorter
return 1;
}
-
- if (n1 instanceof String)
- {
- return ((String) n1).compareTo((String) n2);
- }
- else if (n1 instanceof Date)
+ if (n1 instanceof Date)
{
return ((Date) n1).compareTo((Date) n2);
}
@@ -131,7 +131,7 @@ public class SystemTableViewSorter extends ViewerSorter
}
else
{
- return collator.compare(n1, n2);
+ return _comparator.compare(n1, n2);
}
}
catch (Exception e)
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java
index 546adad6cec..0c1a00cbb7b 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2002, 2013 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -17,6 +17,7 @@
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
* David McKnight (IBM) - [234924] [ftp][dnd][Refresh] Copy/Paste file from Package Explorer doesn't refresh folder
* David McKnight (IBM) - [248339] [dnd][encodings] Cannot drag&drop / copy&paste files or folders with turkish or arabic names
+ * David McKnight (IBM) - [398324] cross systems folder transfer breaks due to scoping rule
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -243,57 +244,7 @@ extends ViewerDropAdapter
target = getViewer().getInput();
}
- List rulesList = new ArrayList();
- int j = 0;
- for (int i = 0; i < srcObjects.size(); i++)
- {
- if (srcObjects.get(i) instanceof ISchedulingRule)
- {
- rulesList.add(srcObjects.get(i));
- j++;
- }
- /** FIXME - can't be coupled with IRemoteFile
- else if (srcObjects.get(i) instanceof IRemoteFile)
- {
- rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)srcObjects.get(i)));
- j++;
- }
- */
- }
- /*
- if (target instanceof ISchedulingRule)
- {
- rulesList.add(target);
- j++;
- }
- */
- /** FIXME - can't be coupled with IRemoteFile
- else if (target instanceof IRemoteFile)
- {
- rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)target));
- }
-
- else if (target instanceof IAdaptable)
- {
- ISystemDragDropAdapter targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
-
- if (targetAdapter != null)
- {
- ISubSystem targetSubSystem = targetAdapter.getSubSystem(target);
- rulesList.add(targetSubSystem);
- j++;
- }
- }
- */
- MultiRule rule = null;
- ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]);
-
- if (j > 0) rule = new MultiRule(rules);
-
- SystemDNDTransferRunnable runnable = new SystemDNDTransferRunnable(target, srcObjects, getViewer(), _sourceType);
- // DKM - rules are causing problems at the moment
- runnable.setRule(rule);
-
+ SystemDNDTransferRunnable runnable = new SystemDNDTransferRunnable(target, srcObjects, getViewer(), _sourceType);
if (target instanceof SystemScratchpad)
{
runnable.run(new NullProgressMonitor());
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java
index 9abd8da1926..6dfa835065e 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2011 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2002, 2013 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -16,6 +16,7 @@
* Kenya Ishimoto (IBM) - [241197] Paste action causes IllegalArgumentException at Resource.copy
* Zhou Renjian (Kortide) - [282241] "Paste" is enabled on file system when text is in clipboard
* David McKnight (IBM) - [330398] RSE leaks SWT resources
+ * David McKnight (IBM) - [398324] cross systems folder transfer breaks due to scoping rule
********************************************************************************/
package org.eclipse.rse.ui.actions;
@@ -101,35 +102,6 @@ public class SystemPasteFromClipboardAction extends SystemBaseAction implements
{
// do the transfer
SystemDNDTransferRunnable runnable = new SystemDNDTransferRunnable(target, (ArrayList)srcObjects, getViewer(), _srcType);
- if (target instanceof IAdaptable)
- {
- ISystemDragDropAdapter targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
-
- if (targetAdapter != null)
- {
- List rulesList = new ArrayList();
-
- if (target instanceof ISchedulingRule) {
- rulesList.add(target);
- }
-
- int j = 0;
- for (int i = 0; i < srcObjects.size(); i++)
- {
- if (srcObjects.get(i) instanceof ISchedulingRule)
- {
- rulesList.add(srcObjects.get(i));
- j++;
- }
- }
- if (rulesList.size() > 0)
- {
- ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]);
- MultiRule rule = new MultiRule(rules);
- runnable.setRule(rule);
- }
- }
- }
runnable.schedule();
RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext();
}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java
index 0b8211e1e6f..6878c7fdbf9 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2012 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2002, 2013 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -32,6 +32,7 @@
* David McKnight (IBM) - [357587] Custom sorter is changed to SystemTableViewSorter
* David McKnight (IBM) - [363392] system table views shows open view actions when they shouldn't
* David McKnight (IBM) - [388947] column sort icon issue with Remote Systems Details view
+ * David McKnight (IBM) - [398306] table sorting of RSE table views inconsistent with Eclipse
********************************************************************************/
package org.eclipse.rse.ui.view;
@@ -206,6 +207,7 @@ public class SystemTableView
{
_upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID);
_downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID);
+
}
@@ -230,19 +232,19 @@ public class SystemTableView
if (oldSorter != null)
{
if (column == oldSorter.getColumnNumber()){
- oldSorter.setReversed(!oldSorter.isReversed());
- if (tcolumn.getImage() == _upI)
- {
- tcolumn.setImage(_downI);
+ boolean isReversed = !oldSorter.isReversed();
+ oldSorter.setReversed(isReversed);
+ if (isReversed) {
+ tcolumn.setImage(_downI);
}
- else
- {
- tcolumn.setImage(_upI);
+ else {
+ tcolumn.setImage(_upI);
}
}
else {
oldSorter.setColumnNumber(column);
- tcolumn.setImage(_downI);
+ oldSorter.setReversed(false);
+ tcolumn.setImage(_upI);
}
}
else
diff --git a/rse/plugins/org.eclipse.rse.ui/pom.xml b/rse/plugins/org.eclipse.rse.ui/pom.xml
index 21865fcc69d..26ee60a6642 100644
--- a/rse/plugins/org.eclipse.rse.ui/pom.xml
+++ b/rse/plugins/org.eclipse.rse.ui/pom.xml
@@ -10,6 +10,6 @@