Skip to content

Commit

Permalink
JENKINS-3133 - Allowing custom port on CVS Root (plus improving
Browse files Browse the repository at this point in the history
validation of CVS Root value)
  • Loading branch information
mc1arke committed Jan 2, 2012
1 parent ce115fb commit 4945e9a
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/main/java/hudson/scm/CVSSCM.java
Expand Up @@ -907,8 +907,8 @@ private class RepositoryBrowser {
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
Expand Down Expand Up @@ -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());
}


Expand Down

0 comments on commit 4945e9a

Please sign in to comment.