diff options
author | Venky Shankar <vshankar@redhat.com> | 2018-08-06 12:12:28 +0200 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2018-08-17 08:45:09 +0200 |
commit | bae6c9db656afeff1dede6253300d22082313187 (patch) | |
tree | 618a287b157164f8ec5fb83337a186486a10c46d /src/include/filepath.h | |
parent | Merge PR #23468 into master (diff) | |
download | ceph-bae6c9db656afeff1dede6253300d22082313187.tar.xz ceph-bae6c9db656afeff1dede6253300d22082313187.zip |
mds: disallow certain file operations to "." and ".." dirents
Also, fixup return value for file operations such as rmdir()
and rename() on these directories.
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'src/include/filepath.h')
-rw-r--r-- | src/include/filepath.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/include/filepath.h b/src/include/filepath.h index 09821b6ed37..b7b7b54385e 100644 --- a/src/include/filepath.h +++ b/src/include/filepath.h @@ -219,6 +219,17 @@ class filepath { o.push_back(new filepath("var/log", 1)); o.push_back(new filepath("foo/bar", 101)); } + + bool is_last_dot_or_dotdot() const { + if (depth() > 0) { + std::string dname = last_dentry(); + if (dname == "." || dname == "..") { + return true; + } + } + + return false; + } }; WRITE_CLASS_ENCODER(filepath) |