(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.
This commit is contained in:
Robey Pointer 2006-10-31 11:06:17 -08:00
parent f076c51d4e
commit 4628a53acf
1 changed files with 8 additions and 2 deletions

View File

@ -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)