s3:vfs:shadow_copy2: fix corner case of "/@GMT-token" in shadow_copy2_strip_snapshot
authorMichael Adam <obnox@samba.org>
Tue, 11 Apr 2017 10:03:52 +0000 (12:03 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 21 Apr 2017 07:57:21 +0000 (09:57 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 26661218b3d3f0d4ee89039727bc110e972c2851)

The last 3 patches address
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12743
vfs_shadow_copy2 fails to list snapshots from shares with GlusterFS backend

source3/modules/vfs_shadow_copy2.c

index 83be84e50a82976316d33b6ac8344daf7bd099ae..7cacac81c1c970b218ea917456b754e09703b197 100644 (file)
@@ -671,10 +671,11 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
                 * with a path prefix.
                 */
                if (pstripped != NULL) {
-                       if (len_before_gmt > 0) {
+                       if (len_before_gmt > 1) {
                                /*
-                                * There is a slash before
-                                * the @GMT-. Remove it.
+                                * There is a path (and not only a slash)
+                                * before the @GMT-. Remove the trailing
+                                * slash character.
                                 */
                                len_before_gmt -= 1;
                        }