|
115 | 115 | from .misc import TermModesArg, TermSizeArg
|
116 | 116 | from .misc import async_context_manager, construct_disc_error
|
117 | 117 | from .misc import get_symbol_names, ip_address, map_handler_name
|
118 |
| -from .misc import parse_byte_count, parse_time_interval |
| 118 | +from .misc import parse_byte_count, parse_time_interval, split_args |
119 | 119 |
|
120 | 120 | from .packet import Boolean, Byte, NameList, String, UInt32, PacketDecodeError
|
121 | 121 | from .packet import SSHPacket, SSHPacketHandler, SSHPacketLogger
|
@@ -231,7 +231,7 @@ async def create_server(self, session_factory: TCPListenerFactory,
|
231 | 231 | _GlobalRequestResult = Tuple[int, SSHPacket]
|
232 | 232 | _KeyOrCertOptions = Mapping[str, object]
|
233 | 233 | _ListenerArg = Union[bool, SSHListener]
|
234 |
| -_ProxyCommand = Optional[Sequence[str]] |
| 234 | +_ProxyCommand = Optional[Union[str, Sequence[str]]] |
235 | 235 | _RequestPTY = Union[bool, str]
|
236 | 236 |
|
237 | 237 | _TCPServerHandlerFactory = Callable[[str, int], SSHSocketSessionFactory]
|
@@ -7144,11 +7144,13 @@ def prepare(self, config: SSHConfig, # type: ignore
|
7144 | 7144 | self.tunnel = tunnel if tunnel != () else config.get('ProxyJump')
|
7145 | 7145 | self.passphrase = passphrase
|
7146 | 7146 |
|
| 7147 | + if proxy_command == (): |
| 7148 | + proxy_command = cast(Optional[str], config.get('ProxyCommand')) |
| 7149 | + |
7147 | 7150 | if isinstance(proxy_command, str):
|
7148 |
| - proxy_command = shlex.split(proxy_command) |
| 7151 | + proxy_command = split_args(proxy_command) |
7149 | 7152 |
|
7150 |
| - self.proxy_command = proxy_command if proxy_command != () else \ |
7151 |
| - cast(Sequence[str], config.get('ProxyCommand')) |
| 7153 | + self.proxy_command = proxy_command |
7152 | 7154 |
|
7153 | 7155 | self.family = cast(int, family if family != () else
|
7154 | 7156 | config.get('AddressFamily', socket.AF_UNSPEC))
|
@@ -9224,7 +9226,7 @@ async def create_server(server_factory: _ServerFactory,
|
9224 | 9226 | async def get_server_host_key(
|
9225 | 9227 | host = '', port: DefTuple[int] = (), *,
|
9226 | 9228 | tunnel: DefTuple[_TunnelConnector] = (),
|
9227 |
| - proxy_command: DefTuple[str] = (), family: DefTuple[int] = (), |
| 9229 | + proxy_command: DefTuple[_ProxyCommand] = (), family: DefTuple[int] = (), |
9228 | 9230 | flags: int = 0, local_addr: DefTuple[HostPort] = (),
|
9229 | 9231 | sock: Optional[socket.socket] = None,
|
9230 | 9232 | client_version: DefTuple[BytesOrStr] = (),
|
@@ -9368,7 +9370,7 @@ def conn_factory() -> SSHClientConnection:
|
9368 | 9370 | async def get_server_auth_methods(
|
9369 | 9371 | host = '', port: DefTuple[int] = (), username: DefTuple[str] = (), *,
|
9370 | 9372 | tunnel: DefTuple[_TunnelConnector] = (),
|
9371 |
| - proxy_command: DefTuple[str] = (), family: DefTuple[int] = (), |
| 9373 | + proxy_command: DefTuple[_ProxyCommand] = (), family: DefTuple[int] = (), |
9372 | 9374 | flags: int = 0, local_addr: DefTuple[HostPort] = (),
|
9373 | 9375 | sock: Optional[socket.socket] = None,
|
9374 | 9376 | client_version: DefTuple[BytesOrStr] = (),
|
|
0 commit comments