##// END OF EJS Templates
ssh: ban any username@host or host that starts with - (SEC)...
Augie Fackler -
r33707:e1074531 stable
parent child Browse files
Show More
@@ -23,6 +23,7 b' import unicodedata'
23 23 from .i18n import _
24 24 from . import (
25 25 encoding,
26 error,
26 27 pycompat,
27 28 )
28 29
@@ -91,6 +92,9 b' def parsepatchoutput(output_line):'
91 92 def sshargs(sshcmd, host, user, port):
92 93 '''Build argument list for ssh'''
93 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 98 return port and ("%s -p %s" % (args, port)) or args
95 99
96 100 def isexec(f):
@@ -17,6 +17,7 b' import sys'
17 17 from .i18n import _
18 18 from . import (
19 19 encoding,
20 error,
20 21 osutil,
21 22 pycompat,
22 23 win32,
@@ -199,6 +200,10 b' def sshargs(sshcmd, host, user, port):'
199 200 '''Build argument list for ssh or Plink'''
200 201 pflag = 'plink' in sshcmd.lower() and '-P' or '-p'
201 202 args = user and ("%s@%s" % (user, host)) or host
203 if args.startswith('-') or args.startswith('/'):
204 raise error.Abort(
205 _('illegal ssh hostname or username starting with - or /: %s') %
206 args)
202 207 return port and ("%s %s %s" % (args, pflag, port)) or args
203 208
204 209 def setflags(f, l, x):
General Comments 0
You need to be logged in to leave comments. Login now