summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-05-29 17:12:21 +0200
committerAndrew Bartlett <abartlet@samba.org>2013-10-05 09:21:20 +1300
commit304a0f531caa5f33f205739470f17e983d25a6b5 (patch)
treecf6d2dd9d662701e31e5239031bd659cf1fe2d68 /source3/modules
parente86923eb52633c5b6133c45678355ce69bb43a54 (diff)
downloadsamba-304a0f531caa5f33f205739470f17e983d25a6b5.tar.gz
samba-304a0f531caa5f33f205739470f17e983d25a6b5.tar.bz2
samba-304a0f531caa5f33f205739470f17e983d25a6b5.zip
shadow_copy2: shadow_copy2_insert_string(): do not prepend a "/" in absolute mode
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.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index e227b1074e..97f208e566 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -161,6 +161,12 @@ static bool shadow_copy2_find_slashes(TALLOC_CTX *mem_ctx, const char *str,
* Given a timstamp, build the string to insert into a path
* as a path component for creating the local path to the
* snapshot at the given timestamp of the input path.
+ *
+ * In the case of a parallel snapdir (specified with an
+ * absolute path), this is the inital portion of the
+ * local path of any snapshot file. The complete path is
+ * obtained by appending the portion of the file's path
+ * below the share root's mountpoint.
*/
static char *shadow_copy2_insert_string(TALLOC_CTX *mem_ctx,
struct vfs_handle_struct *handle,
@@ -170,6 +176,7 @@ static char *shadow_copy2_insert_string(TALLOC_CTX *mem_ctx,
fstring snaptime_string;
size_t snaptime_len;
struct shadow_copy2_config *config;
+ char *result = NULL;
SMB_VFS_HANDLE_GET_DATA(handle, config, struct shadow_copy2_config,
return NULL);
@@ -204,8 +211,19 @@ static char *shadow_copy2_insert_string(TALLOC_CTX *mem_ctx,
return NULL;
}
}
- return talloc_asprintf(mem_ctx, "/%s/%s",
- config->snapdir, snaptime_string);
+
+ if (config->snapdir_absolute) {
+ result = talloc_asprintf(mem_ctx, "%s/%s",
+ config->snapdir, snaptime_string);
+ } else {
+ result = talloc_asprintf(mem_ctx, "/%s/%s",
+ config->snapdir, snaptime_string);
+ }
+ if (result == NULL) {
+ DEBUG(1, (__location__ " talloc_asprintf failed\n"));
+ }
+
+ return result;
}
/**