summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorAjeet Jha <ajha@redhat.com>2013-09-23 13:42:21 +0530
committerAnand Avati <avati@redhat.com>2013-10-03 21:25:28 -0700
commita65d64e89c96b52b9805b63afbbc3e7b67dbc3ad (patch)
tree604ec8be600c1c7540fe073a07e3828587c66d0d /xlators/mgmt
parent7dba6f9b556288a95d6ca7e9c3222d14cae3def5 (diff)
glusterd: Validating invalid log-level under geo-rep config options.
Change-Id: I8ff6b48ef41fd6e9ea68c42dfb9878f8a08ed627 BUG: 1010874 Signed-off-by: Ajeet Jha <ajha@redhat.com> Reviewed-on: http://review.gluster.org/5989 Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h7
2 files changed, 18 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 8bdb9457462..5786694bdf9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -42,12 +42,19 @@ glusterd_gsync_read_frm_status (char *path, char *buf, size_t blen);
struct gsync_config_opt_vals_ gsync_confopt_vals[] = {
{.op_name = "change_detector",
.no_of_pos_vals = 2,
+ .case_sensitive = _gf_true,
.values = {"xsync", "changelog"},
},
{.op_name = "special_sync_mode",
.no_of_pos_vals = 2,
+ .case_sensitive = _gf_true,
.values = {"partial", "recover"}
},
+ {.op_name = "log-level",
+ .no_of_pos_vals = 5,
+ .case_sensitive = _gf_false,
+ .values = {"critical", "error", "warning", "info", "debug"}
+ },
{.op_name = NULL,
},
};
@@ -894,8 +901,13 @@ gsync_verify_config_options (dict_t *dict, char **op_errstr, char *volname)
if (op_match) {
val_match = _gf_false;
for (i = 0; i < conf_vals->no_of_pos_vals; i++) {
- if (!strcmp (conf_vals->values[i], op_value))
- val_match = _gf_true;
+ if(conf_vals->case_sensitive){
+ if (!strcmp (conf_vals->values[i], op_value))
+ val_match = _gf_true;
+ } else {
+ if (!strcasecmp (conf_vals->values[i], op_value))
+ val_match = _gf_true;
+ }
}
if (!val_match) {
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 26e9b0c0dbf..4ca30770a0f 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -326,9 +326,10 @@ typedef struct glusterd_pending_node_ {
} glusterd_pending_node_t;
struct gsync_config_opt_vals_ {
- char *op_name;
- int no_of_pos_vals;
- char *values[GEO_CONF_MAX_OPT_VALS];
+ char *op_name;
+ int no_of_pos_vals;
+ gf_boolean_t case_sensitive;
+ char *values[GEO_CONF_MAX_OPT_VALS];
};
enum glusterd_op_ret {