1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

s3: VFS: Add SMB_VFS_CREATE_DFS_PATHAT().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Jeremy Allison 2020-01-09 10:13:14 -08:00
parent 86a31defbf
commit b0b9dd2f86
7 changed files with 115 additions and 0 deletions

View File

@ -103,6 +103,15 @@ static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
return NT_STATUS_NOT_IMPLEMENTED;
}
static NTSTATUS skel_create_dfs_pathat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const struct referral *reflist,
size_t referral_count)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
static DIR *skel_opendir(vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
const char *mask,
@ -1032,6 +1041,7 @@ static struct vfs_fn_pointers skel_opaque_fns = {
.statvfs_fn = skel_statvfs,
.fs_capabilities_fn = skel_fs_capabilities,
.get_dfs_referrals_fn = skel_get_dfs_referrals,
.create_dfs_pathat_fn = skel_create_dfs_pathat,
.snap_check_path_fn = skel_snap_check_path,
.snap_create_fn = skel_snap_create,
.snap_delete_fn = skel_snap_delete,

View File

@ -100,6 +100,19 @@ static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
}
static NTSTATUS skel_create_dfs_pathat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const struct referral *reflist,
size_t referral_count)
{
return SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle,
dirfsp,
smb_fname,
reflist,
referral_count);
}
static DIR *skel_opendir(vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
const char *mask,
@ -1330,6 +1343,7 @@ static struct vfs_fn_pointers skel_transparent_fns = {
.statvfs_fn = skel_statvfs,
.fs_capabilities_fn = skel_fs_capabilities,
.get_dfs_referrals_fn = skel_get_dfs_referrals,
.create_dfs_pathat_fn = skel_create_dfs_pathat,
.snap_check_path_fn = skel_snap_check_path,
.snap_create_fn = skel_snap_create,
.snap_delete_fn = skel_snap_delete,

View File

@ -288,6 +288,7 @@
/* Version 42 - Remove SMB_VFS_CHOWN */
/* Version 42 - Remove struct write_cache *wcp from files_struct */
/* Version 42 - SMB_VFS_NTIMES() receives null times based on UTIMES_OMIT */
/* Version 42 - Add SMB_VFS_CREATE_DFS_PATHAT() */
#define SMB_VFS_INTERFACE_VERSION 42
@ -547,6 +548,7 @@ typedef struct connection_struct {
struct smbd_smb2_request;
struct privilege_paths;
struct referral;
struct smb_request {
uint8_t cmd;
@ -702,6 +704,11 @@ struct vfs_fn_pointers {
*/
NTSTATUS (*get_dfs_referrals_fn)(struct vfs_handle_struct *handle,
struct dfs_GetDFSReferral *r);
NTSTATUS (*create_dfs_pathat_fn)(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const struct referral *reflist,
size_t referral_count);
/* Directory operations */
@ -1205,6 +1212,11 @@ uint32_t smb_vfs_call_fs_capabilities(struct vfs_handle_struct *handle,
*/
NTSTATUS smb_vfs_call_get_dfs_referrals(struct vfs_handle_struct *handle,
struct dfs_GetDFSReferral *r);
NTSTATUS smb_vfs_call_create_dfs_pathat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const struct referral *reflist,
size_t referral_count);
DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
const char *mask,
@ -1642,6 +1654,11 @@ uint32_t vfs_not_implemented_fs_capabilities(struct vfs_handle_struct *handle,
enum timestamp_set_resolution *p_ts_res);
NTSTATUS vfs_not_implemented_get_dfs_referrals(struct vfs_handle_struct *handle,
struct dfs_GetDFSReferral *r);
NTSTATUS vfs_not_implemented_create_dfs_pathat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const struct referral *reflist,
size_t referral_count);
DIR *vfs_not_implemented_opendir(vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
const char *mask,

View File

@ -78,6 +78,19 @@
#define SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r) \
smb_vfs_call_get_dfs_referrals((handle)->next, (r))
#define SMB_VFS_CREATE_DFS_PATHAT(conn, dirfsp, smb_fname, reflist, count) \
smb_vfs_call_create_dfs_pathat((conn)->vfs_handles, \
(dirfsp), \
(smb_fname), \
(reflist), \
(count))
#define SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle, dirfsp, smb_fname, reflist, count) \
smb_vfs_call_create_dfs_pathat((handle)->next, \
(dirfsp), \
(smb_fname), \
(reflist), \
(count))
/* Directory operations */
#define SMB_VFS_OPENDIR(conn, smb_fname, mask, attr) \
smb_vfs_call_opendir((conn)->vfs_handles, (smb_fname), (mask), (attr))

View File

@ -368,6 +368,42 @@ static NTSTATUS vfswrap_get_dfs_referrals(struct vfs_handle_struct *handle,
return NT_STATUS_OK;
}
static NTSTATUS vfswrap_create_dfs_pathat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const struct referral *reflist,
size_t referral_count)
{
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status = NT_STATUS_NO_MEMORY;
int ret;
char *msdfs_link = NULL;
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
/* Form the msdfs_link contents */
msdfs_link = msdfs_link_string(frame,
reflist,
referral_count);
if (msdfs_link == NULL) {
goto out;
}
ret = symlinkat(msdfs_link,
dirfsp->fh->fd,
smb_fname->base_name);
if (ret == 0) {
status = NT_STATUS_OK;
} else {
status = map_nt_error_from_unix(errno);
}
out:
TALLOC_FREE(frame);
return status;
}
static NTSTATUS vfswrap_snap_check_path(struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
const char *service_path,
@ -3480,6 +3516,7 @@ static struct vfs_fn_pointers vfs_default_fns = {
.statvfs_fn = vfswrap_statvfs,
.fs_capabilities_fn = vfswrap_fs_capabilities,
.get_dfs_referrals_fn = vfswrap_get_dfs_referrals,
.create_dfs_pathat_fn = vfswrap_create_dfs_pathat,
.snap_check_path_fn = vfswrap_snap_check_path,
.snap_create_fn = vfswrap_snap_create,
.snap_delete_fn = vfswrap_snap_delete,

View File

@ -97,6 +97,15 @@ NTSTATUS vfs_not_implemented_get_dfs_referrals(struct vfs_handle_struct *handle,
return NT_STATUS_NOT_IMPLEMENTED;
}
NTSTATUS vfs_not_implemented_create_dfs_pathat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const struct referral *reflist,
size_t referral_count)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
DIR *vfs_not_implemented_opendir(vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
const char *mask,
@ -1037,6 +1046,7 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = {
.statvfs_fn = vfs_not_implemented_statvfs,
.fs_capabilities_fn = vfs_not_implemented_fs_capabilities,
.get_dfs_referrals_fn = vfs_not_implemented_get_dfs_referrals,
.create_dfs_pathat_fn = vfs_not_implemented_create_dfs_pathat,
.snap_check_path_fn = vfs_not_implemented_snap_check_path,
.snap_create_fn = vfs_not_implemented_snap_create,
.snap_delete_fn = vfs_not_implemented_snap_delete,

View File

@ -1563,6 +1563,20 @@ NTSTATUS smb_vfs_call_get_dfs_referrals(struct vfs_handle_struct *handle,
return handle->fns->get_dfs_referrals_fn(handle, r);
}
NTSTATUS smb_vfs_call_create_dfs_pathat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
const struct referral *reflist,
size_t referral_count)
{
VFS_FIND(create_dfs_pathat);
return handle->fns->create_dfs_pathat_fn(handle,
dirfsp,
smb_fname,
reflist,
referral_count);
}
DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
const char *mask,