Пример #1
0
        public static void ReadConfigReturn(CreateCloseConfig c)
        {
            Condition.IsTrue(State == ModelState.Uninitialized);
            Condition.IsNotNull(c);
            Config = c;
            State  = ModelState.Initialized;

            // Force SE to expand Config.MaxSmbVersionServerSupported
            Condition.IsTrue(c.MaxSmbVersionServerSupported == ModelDialectRevision.Smb2002 ||
                             c.MaxSmbVersionServerSupported == ModelDialectRevision.Smb21 ||
                             c.MaxSmbVersionServerSupported == ModelDialectRevision.Smb30 ||
                             c.MaxSmbVersionServerSupported == ModelDialectRevision.Smb302);
        }
Пример #2
0
        public static void CreateResponse(ModelSmb2Status status, CreateCloseConfig c)
        {
            Condition.IsTrue(Config.Platform == c.Platform);
            Condition.IsTrue(State == ModelState.Connected);

            ModelCreateRequest createRequest = ModelHelper.RetrieveOutstandingRequest <ModelCreateRequest>(ref Request);

            if (createRequest.NameType == CreateFileNameType.StartWithPathSeparator)
            {
                ModelHelper.Log(LogType.Requirement, "3.3.5.9: If the file name length is greater than zero and the first character is a path separator character, the server MUST fail the request with STATUS_INVALID_PARAMETER.");
                ModelHelper.Log(LogType.TestInfo, "The first character in the file name of the Create Request is a path separator.");
                ModelHelper.Log(LogType.TestTag, TestTag.UnexpectedFields);
                Condition.IsTrue(status == ModelSmb2Status.STATUS_INVALID_PARAMETER);
                return;
            }

            if (createRequest.NameType == CreateFileNameType.OtherInvalidFileName)
            {
                ModelHelper.Log(LogType.Requirement, "3.3.5.9: If the file name fails to conform with the specification of a relative pathname in [MS-FSCC] section 2.1.5, the server MUST fail the request with STATUS_OBJECT_NAME_INVALID.");
                ModelHelper.Log(LogType.TestInfo, "The file name of the Create Request contains illegal character.");
                ModelHelper.Log(LogType.TestTag, TestTag.UnexpectedFields);
                Condition.IsTrue(status == ModelSmb2Status.STATUS_OBJECT_NAME_INVALID);
                return;
            }

            if (createRequest.ContextType == CreateContextType.InvalidCreateContext)
            {
                ModelHelper.Log(LogType.Requirement, "3.3.5.9: The server SHOULD fail any request having a create context not specified in section 2.2.13.2, with a STATUS_INVALID_PARAMETER error.");
                ModelHelper.Log(LogType.TestInfo, "The create context of Create Request is invalid");
                ModelHelper.Log(LogType.TestTag, TestTag.UnexpectedContext);
                if (Config.Platform != Platform.NonWindows)
                {
                    ModelHelper.Log(LogType.TestInfo, "The SUT platform is Windows");
                    Condition.IsTrue(status == ModelSmb2Status.STATUS_INVALID_PARAMETER);
                }
                else
                {
                    ModelHelper.Log(LogType.TestInfo, "The SUT platform is NonWindows");
                    Condition.IsTrue(status != ModelSmb2Status.STATUS_SUCCESS);
                }
                return;
            }

            // Create Context Validation:
            if (createRequest.ContextType == CreateContextType.InvalidCreateContextSize)
            {
                ModelHelper.Log(LogType.Requirement, "3.3.5.9: If the size of each individual create context is not equal to the DataLength of the create context, the server MUST fail the request with STATUS_INVALID_PARAMETER.");
                ModelHelper.Log(LogType.TestInfo, "The size of the create context in the Create Request is invalid.");
                ModelHelper.Log(LogType.TestTag, TestTag.OutOfBoundary);
                Condition.IsTrue(status == ModelSmb2Status.STATUS_INVALID_PARAMETER);
                return;
            }

            if (createRequest.ImpersonationType == ImpersonationLevelType.InvalidImpersonationLevel && Config.Platform != Platform.WindowsServer2008)
            {
                ModelHelper.Log(LogType.Requirement, "3.3.5.9: If the ImpersonationLevel in the request is not one of the values specified in section 2.2.13, the server SHOULD fail the request with STATUS_BAD_IMPERSONATION_LEVEL.");
                ModelHelper.Log(LogType.TestInfo, "The ImpersonationLevel of the Create Request is invalid.");
                ModelHelper.Log(LogType.TestTag, TestTag.UnexpectedFields);

                // <236> Section 3.3.5.9: Windows Vista and Windows Server 2008 do not fail the request if the ImpersonationLevel in the request is not one of the values specified in section 2.2.13.
                if (Config.Platform != Platform.NonWindows)
                {
                    ModelHelper.Log(LogType.TestInfo, "The SUT platform is Windows");
                    Condition.IsTrue(status == ModelSmb2Status.STATUS_BAD_IMPERSONATION_LEVEL);
                }
                else
                {
                    ModelHelper.Log(LogType.TestInfo, "The SUT platform is NonWindows");
                    Condition.IsTrue(status != ModelSmb2Status.STATUS_SUCCESS);
                }
                return;
            }

            ModelHelper.Log(LogType.Requirement, "3.3.5.9: If the open is successful, the server MUST allocate an open object for this open and insert it into Session.OpenTable and GlobalOpenTable. ");
            ModelHelper.Log(LogType.TestInfo, "The Create Request doesn't contain any invalid fields, the open is created successfully and server should return STATUS_SUCCESS");
            Condition.IsTrue(status == ModelSmb2Status.STATUS_SUCCESS);
            HasOpen = true;
        }