Show More
@@ -83,16 +83,17 b' class pathauditor(object):' | |||||
83 | parts.pop() |
|
83 | parts.pop() | |
84 | normparts.pop() |
|
84 | normparts.pop() | |
85 | prefixes = [] |
|
85 | prefixes = [] | |
86 | while parts: |
|
86 | # It's important that we check the path parts starting from the root. | |
87 | prefix = os.sep.join(parts) |
|
87 | # This means we won't accidentaly traverse a symlink into some other | |
88 | normprefix = os.sep.join(normparts) |
|
88 | # filesystem (which is potentially expensive to access). | |
|
89 | for i in range(len(parts)): | |||
|
90 | prefix = os.sep.join(parts[:i + 1]) | |||
|
91 | normprefix = os.sep.join(normparts[:i + 1]) | |||
89 | if normprefix in self.auditeddir: |
|
92 | if normprefix in self.auditeddir: | |
90 |
|
|
93 | continue | |
91 | if self._realfs: |
|
94 | if self._realfs: | |
92 | self._checkfs(prefix, path) |
|
95 | self._checkfs(prefix, path) | |
93 | prefixes.append(normprefix) |
|
96 | prefixes.append(normprefix) | |
94 | parts.pop() |
|
|||
95 | normparts.pop() |
|
|||
96 |
|
97 | |||
97 | self.audited.add(normpath) |
|
98 | self.audited.add(normpath) | |
98 | # only add prefixes to the cache after checking everything: we don't |
|
99 | # only add prefixes to the cache after checking everything: we don't |
General Comments 0
You need to be logged in to leave comments.
Login now