Skip to content
Snippets Groups Projects
Commit e3f30068d2eb authored by Matt Mackall's avatar Matt Mackall
Browse files

sshpeer: more thorough shell quoting

This fixes an issue spotted by Jesse Hertz.
parent b65a01a4316b
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,8 @@
self.release()
def _serverquote(s):
if not s:
return s
'''quote a string for the remote shell ... which we assume is sh'''
if re.match('[a-zA-Z0-9@%_+=:,./-]*$', s):
return s
......@@ -45,7 +47,10 @@
sshcmd = self.ui.config("ui", "ssh", "ssh")
remotecmd = self.ui.config("ui", "remotecmd", "hg")
args = util.sshargs(sshcmd, self.host, self.user, self.port)
args = util.sshargs(sshcmd,
_serverquote(self.host),
_serverquote(self.user),
_serverquote(self.port))
if create:
cmd = '%s %s %s' % (sshcmd, args,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment