summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-03-13 17:26:13 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-14 03:21:03 -0700
commit90333660ce4dd1fc94aa8f6b30c085d354f6693e (patch)
treeac46e7a7c3e072a3ad05c58c598563940a9396f2 /xlators/storage/posix/src/posix.c
parent718a8ab91f6b9bd84da52c2029707f48e9fecaa4 (diff)
storage/posix: don't allow rmdir()/lookup() on HIDDEN_DIRECTORY
so that we won't even have a GFID set on the GFID dir itself. Change-Id: I65be7d675a308f51f4c62a86499341412b20c47f Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 802726 Reviewed-on: http://review.gluster.com/2936 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index f699e4c4da8..2df5702cbc3 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -114,6 +114,18 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (loc, out);
VALIDATE_OR_GOTO (loc->path, out);
+ /* The Hidden directory should be for housekeeping purpose and it
+ should not get any gfid on it */
+ if (__is_root_gfid (loc->pargfid) &&
+ (strcmp (loc->name, GF_HIDDEN_PATH) == 0)) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Lookup issued on %s, which is not permitted",
+ GF_HIDDEN_PATH);
+ op_errno = EPERM;
+ op_ret = -1;
+ goto out;
+ }
+
if (uuid_is_null (loc->pargfid)) {
/* nameless lookup */
MAKE_INODE_HANDLE (real_path, this, loc, &buf);
@@ -1098,9 +1110,22 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (loc, out);
+ SET_FS_ID (frame->root->uid, frame->root->gid);
+
+ /* The Hidden directory should be for housekeeping purpose and it
+ should not get deleted from inside process */
+ if (__is_root_gfid (loc->pargfid) &&
+ (strcmp (loc->name, GF_HIDDEN_PATH) == 0)) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "rmdir issued on %s, which is not permitted",
+ GF_HIDDEN_PATH);
+ op_errno = EPERM;
+ op_ret = -1;
+ goto out;
+ }
+
priv = this->private;
- SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, &stbuf);
op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent);