smbclient: Also allow four digit years in utimes command
authorChristof Schmitt <cs@samba.org>
Tue, 14 Apr 2020 23:40:55 +0000 (16:40 -0700)
committerChristof Schmitt <cs@samba.org>
Thu, 16 Apr 2020 17:27:40 +0000 (17:27 +0000)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/client/client.c

index b19d47526919b2414c6bf984684aedbe237cc636..87b27062d154879ff4773d30f25a9304b45d8bb9 100644 (file)
@@ -5237,13 +5237,17 @@ static int cmd_utimes(void)
 
                ret = strptime(s, "%y:%m:%d-%H:%M:%S", &tm);
 
+               if (ret == NULL) {
+                       ret = strptime(s, "%Y:%m:%d-%H:%M:%S", &tm);
+               }
+
                /* We could not match all the chars, so print error */
                if (ret == NULL || *ret != 0) {
                        d_printf("Invalid date format: %s\n", s);
                        d_printf("utimes <filename> <create-time> "
                                "<access-time> <write-time> <change-time>\n");
-                       d_printf("Dates should be in YY:MM:DD-HH:MM:SS format "
-                               "or -1 for no change\n");
+                       d_printf("Dates should be in [YY]YY:MM:DD-HH:MM:SS "
+                                "format or -1 for no change\n");
                        err = 1;
                        goto out;
                }