From 3399d519e04c73ea2c16df4037da9de20b5c83f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emre=20Y=C4=B1lmaz?= Date: Tue, 21 May 2013 00:40:28 +0300 Subject: [PATCH 1/4] updated config to be compatible with multiple localforward and remoteforward options. --- paramiko/config.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/paramiko/config.py b/paramiko/config.py index 31caf29..b0be1a8 100644 --- a/paramiko/config.py +++ b/paramiko/config.py @@ -126,14 +126,15 @@ class SSHConfig (object): self._config.append(host) value = value.split() host = {key: value, 'config': {}} - #identityfile is a special case, since it is allowed to be + #identityfile, localforward, remoteforward keys are special cases, since they are allowed to be # specified multiple times and they should be tried in order # of specification. - elif key == 'identityfile': + + elif key in ['identityfile', 'localforward', 'remoteforward']: if key in host['config']: - host['config']['identityfile'].append(value) + host['config'][key].append(value) else: - host['config']['identityfile'] = [value] + host['config'][key] = [value] elif key not in host['config']: host['config'].update({key: value}) self._config.append(host) From 7ed1e2bccc545d6819f081a12abc854540823e42 Mon Sep 17 00:00:00 2001 From: Jonathan Halcrow Date: Mon, 29 Aug 2011 22:26:14 -0300 Subject: [PATCH 2/4] This fixes a Bad file descriptor error caused by attempting to access the request after it has already been closed. --- demos/forward.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/forward.py b/demos/forward.py index 4e10785..2a4c424 100644 --- a/demos/forward.py +++ b/demos/forward.py @@ -78,9 +78,11 @@ class Handler (SocketServer.BaseRequestHandler): if len(data) == 0: break self.request.send(data) + + peername = self.request.getpeername() chan.close() self.request.close() - verbose('Tunnel closed from %r' % (self.request.getpeername(),)) + verbose('Tunnel closed from %r' % (peername,)) def forward_tunnel(local_port, remote_host, remote_port, transport): From fa61f3c398068895e6a483e3ce1ccc684b18ff49 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 20 Sep 2013 14:13:08 -0700 Subject: [PATCH 3/4] Changelog re #36 --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index d052ebb..07ab799 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,8 @@ v1.10.3 (20th Sep 2013) * #162: Clean up HMAC module import to avoid deadlocks in certain uses of SSHClient. Thanks to Gernot Hillier for the catch & suggested fix. +* #36: Fix the port-forwarding demo to avoid file descriptor errors. Thanks to + Jonathan Halcrow for catch & patch. v1.10.2 (26th Jul 2013) ----------------------- From db9dfebca801efbfd3743d85d4f7916f3996f4f5 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 20 Sep 2013 14:46:32 -0700 Subject: [PATCH 4/4] Changelog re #168 --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 07ab799..fadd878 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,8 @@ v1.10.3 (20th Sep 2013) fix. * #36: Fix the port-forwarding demo to avoid file descriptor errors. Thanks to Jonathan Halcrow for catch & patch. +* #168: Update config handling to properly handle multiple 'localforward' and + 'remoteforward' keys. Thanks to Emre Yılmaz for the patch. v1.10.2 (26th Jul 2013) -----------------------