s3: vfs: shadow_copy2. Remove any trailing slash when stripping @GMT-YYYY... from...
authorJeremy Allison <jra@samba.org>
Tue, 16 Aug 2016 16:43:37 +0000 (09:43 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 17 Aug 2016 03:25:30 +0000 (05:25 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12150

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug 17 05:25:30 CEST 2016 on sn-devel-144

source3/modules/vfs_shadow_copy2.c

index b1aae1e530165e567d89b342ce657c83eed2ed71..4ac16d3c10e2345cf9ae5fbe2f7f1411764947f5 100644 (file)
@@ -486,6 +486,13 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
                 * with a path prefix.
                 */
                if (pstripped != NULL) {
+                       if (len_before_gmt > 0) {
+                               /*
+                                * There is a slash before
+                                * the @GMT-. Remove it.
+                                */
+                               len_before_gmt -= 1;
+                       }
                        stripped = talloc_strndup(mem_ctx, name,
                                        len_before_gmt);
                        if (stripped == NULL) {