summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-12-06 14:00:40 +0530
committerVijay Bellur <vijay@gluster.com>2011-12-15 02:50:00 -0800
commitebe0cedb072baf4c1f4bd81f22745c428ab6b911 (patch)
tree4e841dd44412af6f2efb76779aae141f1904baca /xlators
parent7235e5b1af090ffc9d87ac59daadf7926433b495 (diff)
protocol/client: Be strict about gfids in fop req
Change-Id: I7508ab3a93329bb6a679801fddfcd0e5b0c7c134 BUG: 765198 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/770 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 2d5e621d449..98d19c701e8 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -2673,6 +2673,9 @@ client3_1_stat (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
conf = this->private;
@@ -2717,6 +2720,9 @@ client3_1_truncate (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.offset = args->offset;
@@ -2803,6 +2809,9 @@ client3_1_access (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.mask = args->mask;
@@ -2848,6 +2857,9 @@ client3_1_readlink (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.size = args->size;
conf = this->private;
@@ -2895,6 +2907,9 @@ client3_1_unlink (call_frame_t *frame, xlator_t *this,
else
memcpy (req.pargfid, args->loc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.pargfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
conf = this->private;
@@ -2940,6 +2955,9 @@ client3_1_rmdir (call_frame_t *frame, xlator_t *this,
else
memcpy (req.pargfid, args->loc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.pargfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.flags = args->flags;
@@ -2995,6 +3013,9 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this,
else
memcpy (req.pargfid, args->loc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.pargfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.linkname = (char *)args->linkname;
req.bname = (char *)args->loc->name;
@@ -3070,6 +3091,12 @@ client3_1_rename (call_frame_t *frame, xlator_t *this,
else
memcpy (req.newgfid, args->newloc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.oldgfid)),
+ unwind, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.newgfid)),
+ unwind, op_errno, EINVAL);
req.oldpath = (char *)args->oldloc->path;
req.oldbname = (char *)args->oldloc->name;
req.newpath = (char *)args->newloc->path;
@@ -3123,6 +3150,12 @@ client3_1_link (call_frame_t *frame, xlator_t *this,
else
memcpy (req.newgfid, args->newloc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.oldgfid)),
+ unwind, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.newgfid)),
+ unwind, op_errno, EINVAL);
local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t);
if (!local) {
op_errno = ENOMEM;
@@ -3188,6 +3221,9 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this,
else
memcpy (req.pargfid, args->loc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.pargfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
@@ -3269,6 +3305,9 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this,
else
memcpy (req.pargfid, args->loc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.pargfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
@@ -3350,6 +3389,9 @@ client3_1_create (call_frame_t *frame, xlator_t *this,
else
memcpy (req.pargfid, args->loc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.pargfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
@@ -3432,6 +3474,9 @@ client3_1_open (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.flags = gf_flags_from_flags (args->flags);
req.wbflags = args->wbflags;
req.path = (char *)args->loc->path;
@@ -3751,6 +3796,9 @@ client3_1_opendir (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
conf = this->private;
@@ -3842,6 +3890,9 @@ client3_1_statfs (call_frame_t *frame, xlator_t *this,
} else
req.gfid[15] = 1;
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
conf = this->private;
@@ -3887,6 +3938,9 @@ client3_1_setxattr (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
if (args->dict) {
ret = dict_allocate_and_serialize (args->dict,
&req.dict.dict_val,
@@ -4157,6 +4211,10 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this,
memcpy (req.gfid, args->loc->inode->gfid, 16);
else
memcpy (req.gfid, args->loc->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.namelen = 1; /* Use it as a flag */
req.path = (char *)args->loc->path;
req.name = (char *)args->name;
@@ -4282,6 +4340,9 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
if (args->dict) {
ret = dict_allocate_and_serialize (args->dict,
&req.dict.dict_val,
@@ -4478,6 +4539,9 @@ client3_1_removexattr (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.name = (char *)args->name;
@@ -4599,6 +4663,9 @@ client3_1_inodelk (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
if (args->cmd == F_GETLK || args->cmd == F_GETLK64)
gf_cmd = GF_LK_GETLK;
else if (args->cmd == F_SETLK || args->cmd == F_SETLK64)
@@ -4743,6 +4810,9 @@ client3_1_entrylk (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.cmd = args->cmd_entrylk;
req.type = args->type;
@@ -5085,6 +5155,9 @@ client3_1_setattr (call_frame_t *frame, xlator_t *this,
else
memcpy (req.gfid, args->loc->gfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
+ !uuid_is_null (*((uuid_t*)req.gfid)),
+ unwind, op_errno, EINVAL);
req.path = (char *)args->loc->path;
req.valid = args->valid;
gf_stat_from_iatt (&req.stbuf, args->stbuf);