Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-130326 / 24.10 / Properly exclude ix-apps dataset from filesystem.listdir #14106

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/middlewared/middlewared/plugins/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from itertools import product
from middlewared.event import EventSource
from middlewared.plugins.pwenc import PWENC_FILE_SECRET, PWENC_FILE_SECRET_MODE
from middlewared.plugins.docker.state_utils import IX_APPS_DIR_NAME
from middlewared.plugins.filesystem_ import chflags
from middlewared.schema import accepts, Bool, Dict, Float, Int, List, Ref, returns, Path, Str, UnixPerm
from middlewared.service import private, CallError, filterable_returns, filterable, Service, job
Expand Down Expand Up @@ -273,10 +274,6 @@ def listdir(self, path, filters, options):
if not path.is_dir():
raise CallError(f'Path {path} is not a directory', errno.ENOTDIR)

for ds in ('ix-applications', 'ix-apps'):
if ds in path.parts:
raise CallError(f'{ds!r} is a system managed dataset and its contents cannot be listed')

file_type = None
for filter_ in filters:
if filter_[0] not in ['type']:
Expand All @@ -301,7 +298,7 @@ def listdir(self, path, filters, options):
# prevent shares from being configured to point to
# a path that doesn't exist on a zpool, we'll
# filter these here.
filters.append(['is_mountpoint', '=', True])
filters.extend([['is_mountpoint', '=', True], ['name', '!=', IX_APPS_DIR_NAME]])

with DirectoryIterator(path, file_type=file_type) as d_iter:
return filter_list(d_iter, filters, options)
Expand Down
Loading