Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeerthi Vasan2011-12-16 12:51:31 +0000
committerTomasz Zarna2011-12-16 12:51:31 +0000
commit4d359c6f870e5c11891c413250a93caaaec7f1e6 (patch)
treed015d11637a30dc176b5fc63faf71f63f0183198
parentc41fe53080c07b2587def394f8d21cf56ccba8c1 (diff)
downloadeclipse.platform.team-4d359c6f870e5c11891c413250a93caaaec7f1e6.tar.gz
eclipse.platform.team-4d359c6f870e5c11891c413250a93caaaec7f1e6.tar.xz
eclipse.platform.team-4d359c6f870e5c11891c413250a93caaaec7f1e6.zip
bug 205251: CVS username disallows full kerberos names
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java5
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java32
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/ResourceSyncInfoTest.java3
5 files changed, 34 insertions, 14 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index 1a41c81fe..be80b0b3e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -311,8 +311,8 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
// Get the user name and password (if provided)
errorMessage = CVSMessages.CVSRepositoryLocation_parsingUser;
-
- end = location.indexOf(HOST_SEPARATOR, start);
+ //Since there is a @ sign in the user name so use lastIndexOf to get to the host separator @
+ end = location.lastIndexOf(HOST_SEPARATOR, location.length());
String user = null;
String password = null;
// if end is -1 then there is no host separator meaning that the username is not present
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java
index 8daa85681..8fa4c40e8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -125,7 +125,7 @@ public class FolderSyncInfo {
private String getRootDirectory() throws CVSException {
try {
String root = getRoot();
- int index = root.indexOf(CVSRepositoryLocation.HOST_SEPARATOR);
+ int index = root.lastIndexOf(CVSRepositoryLocation.HOST_SEPARATOR);
if (index == -1) {
// If the username is missing, we have to find the third ':'.
index = root.indexOf(CVSRepositoryLocation.COLON);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
index c28d9d468..dab83dbce 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -570,7 +570,8 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
if (user.length() == 0) {
return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, CVSUIMessages.ConfigurationWizardMainPage_1, null);
}
- if ((user.indexOf('@') != -1) || (user.indexOf(':') != -1)) {
+ // removed the @ sign check since, so the UI can allow full kerberos names
+ if (user.indexOf(':') != -1) {
return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
CVSUIMessages.ConfigurationWizardMainPage_invalidUserName, null);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java
index 72ccda809..0efde6e59 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -13,12 +13,27 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.StringTokenizer;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
+import org.eclipse.team.internal.ccvs.core.ICVSFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.tests.ccvs.core.*;
+import org.eclipse.team.tests.ccvs.core.CommandLineCVSClient;
+import org.eclipse.team.tests.ccvs.core.EclipseCVSClient;
+import org.eclipse.team.tests.ccvs.core.ICVSClient;
+import org.eclipse.team.tests.ccvs.core.JUnitTestCase;
/**
@@ -447,18 +462,21 @@ public final class SameResultEnv extends JUnitTestCase {
* when you insert ":pserver:nkrambro:password@fiji:/home/nkrambro/repo"
*/
public static String removePassword(String root) {
- StringTokenizer tok = new StringTokenizer(root, ":@", true);
+ int indexOfHostSeparator = root.lastIndexOf("@", root.length());
+ String hostAndPath = root.substring(indexOfHostSeparator);
+ root = root.substring(0, indexOfHostSeparator);
+ StringTokenizer tok = new StringTokenizer(root, ":", true);
StringBuffer filteredRoot = new StringBuffer();
int colonCounter = 3;
while (tok.hasMoreTokens()) {
String token = tok.nextToken();
- if ("@".equals(token)) colonCounter = -1;
if (":".equals(token)) {
if (--colonCounter == 0) continue; // skip colon
}
if (colonCounter == 0) continue; // skip password
filteredRoot.append(token);
}
+ filteredRoot.append(hostAndPath);
return filteredRoot.toString();
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/ResourceSyncInfoTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/ResourceSyncInfoTest.java
index d448da7b9..e239093a2 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/ResourceSyncInfoTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/ResourceSyncInfoTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -189,6 +189,7 @@ public class ResourceSyncInfoTest extends EclipseTest {
assertPathCorrect(CVSRepositoryLocation.fromString(":pserver:user@host/home/path"), "/home/path");
assertPathCorrect(CVSRepositoryLocation.fromString(":pserver:user:password@host/home/path"), "/home/path");
assertPathCorrect(CVSRepositoryLocation.fromString(":pserver:host/home/path"), "/home/path");
+ assertPathCorrect(CVSRepositoryLocation.fromString(":pserver:user@domain:password@host/home/path"), "/home/path");
}
private void assertPathCorrect(CVSRepositoryLocation location, String string) throws CVSException {

Back to the top