Patch: Move the error handling for svhdx to vfswrap_create
Jeremy Allison
jra at samba.org
Fri Jul 31 16:29:34 UTC 2015
On Tue, Jul 28, 2015 at 07:16:50PM -0700, Richard Sharpe wrote:
> Hi folks,
>
> A cleaned up version of that patch with my signed-off-by.
OK, looking carefully I don't think we need the changes to
smbd_smb2_create_send() that remove the smb2_create_blob_find()
of SVHDX_OPEN_DEVICE_CONTEXT. It doesn't do any harm and
shows what blobs we can process even if we don't use it
here.
We only need the:
> - if (svhdx != NULL) {
> - /* SharedVHD is not yet supported */
> - tevent_req_nterror(
> - req, NT_STATUS_INVALID_DEVICE_REQUEST);
> - return tevent_req_post(req, ev);
> - }
change in smbd_smb2_create_send() I think.
Do you agree ?
Jeremy.
> From 96b77e73157ff28467046196309df78aafc7aa2e Mon Sep 17 00:00:00 2001
> From: Richard Sharpe <rsharpe at samba.org>
> Date: Tue, 28 Jul 2015 19:08:02 -0700
> Subject: [PATCH] Move the error handling for svhdx to vfswrap_create to give
> VFS module writers a chance to handle RSVD opens if they want to.
>
> Signed-off-by: Richard Sharpe <rsharpe at samba.org>
> ---
> source3/modules/vfs_default.c | 11 +++++++++++
> source3/smbd/smb2_create.c | 15 ---------------
> 2 files changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
> index 10d0f3b..05c52ff 100644
> --- a/source3/modules/vfs_default.c
> +++ b/source3/modules/vfs_default.c
> @@ -562,6 +562,17 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
> const struct smb2_create_blobs *in_context_blobs,
> struct smb2_create_blobs *out_context_blobs)
> {
> + struct smb2_create_blob *svhdx = NULL;
> +
> + svhdx = smb2_create_blob_find(&in_context_blobs,
> + SVHDX_OPEN_DEVICE_CONTEXT);
> +
> + if (svhdx != NULL) {
> + /* SharedVHD is not yet supported */
> + DEBUG(10, ("Shared VHD not yet supported, INVALID_DEVICE_REQUEST\n"));
> + return NT_STATUS_INVALID_DEVICE_REQUEST;
> + }
> +
> return create_file_default(handle->conn, req, root_dir_fid, smb_fname,
> access_mask, share_access,
> create_disposition, create_options,
> diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
> index 880ceee..c9cc9bd 100644
> --- a/source3/smbd/smb2_create.c
> +++ b/source3/smbd/smb2_create.c
> @@ -675,7 +675,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
> struct smb2_lease lease;
> struct smb2_lease *lease_ptr = NULL;
> ssize_t lease_len = -1;
> - struct smb2_create_blob *svhdx = NULL;
>
> exta = smb2_create_blob_find(&in_context_blobs,
> SMB2_CREATE_TAG_EXTA);
> @@ -689,13 +688,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
> SMB2_CREATE_TAG_TWRP);
> qfid = smb2_create_blob_find(&in_context_blobs,
> SMB2_CREATE_TAG_QFID);
> - if (smb2req->xconn->protocol >= PROTOCOL_SMB3_02) {
> - /*
> - * This was introduced with SMB3_02
> - */
> - svhdx = smb2_create_blob_find(&in_context_blobs,
> - SVHDX_OPEN_DEVICE_CONTEXT);
> - }
>
> fname = talloc_strdup(state, in_name);
> if (tevent_req_nomem(fname, req)) {
> @@ -910,13 +902,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
> }
> }
>
> - if (svhdx != NULL) {
> - /* SharedVHD is not yet supported */
> - tevent_req_nterror(
> - req, NT_STATUS_INVALID_DEVICE_REQUEST);
> - return tevent_req_post(req, ev);
> - }
> -
> /* these are ignored for SMB2 */
> in_create_options &= ~(0x10);/* NTCREATEX_OPTIONS_SYNC_ALERT */
> in_create_options &= ~(0x20);/* NTCREATEX_OPTIONS_ASYNC_ALERT */
> --
> 2.4.2
>
More information about the samba-technical
mailing list