/// <summary> /// Verify the response by sending the ROP RopIdFromLongTermId /// </summary> /// <param name="request">The structure of ROP RopIdFromLongTermId request.</param> /// <param name="response">The structure of ROP RopIdFromLongTermId response.</param> private void VerifyRopIdFromLongTermId(RopIdFromLongTermIdRequest request, RopIdFromLongTermIdResponse response) { if (response.ReturnValue == 0) { ulong globalCounter = 0; for (int i = 0; i < 6; i++) { globalCounter += ((ulong)request.LongTermId.GlobalCounter[i]) << (i * 8); } globalCounter = globalCounter << 16; // The last 2 bytes of the Folder ID or Message ID are not fixed. ulong maskedObjectId = response.ObjectId & ~(ulong)0xFFFF; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R59721"); // If the returned ObjectId is associated with the requested GlobalCounter, indicates the ROP's functionality is consistent with its description. this.Site.CaptureRequirementIfAreEqual<ulong>( globalCounter, maskedObjectId, 59721, @"[in RopIdFromLongTermId ROP] The RopIdFromLongTermId ROP ([MS-OXCROPS] section 2.2.3.9) is used to obtain the Folder ID or Message ID, as specified in [MS-OXCDATA] sections 2.2.4.1 or 2.2.4.2, given the LongTermID, as specified in [MS-OXCDATA] section 2.2.1.3.1."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R458"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R458 this.Site.CaptureRequirementIfAreEqual<ulong>( globalCounter, maskedObjectId, 458, @"[In RopIdFromLongTermId ROP Success Response Buffer] ObjectId: Contains the Folder ID or Message ID, as specified in [MS-OXCDATA] sections 2.2.1.1 or 2.2.1.2, that is mapped from the given LongTermID as specified in [MS-OXCDATA] section 2.2.1.3.1."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R459"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R459 // The underlying structure for LongTermId is parsed as structure as REPLGUID(128-bit) with the specified sequence, if GlobalCounter is associated with the given short-term ID,this requirement can be verified. Site.CaptureRequirementIfAreEqual<ulong>( globalCounter, maskedObjectId, 459, @"[In RopIdFromLongTermId ROP Success Response Buffer] ObjectId: The Folder ID or Message ID is a 64-bit value composed of the 16-bit replica ID (REPLID) followed by the 48-bit global counter portion of the given LongTermID."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R1253"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R1253 this.Site.CaptureRequirementIfAreEqual<ulong>( globalCounter, maskedObjectId, 1253, @"[In Receiving a RopIdFromLongTermId ROP Request] The Folder ID or Message ID consists of the 16-bit REPLID followed by the 48-bit global counter portion of the given LongTermID."); } }
/// <summary> /// Convert longTermId to id. /// </summary> /// <param name="serverId">server id.</param> /// <param name="longTermId">longTerm id.</param> /// <returns>Converted short term id.</returns> private ulong GetIdFromLongTerm(int serverId, LongTermId longTermId) { RopIdFromLongTermIdRequest ropIdFromLongTermRequest = new RopIdFromLongTermIdRequest(); RopIdFromLongTermIdResponse ropIdFromLongTermResponse = new RopIdFromLongTermIdResponse(); ropIdFromLongTermRequest.RopId = 0x44; ropIdFromLongTermRequest.LogonId = 0x00; ropIdFromLongTermRequest.InputHandleIndex = 0x00; ropIdFromLongTermRequest.LongTermId = longTermId; ropIdFromLongTermResponse = (RopIdFromLongTermIdResponse)this.Process(serverId, ropIdFromLongTermRequest, this.logonHandleOut); return ropIdFromLongTermResponse.ObjectId; }
/// <summary> /// Verify RopIdFromLongTermId Failure Response /// </summary> /// <param name="ropIdFromLongTermIdResponse">The failure response of RopIdFromLongTermId request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopIdFromLongTermId request</param> private void VerifyRopIdFromLongTermIdFailureResponse(RopIdFromLongTermIdResponse ropIdFromLongTermIdResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R381"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R381 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropIdFromLongTermIdResponse.RopId.GetType(), 381, @"[In RopIdFromLongTermId ROP Failure Response Buffer] RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R383"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R383 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopIdFromLongTermId, ropIdFromLongTermIdResponse.RopId, 383, @"[In RopIdFromLongTermId ROP Failure Response Buffer] RopId (1 byte): For this operation[RopIdFromLongTermId], this field[RopId (1 byte)] is set to 0x44."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R384"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R384 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropIdFromLongTermIdResponse.InputHandleIndex.GetType(), 384, @"[In RopIdFromLongTermId ROP Failure Response Buffer] InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R385"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R385 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropIdFromLongTermIdResponse.InputHandleIndex, 385, @"[In RopIdFromLongTermId 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_R386"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R386 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropIdFromLongTermIdResponse.ReturnValue.GetType(), 386, @"[In RopIdFromLongTermId 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, ropIdFromLongTermIdResponse.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_R388"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R388 Site.CaptureRequirementIfAreNotEqual<uint>( SuccessReturnValue, ropIdFromLongTermIdResponse.ReturnValue, 388, @"[In RopIdFromLongTermId ROP Failure Response Buffer] ReturnValue (4 bytes): For this response[Failure Response], this field[ReturnValue (4 bytes)] is set to a value other than 0x00000000."); } }
/// <summary> /// Verify RopIdFromLongTermId Success Response /// </summary> /// <param name="ropIdFromLongTermIdResponse">The success response of RopIdFromLongTermId request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopIdFromLongTermId request</param> private void VerifyRopIdFromLongTermIdSuccessResponse(RopIdFromLongTermIdResponse ropIdFromLongTermIdResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R371"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R371 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropIdFromLongTermIdResponse.RopId.GetType(), 371, @"[In RopIdFromLongTermId ROP Success Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R373"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R373 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopIdFromLongTermId, ropIdFromLongTermIdResponse.RopId, 373, @"[In RopIdFromLongTermId ROP Success Response Buffer]RopId (1 byte): For this operation[RopIdFromLongTermId], this field[RopId (1 byte)] is set to 0x44."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R374"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R374 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropIdFromLongTermIdResponse.InputHandleIndex.GetType(), 374, @"[In RopIdFromLongTermId ROP Success Response Buffer] InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R375"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R375 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropIdFromLongTermIdResponse.InputHandleIndex, 375, @"[In RopIdFromLongTermId ROP Success 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_R376"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R376 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropIdFromLongTermIdResponse.ReturnValue.GetType(), 376, @"[In RopIdFromLongTermId ROP Success Response Buffer] ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R378"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R378 Site.CaptureRequirementIfAreEqual<uint>( SuccessReturnValue, ropIdFromLongTermIdResponse.ReturnValue, 378, @"[In RopIdFromLongTermId ROP Success Response Buffer] ReturnValue (4 bytes): For this response[Success Response], this field[ReturnValue (4 bytes)] is set to 0x00000000."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R379"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R379 Site.CaptureRequirementIfAreEqual<int>( 8, Marshal.SizeOf(ropIdFromLongTermIdResponse.ObjectId.GetType()), 379, @"[In RopIdFromLongTermId ROP Success Response Buffer] ObjectId (8 bytes): ): An identifier."); }