From 541e6a0079e50aa36e37270a91d86fccb2467ee4 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Mon, 22 May 2017 20:23:06 +0530 Subject: glusterd: ignore incorrect uuid validation if uuid_str is empty If uuid_str is not filled up in dictionary (when glusterd bit is old), we shouldn't be additional validation with peer uuid otherwise the handshake request will fail. Refer : http://lists.gluster.org/pipermail/gluster-users/2017-May/031187.html Credits : pawan@platform.sh >Reviewed-on: https://review.gluster.org/17358 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Amar Tumballi >Reviewed-by: Prashanth Pai >(cherry picked from commit b1fbc695a63801a3a2c62738fd6660388123724a) Change-Id: I2c30bf0490c31d1418b31d555e7758696e79409f BUG: 1455182 Signed-off-by: Atin Mukherjee Reviewed-on: https://review.gluster.org/17386 Smoke: Gluster Build System Reviewed-by: Prashanth Pai NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Raghavendra Talur --- xlators/mgmt/glusterd/src/glusterd-handshake.c | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c index 96d39f03007..c59719a814a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handshake.c +++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c @@ -1130,20 +1130,25 @@ gd_validate_mgmt_hndsk_req (rpcsvc_request_t *req, dict_t *dict) * node due to a reinstall, in that case the validation should fail! */ rcu_read_lock (); - peer = glusterd_peerinfo_find (NULL, hostname); - if (!peer) { - ret = -1; - } else if (peer && glusterd_peerinfo_find (peer_uuid, NULL) != NULL) { - ret = 0; + if (!uuid_str) { + ret = (glusterd_peerinfo_find (NULL, hostname) == NULL); } else { - gf_msg (this->name, GF_LOG_ERROR, 0, - GD_MSG_HANDSHAKE_REQ_REJECTED, "Request from peer %s " - "has an entry in peerinfo, but uuid does not match", - req->trans->peerinfo.identifier); - ret = -1; + peer = glusterd_peerinfo_find (NULL, hostname); + if (!peer) { + ret = -1; + } else if (peer && + glusterd_peerinfo_find (peer_uuid, NULL) != NULL) { + ret = 0; + } else { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_HANDSHAKE_REQ_REJECTED, "Request from " + "peer %s has an entry in peerinfo, but uuid " + "does not match", + req->trans->peerinfo.identifier); + ret = -1; + } } rcu_read_unlock (); - if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_HANDSHAKE_REQ_REJECTED, "Rejecting management " -- cgit