/// <summary> /// Verify RopGetOwningServers Failure Response /// </summary> /// <param name="ropGetOwningServerResponse">The failure response of RopGetOwningServers request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopGetOwningServers request</param> private void VerifyRopGetOwningServersFailureResponse(RopGetOwningServersResponse ropGetOwningServerResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R277"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R277 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetOwningServerResponse.RopId.GetType(), 277, @"[In RopGetOwningServers ROP Failure Response Buffer] RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R279"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R279 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopGetOwningServers, ropGetOwningServerResponse.RopId, 279, @"[In RopGetOwningServers ROP Failure Response Buffer] RopId (1 byte): For this operation[RopGetOwningServers], this field[RopId (1 byte)] is set to 0x42."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R280"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R280 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetOwningServerResponse.InputHandleIndex.GetType(), 280, @"[In RopGetOwningServers ROP Failure Response Buffer] InputHandleIndex (1 byte): An unsigned integer "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R281"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R281 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropGetOwningServerResponse.InputHandleIndex, 281, @"[In RopGetOwningServers 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_R282"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R282 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropGetOwningServerResponse.ReturnValue.GetType(), 282, @"[In RopGetOwningServers ROP Failure Response Buffer] ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R284"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R284 Site.CaptureRequirementIfAreNotEqual<uint>( SuccessReturnValue, ropGetOwningServerResponse.ReturnValue, 284, @"[In RopGetOwningServers ROP Failure Response Buffer] ReturnValue (4 bytes): For this response[Failure Response Buffer], this field[ReturnValue (4 bytes)] is set to a value other than 0x00000000."); }
/// <summary> /// Verify the response by sending the ROP RopGetOwningServers. /// </summary> /// <param name="response">The structure of ROP RopGetOwningServers response.</param> private void VerifyRopGetOwningServers(RopGetOwningServersResponse response) { // The this.returnValue is 0 to indicate that the response is successful. if (response.ReturnValue == 0) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R343"); // If the response can be parsed successfully and the return value is success, indicates the ROP's functionality is consistent with its description. this.Site.CaptureRequirement( 343, @"[In RopGetOwningServers ROP] RopGetOwningServers is used to obtain the set of servers that host content for a replicated public folder."); // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-OXCSTOR_R367, the CheapServersCount is: {0}, and the OwningServersCount is: {1}.", response.CheapServersCount, response.OwningServersCount); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R367 Site.CaptureRequirementIfIsTrue( response.CheapServersCount <= response.OwningServersCount, 367, @"[In RopGetOwningServers ROP Success Response Buffer] CheapServersCount: This value [CheapServersCount] MUST be less than or equal to OwningServersCount."); if (response.OwningServersCount > 0) { // Add the debug information this.Site.Log.Add( LogEntryKind.Debug, "Verify MS-OXCSTOR_R368, the CheapServersCount is: {0}, and the OwningServersCount is: {1}.", response.CheapServersCount, response.OwningServersCount); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R368 bool isVerifiedR368 = response.CheapServersCount > 0; this.Site.CaptureRequirementIfIsTrue( isVerifiedR368, 368, @"[In RopGetOwningServers ROP Success Response Buffer] CheapServersCount: This value [CheapServersCount] MUST be greater than zero if OwningServersCount is greater than zero."); } bool isServerNameWithNullTerminated = true; foreach (string serverName in response.OwningServers) { if (serverName[serverName.Length - 1] != '\0') { isServerNameWithNullTerminated = false; break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R369"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R369 this.Site.CaptureRequirementIfIsTrue( isServerNameWithNullTerminated, 369, @"[In RopGetOwningServers ROP Success Response Buffer] OwningServers: Contains an array of null-terminated ASCII strings."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R371"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R371 Site.CaptureRequirementIfAreEqual<int>( (int)response.OwningServersCount, response.OwningServers.Length, 371, @"[In RopGetOwningServers ROP Success Response Buffer] OwningServers: The number of strings MUST be equal to the value specified in the OwningServersCount field."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R351"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R351 this.Site.CaptureRequirementIfAreEqual<int>( (int)response.OwningServersCount, response.OwningServers.Length, 351, @"[In RopGetOwningServers ROP Success Response Buffer] OwningServersCount: Identifies the number of strings contained in the OwningServers field."); } }
/// <summary> /// Verify RopGetOwningServers Success Response /// </summary> /// <param name="ropGetOwningServerResponse">The success response of RopGetOwningServers request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopGetOwningServers request</param> private void VerifyRopGetOwningServersSuccessResponse(RopGetOwningServersResponse ropGetOwningServerResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R262"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R262 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetOwningServerResponse.RopId.GetType(), 262, @"[In RopGetOwningServers ROP Success Response Buffer] RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R264"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R264 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopGetOwningServers, ropGetOwningServerResponse.RopId, 264, @"[In RopGetOwningServers ROP Success Response Buffer] RopId (1 byte): For this operation[RopGetOwningServers], this field[RopId (1 byte)] is set to 0x42."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R265"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R265 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetOwningServerResponse.InputHandleIndex.GetType(), 265, @"[In RopGetOwningServers ROP Success Response Buffer] InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R266"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R266 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropGetOwningServerResponse.InputHandleIndex, 266, @"[In RopGetOwningServers 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_R267"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R267 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropGetOwningServerResponse.ReturnValue.GetType(), 267, @"[In RopGetOwningServers ROP Success Response Buffer] ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R269"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R269 Site.CaptureRequirementIfAreEqual<uint>( SuccessReturnValue, ropGetOwningServerResponse.ReturnValue, 269, @"[In RopGetOwningServers ROP Success Response Buffer] ReturnValue (4 bytes): For this response[Success Response Buffer], this field[ReturnValue (4 bytes)] is set to 0x00000000."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R270"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R270 Site.CaptureRequirementIfAreEqual<Type>( typeof(ushort), ropGetOwningServerResponse.OwningServersCount.GetType(), 270, @"[In RopGetOwningServers ROP Success Response Buffer] OwningServersCount (2 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R272"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R272 Site.CaptureRequirementIfAreEqual<Type>( typeof(ushort), ropGetOwningServerResponse.CheapServersCount.GetType(), 272, @"[In RopGetOwningServers ROP Success Response Buffer] CheapServersCount (2 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R274,the length of the OwningServers is {0}", ropGetOwningServerResponse.OwningServers.Length); // Verify MS-OXCROPS requirement: MS-OXCROPS_R274 // Assume the result is true. If one of List is not null-terminated ASCII string, then false. bool isVerifyR274 = true; foreach (string service in ropGetOwningServerResponse.OwningServers) { byte[] buffer = Encoding.ASCII.GetBytes(service); isVerifyR274 = isVerifyR274 && this.IsNullTerminatedASCIIStr(buffer); // If one of List is not null-terminated ASCII string then break iteration if (!isVerifyR274) { break; } } Site.CaptureRequirementIfIsTrue( isVerifyR274, 274, @"[In RopGetOwningServers ROP Success Response Buffer] OwningServers (variable):A list of null-terminated ASCII strings."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R275"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R275 Site.CaptureRequirementIfAreEqual<ushort>( ropGetOwningServerResponse.OwningServersCount, (ushort)ropGetOwningServerResponse.OwningServers.Length, 275, @"[In RopGetOwningServers ROP Success Response Buffer] OwningServers (variable): The number of strings contained in this field is specified by the OwningServersCount field."); }