コード例 #1
0
        /// <summary>
        /// Verify RopGetNamesFromPropertyIds Failure Response
        /// </summary>
        /// <param name="ropGetNamesFromPropertyIdsResponse">The failure response of RopGetNamesFromPropertyIds request</param>
        /// <param name="inputHandleIndex">The field of InputHandleIndex in RopGetNamesFromPropertyIds request</param>
        private void VerifyRopGetNamesFromPropertyIdsFailureResponse(RopGetNamesFromPropertyIdsResponse ropGetNamesFromPropertyIdsResponse, byte inputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2664");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2664
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropGetNamesFromPropertyIdsResponse.RopId.GetType(),
                2664,
                @"[In RopGetNamesFromPropertyIds ROP Failure Response Buffer]RopId (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2666");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2666
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopGetNamesFromPropertyIds,
                ropGetNamesFromPropertyIdsResponse.RopId,
                2666,
                @"[In RopGetNamesFromPropertyIds ROP Failure Response Buffer,RopId (1 byte)]For this operation[RopGetNamesFromPropertyIds], this field is set to 0x55.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2667");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2667
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropGetNamesFromPropertyIdsResponse.InputHandleIndex.GetType(),
                2667,
                @"[In RopGetNamesFromPropertyIds ROP Failure Response Buffer]InputHandleIndex (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2668");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2668
            Site.CaptureRequirementIfAreEqual<byte>(
                inputHandleIndex,
                ropGetNamesFromPropertyIdsResponse.InputHandleIndex,
                2668,
                @"[In RopGetNamesFromPropertyIds ROP Failure Response Buffer,InputHandleIndex (1 byte)]This index MUST be set to the value specified in the InputHandleIndex field in the request.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2670");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2670
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropGetNamesFromPropertyIdsResponse.ReturnValue.GetType(),
                2670,
                @"[In RopGetNamesFromPropertyIds ROP Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer.");

            // Refer to MS-OXCROPS: For some ROPs, Exchange 2003 and Exchange 2007 use different methods to resolve 
            // the Server object and, therefore, do not fail the ROP if the index is invalid.
            if (Common.IsRequirementEnabled(4713, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4713");

                // Verify MS-OXCROPS requirement: MS-OXCROPS_R4713
                Site.CaptureRequirementIfAreEqual<uint>(
                    SuccessReturnValue,
                    ropGetNamesFromPropertyIdsResponse.ReturnValue,
                    4713,
                    @"[In Appendix B: Product Behavior] For some ROPs, Implementation does use different methods to resolve the Server object and, therefore, do not fail the ROP if the index is invalid. (<23> Section 3.2.5.1: For some ROPs, Exchange 2007 use different methods to resolve the Server object and, therefore, do not fail the ROP if the index is invalid.)");
            }
            else
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2672");

                // Verify MS-OXCROPS requirement: MS-OXCROPS_R2672
                Site.CaptureRequirementIfAreNotEqual<uint>(
                    SuccessReturnValue,
                    ropGetNamesFromPropertyIdsResponse.ReturnValue,
                    2672,
                    @"[In RopGetNamesFromPropertyIds ROP Failure Response Buffer,ReturnValue (4 bytes)]For this response[Failure Response], this field is set to a value other than 0x00000000.");
            }
        }
コード例 #2
0
        /// <summary>
        /// Verify the RopGetNamesFromPropertyIds operation related requirements.
        /// </summary>
        /// <param name="propertyIdCount">The PropertyIdCount parameter in the request buffer which indicates the number of PropertyId.</param>
        /// <param name="propertyIds">A list of PropertyId in the request buffer.</param>
        /// <param name="ropGetNamesFromPropertyIdsResponse">The RopGetNamesFromPropertyIds response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopGetNamesFromPropertyIds operation is acting on.</param>
        private void VerifyRopGetNamesFromPropertyIds(
            ushort propertyIdCount,
            PropertyId[] propertyIds,
            RopGetNamesFromPropertyIdsResponse ropGetNamesFromPropertyIdsResponse,
            ServerObjectType objectType)
        {
            // Since the RopGetNamesFromPropertyIds ROP response was parsed successfully, MS-OXCPRPT_R51802 can be captured directly.
            Site.CaptureRequirement(
                51802,
                @"[In Processing RopGetNamesFromPropertyIds] The server responds with a RopGetNamesFromPropertyIds ROP response buffer.");

            if (ropGetNamesFromPropertyIdsResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None))
            {
                if (objectType == ServerObjectType.Message)
                {
                    // If the object type this operation acting on is Message object and this operation is performed successfully, then the following requirement can be captured.
                    Site.CaptureRequirement(
                        23701,
                        @"[In RopGetNamesFromPropertyIds ROP] This operation [RopGetNamesFromPropertyIds ROP] is valid on Message objects.");
                }

                if (objectType == ServerObjectType.Folder)
                {
                    // If the object type this operation acting on is Folder object and this operation is performed successfully, then the following requirement can be captured.
                    Site.CaptureRequirement(
                        23703,
                        @"[In RopGetNamesFromPropertyIds ROP] This operation [RopGetNamesFromPropertyIds ROP] is valid on Folder objects.");
                }

                if (objectType == ServerObjectType.Attachment)
                {
                    // If the object type this operation acting on is Attachment object and this operation is performed successfully, then the following requirement can be captured.
                    Site.CaptureRequirement(
                        23702,
                        @"[In RopGetNamesFromPropertyIds ROP] This operation [RopGetNamesFromPropertyIds ROP] is valid on Attachment objects.");
                }

                if (objectType == ServerObjectType.Logon)
                {
                    // If the object type this operation acting on is Logon object and this operation is performed successfully, then the following requirement can be captured.
                    Site.CaptureRequirement(
                        23704,
                        @"[In RopGetNamesFromPropertyIds ROP] This operation [RopGetNamesFromPropertyIds ROP] is valid on Logon objects.");
                }

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                  248,
                  @"[In RopGetNamesFromPropertyIds ROP Response Buffer] PropertyNameCount: 2 bytes integer.");

                if (ropGetNamesFromPropertyIdsResponse.PropertyNameCount != 0)
                {
                    // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                    Site.CaptureRequirement(
                          250,
                          @"[In RopGetNamesFromPropertyIds ROP Response Buffer] PropertyNames (variable): An array of PropertyName structures ([MS-OXCDATA] section 2.6).");
                }

                // Add the debug information
                Site.Log.Add(
                    LogEntryKind.Debug,
                    "Verify MS-OXCPRPT_R658, PropertyNameCount is {0}, ProertyNames is {1}",
                    ropGetNamesFromPropertyIdsResponse.PropertyNameCount,
                    ropGetNamesFromPropertyIdsResponse.PropertyNames);
            }

            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R249
            Site.CaptureRequirementIfAreEqual<ushort>(
                propertyIdCount,
                ropGetNamesFromPropertyIdsResponse.PropertyNameCount,
                249,
                @"[In RopGetNamesFromPropertyIds ROP Response Buffer] PropertyNameCount: This value MUST be equal to the value of the PropertyIdCount field of the ROP request buffer. ");

            Site.CaptureRequirementIfAreEqual<ushort>(
               propertyIdCount,
               (ushort)ropGetNamesFromPropertyIdsResponse.PropertyNames.Length,
               24802,
               @"[In RopGetNamesFromPropertyIds ROP Response Buffer] propertyNameCount: An integer that specifies the number of structures contained in the PropertyNames field. ");

            // Examine each property ID in the request message and each associated PropertyName in the response message.The order of the ID and Name matches.
            for (int i = 0; i < propertyIds.Length; i++)
            {
                if (propertyIds[i].ID < 0x8000)
                {
                    // Add the debug information
                    Site.Log.Add(
                        LogEntryKind.Debug,
                        "Verify MS-OXCPRPT_R518,The PropertyId requested is {0}, The GUID response in PropertyName is {1}, The expected value of GUID is {2}",
                        propertyIds[i].ID,
                        ropGetNamesFromPropertyIdsResponse.PropertyNames[i].Guid.ToString(),
                        this.valuePSMAPI.ToString());

                    // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R518
                    // Check whether the PropertyName's GUID is PS-MAPI
                    bool isVerifyR518 = Common.CompareByteArray(ropGetNamesFromPropertyIdsResponse.PropertyNames[i].Guid, this.valuePSMAPI);

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR518,
                        518,
                        @"[In Processing RopGetNamesFromPropertyIds] For each property ID in the PropertyIds field of the ROP request buffer, the server MUST perform the following: If the property ID is less than 0x8000, the associated PropertyName structure ([MS-OXCDATA] section 2.6.1) contained in the PropertyNames field of the ROP response buffer MUST be composed as follows: The structure's GUID field is set to the PS_MAPI property set ([MS-OXPROPS] section 1.3.2).");

                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R519");

                    Site.CaptureRequirementIfAreEqual<byte>(
                        0x00,
                        ropGetNamesFromPropertyIdsResponse.PropertyNames[i].Kind,
                        519,
                        @"[In Processing RopGetNamesFromPropertyIds] For each property ID in the PropertyIds field of the ROP request buffer, the server MUST perform the following: If the property ID is less than 0x8000, the associated PropertyName structure ([MS-OXCDATA] section 2.6.1) contained in the PropertyNames field of the ROP response buffer MUST be composed as follows:: The structure's Kind field is set to 0x00.");

                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R520");

                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)propertyIds[i].ID,
                        (uint)ropGetNamesFromPropertyIdsResponse.PropertyNames[i].LID,
                        520,
                        @"[In Processing RopGetNamesFromPropertyIds] For each property ID in the PropertyIds field of the ROP request buffer, the server MUST perform the following: If the property ID is less than 0x8000, the associated PropertyName structure ([MS-OXCDATA] section 2.6.1) contained in the PropertyNames field of the ROP response buffer MUST be composed as follows:: The structure's LID field is set to the property ID.");
                }
            }

            bool isCDATAR25Valid = true;
            bool isCDATAR27Valid = true;
            foreach (PropertyName propertyName in ropGetNamesFromPropertyIdsResponse.PropertyNames)
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    "MS-OXCDATA",
                    30,
                    @"[In PropertyName Structure] Name (optional) (variable):  The value is a Unicode (UTF-16 format) string, followed by two zero bytes as terminating null characters, that identifies the property within its property set.");

                Site.CaptureRequirementIfIsNotNull(
                    propertyName.Guid,
                    "MS-OXCDATA",
                    21,
                    @"[In PropertyName Structure] GUID (16 bytes):  The GUID that identifies the property set for the named property.");

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    "MS-OXCDATA",
                    26,
                    @"[In PropertyName Structure] LID (optional) (4 bytes):  An unsigned integer that identifies the named property within its property set.");

                if ((propertyName.LID != 0x00 && propertyName.Kind != 0x00) || ((propertyName.Kind == 0x01 || propertyName.Kind == 0x0ff) && propertyName.LID != 0x00))
                {
                    isCDATAR25Valid = false;
                }

                if ((propertyName.NameSize != null && propertyName.Kind != 0x01) || ((propertyName.Kind == 0x00 || propertyName.Kind == 0x0ff) && propertyName.NameSize != null))
                {
                    isCDATAR27Valid = false;
                }
            }

            Site.CaptureRequirementIfIsTrue(
                isCDATAR25Valid,
                "MS-OXCDATA",
                25,
                @"[In PropertyName Structure] LID (optional) (4 bytes): This field is present only if the value of the Kind field is equal to 0x00.");

            Site.CaptureRequirementIfIsTrue(
               isCDATAR27Valid,
               "MS-OXCDATA",
               27,
               @"[In PropertyName Structure] NameSize (optional) (1 byte):  This field is present only if the value of the Kind field is equal to 0x01.");

            Site.CaptureRequirementIfIsTrue(
               isCDATAR27Valid,
               "MS-OXCDATA",
               29,
               @"[In PropertyName Structure] Name (optional) (variable): This field is present only if Kind is equal to 0x01.");

            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R521
            // The property ID values has been verified that have an associated PropertyName.
            // Server will set the PropertyName value according to the PropertyId. So if the returned PropertyNames is not null, this requirement can be verified.
            Site.CaptureRequirementIfIsNotNull(
                ropGetNamesFromPropertyIdsResponse.PropertyNames,
                521,
                @"[In Processing RopGetNamesFromPropertyIds] For each property ID in the PropertyIds field of the ROP request buffer, the server MUST perform the following: For property IDs that have an associated PropertyName structure, the server MUST return the PropertyName structure associated with the property ID.");

            // Since the RopGetNamesFromPropertyIds ROP response was parsed successfully, MS-OXCPRPT_R230 can be captured directly.
            Site.CaptureRequirement(
                230,
                @"[In RopGetNamesFromPropertyIds ROP] The RopGetNamesFromPropertyIds ROP ([MS-OXCROPS] section 2.2.8.2) maps concrete property IDs to abstract, client-defined named properties");
        }
コード例 #3
0
        /// <summary>
        /// Verify RopGetNamesFromPropertyIds Success Response
        /// </summary>
        /// <param name="ropGetNamesFromPropertyIdsResponse">The success response of RopGetNamesFromPropertyIds request</param>
        /// <param name="inputHandleIndex">The field of InputHandleIndex in RopGetNamesFromPropertyIds request</param>
        private void VerifyRopGetNamesFromPropertyIdsSuccessResponse(RopGetNamesFromPropertyIdsResponse ropGetNamesFromPropertyIdsResponse, byte inputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2649");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2649
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropGetNamesFromPropertyIdsResponse.RopId.GetType(),
                2649,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer]RopId (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2651");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2651
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopGetNamesFromPropertyIds,
                ropGetNamesFromPropertyIdsResponse.RopId,
                2651,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer,RopId (1 byte)] For this operation[RopGetNamesFromPropertyIds], this field is set to 0x55.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2652");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2652
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropGetNamesFromPropertyIdsResponse.InputHandleIndex.GetType(),
                2652,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer]InputHandleIndex (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2653");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2653
            Site.CaptureRequirementIfAreEqual<byte>(
                inputHandleIndex,
                ropGetNamesFromPropertyIdsResponse.InputHandleIndex,
                2653,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer,InputHandleIndex (1 byte)]This index MUST be set to the InputHandleIndex specified in the request.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2655");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2655
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropGetNamesFromPropertyIdsResponse.ReturnValue.GetType(),
                2655,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer]ReturnValue (4 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2657");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2657
            Site.CaptureRequirementIfAreEqual<uint>(
                SuccessReturnValue,
                ropGetNamesFromPropertyIdsResponse.ReturnValue,
                2657,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer,ReturnValue (4 bytes)]For this response[Success Response ], this field is set to 0x00000000.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2658");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2658
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ushort),
                ropGetNamesFromPropertyIdsResponse.PropertyNameCount.GetType(),
                2658,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer]PropertyNameCount (2 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2660");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2660
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(PropertyName[]),
                ropGetNamesFromPropertyIdsResponse.PropertyNames.GetType(),
                2660,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer]PropertyNames (variable): A list of PropertyName structures.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2661");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2661
            Site.CaptureRequirementIfAreEqual<int>(
                ropGetNamesFromPropertyIdsResponse.PropertyNameCount,
                ropGetNamesFromPropertyIdsResponse.PropertyNames.Length,
                2661,
                @"[In RopGetNamesFromPropertyIds ROP Success Response Buffer,PropertyNames (variable)]The number of structures contained in this field is specified by the PropertyNameCount field.");
        }