summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2011-12-14 14:46:09 +0530
committerVijay Bellur <vijay@gluster.com>2011-12-19 08:42:56 -0800
commit3a0fe71cebd59c1204c60a7d20b2fe2b94f07665 (patch)
treeea99318a2051745a068a066b4dc52968b5a67f8c /xlators/mgmt
parentcd24be007c64bd10d8c28e8e9b1c988478a32c8c (diff)
glusterd: Fail 'requests' from non-peers.
glusterd should not honour "volume op requests" from peers who are not part of the cluster. Change-Id: I6cb6d630a9da02ab060650f21edb46db8deb70e8 BUG: 767559 Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-on: http://review.gluster.com/787 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/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 1d311649c..a331bfbb2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -463,6 +463,7 @@ glusterd_handle_cluster_lock (rpcsvc_request_t *req)
gd1_mgmt_cluster_lock_req lock_req = {{0},};
int32_t ret = -1;
glusterd_op_lock_ctx_t *ctx = NULL;
+ glusterd_peerinfo_t *peerinfo = NULL;
GF_ASSERT (req);
@@ -475,6 +476,13 @@ glusterd_handle_cluster_lock (rpcsvc_request_t *req)
gf_log ("glusterd", GF_LOG_INFO,
"Received LOCK from uuid: %s", uuid_utoa (lock_req.uuid));
+ if (glusterd_friend_find_by_uuid (lock_req.uuid, &peerinfo)) {
+ gf_log (THIS->name, GF_LOG_WARNING, "%s doesn't "
+ "belong to the cluster. Ignoring request.",
+ uuid_utoa (lock_req.uuid));
+ ret = -1;
+ goto out;
+ }
ctx = GF_CALLOC (1, sizeof (*ctx), gf_gld_mt_op_lock_ctx_t);
@@ -551,6 +559,7 @@ glusterd_handle_stage_op (rpcsvc_request_t *req)
int32_t ret = -1;
glusterd_req_ctx_t *req_ctx = NULL;
gd1_mgmt_stage_op_req op_req = {{0},};
+ glusterd_peerinfo_t *peerinfo = NULL;
GF_ASSERT (req);
if (!xdr_to_generic (req->msg[0], &op_req, (xdrproc_t)xdr_gd1_mgmt_stage_op_req)) {
@@ -559,6 +568,14 @@ glusterd_handle_stage_op (rpcsvc_request_t *req)
goto out;
}
+ if (glusterd_friend_find_by_uuid (op_req.uuid, &peerinfo)) {
+ gf_log (THIS->name, GF_LOG_WARNING, "%s doesn't "
+ "belong to the cluster. Ignoring request.",
+ uuid_utoa (op_req.uuid));
+ ret = -1;
+ goto out;
+ }
+
ret = glusterd_req_ctx_create (req, op_req.op, op_req.uuid,
op_req.buf.buf_val, op_req.buf.buf_len,
gf_gld_mt_op_stage_ctx_t, &req_ctx);
@@ -581,6 +598,7 @@ glusterd_handle_commit_op (rpcsvc_request_t *req)
int32_t ret = -1;
glusterd_req_ctx_t *req_ctx = NULL;
gd1_mgmt_commit_op_req op_req = {{0},};
+ glusterd_peerinfo_t *peerinfo = NULL;
GF_ASSERT (req);
@@ -590,6 +608,14 @@ glusterd_handle_commit_op (rpcsvc_request_t *req)
goto out;
}
+ if (glusterd_friend_find_by_uuid (op_req.uuid, &peerinfo)) {
+ gf_log (THIS->name, GF_LOG_WARNING, "%s doesn't "
+ "belong to the cluster. Ignoring request.",
+ uuid_utoa (op_req.uuid));
+ ret = -1;
+ goto out;
+ }
+
//the structures should always be equal
GF_ASSERT (sizeof (gd1_mgmt_commit_op_req) == sizeof (gd1_mgmt_stage_op_req));
ret = glusterd_req_ctx_create (req, op_req.op, op_req.uuid,
@@ -1239,6 +1265,7 @@ glusterd_handle_cluster_unlock (rpcsvc_request_t *req)
gd1_mgmt_cluster_unlock_req unlock_req = {{0}, };
int32_t ret = -1;
glusterd_op_lock_ctx_t *ctx = NULL;
+ glusterd_peerinfo_t *peerinfo = NULL;
GF_ASSERT (req);
@@ -1253,6 +1280,14 @@ glusterd_handle_cluster_unlock (rpcsvc_request_t *req)
gf_log ("glusterd", GF_LOG_INFO,
"Received UNLOCK from uuid: %s", uuid_utoa (unlock_req.uuid));
+ if (glusterd_friend_find_by_uuid (unlock_req.uuid, &peerinfo)) {
+ gf_log (THIS->name, GF_LOG_WARNING, "%s doesn't "
+ "belong to the cluster. Ignoring request.",
+ uuid_utoa (unlock_req.uuid));
+ ret = -1;
+ goto out;
+ }
+
ctx = GF_CALLOC (1, sizeof (*ctx), gf_gld_mt_op_lock_ctx_t);
if (!ctx) {