From 9083ed64125f17ff04383f32300582d7b33c0be4 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Fri, 20 Apr 2012 11:20:41 +0530 Subject: storage/posix: Don't allow mkdir() on HIDDEN_DIRECTORY Change-Id: Iecbd71d13ee8a492a99689674be99b4a451593db BUG: 788150 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.com/3200 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- xlators/storage/posix/src/posix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 168e7f7d2e6..c218a673548 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -913,6 +913,18 @@ posix_mkdir (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (this, out); VALIDATE_OR_GOTO (loc, out); + /* The Hidden directory should be for housekeeping purpose and it + should not get created from a user request */ + if (__is_root_gfid (loc->pargfid) && + (strcmp (loc->name, GF_HIDDEN_PATH) == 0)) { + gf_log (this->name, GF_LOG_WARNING, + "mkdir issued on %s, which is not permitted", + GF_HIDDEN_PATH); + op_errno = EPERM; + op_ret = -1; + goto out; + } + priv = this->private; VALIDATE_OR_GOTO (priv, out); -- cgit