Skip to content

Commit

Permalink
Allow remote hosts with colons in the username
Browse files Browse the repository at this point in the history
  • Loading branch information
sclevine authored and brianmay committed Feb 10, 2017
1 parent 5e90491 commit abce18c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sshuttle/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def empackage(z, name, data=None):
def connect(ssh_cmd, rhostport, python, stderr, options):
portl = []

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

0 comments on commit abce18c

Please sign in to comment.