file_manager: implement additional reserved path filters

Do not add inotify watches for reserved paths that exclude
write acccess.  Do not return include reserved paths in
file list requests without read access.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-11-05 10:48:50 -04:00
parent 484950cb40
commit b291d94596
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 5 additions and 1 deletions

View File

@ -748,6 +748,7 @@ class FileManager:
key = (st.st_dev, st.st_ino)
if key not in visited_dirs:
visited_dirs.add(key)
if not self.check_reserved_path(full_path, False, False):
scan_dirs.append(dname)
dir_names[:] = scan_dirs
for name in files:
@ -915,6 +916,9 @@ class InotifyNode:
for fname in os.listdir(dir_path):
item_path = os.path.join(dir_path, fname)
if os.path.isdir(item_path):
fm = self.ihdlr.file_manager
if fm.check_reserved_path(item_path, True, False):
continue
new_child = self.create_child_node(fname, False)
if new_child is not None:
metadata_events.extend(new_child.scan_node(visited_dirs))