summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-05-23 16:23:03 +0200
committerAndrew Bartlett <abartlet@samba.org>2013-10-05 09:21:30 +1300
commit9ab89371c8eddad2f274736b508866e2a92b74a3 (patch)
tree6fa7c76c86305d833c7570f37d93baec86b47e05 /source3/modules
parent86988db1f0ebd170d2bc91b6ed78f8845bfd270c (diff)
downloadsamba-9ab89371c8eddad2f274736b508866e2a92b74a3.tar.gz
samba-9ab89371c8eddad2f274736b508866e2a92b74a3.tar.bz2
samba-9ab89371c8eddad2f274736b508866e2a92b74a3.zip
shadow_copy2: fix shadow_copy2_convert() in the classical case.
I.e. the non-snapdirseverywhere case. This in particular fixes the case of a snapdir hierarchy that is parallel to the share or mountpoint and not subordinate. 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.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 95249b2eac..cdab21e892 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -490,6 +490,51 @@ static char *shadow_copy2_convert(TALLOC_CTX *mem_ctx,
SMB_VFS_HANDLE_GET_DATA(handle, config, struct shadow_copy2_config,
return NULL);
+ DEBUG(10, ("converting '%s'\n", name));
+
+ if (!config->snapdirseverywhere) {
+ int ret;
+ char *snapshot_path;
+
+ snapshot_path = shadow_copy2_snapshot_path(talloc_tos(),
+ handle,
+ timestamp);
+ if (snapshot_path == NULL) {
+ goto fail;
+ }
+
+ if (config->rel_connectpath == NULL) {
+ converted = talloc_asprintf(mem_ctx, "%s/%s",
+ snapshot_path, name);
+ } else {
+ converted = talloc_asprintf(mem_ctx, "%s/%s/%s",
+ snapshot_path,
+ config->rel_connectpath,
+ name);
+ }
+ if (converted == NULL) {
+ goto fail;
+ }
+
+ ZERO_STRUCT(converted_fname);
+ converted_fname.base_name = converted;
+
+ ret = SMB_VFS_NEXT_LSTAT(handle, &converted_fname);
+ DEBUG(10, ("Trying[not snapdirseverywhere] %s: %d (%s)\n",
+ converted,
+ ret, ret == 0 ? "ok" : strerror(errno)));
+ if (ret == 0) {
+ DEBUG(10, ("Found %s\n", converted));
+ result = converted;
+ converted = NULL;
+ goto fail;
+ } else {
+ errno = ENOENT;
+ goto fail;
+ }
+ /* never reached ... */
+ }
+
path = talloc_asprintf(mem_ctx, "%s/%s", handle->conn->connectpath,
name);
if (path == NULL) {
@@ -498,8 +543,6 @@ static char *shadow_copy2_convert(TALLOC_CTX *mem_ctx,
}
pathlen = talloc_get_size(path)-1;
- DEBUG(10, ("converting %s\n", path));
-
if (!shadow_copy2_find_slashes(talloc_tos(), path,
&slashes, &num_slashes)) {
goto fail;