diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c index 5eab0a1..6ec918d 100644 --- a/source3/smbd/smb2_break.c +++ b/source3/smbd/smb2_break.c @@ -74,8 +74,19 @@ NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req) /* Are we awaiting a break message ? */ if (in_fsp->oplock_timeout == NULL) { - return smbd_smb2_request_error( - req, NT_STATUS_INVALID_OPLOCK_PROTOCOL); + DEBUG(1, ("Invalid request: no oplock. in_oplock_level 0x%x lease type 0x%x\n", in_oplock_level, fsp_lease_type(in_fsp))); + /* See MS-SMB2 3.3.5.22.1 */ + if (in_oplock_level == SMB2_OPLOCK_LEVEL_LEASE) + return smbd_smb2_request_error( + req, NT_STATUS_INVALID_PARAMETER); + else if ((in_oplock_level == SMB2_OPLOCK_LEVEL_NONE) || + ((in_oplock_level == SMB2_OPLOCK_LEVEL_II) && + (fsp_lease_type(in_fsp) != SMB2_OPLOCK_LEVEL_II))) + return smbd_smb2_request_error( + req, NT_STATUS_INVALID_DEVICE_STATE); + else + return smbd_smb2_request_error( + req, NT_STATUS_INVALID_OPLOCK_PROTOCOL); } if (in_oplock_level != SMB2_OPLOCK_LEVEL_NONE &&