Correctly honor IdentityFile from ~/.ssh/config
commitd0fd6f96b9311b972c6bffa8680544607d7e3c56
authorShawn O. Pearce <spearce@spearce.org>
Fri, 17 Apr 2009 16:36:42 +0000 (17 09:36 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 17 Apr 2009 23:13:51 +0000 (18 01:13 +0200)
tree67a89860afbecd8951fc4b33c60d53a244696d69
parentbcef396418f43c947198b022f5303911632be551
Correctly honor IdentityFile from ~/.ssh/config

JSch offers all identities available within the JSch object used to
create a Session.  In order to offer only a specific IdentityFile
to the remote server we must create a unique JSch with only that
one identity loaded.  However, we also want to cache the key once
it has been decrypted, so that repeated uses of a single file from
the same JVM do not cause repeated passphrase prompts.

The SshConfigSessionFactory now loads only the default SSH keys
(~/.ssh/identity for SSH1, ~/.ssh/{id_rsa,id_dsa} for SSH2) into
the default JSch.  If a Host block in ~/.ssh/config selects some
other IdentityFile then we create a unique JSch instance for the
key, and copy over the same known hosts table.

Fix issue 35 (Correctly honor IdentityFile in ~/.ssh/config)

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.egit.ui/src/org/spearce/egit/ui/EclipseSshSessionFactory.java
org.spearce.jgit/src/org/spearce/jgit/transport/SshConfigSessionFactory.java