Allow remote hosts with colons in the username

This commit is contained in:
Stephen Levine 2017-02-07 22:23:48 -05:00 committed by Brian May
parent 5e90491344
commit abce18cfc2

View File

@ -63,7 +63,7 @@ def empackage(z, name, data=None):
def connect(ssh_cmd, rhostport, python, stderr, options): def connect(ssh_cmd, rhostport, python, stderr, options):
portl = [] portl = []
if (rhostport or '').count(':') > 1: if re.sub(r'.*@', '', rhostport or '').count(':') > 1:
if rhostport.count(']') or rhostport.count('['): if rhostport.count(']') or rhostport.count('['):
result = rhostport.split(']') result = rhostport.split(']')
rhost = result[0].strip('[') rhost = result[0].strip('[')
@ -76,7 +76,7 @@ def connect(ssh_cmd, rhostport, python, stderr, options):
else: else:
rhost = rhostport rhost = rhostport
else: # IPv4 else: # IPv4
l = (rhostport or '').split(':', 1) l = (rhostport or '').rsplit(':', 1)
rhost = l[0] rhost = l[0]
if len(l) > 1: if len(l) > 1:
portl = ['-p', str(int(l[1]))] portl = ['-p', str(int(l[1]))]