mirror of
https://github.com/samba-team/samba.git
synced 2025-02-24 13:57:43 +03:00
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>
This commit is contained in:
parent
ed751b9ee4
commit
2d5a3af4bc
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user