summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_snapper.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2016-08-17 10:57:10 -0700
committerDavid Disseldorp <ddiss@samba.org>2016-08-18 06:43:02 +0200
commitb21308252eb409bad6089cc0f09fada0229d33e8 (patch)
tree370f0aaaa67be961d57f8e7c17c6cb3cfffede22 /source3/modules/vfs_snapper.c
parent3e3b9be948d873696a1ab9c0cb859bd8911165f0 (diff)
downloadsamba-b21308252eb409bad6089cc0f09fada0229d33e8.tar.gz
s3: vfs: snapper: Fix snapper_gmt_strip_snapshot() function to strip @GMT token identically to shadow_copy2.c:shadow_copy2_strip_snapshot()
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> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Thu Aug 18 06:43:02 CEST 2016 on sn-devel-144
Diffstat (limited to 'source3/modules/vfs_snapper.c')
-rw-r--r--source3/modules/vfs_snapper.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c
index f5ccc15f483..5c1821d98f1 100644
--- a/source3/modules/vfs_snapper.c
+++ b/source3/modules/vfs_snapper.c
@@ -1748,9 +1748,23 @@ static bool snapper_gmt_strip_snapshot(TALLOC_CTX *mem_ctx,
if (timestamp == (time_t)-1) {
goto no_snapshot;
}
- if ((p == name) && (q[0] == '\0')) {
+ if (q[0] == '\0') {
+ /*
+ * The name consists of only the GMT token or the GMT
+ * token is at the end of the path. XP seems to send
+ * @GMT- at the end under certain circumstances even
+ * with a path prefix.
+ */
if (pstripped != NULL) {
- stripped = talloc_strdup(mem_ctx, "");
+ 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) {
return false;
}
@@ -1760,6 +1774,10 @@ static bool snapper_gmt_strip_snapshot(TALLOC_CTX *mem_ctx,
return true;
}
if (q[0] != '/') {
+ /*
+ * It is not a complete path component, i.e. the path
+ * component continues after the gmt-token.
+ */
goto no_snapshot;
}
q += 1;