Show More
@@ -23,6 +23,7 b' import unicodedata' | |||||
23 | from .i18n import _ |
|
23 | from .i18n import _ | |
24 | from . import ( |
|
24 | from . import ( | |
25 | encoding, |
|
25 | encoding, | |
|
26 | error, | |||
26 | pycompat, |
|
27 | pycompat, | |
27 | ) |
|
28 | ) | |
28 |
|
29 | |||
@@ -91,6 +92,9 b' def parsepatchoutput(output_line):' | |||||
91 | def sshargs(sshcmd, host, user, port): |
|
92 | def sshargs(sshcmd, host, user, port): | |
92 | '''Build argument list for ssh''' |
|
93 | '''Build argument list for ssh''' | |
93 | args = user and ("%s@%s" % (user, host)) or host |
|
94 | args = user and ("%s@%s" % (user, host)) or host | |
|
95 | if '-' in args[:2]: | |||
|
96 | raise error.Abort( | |||
|
97 | _('illegal ssh hostname or username starting with -: %s') % args) | |||
94 | return port and ("%s -p %s" % (args, port)) or args |
|
98 | return port and ("%s -p %s" % (args, port)) or args | |
95 |
|
99 | |||
96 | def isexec(f): |
|
100 | def isexec(f): |
@@ -17,6 +17,7 b' import sys' | |||||
17 | from .i18n import _ |
|
17 | from .i18n import _ | |
18 | from . import ( |
|
18 | from . import ( | |
19 | encoding, |
|
19 | encoding, | |
|
20 | error, | |||
20 | policy, |
|
21 | policy, | |
21 | pycompat, |
|
22 | pycompat, | |
22 | win32, |
|
23 | win32, | |
@@ -203,6 +204,10 b' def sshargs(sshcmd, host, user, port):' | |||||
203 | '''Build argument list for ssh or Plink''' |
|
204 | '''Build argument list for ssh or Plink''' | |
204 | pflag = 'plink' in sshcmd.lower() and '-P' or '-p' |
|
205 | pflag = 'plink' in sshcmd.lower() and '-P' or '-p' | |
205 | args = user and ("%s@%s" % (user, host)) or host |
|
206 | args = user and ("%s@%s" % (user, host)) or host | |
|
207 | if args.startswith('-') or args.startswith('/'): | |||
|
208 | raise error.Abort( | |||
|
209 | _('illegal ssh hostname or username starting with - or /: %s') % | |||
|
210 | args) | |||
206 | return port and ("%s %s %s" % (args, pflag, port)) or args |
|
211 | return port and ("%s %s %s" % (args, pflag, port)) or args | |
207 |
|
212 | |||
208 | def setflags(f, l, x): |
|
213 | def setflags(f, l, x): |
General Comments 0
You need to be logged in to leave comments.
Login now