private void OnOplockBreakNotificationReceived(Packet_Header header, OPLOCK_BREAK_Notification_Packet packet)
        {
            Site.Log.Add(LogEntryKind.Debug, "OplockBreakNotification was received from server");

            Site.Assert.AreEqual(
                Smb2Command.OPLOCK_BREAK,
                header.Command,
                "The server MUST set the Command in the SMB2 header to SMB2 OPLOCK_BREAK");

            Site.Assert.AreEqual(
                0xFFFFFFFFFFFFFFFF,
                header.MessageId,
                "The server MUST set the MessageId to 0xFFFFFFFFFFFFFFFF");

            Site.Assert.AreEqual(
                (uint)0,
                header.TreeId,
                "The server MUST set the TreeId to 0");

            Site.Assert.AreEqual(
                fileId,
                packet.FileId,
                "The FileId field of the response structure MUST be set to the values from the Open structure, with the volatile part set to Open.FileId and the persistent part set to Open.DurableFileId");

            // Verify signature is set to 0 if it's not signed
            Site.Assert.AreEqual(
                true,
                BitConverter.ToUInt64(header.Signature, 0) == 0 && BitConverter.ToUInt64(header.Signature, 8) == 0,
                "The SMB2 Oplock Break Notification is sent to the client. The message MUST NOT be signed, as specified in section 3.3.4.1.1");

            OplockBreakNotification(packet.OplockLevel);
        }
예제 #2
0
        private void OnOpLockBreakNotificationReceived(Packet_Header respHeader, OPLOCK_BREAK_Notification_Packet OpLockBreakNotify)
        {
            BaseTestSite.Log.Add(
                LogEntryKind.Comment,
                "OpLockBreakNotification was received from server");
            OpLockBreakNotifyReceived = OpLockBreakNotify;

            ///The FileId field of the response structure MUST be set to the values from the Open structure,
            ///with the volatile part set to Open.FileId and the persistent part set to Open.DurableFileId.
            BaseTestSite.Assert.AreEqual(fileId, OpLockBreakNotify.FileId, "FileId should be identical");

            BaseTestSite.Assert.IsTrue(
                OpLockBreakNotify.OplockLevel == OPLOCK_BREAK_Notification_Packet_OplockLevel_Values.OPLOCK_LEVEL_II ||
                OpLockBreakNotify.OplockLevel == OPLOCK_BREAK_Notification_Packet_OplockLevel_Values.OPLOCK_LEVEL_NONE,
                "The new oplock level MUST be either SMB2_OPLOCK_LEVEL_NONE or SMB2_OPLOCK_LEVEL_II.");
            OpLockNotificationReceived.Set();
        }
        /// <summary>
        /// Handle the oplock break notification.
        /// </summary>
        /// <param name="respHeader">The SMB2 header included in the notification.</param>
        /// <param name="oplockBreakNotify">Oplock break notification payload in the notification.</param>
        private void OnOplockBreakNotificationReceived(Packet_Header respHeader, OPLOCK_BREAK_Notification_Packet oplockBreakNotify)
        {
            Smb2FunctionalClient client = null;

            if (smb2ClientMainChannel != null)
            {
                client = smb2ClientMainChannel;
            }
            else if (smb2ClientAlternativeChannel != null)
            {
                client = smb2ClientAlternativeChannel;
            }

            if (client != null)
            {
                Site.Log.Add(LogEntryKind.Debug, "Receive an oplock break notification and will send oplock break acknowledgment.");
                client.OplockAcknowledgement(
                    treeIdMainChannel,
                    fileIdMainChannel,
                    (OPLOCK_BREAK_Acknowledgment_OplockLevel_Values)oplockBreakNotify.OplockLevel,
                    checker: (responseHeader, response) => { }
                    );
            }
        }
 private void OnLeaseBreakNotificationReceived(Packet_Header header, OPLOCK_BREAK_Notification_Packet notification)
 {
     breakType = ModelBreakType.OplockBreak;
     oplockClient.OplockAcknowledgement(treeIdOplock, notification.FileId, (OPLOCK_BREAK_Acknowledgment_OplockLevel_Values)notification.OplockLevel);
 }