summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-05-31 16:36:33 +0200
committerAndrew Bartlett <abartlet@samba.org>2013-10-05 09:21:10 +1300
commit2d5a3af4bc44d13877a26fa1857b3ceafe138de8 (patch)
treed93195a2f2c1bec6151833c7603873e21819cd38 /source3/modules
parented751b9ee49d8e4a319759640321e8b49be4f154 (diff)
downloadsamba-2d5a3af4bc44d13877a26fa1857b3ceafe138de8.tar.gz
samba-2d5a3af4bc44d13877a26fa1857b3ceafe138de8.tar.bz2
samba-2d5a3af4bc44d13877a26fa1857b3ceafe138de8.zip
shadow_copy2: introduce "shadow:mountpoint" option
Possiblity to explicitly set the share's mount point. This is useful mainly for debugging and testing purposes. 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.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index d584fa92af..afe2ff4638 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1583,6 +1583,7 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
const char *gmt_format;
const char *sort_order;
const char *basedir;
+ const char *mount_point;
DEBUG(10, (__location__ ": cnum[%u], connectpath[%s]\n",
(unsigned)handle->conn->cnum,
@@ -1649,11 +1650,43 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
return -1;
}
- config->mount_point = shadow_copy2_find_mount_point(config, handle);
- if (config->mount_point == NULL) {
- DEBUG(0, (__location__ ": shadow_copy2_find_mount_point "
- "failed: %s\n", strerror(errno)));
- return -1;
+ mount_point = lp_parm_const_string(SNUM(handle->conn),
+ "shadow", "mountpoint", NULL);
+ if (mount_point != NULL) {
+ if (mount_point[0] != '/') {
+ DEBUG(1, (__location__ " Warning: 'mountpoint' is "
+ "relative ('%s'), but it has to be an "
+ "absolute path. Ignoring provided value.\n",
+ mount_point));
+ mount_point = NULL;
+ } else {
+ char *p;
+ p = strstr(handle->conn->connectpath, mount_point);
+ if (p != handle->conn->connectpath) {
+ DEBUG(1, ("Warning: mount_point (%s) is not a "
+ "subdirectory of the share root "
+ "(%s). Ignoring provided value.\n",
+ mount_point,
+ handle->conn->connectpath));
+ mount_point = NULL;
+ }
+ }
+ }
+
+ if (mount_point != NULL) {
+ config->mount_point = talloc_strdup(config, mount_point);
+ if (config->mount_point == NULL) {
+ DEBUG(0, (__location__ " talloc_strdup() failed\n"));
+ return -1;
+ }
+ } else {
+ config->mount_point = shadow_copy2_find_mount_point(config,
+ handle);
+ if (config->mount_point == NULL) {
+ DEBUG(0, (__location__ ": shadow_copy2_find_mount_point"
+ " failed: %s\n", strerror(errno)));
+ return -1;
+ }
}
basedir = lp_parm_const_string(SNUM(handle->conn),