From dafb1ad4b65de92470711b876838a2d73e9203c8 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sat, 22 Jul 2017 18:40:16 +0200 Subject: [PATCH] s3/smbd: move requested_oplock_level into smbd_smb2_create_state Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- source3/smbd/smb2_create.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index dbf0fe852aa..cec134b51dc 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -438,6 +438,7 @@ struct smbd_smb2_create_state { struct deferred_open_record *open_rec; files_struct *result; bool replay_operation; + int requested_oplock_level; uint8_t out_oplock_level; uint32_t out_create_action; struct timespec out_creation_ts; @@ -479,7 +480,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, NTSTATUS status; struct smb_request *smb1req = NULL; int info; - int requested_oplock_level; struct smb2_create_blob *dhnc = NULL; struct smb2_create_blob *dh2c = NULL; struct smb2_create_blob *dhnq = NULL; @@ -512,12 +512,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, struct smb2_create_blob *svhdx = NULL; #endif - if(lp_fake_oplocks(SNUM(smb2req->tcon->compat))) { - requested_oplock_level = SMB2_OPLOCK_LEVEL_NONE; - } else { - requested_oplock_level = in_oplock_level; - } - req = tevent_req_create(mem_ctx, &state, struct smbd_smb2_create_state); if (req == NULL) { @@ -553,6 +547,12 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, TALLOC_FREE(smb2req->subreq); smb2req->subreq = req; + if (lp_fake_oplocks(SNUM(smb2req->tcon->compat))) { + state->requested_oplock_level = SMB2_OPLOCK_LEVEL_NONE; + } else { + state->requested_oplock_level = in_oplock_level; + } + /* these are ignored for SMB2 */ in_create_options &= ~(0x10);/* NTCREATEX_OPTIONS_SYNC_ALERT */ in_create_options &= ~(0x20);/* NTCREATEX_OPTIONS_ASYNC_ALERT */ @@ -999,7 +999,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, if (!smb2_lease_key_valid(&lease.lease_key)) { lease_ptr = NULL; - requested_oplock_level = SMB2_OPLOCK_LEVEL_NONE; + state->requested_oplock_level = SMB2_OPLOCK_LEVEL_NONE; } if ((smb2req->xconn->protocol < PROTOCOL_SMB3_00) && @@ -1123,9 +1123,9 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, struct smb_filename *smb_fname = NULL; uint32_t ucf_flags; - if (requested_oplock_level == SMB2_OPLOCK_LEVEL_LEASE) { + if (state->requested_oplock_level == SMB2_OPLOCK_LEVEL_LEASE) { if (lease_ptr == NULL) { - requested_oplock_level = SMB2_OPLOCK_LEVEL_NONE; + state->requested_oplock_level = SMB2_OPLOCK_LEVEL_NONE; } } else { lease_ptr = NULL; @@ -1200,7 +1200,8 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, in_create_disposition, in_create_options, in_file_attributes, - map_smb2_oplock_levels_to_samba(requested_oplock_level), + map_smb2_oplock_levels_to_samba( + state->requested_oplock_level), lease_ptr, allocation_size, 0, /* private_flags */ -- 2.47.3