コード例 #1
0
        public void ReadConfig(out ResilientHandleServerConfig config)
        {
            resilientHandleConfig = new ResilientHandleServerConfig
            {
                MaxSmbVersionSupported         = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                IsIoCtlCodeResiliencySupported = testConfig.IsIoCtlCodeSupported(CtlCode_Values.FSCTL_LMR_REQUEST_RESILIENCY),
                Platform = testConfig.Platform >= Platform.WindowsServer2016 ? Platform.WindowsServer2016 : testConfig.Platform
            };
            config = resilientHandleConfig;

            prepareOpenClient = null;
            Site.Log.Add(LogEntryKind.Debug, resilientHandleConfig.ToString());

            // Resilient only applies only to servers that implement the SMB 2.1 or the SMB 3.x dialect family.
            testConfig.CheckDialect(DialectRevision.Smb21);
        }
コード例 #2
0
        public static void IoCtlResiliencyResponse(ModelSmb2Status status, ResilientHandleServerConfig c)
        {
            Condition.IsTrue(State == ModelState.Connected);
            Condition.IsNotNull(Open);

            Condition.IsTrue(Config.Platform == c.Platform);
            Condition.IsTrue(Config.MaxSmbVersionSupported == c.MaxSmbVersionSupported);
            Condition.IsTrue(Config.IsIoCtlCodeResiliencySupported == c.IsIoCtlCodeResiliencySupported);

            ModelResiliencyRequest resiliencyRequest = ModelHelper.RetrieveOutstandingRequest<ModelResiliencyRequest>(ref Request);

            ModelHelper.Log(LogType.Requirement, "3.3.5.15.9 Handling a Resiliency Request");
            ModelHelper.Log(LogType.Requirement, "This section applies only to servers that implement the SMB 2.1 or the SMB 3.x dialect family.");
            if (c.MaxSmbVersionSupported == ModelDialectRevision.Smb2002)
            {
                ModelHelper.Log(LogType.TestInfo, "The server only supports SMB 2.002.");
                ModelHelper.Log(LogType.TestTag, TestTag.Compatibility);
                return;
            }

            if (Connection_Dialect == DialectRevision.Smb2002)
            {
                ModelHelper.Log(LogType.Requirement, "If Open.Connection.Dialect is \"2.002\", the server MAY<320> fail the request with STATUS_INVALID_DEVICE_REQUEST.");
                ModelHelper.Log(LogType.TestInfo, "Open.Connection.Dialect is \"2.002\".");
                ModelHelper.Log(LogType.TestTag, TestTag.Compatibility);
                if (c.Platform == Platform.NonWindows)
                {
                    ModelHelper.Log(LogType.TestInfo, "The SUT platform is NonWindows.");
                    if (status == ModelSmb2Status.STATUS_INVALID_DEVICE_REQUEST)
                    {
                        return;
                    }
                }
                else
                {
                    ModelHelper.Log(LogType.TestInfo, "The SUT platform is Windows.");
                    Condition.IsFalse(status == ModelSmb2Status.STATUS_INVALID_DEVICE_REQUEST);
                }

            }

            if (!c.IsIoCtlCodeResiliencySupported)
            {
                ModelHelper.Log(LogType.Requirement,
                    "Otherwise, if the server does not support FSCTL_LMR_REQUEST_RESILIENCY requests, the server SHOULD fail the request with STATUS_NOT_SUPPORTED.");
                ModelHelper.Log(LogType.TestInfo,
                    "The server does not support FSCTL_LMR_REQUEST_RESILIENCY requests.");
                ModelHelper.Log(LogType.TestTag, TestTag.Compatibility);
                if (c.Platform == Platform.NonWindows)
                {// Non Windows
                    ModelHelper.Log(LogType.TestInfo, "The SUT platform is NonWindows.");
                    Condition.IsFalse(status == ModelSmb2Status.STATUS_SUCCESS);
                }
                else
                {// Windows
                    ModelHelper.Log(LogType.TestInfo, "The SUT platform is Windows.");
                    Condition.IsTrue(status == ModelSmb2Status.STATUS_NOT_SUPPORTED);
                    return;
                }
            }

            if (resiliencyRequest.InputCount == IoCtlInputCount.InputCountSmallerThanRequestSize
                || resiliencyRequest.Timeout == ResilientTimeout.InvalidTimeout)
            {
                ModelHelper.Log(LogType.Requirement,
                    "If InputCount is smaller than the size of the NETWORK_RESILIENCY_REQUEST request as specified in section 2.2.31.3, " +
                    "or if the requested Timeout in seconds is greater than MaxResiliencyTimeout in seconds, the request MUST be failed with STATUS_INVALID_PARAMETER.");
                ModelHelper.Log(LogType.TestInfo,
                    "InputCount is {0}smaller than the size of the NETWORK_RESILIENCY_REQUEST request.",
                    resiliencyRequest.InputCount == IoCtlInputCount.InputCountSmallerThanRequestSize ? "" : "not ");
                ModelHelper.Log(LogType.TestInfo,
                    "The requested Timeout is {0} greater than MaxResiliencyTimeout.",
                    resiliencyRequest.Timeout == ResilientTimeout.InvalidTimeout ? "" : "not ");
                ModelHelper.Log(LogType.TestTag, TestTag.OutOfBoundary);
                Condition.IsTrue(status == ModelSmb2Status.STATUS_INVALID_PARAMETER);
                return;
            }

            ModelHelper.Log(LogType.Requirement, "Open.IsDurable MUST be set to FALSE. Open.IsResilient MUST be set to TRUE. ");
            ModelHelper.Log(LogType.TestInfo, "Open.IsDurable is set to FALSE. Open.IsResilient is set to TRUE.");
            Open.IsDurable = false;
            Open.IsResilient = true;

            ModelHelper.Log(LogType.Requirement,
                "Open.DurableOwner MUST be set to a security descriptor accessible only by the user represented by Open.Session.SecurityContext.");
            ModelHelper.Log(LogType.TestInfo, "Open.DurableOwner is set to default user.");
            Open.DurableOwner = ModelUser.DefaultUser; // In Resilient Handle Mode, Resilient always be requested as default user

            Condition.IsTrue(status == ModelSmb2Status.STATUS_SUCCESS);
        }
コード例 #3
0
        public static void ReadConfigReturn(ResilientHandleServerConfig c)
        {
            Condition.IsTrue(State == ModelState.Uninitialized);

            Condition.IsTrue(c.MaxSmbVersionSupported == ModelDialectRevision.Smb2002
                || c.MaxSmbVersionSupported == ModelDialectRevision.Smb21
                || c.MaxSmbVersionSupported == ModelDialectRevision.Smb30
                || c.MaxSmbVersionSupported == ModelDialectRevision.Smb302);

            Config = c;
            State = ModelState.Initialized;
        }
        public void ReadConfig(out ResilientHandleServerConfig config)
        {
            resilientHandleConfig = new ResilientHandleServerConfig
            {
                MaxSmbVersionSupported = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                IsLeasingSupported = testConfig.IsLeasingSupported,
                IsIoCtlCodeResiliencySupported = testConfig.IsIoCtlCodeSupported(CtlCode_Values.FSCTL_LMR_REQUEST_RESILIENCY),
                Platform = testConfig.Platform
            };
            config = resilientHandleConfig;

            prepareOpenClient = null;
            Site.Log.Add(LogEntryKind.Debug, resilientHandleConfig.ToString());

            // Resilient only applies only to servers that implement the SMB 2.1 or the SMB 3.x dialect family.
            testConfig.CheckDialect(DialectRevision.Smb21);
        }