The branch, x2go has been updated via ddb4343318bc9190a25ca7489d9038901da18ce3 (commit) via 2fa1479d3f6b50a2cc1dd8821c934bebcd03a466 (commit) from 578f2988212d939a43e2f434892e4c9d44b1ad40 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ddb4343318bc9190a25ca7489d9038901da18ce3 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Sep 27 23:52:53 2013 +0200 clean-up last commit commit 2fa1479d3f6b50a2cc1dd8821c934bebcd03a466 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Sep 27 23:51:31 2013 +0200 Revert "clean-up last commit" This reverts commit 578f2988212d939a43e2f434892e4c9d44b1ad40. ----------------------------------------------------------------------- Summary of changes: Makefile | 15 ++++++++++++++ paramiko/__init__.py | 2 -- paramiko/client.py | 56 ++++++++++++++++++++------------------------------ paramiko/hostkeys.py | 7 ++----- 4 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 Makefile The diff of changes is: diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..572f867 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +release: docs + python setup.py sdist register upload + +docs: paramiko/* + epydoc --no-private -o docs/ paramiko + +clean: + rm -rf build dist docs + rm -f MANIFEST *.log demos/*.log + rm -f paramiko/*.pyc + rm -f test.log + rm -rf paramiko.egg-info + +test: + python ./test.py diff --git a/paramiko/__init__.py b/paramiko/__init__.py index 7f9aa31..62cd51c 100644 --- a/paramiko/__init__.py +++ b/paramiko/__init__.py @@ -87,8 +87,6 @@ from hostkeys import HostKeys from config import SSHConfig from proxy import ProxyCommand -__version_info__ = tuple([ int(d) for d in __version__.split(".") ]) - # fix module names for epydoc for c in locals().values(): if issubclass(type(c), type) or type(c).__name__ == 'classobj': diff --git a/paramiko/client.py b/paramiko/client.py index ee26278..493d548 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -33,7 +33,7 @@ from paramiko.dsskey import DSSKey from paramiko.hostkeys import HostKeys from paramiko.resource import ResourceManager from paramiko.rsakey import RSAKey -from paramiko.ssh_exception import PasswordRequiredException, SSHException, BadHostKeyException +from paramiko.ssh_exception import SSHException, BadHostKeyException from paramiko.transport import Transport from paramiko.util import retry_on_signal @@ -231,8 +231,8 @@ class SSHClient (object): """ self._policy = policy - def connect(self, hostname, port=SSH_PORT, username=None, password=None, passphrase=None, - pkey=None, key_filename=None, timeout=None, allow_agent=True, look_for_keys=True, + def connect(self, hostname, port=SSH_PORT, username=None, password=None, pkey=None, + key_filename=None, timeout=None, allow_agent=True, look_for_keys=True, compress=False, sock=None): """ Connect to an SSH server and authenticate to it. The server's host key @@ -262,10 +262,6 @@ class SSHClient (object): @param password: a password to use for authentication or for unlocking a private key @type password: str - @param passphrase: a passphrase to use for unlocking - a private key in case the password is already needed for two-factor - authentication - @type passphrase: str @param pkey: an optional private key to use for authentication @type pkey: L{PKey} @param key_filename: the filename, or list of filenames, of optional @@ -343,7 +339,7 @@ class SSHClient (object): key_filenames = [ key_filename ] else: key_filenames = key_filename - self._auth(username, password, passphrase, pkey, key_filenames, allow_agent, look_for_keys) + self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys) def close(self): """ @@ -433,7 +429,7 @@ class SSHClient (object): """ return self._transport - def _auth(self, username, password, passphrase, pkey, key_filenames, allow_agent, look_for_keys): + def _auth(self, username, password, pkey, key_filenames, allow_agent, look_for_keys): """ Try, in order: @@ -442,17 +438,12 @@ class SSHClient (object): - Any "id_rsa" or "id_dsa" key discoverable in ~/.ssh/ (if allowed). - Plain username/password auth, if a password was given. - The password might be needed to unlock a private key, or for - two-factor authentication [for which it is required]. - - If the SSH key needs unlocking via passphrase and two-factor - auth requires a password, the passphrase is unused for unlocking - the key whereas the password is used for server authentication. + (The password might be needed to unlock a private key, or for + two-factor authentication [for which it is required].) """ saved_exception = None two_factor = False allowed_types = [] - if passphrase is None: passphrase = password if pkey is not None: try: @@ -464,6 +455,20 @@ class SSHClient (object): except SSHException, e: saved_exception = e + if not two_factor: + for key_filename in key_filenames: + for pkey_class in (RSAKey, DSSKey): + try: + key = pkey_class.from_private_key_file(key_filename, password) + self._log(DEBUG, 'Trying key %s from %s' % (hexlify(key.get_fingerprint()), key_filename)) + self._transport.auth_publickey(username, key) + two_factor = (allowed_types == ['password']) + if not two_factor: + return + break + except SSHException, e: + saved_exception = e + if not two_factor and allow_agent: if self._agent == None: self._agent = Agent() @@ -481,23 +486,6 @@ class SSHClient (object): saved_exception = e if not two_factor: - for key_filename in key_filenames: - for pkey_class in (RSAKey, DSSKey): - try: - key = pkey_class.from_private_key_file(key_filename, passphrase) - self._log(DEBUG, 'Trying key %s from %s' % (hexlify(key.get_fingerprint()), key_filename)) - allowed_types = self._transport.auth_publickey(username, key) - two_factor = (allowed_types == ['password']) - if not two_factor: - return - break - except PasswordRequiredException, e: - saved_exception = e - break - except SSHException, e: - saved_exception = e - - if not two_factor: keyfiles = [] rsa_key = os.path.expanduser('~/.ssh/id_rsa') dsa_key = os.path.expanduser('~/.ssh/id_dsa') @@ -518,7 +506,7 @@ class SSHClient (object): for pkey_class, filename in keyfiles: try: - key = pkey_class.from_private_key_file(filename, passphrase) + key = pkey_class.from_private_key_file(filename, password) self._log(DEBUG, 'Trying discovered key %s in %s' % (hexlify(key.get_fingerprint()), filename)) # for 2-factor auth a successfully auth'd key will result in ['password'] allowed_types = self._transport.auth_publickey(username, key) diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py index 0f29f2b..f64e6e6 100644 --- a/paramiko/hostkeys.py +++ b/paramiko/hostkeys.py @@ -130,9 +130,9 @@ class HostKeys (UserDict.DictMixin): if filename is not None: self.load(filename) - def add(self, hostname, keytype, key, hash_hostname=True): + def add(self, hostname, keytype, key): """ - Add a host key entry to the table. Any existing entry for a + Add a host key entry to the table. Any existing entry for a C{(hostname, keytype)} pair will be replaced. @param hostname: the hostname (or IP) to add @@ -141,14 +141,11 @@ class HostKeys (UserDict.DictMixin): @type keytype: str @param key: the key to add @type key: L{PKey} - """ for e in self._entries: if (hostname in e.hostnames) and (e.key.get_name() == keytype): e.key = key return - if not hostname.startswith('|1|') and hash_hostname: - hostname = self.hash_host(hostname) self._entries.append(HostKeyEntry([hostname], key)) def load(self, filename): hooks/post-receive -- python-paramiko.git (Debian package python-paramiko) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "python-paramiko.git" (Debian package python-paramiko).