mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 14:02:22 +00:00
fixed a bug in handling svn+ssh
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5680 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
a1898d8bc0
commit
edf866af36
1 file changed
+20
-8
@@ -889,16 +889,20 @@ public class SubversionSCM extends SCM implements Serializable {
|
||||
public SVNAuthentication requestClientAuthentication(String kind, SVNURL url, String realm, SVNErrorMessage errorMessage, SVNAuthentication previousAuth, boolean authMayBeStored) {
|
||||
Credential cred = source.getCredential(realm);
|
||||
LOGGER.fine(String.format("requestClientAuthentication(%s,%s,%s)=>%s",kind,url,realm,cred));
|
||||
if(cred==null) {
|
||||
// this happens with file:// URL. The base class does this, too.
|
||||
if (ISVNAuthenticationManager.USERNAME.equals(kind))
|
||||
// user auth shouldn't be null.
|
||||
return new SVNUserNameAuthentication("",false);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return cred.createSVNAuthentication(kind);
|
||||
SVNAuthentication auth=null;
|
||||
if(cred!=null)
|
||||
auth = cred.createSVNAuthentication(kind);
|
||||
|
||||
if(auth==null && ISVNAuthenticationManager.USERNAME.equals(kind)) {
|
||||
// this happens with file:// URL and svn+ssh (in this case this method gets invoked twice.)
|
||||
// The base class does this, too.
|
||||
// user auth shouldn't be null.
|
||||
return new SVNUserNameAuthentication("",false);
|
||||
}
|
||||
|
||||
return auth;
|
||||
} catch (SVNException e) {
|
||||
logger.log(Level.SEVERE, "Failed to authorize",e);
|
||||
throw new RuntimeException("Failed to authorize",e);
|
||||
@@ -987,6 +991,14 @@ public class SubversionSCM extends SCM implements Serializable {
|
||||
|
||||
@Override
|
||||
public SVNAuthentication getFirstAuthentication(String kind, String realm, SVNURL url) throws SVNException {
|
||||
if(kind.equals(ISVNAuthenticationManager.USERNAME))
|
||||
// when using svn+ssh, svnkit first asks for ISVNAuthenticationManager.SSH
|
||||
// authentication to connect via SSH, then calls this method one more time
|
||||
// to get the user name. Perhaps svn takes user name on its own, separate
|
||||
// from OS user name? In any case, we need to return the same user name.
|
||||
// I don't set the cred field here, so that the 1st credential for ssh
|
||||
// won't get clobbered.
|
||||
return new SVNUserNameAuthentication(username,false);
|
||||
if(kind.equals(ISVNAuthenticationManager.PASSWORD))
|
||||
cred = new PasswordCredential(username,password);
|
||||
if(kind.equals(ISVNAuthenticationManager.SSH)) {
|
||||
|
||||
Reference in new issue
Block a user