From 2d79eddbb3d553efa469b49f2e30d5e01af46389 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 2 Jun 2021 11:36:59 -0700 Subject: [PATCH] s3: smbd: Add can_write_to_fsp(). Not yet used. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/file_access.c | 11 +++++++++++ source3/smbd/proto.h | 1 + 2 files changed, 12 insertions(+) diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c index 0dd441b4468..54c99b17c5f 100644 --- a/source3/smbd/file_access.c +++ b/source3/smbd/file_access.c @@ -152,6 +152,17 @@ bool can_write_to_file(connection_struct *conn, FILE_WRITE_DATA)); } +/**************************************************************************** + Userspace check for write access to fsp. +****************************************************************************/ + +bool can_write_to_fsp(struct files_struct *fsp) +{ + return NT_STATUS_IS_OK(smbd_check_access_rights_fsp(fsp, + false, + FILE_WRITE_DATA)); +} + /**************************************************************************** Check for an existing default Windows ACL on a directory fsp. ****************************************************************************/ diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 26d65df8fab..f9691656ea2 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -337,6 +337,7 @@ bool can_delete_file_in_directory(connection_struct *conn, bool can_write_to_file(connection_struct *conn, struct files_struct *dirfsp, const struct smb_filename *smb_fname); +bool can_write_to_fsp(struct files_struct *fsp); bool directory_has_default_acl_fsp(struct files_struct *fsp); NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode); -- 2.47.3