summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2012-11-26 14:25:21 +0530
committerAnand Avati <avati@redhat.com>2012-12-10 14:18:34 -0800
commit5886396d969a317cfd46e3da82543b0868325acc (patch)
treef8cd00c088bc6b6437363c0ff7fa90c41a9edc0b /cli
parent845aba3ddcfaf7bcef283002b7b5bbf2075d4539 (diff)
cli: fail vol set when value = empty string/string with all whitespaces
PROBLEMS: a. 'volume set' operation accepts empty strings and strings containing all whitespaces for value. The result - subsequent attempts to start glusterd fail. b. 'volume set group' operation, when passed an empty string or string containing all spaces as value, fopens the wrong file. FIX: Made volume set parser in cli check for and invalidate value if its length is 0 after all the whitespaces have been stripped off. Change-Id: I6792ee1fe9452d8e25e1fd1eeb1b9981be3389f1 BUG: 859927 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/4246 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index ae754b97c05..8725b79f6f7 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -832,6 +832,11 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options)
if (ret == -1)
goto out;
+ if (strlen (value) == 0) {
+ ret = -1;
+ goto out;
+ }
+
ret = cli_add_key_group (dict, key, value);
if (ret == 0)
*options = dict;
@@ -854,6 +859,11 @@ cli_cmd_volume_set_parse (const char **words, int wordcount, dict_t **options)
if (ret == -1)
goto out;
+ if (strlen (value) == 0) {
+ ret = -1;
+ goto out;
+ }
+
if (cli_is_key_spl (key)) {
ret = -1;
goto out;