Skip to content

Commit

Permalink
s3: vfs: snapper: Fix snapper_gmt_strip_snapshot() function to strip @…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
Reviewed-by: Christof Schmitt <[email protected]>
Reviewed-by: David Disseldorp <[email protected]>

Autobuild-User(master): David Disseldorp <[email protected]>
Autobuild-Date(master): Thu Aug 18 06:43:02 CEST 2016 on sn-devel-144
  • Loading branch information
jrasamba authored and ddiss committed Aug 18, 2016
1 parent 3e3b9be commit b213082
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions source3/modules/vfs_snapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit b213082

Please sign in to comment.