summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobey Pointer <robey@twitter.com>2011-05-23 13:40:33 -0700
committerRobey Pointer <robey@twitter.com>2011-05-23 13:40:33 -0700
commitafae8dd7c59dbe2d1b3f8650d6f826290de306cb (patch)
treeba073ef6900ac4b17fd5c8ec9e53c50f2d926f9a
parent18f6a836daa4beb04776b8543b4fdbed7ace6930 (diff)
oops. fix potential exception when there's no ssh agent available.
-rw-r--r--paramiko/agent.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/paramiko/agent.py b/paramiko/agent.py
index 67d58c45..3bb94261 100644
--- a/paramiko/agent.py
+++ b/paramiko/agent.py
@@ -55,6 +55,7 @@ class Agent:
@raise SSHException: if an SSH agent is found, but speaks an
incompatible protocol
"""
+ self.conn = None
self.keys = ()
if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'):
conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
@@ -87,7 +88,8 @@ class Agent:
"""
Close the SSH agent connection.
"""
- self.conn.close()
+ if self.conn is not None:
+ self.conn.close()
self.conn = None
self.keys = ()