diff options
| author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2012-05-18 13:35:58 +0530 |
|---|---|---|
| committer | gluster-ant <bugzilla-bot@gluster.org> | 2012-05-18 13:35:58 +0530 |
| commit | f8758d498668f471fbb501c7149149e64e2fe5bf (patch) | |
| tree | 1669247810aa738162f29f765dd5ee6a0b2a4e21 /cli/src | |
| parent | 583096125fbaf42875915e6dd7ffea24b1ab087c (diff) | |
cli: validate quota enable/disable arguments properly
Change-Id: I175cfd418fae52f3e82402c989b9f5da15058146
BUG: 807667
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/3363
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli/src')
| -rw-r--r-- | cli/src/cli-cmd-parser.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index f590a4a5ac..2dde16744e 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -523,16 +523,26 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options) goto out; } - if ((strcmp (w, "enable")) == 0 && wordcount == 4) { - type = GF_QUOTA_OPTION_TYPE_ENABLE; - ret = 0; - goto set_type; + if (strcmp (w, "enable") == 0) { + if (wordcount == 4) { + type = GF_QUOTA_OPTION_TYPE_ENABLE; + ret = 0; + goto set_type; + } else { + ret = -1; + goto out; + } } - if (strcmp (w, "disable") == 0 && wordcount == 4) { - type = GF_QUOTA_OPTION_TYPE_DISABLE; - ret = 0; - goto set_type; + if (strcmp (w, "disable") == 0) { + if (wordcount == 4) { + type = GF_QUOTA_OPTION_TYPE_DISABLE; + ret = 0; + goto set_type; + } else { + ret = -1; + goto out; + } } if (strcmp (w, "limit-usage") == 0) { |
