From 66cfa97cce92b1d60383d178887b18dddb999fc1 Mon Sep 17 00:00:00 2001 From: Scott Maxwell Date: Wed, 30 Oct 2013 16:19:30 -0700 Subject: Fix imports --- paramiko/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 23a5a2e4..67bb0671 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -34,7 +34,7 @@ from paramiko.ssh_exception import SSHException from paramiko.message import Message from paramiko.pkey import PKey from paramiko.channel import Channel -from paramiko.common import io_sleep +from paramiko.common import * from paramiko.util import retry_on_signal SSH2_AGENTC_REQUEST_IDENTITIES, SSH2_AGENT_IDENTITIES_ANSWER, \ -- cgit v1.2.1 From 339d73cc13765bea4dd5b683ca14b02c9baa589f Mon Sep 17 00:00:00 2001 From: Scott Maxwell Date: Wed, 30 Oct 2013 16:48:50 -0700 Subject: Fix imports --- paramiko/agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 67bb0671..f50a7c00 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -215,7 +215,7 @@ class AgentClientProxy(object): # probably a dangling env var: the ssh agent is gone return elif sys.platform == 'win32': - import win_pageant + from . import win_pageant if win_pageant.can_talk_to_agent(): conn = win_pageant.PageantConnection() else: @@ -334,7 +334,7 @@ class Agent(AgentSSH): # probably a dangling env var: the ssh agent is gone return elif sys.platform == 'win32': - import win_pageant + from . import win_pageant if win_pageant.can_talk_to_agent(): conn = win_pageant.PageantConnection() else: -- cgit v1.2.1 From 0e4ce3762a5b25c5d3eb89335495d3bb9054e3e7 Mon Sep 17 00:00:00 2001 From: Scott Maxwell Date: Wed, 30 Oct 2013 17:09:34 -0700 Subject: Fix message sending Create constants for byte messages, implement asbytes so many methods can take Message and key objects directly and split get_string into get_text and get_binary. Also, change int handling to use mpint with a flag whenever the int is greater than 32 bits. --- paramiko/agent.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index f50a7c00..a6a177db 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -37,8 +37,11 @@ from paramiko.channel import Channel from paramiko.common import * from paramiko.util import retry_on_signal -SSH2_AGENTC_REQUEST_IDENTITIES, SSH2_AGENT_IDENTITIES_ANSWER, \ - SSH2_AGENTC_SIGN_REQUEST, SSH2_AGENT_SIGN_RESPONSE = range(11, 15) +cSSH2_AGENTC_REQUEST_IDENTITIES = byte_chr(11) +SSH2_AGENT_IDENTITIES_ANSWER = 12 +cSSH2_AGENTC_SIGN_REQUEST = byte_chr(13) +SSH2_AGENT_SIGN_RESPONSE = 14 + class AgentSSH(object): """ @@ -68,12 +71,12 @@ class AgentSSH(object): def _connect(self, conn): self._conn = conn - ptype, result = self._send_message(chr(SSH2_AGENTC_REQUEST_IDENTITIES)) + ptype, result = self._send_message(cSSH2_AGENTC_REQUEST_IDENTITIES) if ptype != SSH2_AGENT_IDENTITIES_ANSWER: raise SSHException('could not get keys from ssh-agent') keys = [] for i in range(result.get_int()): - keys.append(AgentKey(self, result.get_string())) + keys.append(AgentKey(self, result.get_binary())) result.get_string() self._keys = tuple(keys) @@ -83,7 +86,7 @@ class AgentSSH(object): self._keys = () def _send_message(self, msg): - msg = str(msg) + msg = asbytes(msg) self._conn.send(struct.pack('>I', len(msg)) + msg) l = self._read_all(4) msg = Message(self._read_all(struct.unpack('>I', l)[0])) @@ -360,21 +363,24 @@ class AgentKey(PKey): def __init__(self, agent, blob): self.agent = agent self.blob = blob - self.name = Message(blob).get_string() + self.name = Message(blob).get_text() - def __str__(self): + def asbytes(self): return self.blob + def __str__(self): + return self.asbytes() + def get_name(self): return self.name def sign_ssh_data(self, rng, data): msg = Message() - msg.add_byte(chr(SSH2_AGENTC_SIGN_REQUEST)) + msg.add_byte(cSSH2_AGENTC_SIGN_REQUEST) msg.add_string(self.blob) msg.add_string(data) msg.add_int(0) ptype, result = self.agent._send_message(msg) if ptype != SSH2_AGENT_SIGN_RESPONSE: raise SSHException('key cannot be used for signing') - return result.get_string() + return result.get_binary() -- cgit v1.2.1 From 676a30c2983f2c335ec86571e3ef7726ee735c52 Mon Sep 17 00:00:00 2001 From: Scott Maxwell Date: Thu, 5 Dec 2013 11:05:47 -0500 Subject: Fix import of win_pageant --- paramiko/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index a6a177db..8f2a486a 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -218,7 +218,7 @@ class AgentClientProxy(object): # probably a dangling env var: the ssh agent is gone return elif sys.platform == 'win32': - from . import win_pageant + import paramiko.win_pageant as win_pageant if win_pageant.can_talk_to_agent(): conn = win_pageant.PageantConnection() else: -- cgit v1.2.1 From 24635609dc5ab8aff2e7fa3f34c4993cbc424579 Mon Sep 17 00:00:00 2001 From: Olle Lundberg Date: Thu, 23 Jan 2014 11:32:59 +0100 Subject: Epydoc -> Sphinx. --- paramiko/agent.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 23a5a2e4..a09851bc 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -44,7 +44,7 @@ class AgentSSH(object): """ Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to - connect to it and retreive L{PKey} objects which can be used when + connect to it and retreive :class:`PKey` objects which can be used when attempting to authenticate to remote SSH servers. Because the SSH agent protocol uses environment variables and unix-domain @@ -61,8 +61,8 @@ class AgentSSH(object): no SSH agent was running (or it couldn't be contacted), an empty list will be returned. - @return: a list of keys available on the SSH agent - @rtype: tuple of L{AgentKey} + :return: a list of keys available on the SSH agent + :rtype: tuple of :class:`AgentKey` """ return self._keys @@ -238,9 +238,9 @@ class AgentClientProxy(object): class AgentServerProxy(AgentSSH): """ - @param t : transport used for the Forward for SSH Agent communication + :param t : transport used for the Forward for SSH Agent communication - @raise SSHException: mostly if we lost the agent + :raises SSHException: mostly if we lost the agent """ def __init__(self, t): AgentSSH.__init__(self) @@ -276,8 +276,8 @@ class AgentServerProxy(AgentSSH): """ Helper for the environnement under unix - @return: the SSH_AUTH_SOCK Environnement variables - @rtype: dict + :return: the SSH_AUTH_SOCK Environnement variables + :rtype: dict """ env = {} env['SSH_AUTH_SOCK'] = self._get_filename() @@ -307,7 +307,7 @@ class Agent(AgentSSH): """ Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to - connect to it and retreive L{PKey} objects which can be used when + connect to it and retreive :class:`PKey` objects which can be used when attempting to authenticate to remote SSH servers. Because the SSH agent protocol uses environment variables and unix-domain @@ -318,10 +318,10 @@ class Agent(AgentSSH): def __init__(self): """ Open a session with the local machine's SSH agent, if one is running. - If no agent is running, initialization will succeed, but L{get_keys} + If no agent is running, initialization will succeed, but :class:`get_keys` will return an empty tuple. - @raise SSHException: if an SSH agent is found, but speaks an + :raises SSHException: if an SSH agent is found, but speaks an incompatible protocol """ AgentSSH.__init__(self) -- cgit v1.2.1 From 3f9270c0be18b09cd39279730eac125776adbedc Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 21 Feb 2014 11:11:10 -0800 Subject: Mass SnR of class refs with dotted ones. Boo on Sphinx for not letting me just change this behavior by default. There are a handful of incorrect items here that will get tweaked later. --- paramiko/agent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index a09851bc..a5413f74 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -44,7 +44,7 @@ class AgentSSH(object): """ Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to - connect to it and retreive :class:`PKey` objects which can be used when + connect to it and retreive :class:`.PKey` objects which can be used when attempting to authenticate to remote SSH servers. Because the SSH agent protocol uses environment variables and unix-domain @@ -62,7 +62,7 @@ class AgentSSH(object): will be returned. :return: a list of keys available on the SSH agent - :rtype: tuple of :class:`AgentKey` + :rtype: tuple of :class:`.AgentKey` """ return self._keys @@ -307,7 +307,7 @@ class Agent(AgentSSH): """ Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to - connect to it and retreive :class:`PKey` objects which can be used when + connect to it and retreive :class:`.PKey` objects which can be used when attempting to authenticate to remote SSH servers. Because the SSH agent protocol uses environment variables and unix-domain -- cgit v1.2.1 From f09b562fa874d3358daa7dfd4ca7f2c8b5d47b68 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 21 Feb 2014 12:15:29 -0800 Subject: Replace accidental class-refs on local method-refs --- paramiko/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index a5413f74..45bb2657 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -318,7 +318,7 @@ class Agent(AgentSSH): def __init__(self): """ Open a session with the local machine's SSH agent, if one is running. - If no agent is running, initialization will succeed, but :class:`get_keys` + If no agent is running, initialization will succeed, but `get_keys` will return an empty tuple. :raises SSHException: if an SSH agent is found, but speaks an -- cgit v1.2.1 From f836c98e5c5c859cb9d0189aed51dd5a884ee072 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 21 Feb 2014 12:16:11 -0800 Subject: Don't actually need :class: anywhere now --- paramiko/agent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 45bb2657..54617655 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -44,7 +44,7 @@ class AgentSSH(object): """ Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to - connect to it and retreive :class:`.PKey` objects which can be used when + connect to it and retreive `.PKey` objects which can be used when attempting to authenticate to remote SSH servers. Because the SSH agent protocol uses environment variables and unix-domain @@ -62,7 +62,7 @@ class AgentSSH(object): will be returned. :return: a list of keys available on the SSH agent - :rtype: tuple of :class:`.AgentKey` + :rtype: tuple of `.AgentKey` """ return self._keys @@ -307,7 +307,7 @@ class Agent(AgentSSH): """ Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to - connect to it and retreive :class:`.PKey` objects which can be used when + connect to it and retreive `.PKey` objects which can be used when attempting to authenticate to remote SSH servers. Because the SSH agent protocol uses environment variables and unix-domain -- cgit v1.2.1 From b47b578e592e204a31f566826005f432d4b9d3fa Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 24 Feb 2014 16:51:55 -0800 Subject: Whitespace --- paramiko/agent.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 54617655..f5b116ca 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -40,6 +40,7 @@ from paramiko.util import retry_on_signal SSH2_AGENTC_REQUEST_IDENTITIES, SSH2_AGENT_IDENTITIES_ANSWER, \ SSH2_AGENTC_SIGN_REQUEST, SSH2_AGENT_SIGN_RESPONSE = range(11, 15) + class AgentSSH(object): """ Client interface for using private keys from an SSH agent running on the @@ -100,6 +101,7 @@ class AgentSSH(object): result += extra return result + class AgentProxyThread(threading.Thread): """ Class in charge of communication between two chan """ def __init__(self, agent): @@ -146,6 +148,7 @@ class AgentProxyThread(threading.Thread): self.__inr.close() self._agent._conn.close() + class AgentLocalProxy(AgentProxyThread): """ Class to be used when wanting to ask a local SSH Agent being @@ -168,6 +171,7 @@ class AgentLocalProxy(AgentProxyThread): raise return None + class AgentRemoteProxy(AgentProxyThread): """ Class to be used when wanting to ask a remote SSH Agent @@ -183,6 +187,7 @@ class AgentRemoteProxy(AgentProxyThread): """ return (self.__chan, None) + class AgentClientProxy(object): """ Class proxying request as a client: @@ -236,6 +241,7 @@ class AgentClientProxy(object): if self._conn is not None: self._conn.close() + class AgentServerProxy(AgentSSH): """ :param t : transport used for the Forward for SSH Agent communication @@ -286,6 +292,7 @@ class AgentServerProxy(AgentSSH): def _get_filename(self): return self._file + class AgentRequestHandler(object): def __init__(self, chanClient): self._conn = None @@ -303,6 +310,7 @@ class AgentRequestHandler(object): for p in self.__clientProxys: p.close() + class Agent(AgentSSH): """ Client interface for using private keys from an SSH agent running on the @@ -314,7 +322,6 @@ class Agent(AgentSSH): sockets, this probably doesn't work on Windows. It does work on most posix platforms though (Linux and MacOS X, for example). """ - def __init__(self): """ Open a session with the local machine's SSH agent, if one is running. @@ -350,13 +357,13 @@ class Agent(AgentSSH): """ self._close() + class AgentKey(PKey): """ Private key held in a local SSH agent. This type of key can be used for authenticating to a remote server (signing). Most other key operations work as expected. """ - def __init__(self, agent, blob): self.agent = agent self.blob = blob -- cgit v1.2.1 From 9ae46dcbfaab42b450db410eecd8e7e94183f1b8 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 24 Feb 2014 17:00:53 -0800 Subject: Fix up AgentSSH vs Agent classes/docstrings, sigh --- paramiko/agent.py | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index f5b116ca..302d31ec 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -17,7 +17,7 @@ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. """ -SSH Agent interface for Unix clients. +SSH Agent interface """ import os @@ -42,16 +42,6 @@ SSH2_AGENTC_REQUEST_IDENTITIES, SSH2_AGENT_IDENTITIES_ANSWER, \ class AgentSSH(object): - """ - Client interface for using private keys from an SSH agent running on the - local machine. If an SSH agent is running, this class can be used to - connect to it and retreive `.PKey` objects which can be used when - attempting to authenticate to remote SSH servers. - - Because the SSH agent protocol uses environment variables and unix-domain - sockets, this probably doesn't work on Windows. It does work on most - posix platforms though (Linux and MacOS X, for example). - """ def __init__(self): self._conn = None self._keys = () @@ -318,19 +308,14 @@ class Agent(AgentSSH): connect to it and retreive `.PKey` objects which can be used when attempting to authenticate to remote SSH servers. - Because the SSH agent protocol uses environment variables and unix-domain - sockets, this probably doesn't work on Windows. It does work on most - posix platforms though (Linux and MacOS X, for example). + Upon initialization, a session with the local machine's SSH agent is + opened, if one is running. If no agent is running, initialization will + succeed, but `get_keys` will return an empty tuple. + + :raises SSHException: + if an SSH agent is found, but speaks an incompatible protocol """ def __init__(self): - """ - Open a session with the local machine's SSH agent, if one is running. - If no agent is running, initialization will succeed, but `get_keys` - will return an empty tuple. - - :raises SSHException: if an SSH agent is found, but speaks an - incompatible protocol - """ AgentSSH.__init__(self) if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'): -- cgit v1.2.1 From 4fb748ccf8743099198daa00265bb38ea096044f Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 24 Feb 2014 17:01:18 -0800 Subject: Remove apparently bogus docstring --- paramiko/agent.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 302d31ec..13d90dbe 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -171,10 +171,6 @@ class AgentRemoteProxy(AgentProxyThread): self.__chan = chan def get_connection(self): - """ - Class to be used when wanting to ask a local SSH Agent being - asked from a remote fake agent (so use a unix socket for ex.) - """ return (self.__chan, None) -- cgit v1.2.1 From c8382442f51eda4ac47de5d3842d4923d0642e5d Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 24 Feb 2014 17:06:08 -0800 Subject: Docstring cleanups --- paramiko/agent.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 13d90dbe..8571f31a 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -93,7 +93,9 @@ class AgentSSH(object): class AgentProxyThread(threading.Thread): - """ Class in charge of communication between two chan """ + """ + Class in charge of communication between two channels. + """ def __init__(self, agent): threading.Thread.__init__(self, target=self.run) self._agent = agent @@ -148,8 +150,10 @@ class AgentLocalProxy(AgentProxyThread): AgentProxyThread.__init__(self, agent) def get_connection(self): - """ Return a pair of socket object and string address - May Block ! + """ + Return a pair of socket object and string address. + + May block! """ conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) try: @@ -177,13 +181,14 @@ class AgentRemoteProxy(AgentProxyThread): class AgentClientProxy(object): """ Class proxying request as a client: - -> client ask for a request_forward_agent() - -> server creates a proxy and a fake SSH Agent - -> server ask for establishing a connection when needed, + + #. client ask for a request_forward_agent() + #. server creates a proxy and a fake SSH Agent + #. server ask for establishing a connection when needed, calling the forward_agent_handler at client side. - -> the forward_agent_handler launch a thread for connecting + #. the forward_agent_handler launch a thread for connecting the remote fake agent and the local agent - -> Communication occurs ... + #. Communication occurs ... """ def __init__(self, chanRemote): self._conn = None -- cgit v1.2.1 From 6dcf67a9ad2868233f163509274e91d772ac7164 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 24 Feb 2014 17:06:25 -0800 Subject: This is really not a link as the target can't have a useful docstring, meh --- paramiko/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 8571f31a..d224cd74 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -201,7 +201,7 @@ class AgentClientProxy(object): def connect(self): """ - Method automatically called by the run() method of the AgentProxyThread + Method automatically called by ``AgentProxyThread.run``. """ if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'): conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) -- cgit v1.2.1 From 999bb4eaafc754764b55f02bf20f782df2eaa80d Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 24 Feb 2014 17:08:09 -0800 Subject: Done with SSH Agent docstring junk --- paramiko/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index d224cd74..cdb4313d 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -235,7 +235,7 @@ class AgentClientProxy(object): class AgentServerProxy(AgentSSH): """ - :param t : transport used for the Forward for SSH Agent communication + :param t: transport used for SSH Agent communication forwarding :raises SSHException: mostly if we lost the agent """ -- cgit v1.2.1 From 7df1ae9602e0b5425ccfd9a1351e059fbbdfce89 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Wed, 26 Feb 2014 11:06:20 -0800 Subject: Start cleaning up info field lists --- paramiko/agent.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index cdb4313d..d9f4b1bc 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -52,8 +52,9 @@ class AgentSSH(object): no SSH agent was running (or it couldn't be contacted), an empty list will be returned. - :return: a list of keys available on the SSH agent - :rtype: tuple of `.AgentKey` + :return: + a tuple of `.AgentKey` objects representing keys available on the + SSH agent """ return self._keys @@ -235,7 +236,7 @@ class AgentClientProxy(object): class AgentServerProxy(AgentSSH): """ - :param t: transport used for SSH Agent communication forwarding + :param .Transport t: Transport used for SSH Agent communication forwarding :raises SSHException: mostly if we lost the agent """ @@ -273,8 +274,8 @@ class AgentServerProxy(AgentSSH): """ Helper for the environnement under unix - :return: the SSH_AUTH_SOCK Environnement variables - :rtype: dict + :return: + a dict containing the ``SSH_AUTH_SOCK`` environnement variables """ env = {} env['SSH_AUTH_SOCK'] = self._get_filename() -- cgit v1.2.1 From f0017b83309899bf6fffc0fa90093c36f1a7f7ea Mon Sep 17 00:00:00 2001 From: Scott Maxwell Date: Fri, 7 Mar 2014 20:45:26 -0800 Subject: Fix import * and a bunch of PEP8 formatting --- paramiko/agent.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'paramiko/agent.py') diff --git a/paramiko/agent.py b/paramiko/agent.py index 3aa58bea..2b11337f 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -29,12 +29,12 @@ import time import tempfile import stat from select import select +from paramiko.common import asbytes, io_sleep +from paramiko.py3compat import byte_chr from paramiko.ssh_exception import SSHException from paramiko.message import Message from paramiko.pkey import PKey -from paramiko.channel import Channel -from paramiko.common import * from paramiko.util import retry_on_signal cSSH2_AGENTC_REQUEST_IDENTITIES = byte_chr(11) @@ -43,7 +43,6 @@ cSSH2_AGENTC_SIGN_REQUEST = byte_chr(13) SSH2_AGENT_SIGN_RESPONSE = 14 - class AgentSSH(object): def __init__(self): self._conn = None @@ -107,7 +106,7 @@ class AgentProxyThread(threading.Thread): def run(self): try: - (r,addr) = self.get_connection() + (r, addr) = self.get_connection() self.__inr = r self.__addr = addr self._agent.connect() @@ -163,11 +162,10 @@ class AgentLocalProxy(AgentProxyThread): try: conn.bind(self._agent._get_filename()) conn.listen(1) - (r,addr) = conn.accept() - return (r, addr) + (r, addr) = conn.accept() + return r, addr except: raise - return None class AgentRemoteProxy(AgentProxyThread): @@ -179,7 +177,7 @@ class AgentRemoteProxy(AgentProxyThread): self.__chan = chan def get_connection(self): - return (self.__chan, None) + return self.__chan, None class AgentClientProxy(object): @@ -280,9 +278,7 @@ class AgentServerProxy(AgentSSH): :return: a dict containing the ``SSH_AUTH_SOCK`` environnement variables """ - env = {} - env['SSH_AUTH_SOCK'] = self._get_filename() - return env + return {'SSH_AUTH_SOCK': self._get_filename()} def _get_filename(self): return self._file -- cgit v1.2.1