summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2006-10-31 11:06:17 -0800
committerRobey Pointer <robey@lag.net>2006-10-31 11:06:17 -0800
commit4628a53acffa07af2a2d1b34fac83e196211c5fe (patch)
tree40602d822db8cd1c8edbcb01a98101ef844a83e4
parentf076c51d4e0fad84be29b10f8ae977451347cb07 (diff)
[project @ robey@lag.net-20061031190617-1113fb493ff5b690]
(bug 69330) in SFTPClient._auth, check for the existence of the rsa/dsa keys before trying to open them, so that an I/O exception doesn't mask an earlier one.
-rw-r--r--paramiko/client.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/paramiko/client.py b/paramiko/client.py
index a0a316f4..c13105e9 100644
--- a/paramiko/client.py
+++ b/paramiko/client.py
@@ -374,8 +374,14 @@ class SSHClient (object):
except SSHException, e:
saved_exception = e
- for pkey_class, filename in ((RSAKey, 'id_rsa'),
- (DSSKey, 'id_dsa')):
+ keyfiles = []
+ rsa_key = os.path.expanduser('~/.ssh/id_rsa')
+ dsa_key = os.path.expanduser('~/.ssh/is_dsa')
+ if os.path.isfile(rsa_key):
+ keyfiles.append((RSAKey, rsa_key))
+ if os.path.isfile(dsa_key):
+ keyfiles.append((DSSKey, dss_key))
+ for pkey_class, filename in keyfiles:
filename = os.path.expanduser('~/.ssh/' + filename)
try:
key = pkey_class.from_private_key_file(filename, password)