Commit ab55bbf1 by btimby

Handle case where client tries to cd .. in /. Nothing nefarious, accidentally…

Handle case where client tries to cd .. in /. Nothing nefarious, accidentally clicking ".." in FileZilla causes this.
parent 27817894
...@@ -183,7 +183,14 @@ class SFTPServerInterface(paramiko.SFTPServerInterface): ...@@ -183,7 +183,14 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
return paramiko.SFTP_OK return paramiko.SFTP_OK
def canonicalize(self, path): def canonicalize(self, path):
try:
return abspath(normpath(path)).encode(self.encoding) return abspath(normpath(path)).encode(self.encoding)
except ValueError, e:
# If the client tries to use backrefs to escape root, gently
# nudge them back to /.
if 'too many backrefs' in e.args[0]:
return '/'
raise
@report_sftp_errors @report_sftp_errors
def chattr(self, path, attr): def chattr(self, path, attr):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment