diff options
author | Vijaikumar M <vmallika@redhat.com> | 2014-03-13 16:39:27 +0530 |
---|---|---|
committer | Rajesh Joseph <rjoseph@redhat.com> | 2014-03-13 04:30:41 -0700 |
commit | 4f6c888c5cc32381273d563b184bcb032ee38cc9 (patch) | |
tree | 028beb946ae8b29730afa9e89756e5fd9492c5a0 /cli | |
parent | 2aa6db3491d58fb7e28da07fbe4d461a0a646d9b (diff) |
glusterd/snapshot: Validate snapshot name length while creation
Change-Id: Iaee04f5209e278d83c086e32c4cafd6c571370cd
Signed-off-by: Vijaikumar M <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/7242
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index c5d6fa009..4357e657e 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -2843,6 +2843,14 @@ cli_snap_create_parse (dict_t *dict, const char **words, int wordcount, goto out; } + if (strlen(words[cmdi]) >= GLUSTERD_MAX_SNAP_NAME) { + cli_out ("snapshot create: failed: snapname cannot exceed " + "256 characters."); + gf_log ("cli", GF_LOG_ERROR, "Snapname too long"); + + goto out; + } + /* Snap name cannot be keyword "description" or "force" */ if (strcmp (words[cmdi], "description") == 0 || strcmp (words[cmdi], "force") == 0) { @@ -3252,6 +3260,7 @@ out : * * return value : -1 on failure * 0 on success + * 1 if user cancel the operation */ int cli_snap_delete_parse (dict_t *dict, const char **words, int wordcount, @@ -3281,7 +3290,7 @@ cli_snap_delete_parse (dict_t *dict, const char **words, int wordcount, answer = cli_cmd_get_confirmation (state, question); if (GF_ANSWER_NO == answer) { - ret = -1; + ret = 1; gf_log ("cli", GF_LOG_DEBUG, "User cancelled " "snapshot delete operation"); goto out; |