diff --git a/paramiko/transport.py b/paramiko/transport.py index c3ad270..e37d931 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -691,17 +691,17 @@ class Transport (threading.Thread): """ return self.open_channel('auth-agent@openssh.com') - def open_forwarded_tcpip_channel(self, (src_addr, src_port), (dest_addr, dest_port)): + def open_forwarded_tcpip_channel(self, src, dest): """ Request a new channel back to the client, of type C{"forwarded-tcpip"}. This is used after a client has requested port forwarding, for sending incoming connections back to the client. - @param src_addr: originator's address - @param src_port: originator's port - @param dest_addr: local (server) connected address - @param dest_port: local (server) connected port + @param src: tuple of the originator (address, port) + @param dest: tuple of the local (server) connected (address, port) """ + src_addr, src_port = src + dest_addr, dest_port = dest return self.open_channel('forwarded-tcpip', (dest_addr, dest_port), (src_addr, src_port)) def open_channel(self, kind, dest_addr=None, src_addr=None): @@ -811,7 +811,9 @@ class Transport (threading.Thread): if port == 0: port = response.get_int() if handler is None: - def default_handler(channel, (src_addr, src_port), (dest_addr, dest_port)): + def default_handler(channel, src, dest): + src_addr, src_port = src + dest_addr, dest_port = dest self._queue_incoming_channel(channel) handler = default_handler self._tcp_handler = handler @@ -1511,7 +1513,8 @@ class Transport (threading.Thread): # only called if a channel has turned on x11 forwarding if handler is None: # by default, use the same mechanism as accept() - def default_handler(channel, (src_addr, src_port)): + def default_handler(channel, src): + src_addr, src_port = src self._queue_incoming_channel(channel) self._x11_handler = default_handler else: diff --git a/tests/test_transport.py b/tests/test_transport.py index 2dc3e08..d3d1c98 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -444,7 +444,8 @@ class TransportTest(ParamikoTest): schan = self.ts.accept(1.0) requested = [] - def handler(c, (addr, port)): + def handler(c, remote): + addr, port = remote requested.append((addr, port)) self.tc._queue_incoming_channel(c) @@ -479,7 +480,9 @@ class TransportTest(ParamikoTest): schan = self.ts.accept(1.0) requested = [] - def handler(c, (origin_addr, origin_port), (server_addr, server_port)): + def handler(c, origin, server): + origin_addr, origin_port = origin + server_addr, server_port = server requested.append((origin_addr, origin_port)) requested.append((server_addr, server_port)) self.tc._queue_incoming_channel(c)