/// <summary> /// Verify the RopWriteAndCommitStream operation related requirements. /// </summary> /// <param name="ropWriteAndCommitStreamResponse">The RopWriteAndCommitStream response buffer structure.</param> /// <param name="isWriteCorrectDataToStream">Indicates if the data is written to stream properly.</param> private void VerifyRopWriteAndCommitStream(RopWriteStreamResponse ropWriteAndCommitStreamResponse, bool isWriteCorrectDataToStream) { // Since the RopWriteAndCommitStream ROP response was parsed successfully, MS-OXCPRPT_R80503 can be captured directly. Site.CaptureRequirement( 80503, @"[In Processing RopWriteAndCommitStream] The server responds with a RopWriteAndCommitStream ROP response buffer."); if (Common.IsRequirementEnabled(752, this.Site)) { // CPRPTErrorCode.None indicates the operation is performed successfully. if (ropWriteAndCommitStreamResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None)) { // Since the RopWriteAndCommitStream ROP response is performed successfully, MS-OXCPRPT_R752 can be captured directly. Site.CaptureRequirement( 752, @"[In Appendix A: Product Behavior] Implementation does implement the RopWriteAndCommitStream ROP. (<17> Section 3.2.5.22: Exchange 2003 and Exchange 2007 implement the RopWriteAndCommitStream ROP ([MS-OXCROPS] section 2.2.9.11.))"); // Since the RopWriteAndCommitStream ROP response is performed successfully, MS-OXCPRPT_R805 can be captured directly. Site.CaptureRequirement( 805, @"[In Processing RopWriteAndCommitStream] If the server implements this ROP, it MUST first process the ROP request as specified in section 3.2.5.13 "); // Since the RopWriteAndCommitStream ROP response is performed successfully, MS-OXCPRPT_R812 can be captured directly. Site.CaptureRequirement( 812, @"[In Processing RopWriteAndCommitStream] If the server implements this ROP, it MUST then process the ROP process the ROP request as specified in section 3.2.5.14."); // If this operation is performed successfully, that means this operation is valid on Stream objects. Site.CaptureRequirement( 63201, @"[In RopWriteAndCommitStream ROP] This operation is valid on Stream objects."); // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 393, @"[In RopWriteAndCommitStream ROP Response Buffer] WrittenSize (2 bytes): An integer."); } } Site.CaptureRequirementIfIsTrue( isWriteCorrectDataToStream, 39301, @"[In RopWriteAndCommitStream ROP Response Buffer] WrittenSize: An integer that specifies the number of bytes actually written and committed to the stream."); }
/// <summary> /// Verify the RopWriteStream operation related requirements. /// </summary> /// <param name="ropWriteStreamResponse">The RopWriteStream response buffer structure.</param> /// <param name="openModeFlags">Specifies OpenModeFlags in RopOpenStream.</param> /// <param name="writeData">The data to be written to the stream.</param> /// <param name="canBeRetrieval">Indicates if the property is immediately available for retrieval by a ROP that uses the same object handle.</param> /// <param name="isChangedInDB">Indicates if the value is changed in database or not.</param> /// <param name="forErrorCode">Indicates if expecting to fail this operation</param> /// <param name="isWriteSizeElementRight">Indicates if the written size is right or not.</param> private void VerifyRopWriteStream(RopWriteStreamResponse ropWriteStreamResponse, OpenModeFlags openModeFlags, string writeData, bool canBeRetrieval, bool isChangedInDB, bool forErrorCode, bool isWriteSizeElementRight) { if (!forErrorCode) { // Since the RopWriteStream ROP response was parsed successfully, MS-OXCPRPT_R55703 can be captured directly. Site.CaptureRequirement( 55703, @"[In Processing RopWriteStream] The server responds with a RopWriteStream ROP response buffer."); Site.CaptureRequirementIfIsTrue( canBeRetrieval, 56401, @"[In Processing RopWriteStream]After a RopWriteStream ROP request buffer is processed, the new value of the property MUST be immediately available for retrieval by a ROP that uses the same object handle. "); if (Common.IsRequirementEnabled(56402, this.Site)) { Site.CaptureRequirementIfIsFalse( isChangedInDB, 56402, @"[In Processing RopWriteStream]However, the new value of the property is not persisted to the database. "); } Site.CaptureRequirementIfAreEqual<int>( writeData.Length, (int)ropWriteStreamResponse.WrittenSize, 297, @"[In RopWriteStream ROP] The RopWriteStream ROP ([MS-OXCROPS] section 2.2.9.3) writes the stream of bytes into a Stream object."); Site.CaptureRequirementIfAreEqual<int>( writeData.Length, (int)ropWriteStreamResponse.WrittenSize, 303, @"[In RopWriteStream ROP Request Buffer] Data (variable): An array of bytes that constitute the data to be written to the stream."); // CPRPTErrorCode.None indicates the operation is performed successfully. if (ropWriteStreamResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None)) { // If this operation is performed successfully, that means this operation is valid on Stream objects. Site.CaptureRequirement( 29801, @"[In RopWriteStream ROP] This operation is valid on Stream objects. "); // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 304, @"[In RopWriteStream ROP Response Buffer] WrittenSize (2 bytes): An integer."); Site.CaptureRequirementIfIsTrue( isWriteSizeElementRight, 30401, @"[In RopWriteStream ROP Response Buffer] WrittenSize: An integer that specifies the number of bytes actually written to the stream."); } } else { // This mode is to test error code returned from server if (openModeFlags == OpenModeFlags.ReadOnly) { if (Common.IsRequirementEnabled(901, this.Site)) { Site.CaptureRequirementIfAreEqual<uint>( (uint)CPRPTErrorCode.STG_E_ACCESSDENIED, ropWriteStreamResponse.ReturnValue, 901, @"[In Processing RopWriteStream] Implementation does return error code ""0x80030005"" with name ""StreamAccessDenied"", when Write access is denied.(Microsoft Exchange Server 2007 and above follow this behavior)"); } } } }
/// <summary> /// Verify the client has read/write access when open property as stream with Create OpenModeFlags. /// </summary> /// <param name="writeStreamResponse">The RopWriteStream response buffer structure.</param> private void VerifyRopWriteStreamWithCreatePermission(RopWriteStreamResponse writeStreamResponse) { // CPRPTErrorCode.None indicates the operation is performed successfully. Site.CaptureRequirementIfAreEqual<uint>( (uint)CPRPTErrorCode.None, writeStreamResponse.ReturnValue, 271, @"[In RopOpenStream ROP Request Buffer] OpenModeFlags: Create: Open a new stream. This mode will delete the current property value and open the stream for read/write access. "); Site.CaptureRequirementIfAreEqual<uint>( (uint)CPRPTErrorCode.None, writeStreamResponse.ReturnValue, 272, @"[In RopOpenStream ROP Request Buffer] OpenModeFlags: Create: This mode is required for a property that has not been set."); }
/// <summary> /// Verify RopWriteStream Response /// </summary> /// <param name="ropWriteStreamResponse">The response of RopWriteStream request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopWriteStream request</param> private void VerifyRopWriteStreamResponse(RopWriteStreamResponse ropWriteStreamResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3247"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3247 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropWriteStreamResponse.RopId.GetType(), 3247, @"[In RopWriteStream ROP Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3249"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3249 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopWriteStream, ropWriteStreamResponse.RopId, 3249, @"[In RopWriteStream ROP Response Buffer,RopId (1 byte)]For this operation[RopWriteStream], this field is set to 0x2D."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3250"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3250 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropWriteStreamResponse.InputHandleIndex.GetType(), 3250, @"[In RopWriteStream ROP Response Buffer]InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3251"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3251 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropWriteStreamResponse.InputHandleIndex, 3251, @"[In RopWriteStream ROP 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_R3253"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3253 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropWriteStreamResponse.ReturnValue.GetType(), 3253, @"[In RopWriteStream ROP Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3255"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R3255 Site.CaptureRequirementIfAreEqual<Type>( typeof(ushort), ropWriteStreamResponse.WrittenSize.GetType(), 3255, @"[In RopWriteStream ROP Response Buffer]WrittenSize (2 bytes): An unsigned integer."); }