summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2017-08-17 10:54:02 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-08-21 14:28:10 +0000
commit80774b1a9cc17f8c7c9e7e59251cf98029d1b42f (patch)
treeaaacbd9ea3b9bb6a8c32003ba97717617ecc2f4c /xlators/mgmt/glusterd/src
parent181d7bafb4da76401c3a1eb30bfdfbe8239968ab (diff)
glusterd: disallow volume specific options to be set with all as volume name
All the .validate_fn defined in volume map entry table refers to volinfo object. And if we end up in trying to set a volume level option cluster wide glusterd results into a crash. >Reviewed-on: https://review.gluster.org/18052 >Smoke: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Prashanth Pai <ppai@redhat.com> >Reviewed-by: mohammed rafi kc <rkavunga@redhat.com> >Reviewed-by: Gaurav Yadav <gyadav@redhat.com> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >(cherry picked from commit 01abf7ee37702407403afcf9aa6c9019a0316e1d) Change-Id: I7c877aee0ff5c8c1d8c95662fdc8c8923355ae7b BUG: 1482804 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/18060 Reviewed-by: Prashanth Pai <ppai@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index d82e0f1ae86..9ee4c8d4c52 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -807,6 +807,14 @@ glusterd_volopt_validate (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
if ((vme->validate_fn) &&
((!strcmp (key, vme->key)) ||
(!strcmp (key, strchr (vme->key, '.') + 1)))) {
+ if ((vme->type != GLOBAL_DOC &&
+ vme->type != GLOBAL_NO_DOC) && !volinfo) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_INVALID_ENTRY, "%s is not"
+ " a global option", vme->key);
+ ret = -1;
+ goto out;
+ }
ret = vme->validate_fn (volinfo, dict, key, value,
op_errstr);
if (ret)