Blob Blame History Raw
From ba30dc0db99f0cd6e83ba5085be43607e4710711 Mon Sep 17 00:00:00 2001
From: Shwetha Acharya <sacharya@gmail.com>
Date: Wed, 21 Nov 2018 12:24:00 +0530
Subject: [PATCH 517/529] geo-rep: validate the config checkpoint date format

Added a strlen check to ensure that the format is (Y-m-d H:M:S).

>Change-Id: I8844aaa33418d43ffe2320c4a05eb1eddd306903
>updates: bz#1651584
>Signed-off-by: Shwetha Acharya <sacharya@gmail.com>

backport of https://review.gluster.org/#/c/glusterfs/+/21692/

BUG: 1429190
Change-Id: I70d56925abfffb02d2d4b7d6f570b2c063a8d9c2
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/162467
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 cli/src/cli-cmd-parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index dcce9d3..a450797 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -2774,7 +2774,7 @@ config_parse (const char **words, int wordcount, dict_t *dict,
                         ret_chkpt = strptime(append_str, "%Y-%m-%d %H:%M:%S",
                                              &checkpoint_time);
 
-                        if (ret_chkpt == NULL) {
+                        if (ret_chkpt == NULL || *ret_chkpt != '\0') {
                                 ret = -1;
                                 cli_err ("Invalid Checkpoint label. Use format "
                                          "\"Y-m-d H:M:S\", Example: 2016-10-25 15:30:45");
-- 
1.8.3.1