Skip to content
Permalink
Browse files

JENKINS-3133 - Allowing custom port on CVS Root (plus improving

validation of CVS Root value)
  • Loading branch information
mc1arke committed Jan 2, 2012
1 parent ce115fb commit 4945e9acf03d41863feddc55f452526b878a3cf5
Showing with 6 additions and 12 deletions.
  1. +6 −12 src/main/java/hudson/scm/CVSSCM.java
@@ -907,8 +907,8 @@ public DescriptorImpl getDescriptor() {
private transient Map<String, RepositoryBrowser> browsers;
// end legacy fields

private static final Pattern CVSROOT_PSERVER_PATTERN =
Pattern.compile(":(ext|extssh|pserver)(;[^:]+)?:[^@^:]+(:[^@]*)?@[^:]+:(\\d+:)?.+");
//private static final Pattern CVSROOT_PSERVER_PATTERN =
// Pattern.compile("^:(ext|extssh|pserver)(;[^:]+)?:([^@^:]+(:[^@^:]*)?@)?[^:]+:([0-9]+:)?(\\d+:)?.+$");

/**
* CVS compression level if individual repositories don't specifically
@@ -1063,16 +1063,10 @@ public FormValidation doCheckCvsRoot(@QueryParameter String value) throws IOExce
return FormValidation.error(Messages.CVSSCM_MissingCvsroot());
}

Matcher m = CVSROOT_PSERVER_PATTERN.matcher(v);

// CVSROOT format isn't really that well defined. So it's hard to check this rigorously.
if(v.startsWith(":pserver") || v.startsWith(":ext")) {
if(!m.matches()) {
return FormValidation.error(Messages.CVSSCM_InvalidCvsroot());
}
// I can't really test if the machine name exists, either.
// some cvs, such as SOCKS-enabled cvs can resolve host names that Jenkins might not
// be able to. If :ext is used, all bets are off anyway.
try {
CVSRoot.parse(v);
} catch(IllegalArgumentException ex) {
return FormValidation.error(Messages.CVSSCM_InvalidCvsroot());
}


0 comments on commit 4945e9a

Please sign in to comment.
You can’t perform that action at this time.