From 99bec6c1fac08f243904b36669dd64b1b6b6d0db Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 15 May 2008 18:34:45 +0000 Subject: [PATCH] added support for PuTTY key format git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9266 71c3de6d-444a-0410-be80-ed276b4c234a --- core/pom.xml | 5 +++++ core/src/main/java/hudson/scm/SubversionSCM.java | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 1e9e8708a3..bcbc1742b6 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -268,6 +268,11 @@ svnkit 1.1.6-hudson-3 + + org.kohsuke + trilead-putty-extension + 1.0 + ${groupId} maven-agent diff --git a/core/src/main/java/hudson/scm/SubversionSCM.java b/core/src/main/java/hudson/scm/SubversionSCM.java index fb77adf67a..fa87f81ebf 100644 --- a/core/src/main/java/hudson/scm/SubversionSCM.java +++ b/core/src/main/java/hudson/scm/SubversionSCM.java @@ -30,6 +30,7 @@ import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Chmod; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.putty.PuTTYKey; import org.tmatesoft.svn.core.SVNDirEntry; import org.tmatesoft.svn.core.SVNErrorCode; import org.tmatesoft.svn.core.SVNErrorMessage; @@ -1049,12 +1050,18 @@ public class SubversionSCM extends SCM implements Serializable { } else { item = parser.getFileItem(kind.equals("publickey")?"privateKey":"certificate"); keyFile = File.createTempFile("hudson","key"); - if(item!=null) + if(item!=null) { try { item.write(keyFile); } catch (Exception e) { throw new IOException2(e); } + if(PuTTYKey.isPuTTYKeyFile(keyFile)) { + // TODO: we need a passphrase support + LOGGER.info("Converting "+keyFile+" from PuTTY format to OpenSSH format"); + new PuTTYKey(keyFile,null).toOpenSSH(keyFile); + } + } } SVNRepository repository = null; -- GitLab