summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2012-05-07 20:09:28 -0700
committerJeff Forcier <jeff@bitprophet.org>2012-09-23 16:19:42 -0700
commit077fdae801da506dda05078d1486bf7f874efd43 (patch)
tree28639247f0dfe81a042eff6269ee4fa5af1212c3
parent1a033dc596d5c3c03a41fee2698d0089debc7313 (diff)
Reorganize forwarded agent cxns to avoid errors
Fixes [Fabric #562](https://github.com/fabric/fabric/issues/562). (cherry picked from commit 58aa52085bc664fbfce61c5981ba54c1452f7abf)
-rw-r--r--CHANGES6
-rw-r--r--paramiko/agent.py28
2 files changed, 27 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index be3b2ad7..e529a666 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,12 @@ Temporary, post-Paramiko changelog while we get our sh!t together.
* #24: Switch some internal type checking to use `isinstance` to help prevent
problems with client libraries using subclasses of builtin types. Thanks to
Alex Morega for the patch.
+* [Fabric #562](https://github.com/fabric/fabric/issues/562): Agent forwarding
+ would error out (with `Authentication response too long`) or freeze, when more
+ than one remote connection to the local agent was active at the same time.
+ This has been fixed. Thanks to Steven McDonald for assisting in
+ troubleshooting/patching, and to GitHub user `@lynxis` for providing the
+ final version of the patch.
## ssh 1.7.13 (2012-02-13)
diff --git a/paramiko/agent.py b/paramiko/agent.py
index 31dcaf8c..7115f17b 100644
--- a/paramiko/agent.py
+++ b/paramiko/agent.py
@@ -186,10 +186,11 @@ class AgentClientProxy(object):
the remote fake agent and the local agent
-> Communication occurs ...
"""
- def __init__(self, chanClient):
+ def __init__(self, chanRemote):
self._conn = None
- self.__chanC = chanClient
- chanClient.request_forward_agent(self._forward_agent_handler)
+ self.__chanR = chanRemote
+ self.thread = AgentRemoteProxy(self, chanRemote)
+ self.thread.start()
def __del__(self):
self.close()
@@ -227,10 +228,6 @@ class AgentClientProxy(object):
if self._conn is not None:
self._conn.close()
- def _forward_agent_handler(self, chanRemote):
- self.thread = AgentRemoteProxy(self, chanRemote)
- self.thread.start()
-
class AgentServerProxy(AgentSSH):
"""
@param t : transport used for the Forward for SSH Agent communication
@@ -281,6 +278,23 @@ class AgentServerProxy(AgentSSH):
def _get_filename(self):
return self._file
+class AgentRequestHandler(object):
+ def __init__(self, chanClient):
+ self._conn = None
+ self.__chanC = chanClient
+ chanClient.request_forward_agent(self._forward_agent_handler)
+ self.__clientProxys = []
+
+ def _forward_agent_handler(self, chanRemote):
+ self.__clientProxys.append(AgentClientProxy(chanRemote))
+
+ def __del__(self):
+ self.close()
+
+ def close(self):
+ for p in self.__clientProxys:
+ p.close()
+
class Agent(AgentSSH):
"""
Client interface for using private keys from an SSH agent running on the