Support for multiple symlink levels in command_cd

This commit is contained in:
HonigBij
2015-08-25 13:10:15 +02:00
parent c409459272
commit e7ff1d95ac

View File

@@ -52,9 +52,13 @@ class command_cd(HoneyPotCommand):
if newdir is None:
self.writeln('bash: cd: %s: No such file or directory' % path)
return
if self.fs.is_link(newpath):
count = 0
while self.fs.is_link(newpath):
f = self.fs.getfile(newpath)
newpath = f[A_TARGET]
count += 1
if count > 10:
raise self.fs.TooManyLevels
if not self.fs.is_dir(newpath):
self.writeln('bash: cd: %s: Not a directory' % path)
return