U q`q@sddlZGdddeZGdddeZGdddeZGdd d eZGd d d eZGd d d eZGdddeZGdddeZ Gdddej Z GdddeZ GdddeZ dS)Nc@seZdZdZdS) SSHExceptionzT Exception raised by failures in SSH2 protocol negotiation or logic errors. N__name__ __module__ __qualname____doc__rr=/tmp/pip-target-nv4zd3e_/lib/python/paramiko/ssh_exception.pyrsrc@seZdZdZdS)AuthenticationExceptionz Exception raised when authentication failed for some reason. It may be possible to retry with different credentials. (Other classes specify more specific reasons.) .. versionadded:: 1.6 Nrrrrr r sr c@seZdZdZdS)PasswordRequiredExceptionzR Exception raised when a password is needed to unlock a private key file. Nrrrrr r *sr c@s$eZdZdZgZddZddZdS)BadAuthenticationTypez Exception raised when an authentication type (like password) is used, but the server isn't allowing that type. (It may only allow public-key, for example.) .. versionadded:: 1.1 cCst|||||_||_dSN)r __init__ explanation allowed_types)selfrtypesrrr r>szBadAuthenticationType.__init__cCsd|j|jS)Nz{}; allowed types: {!r})formatrrrrrr __str__EszBadAuthenticationType.__str__Nrrrrrrrrrrr r 2sr c@s$eZdZdZgZddZddZdS)PartialAuthenticationzM An internal exception thrown in the case of partial authentication. cCst||||_dSr )r rr)rrrrr rRs zPartialAuthentication.__init__cCs d|jS)Nz+Partial authentication; allowed types: {!r})rrrrrr rVszPartialAuthentication.__str__Nrrrrr rKsrc@s eZdZdZddZddZdS)ChannelExceptionz Exception raised when an attempt to open a new `.Channel` fails. :param int code: the error code returned by the server .. versionadded:: 1.6 cCst|||||_||_dSr )rrcodetext)rrrrrr reszChannelException.__init__cCsd|j|jS)NzChannelException({!r}, {!r}))rrrrrrr rjszChannelException.__str__Nrrrrrrrrrr r\src@s eZdZdZddZddZdS)BadHostKeyExceptiona The host key given by the SSH server did not match what we were expecting. :param str hostname: the hostname of the SSH server :param PKey got_key: the host key presented by the server :param PKey expected_key: the host key expected .. versionadded:: 1.6 cCs&t||||||_||_||_dSr )rrhostnamekey expected_key)rrZgot_keyrrrr ryszBadHostKeyException.__init__cCs d}||j|j|jS)Nz@Host key for server '{}' does not match: got '{}', expected '{}')rrrZ get_base64r)rmsgrrr rszBadHostKeyException.__str__Nrrrrr rns rc@s eZdZdZddZddZdS)ProxyCommandFailurez The "ProxyCommand" found in the .ssh/config file returned an error. :param str command: The command line that is generating this exception. :param str error: The error captured from the proxy command output. cCst|||||_||_dSr )rrcommanderror)rr"r#rrr rszProxyCommandFailure.__init__cCsd|j|jS)Nz3ProxyCommand("{}") returned nonzero exit status: {})rr"r#rrrr rszProxyCommandFailure.__str__Nrrrrr r!sr!cs(eZdZdZfddZddZZS)NoValidConnectionsErrora Multiple connection attempts were made and no families succeeded. This exception class wraps multiple "real" underlying connection errors, all of which represent failed connection attempts. Because these errors are not guaranteed to all be of the same error type (i.e. different errno, `socket.error` subclass, message, etc) we expose a single unified error message and a ``None`` errno so that instances of this class match most normal handling of `socket.error` objects. To see the wrapped exception objects, access the ``errors`` attribute. ``errors`` is a dict whose keys are address tuples (e.g. ``('127.0.0.1', 22)``) and whose values are the exception encountered trying to connect to that address. It is implied/assumed that all the errors given to a single instance of this class are from connecting to the same hostname + port (and thus that the differences are in the resolution of the hostname - e.g. IPv4 vs v6). .. versionadded:: 1.16 cspt|}ddd|ddD}|dd}|r>d}nd}tt|d||dd ||||_dS) zl :param dict errors: The errors dict to store, as described by class docstring. z, cSsg|] }|dqS)rr).0xrrr sz4NoValidConnectionsError.__init__..Nrz+Unable to connect to port {0} on {1} or {2}z$Unable to connect to port {0} on {2})sortedkeysjoinsuperr$rrerrors)rr.addrsbodytailr  __class__rr rs   z NoValidConnectionsError.__init__cCs|j|jffSr )r3r.rrrr __reduce__sz"NoValidConnectionsError.__reduce__)rrrrrr4 __classcell__rrr2r r$s r$c@seZdZdZdS)CouldNotCanonicalizezh Raised when hostname canonicalization fails & fallback is disabled. .. versionadded:: 2.7 Nrrrrr r6sr6c@seZdZdZdS)ConfigParseErrora@ A fatal error was encountered trying to parse SSH config data. Typically this means a config file violated the ``ssh_config`` specification in a manner that requires exiting immediately, such as not matching ``key = value`` syntax or misusing certain ``Match`` keywords. .. versionadded:: 2.7 Nrrrrr r7s r7)socket Exceptionrr r r rrrr!r#r$r6r7rrrr s ,