diff options
author | Michael Adam <obnox@samba.org> | 2013-05-29 17:16:23 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-10-05 09:21:26 +1300 |
commit | 4b8d9c65f45db426716763629f1e22b0eb859a99 (patch) | |
tree | 586d68fbc2507bd6e5af7e374439e2b06d2eb2ae /source3/modules | |
parent | afcb84e69f46671030710bdda1c8798235b9ace7 (diff) | |
download | samba-4b8d9c65f45db426716763629f1e22b0eb859a99.tar.gz samba-4b8d9c65f45db426716763629f1e22b0eb859a99.tar.bz2 samba-4b8d9c65f45db426716763629f1e22b0eb859a99.zip |
shadow_copy2: fix shadow_copy2_strip_snapshot() in the classical case
I.e., fix detection of already converted names.
This is done by using the shadow_copy2_snapshot_path() function
and comparing if the input string starts with that.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/vfs_shadow_copy2.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 17eb8ba6f9..8c2e767946 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -381,6 +381,36 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx, goto no_snapshot; } TALLOC_FREE(insert); + } else { + char *snapshot_path; + char *s; + + snapshot_path = shadow_copy2_snapshot_path(talloc_tos(), + handle, + timestamp); + if (snapshot_path == NULL) { + errno = ENOMEM; + return false; + } + + DEBUG(10, (__location__ " path: '%s'.\n" + "snapshot path: '%s'\n", name, snapshot_path)); + + s = strstr(name, snapshot_path); + if (s == name) { + /* + * this starts with "snapshot_basepath/GMT-Token" + * so it is already a converted absolute + * path. Don't process further. + */ + DEBUG(10, (__location__ ": path '%s' starts with " + "snapshot path '%s' (not in " + "snapdirseverywhere mode) ==> " + "already converted\n", name, snapshot_path)); + talloc_free(snapshot_path); + goto no_snapshot; + } + talloc_free(snapshot_path); } if (pstripped != NULL) { |