/// <summary> /// Verify the RopCopyTo operation about public folder related requirements. /// </summary> /// <param name="ropCopyToResponse">The RopCopyTo response buffer structure.</param> private void VerifyRopCopyToForPublicFolder(RopCopyToResponse ropCopyToResponse) { if (Common.IsRequirementEnabled(5070513, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R5070513, the return error code value is: {0}", ropCopyToResponse.ReturnValue); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R5070513 Site.CaptureRequirementIfAreNotEqual<uint>( (uint)CPRPTErrorCode.NotSupported, ropCopyToResponse.ReturnValue, 5070513, @"[In Appendix A: Product Behavior] Implementation does not return a NotSupported error (0x80040102) if the RopCopyTo ROP request specifies a public folder as either the source object or the destination object. (<10> Section 3.2.5.8: Exchange 2007 and Exchange 2010 follow this behavior.)"); } if (Common.IsRequirementEnabled(5070514, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R5070514, the return error code value is: {0}", ropCopyToResponse.ReturnValue); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R5070514 Site.CaptureRequirementIfAreEqual<uint>( (uint)CPRPTErrorCode.NotSupported, ropCopyToResponse.ReturnValue, 5070514, @"[In Appendix A: Product Behavior] Implementation does return a NotSupported error (0x80040102) if the RopCopyTo ROP request specifies a public folder as either the source object or the destination object. (<10> Section 3.2.5.8: Exchange 2013 follows this behavior.)"); } }
/// <summary> /// Verify the RopCopyTo operation related requirements. /// </summary> /// <param name="ropCopyToResponse">The RopCopyTo response buffer structure.</param> /// <param name="copyToCondition">The condition to generate the corresponding error codes.</param> /// <param name="objectType">Indicates which object type the RopCopyProperties operation is acting on.</param> /// <param name="copyFlags">Indicates the copy flags.</param> private void VerifyRopCopyTo(RopCopyToResponse ropCopyToResponse, CopyToCondition copyToCondition, ServerObjectType objectType, CopyFlags copyFlags) { // Since the RopCopyTo ROP response was parsed successfully, MS-OXCPRPT_R50702 can be captured directly. Site.CaptureRequirement( 50702, @"[In Processing RopCopyTo] The server responds with a RopCopyTo ROP response buffer."); if (ropCopyToResponse.ReturnValue == (uint)CPRPTErrorCode.NotSupported) { // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( "MS-OXCDATA", 928, @"[In Error Codes] The numeric value (hex) for error code NotSupported is 0x80040102, %x02.01.04.80."); } if (ropCopyToResponse.ReturnValue == (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( 17201, @"[In RopCopyTo ROP] This operation [RopCopyTo ROP] is valid on Message objects."); } if (objectType == ServerObjectType.Folder) { if (copyFlags == CopyFlags.Move) { if (Common.IsRequirementEnabled(5070511, this.Site)) { // If the implementation return a successful response, it means it doesn't return NotSupported error. So it can be capture directly. Site.CaptureRequirement( 5070511, @"[In Processing RopCopyTo] Implementation does not return a NotSupported error (0x80040102), if the original object is a Folder object and the CopyFlags field has the Move flag set. (Microsoft Exchange Server 2007 and above follow this behavior.)"); } } // 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( 17203, @"[In RopCopyTo ROP] This operation [RopCopyTo 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( 17202, @"[In RopCopyTo ROP] This operation [RopCopyTo ROP] is valid on Attachment objects."); } // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 192, @"[In RopCopyTo ROP Response Buffer] propertyProblemCount: 2 bytes integer."); if (ropCopyToResponse.PropertyProblemCount != 0) { for (int counter = 0; counter < ropCopyToResponse.PropertyProblems.Length; counter++) { this.VerifyPropertyProblemSturctureInCDATA(); } Site.CaptureRequirementIfAreEqual<ushort>( ropCopyToResponse.PropertyProblemCount, (ushort)ropCopyToResponse.PropertyProblems.Length, 19201, @"[In RopCopyTo ROP Response Buffer] propertyProblemCount: An integer that specifies the number of elements contained in the PropertyProblems field. "); // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 193, @"[In RopCopyTo ROP Response Buffer] propertyProblems (variable): An array of PropertyProblem structures ([MS-OXCDATA] section 2.7)."); } // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 19601, @"[In RopCopyTo ROP Response Buffer] DestHandleIndex (4 bytes): An integer."); } if (ropCopyToResponse.ReturnValue.Equals((uint)CPRPTErrorCode.NullDestinationObject)) { // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R195 // The value of DestHandleIndex is not 0 means this field is present. Site.CaptureRequirementIfAreEqual<uint>( 1, ropCopyToResponse.DestHandleIndex, 196, @"[In RopCopyTo ROP Response Buffer] DestHandleIndex: The DestHandleIndex field MUST be set to the value of the DestHandleIndex field of the ROP request buffer"); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R739 // The value of PropertyProblemCount is 0 means this field is not present. Site.CaptureRequirementIfAreEqual<ushort>( 0, ropCopyToResponse.PropertyProblemCount, 739, @"[In RopCopyTo ROP Response Buffer] PropertyProblemCount: This field MUST NOT be present if the ReturnValue field is set to NullDestinationObject (0x00000503)."); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R740 // PropertyProblems is null means this field is not present. Site.CaptureRequirementIfIsNull( ropCopyToResponse.PropertyProblems, 740, @"[In RopCopyTo ROP Response Buffer] PropertyProblems: This field MUST NOT be present if the ReturnValue field is set to NullDestinationObject (0x00000503)."); } else { // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R197 // The value of DestHandleIndex is 0 means this field is not present. Site.CaptureRequirementIfAreEqual<uint>( 0, ropCopyToResponse.DestHandleIndex, 197, @"[In RopCopyTo ROP Response Buffer] DestHandleIndex: The DestHandleIndex field MUST NOT be present if the ReturnValue field is set to any value other than NullDestinationObject (0x00000503)."); } if (copyToCondition == CopyToCondition.SourceContainsDest) { if (objectType == ServerObjectType.Folder) { if (Common.IsRequirementEnabled(89603, this.Site)) { Site.CaptureRequirementIfAreEqual<uint>( (uint)CPRPTErrorCode.FolderCycle, ropCopyToResponse.ReturnValue, 89603, @"[In Processing RopCopyTo] Implementation does return error code ""0x8004060B"" with name ""FolderCycle"" when The source folder contains the destination folder.(Microsoft Exchange Server 2007 and above follow this behavior)"); } } } else if (copyToCondition == CopyToCondition.SourceDestNotCompatible) { // CopyToCondition.SourceDestNotCompatible means source object and destination object are not compatible with each other for the copy operation. bool isR890Satisfied = ropCopyToResponse.ReturnValue == (uint)CPRPTErrorCode.NotSupported; if (Common.IsRequirementEnabled(890, this.Site)) { // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R890 Site.CaptureRequirementIfIsTrue( isR890Satisfied, 890, @"[In Processing RopCopyTo] Implementation does return error code ""0x80040102"" with name ""NotSupported"", when ""The source object and destination object are not compatible with each other for the copy operation."" (Microsoft Exchange Server 2007 and above follow this behavior)"); Site.CaptureRequirementIfIsTrue( isR890Satisfied, 150, @"[In RopCopyProperties ROP] Also, the source and destination object MUST be of the same type."); } } else if (copyToCondition == CopyToCondition.SourceDestHasSubObjWithSameDisplayName) { // CopyToCondition.SourceDestHasSubObjWithSameDisplayName means a sub-object cannot be copied because there is already a sub-object existing // in the destination object with the same display name (PidTagDisplayName) as the sub-object to be copied. if (Common.IsRequirementEnabled(899, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R899, the return error code value is: {0}", ropCopyToResponse.ReturnValue); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R899 Site.CaptureRequirementIfAreEqual<uint>( (uint)CPRPTErrorCode.CollidingNames, ropCopyToResponse.ReturnValue, 899, @"[In Processing RopCopyTo] Implementation does return error code ""0x80040604"" with name ""CollidingNames"", when a subobject cannot be copied because there is already a subobject existing in the destination object with the same display name, which is specified in the PidTagDisplayName property ([MS-OXCFOLD] section 2.2.2.2.2.4), as the subobject to be copied.(Microsoft Exchange Server 2007 and above follow this behavior)"); } } else if (copyToCondition == CopyToCondition.SourceMessageContainsDestMessage && Common.IsRequirementEnabled(89601, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R89601, the return error code value is: {0}", ropCopyToResponse.ReturnValue); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R89601 Site.CaptureRequirementIfAreEqual<uint>( (uint)CPRPTErrorCode.MessageCycle, ropCopyToResponse.ReturnValue, 89601, @"[In Appendix A: Product Behavior] Implementation does return error code ""0x00000504"" with name ""MessageCycle"" when the source message directly contains the destination message. (Exchange 2007 and above follow this behavior.)"); } else if (copyToCondition == CopyToCondition.SourceMessageIndirectlyContainsDestMessage && Common.IsRequirementEnabled(89604, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R89604, the return error code value is: {0}", ropCopyToResponse.ReturnValue); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R89604 Site.CaptureRequirementIfAreEqual<uint>( (uint)CPRPTErrorCode.MessageCycle, ropCopyToResponse.ReturnValue, 89604, @"[In Appendix A: Product Behavior] Implementation does return error code ""0x00000504"" with name ""MessageCycle"" when the source message indirectly contains the destination message. (Exchange 2007 and above follow this behavior.)"); } }
/// <summary> /// Verify RopCopyTo Null Destination Failure Response /// </summary> /// <param name="ropCopyToResponse">The null destination failure response of RopCopyTo request</param> /// <param name="sourceHandleIndex">The field of SourceHandleIndex in RopCopyTo request</param> /// <param name="destHandleIndex">The field of DestHandleIndex in RopCopyTo request</param> private void VerifyRopCopyToNullDestinationFailureResponse(RopCopyToResponse ropCopyToResponse, byte sourceHandleIndex, uint destHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3099"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3099 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCopyToResponse.RopId.GetType(), 3099, @"[In RopCopyTo ROP Null Destination Failure Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3101"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3101 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopCopyTo, ropCopyToResponse.RopId, 3101, @"[In RopCopyTo ROP Null Destination Failure Response Buffer,RopId (1 byte)]For this operation[RopCopyTo], this field is set to 0x39."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3102"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3102 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCopyToResponse.SourceHandleIndex.GetType(), 3102, @"[In RopCopyTo ROP Null Destination Failure Response Buffer]SourceHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3103"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3103 Site.CaptureRequirementIfAreEqual<byte>( sourceHandleIndex, ropCopyToResponse.SourceHandleIndex, 3103, @"[In RopCopyTo ROP Null Destination Failure Response Buffer,SourceHandleIndex (1 byte)]This index MUST be set to the value specified in the SourceHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3105"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3105 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropCopyToResponse.ReturnValue.GetType(), 3105, @"[In RopCopyTo ROP Null Destination Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3107"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3107 Site.CaptureRequirementIfAreEqual<uint>( ReturnValueForRopMoveFolderResponseAndMoveCopyMessage, ropCopyToResponse.ReturnValue, 3107, @"[In RopCopyTo ROP Null Destination Failure Response Buffer,ReturnValue (4 bytes)]For this response[Null Destination Failure Response], this field is set to 0x00000503."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3108"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3108 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropCopyToResponse.DestHandleIndex.GetType(), 3108, @"[In RopCopyTo ROP Null Destination Failure Response Buffer]DestHandleIndex (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3109"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3109 Site.CaptureRequirementIfAreEqual<uint>( destHandleIndex, ropCopyToResponse.DestHandleIndex, 3109, @"[In RopCopyTo ROP Null Destination Failure Response Buffer,DestHandleIndex (4 bytes)]This index MUST be set to the DestHandleIndex specified in the request."); }
/// <summary> /// Verify RopCopyTo Failure Response /// </summary> /// <param name="ropCopyToResponse">The failure response of RopCopyTo request</param> /// <param name="sourceHandleIndex">The field of SourceHandleIndex in RopCopyTo request</param> private void VerifyRopCopyToFailureResponse(RopCopyToResponse ropCopyToResponse, byte sourceHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3111"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3111 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCopyToResponse.RopId.GetType(), 3111, @"[In RopCopyTo ROP Failure Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3113"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3113 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopCopyTo, ropCopyToResponse.RopId, 3113, @"[In RopCopyTo ROP Failure Response Buffer,RopId (1 byte)]For this operation[RopCopyTo], this field is set to 0x39."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3114"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3114 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCopyToResponse.SourceHandleIndex.GetType(), 3114, @"[In RopCopyTo ROP Failure Response Buffer]SourceHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3115"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3115 Site.CaptureRequirementIfAreEqual<byte>( sourceHandleIndex, ropCopyToResponse.SourceHandleIndex, 3115, @"[In RopCopyTo ROP Failure Response Buffer,SourceHandleIndex (1 byte)]This index MUST be set to the value specified in the SourceHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3117"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3117 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropCopyToResponse.ReturnValue.GetType(), 3117, @"[In RopCopyTo ROP Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3119,the ReturnValue:{0}", ropCopyToResponse.ReturnValue); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3119 bool isVerifyR3119 = (ropCopyToResponse.ReturnValue != SuccessReturnValue) && (ropCopyToResponse.ReturnValue != ReturnValueForRopMoveFolderResponseAndMoveCopyMessage); Site.CaptureRequirementIfIsTrue( isVerifyR3119, 3119, @"[In RopCopyTo ROP Failure Response Buffer,ReturnValue (4 bytes)]For this response[Failure Response ], this field is set to a value other than 0x00000000 or 0x00000503."); }
/// <summary> /// Verify RopCopyTo Success Response /// </summary> /// <param name="ropCopyToResponse">The success response of RopCopyTo request</param> /// <param name="sourceHandleIndex">The field of sourceHandleIndex in RopCopyTo request</param> private void VerifyRopCopyToSuccessResponse(RopCopyToResponse ropCopyToResponse, byte sourceHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3085"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3085 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCopyToResponse.RopId.GetType(), 3085, @"[In RopCopyTo ROP Success Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3087"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3087 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopCopyTo, ropCopyToResponse.RopId, 3087, @"[In RopCopyTo ROP Success Response Buffer,RopId (1 byte)]For this operation[RopCopyTo], this field is set to 0x39."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3088"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3088 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCopyToResponse.SourceHandleIndex.GetType(), 3088, @"[In RopCopyTo ROP Success Response Buffer]SourceHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3089"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3089 Site.CaptureRequirementIfAreEqual<byte>( sourceHandleIndex, ropCopyToResponse.SourceHandleIndex, 3089, @"[In RopCopyTo ROP Success Response Buffer,SourceHandleIndex (1 byte)]This index MUST be set to the value specified in the SourceHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3091"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3091 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropCopyToResponse.ReturnValue.GetType(), 3091, @"[In RopCopyTo ROP Success Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3093"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3093 Site.CaptureRequirementIfAreEqual<uint>( SuccessReturnValue, ropCopyToResponse.ReturnValue, 3093, @"[In RopCopyTo 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_R3094"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3094 Site.CaptureRequirementIfAreEqual<Type>( typeof(ushort), ropCopyToResponse.PropertyProblemCount.GetType(), 3094, @"[In RopCopyTo ROP Success Response Buffer]PropertyProblemCount (2 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3096"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3096 Site.CaptureRequirementIfAreEqual<Type>( typeof(PropertyProblem[]), ropCopyToResponse.PropertyProblems.GetType(), 3096, @"[In RopCopyTo ROP Success Response Buffer]PropertyProblems (variable): An array of PropertyProblem structures."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3097"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3097 Site.CaptureRequirementIfAreEqual<int>( ropCopyToResponse.PropertyProblemCount, ropCopyToResponse.PropertyProblems.Length, 3097, @"[In RopCopyTo ROP Success Response Buffer,PropertyProblems (variable)]The number of structures contained in this field is specified by the PropertyProblemCount field."); }