/// <summary> /// Verify RopQueryNamedProperties Failure Response /// </summary> /// <param name="ropQueryNamedPropertiesResponse">The failure response of RopQueryNamedProperties request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopQeuryNamedProperties request</param> private void VerifyRopQueryNamedPropertiesFailureResponse(RopQueryNamedPropertiesResponse ropQueryNamedPropertiesResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2991"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2991 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropQueryNamedPropertiesResponse.RopId.GetType(), 2991, @"[In RopQueryNamedProperties ROP Failure Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2993"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2993 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopQueryNamedProperties, ropQueryNamedPropertiesResponse.RopId, 2993, @"[In RopQueryNamedProperties ROP Failure Response Buffer,RopId (1 byte)]For this operation[RopQueryNamedProperties], this field is set to 0x5F."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2994"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2994 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropQueryNamedPropertiesResponse.InputHandleIndex.GetType(), 2994, @"[In RopQueryNamedProperties ROP Failure Response Buffer]InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2995"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2995 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropQueryNamedPropertiesResponse.InputHandleIndex, 2995, @"[In RopQueryNamedProperties 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_R2997"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2997 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropQueryNamedPropertiesResponse.ReturnValue.GetType(), 2997, @"[In RopQueryNamedProperties ROP Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2999,the return value:{0}", ropQueryNamedPropertiesResponse.ReturnValue); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2999 bool isVerifyR2999 = (ropQueryNamedPropertiesResponse.ReturnValue != SuccessReturnValue) && (ropQueryNamedPropertiesResponse.ReturnValue != ReturnValueForRopQueryNamedProperties); Site.CaptureRequirementIfIsTrue( isVerifyR2999, 2999, @"[In RopQueryNamedProperties ROP Failure Response Buffer,ReturnValue (4 bytes)]For this response[Failure Response], this field is set to a value other than 0x00000000 or 0x00040380."); }
/// <summary> /// Verify the RopQueryNamedProperties operation related requirements. /// </summary> /// <param name="queryFlags">The QueryFlags specified in request buffer.</param> /// <param name="propertyGuid">The PropertyGuid specified in request buffer.</param> /// <param name="ropQueryNamedPropertiesResopnse">The RopQueryNamedProperties response buffer structure.</param> /// <param name="objectType">Indicates which object type the RopQueryNamedProperties operation is acting on.</param> /// <param name="isOrdered">A boolean value which indicates whether the order of elements in request/response buffer is right.</param> private void VerifyRopQueryNamedProperties( QueryFlags queryFlags, byte[] propertyGuid, RopQueryNamedPropertiesResponse ropQueryNamedPropertiesResopnse, ServerObjectType objectType, bool isOrdered) { // Since the RopQueryNamedProperties ROP response was parsed successfully, MS-OXCPRPT_R49502 can be captured directly. Site.CaptureRequirement( 49502, @"[In Processing RopQueryNamedProperties] The server responds with a RopQueryNamedProperties ROP response buffer."); if (ropQueryNamedPropertiesResopnse.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( 12901, @"[In RopQueryNamedProperties ROP] This operation 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( 12902, @"[In RopQueryNamedProperties ROP] This operation 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( 12903, @"[In RopQueryNamedProperties ROP] This operation is valid on Attachment objects."); } if (objectType == ServerObjectType.Logon) { if (Common.IsRequirementEnabled(12904, this.Site)) { // 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( 12904, @"[In RopQueryNamedProperties ROP] Implementation is valid on Logon objects. (Microsoft Exchange Server 2010 and above follow this behavior)"); } } if (ropQueryNamedPropertiesResopnse.IdCount != 0) { // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 14301, @"[In RopQueryNamedProperties ROP Response Buffer] propertyNames (variable): An array of PropertyName structures ([MS-OXCDATA] section 2.6.1). "); } // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 14201, @"[In RopQueryNamedProperties ROP Response Buffer] propertyIds (variable): An array of 16-bit integers, each of which is a property ID."); if (ropQueryNamedPropertiesResopnse.PropertyNames != null) { Site.CaptureRequirementIfAreEqual<int>( ropQueryNamedPropertiesResopnse.PropertyIds.Length, ropQueryNamedPropertiesResopnse.PropertyNames.Length, 14203, @"[In RopQueryNamedProperties ROP Response Buffer] PropertyIds: The array MUST contain one property ID for each of the named properties specified in the PropertyNames field."); if (queryFlags == QueryFlags.NoStrings) { // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R132 bool isVerifyR132 = true; // Examine every PropertyName in the ropQueryNamedPropertiesResponse. for (int i = 0; i < ropQueryNamedPropertiesResopnse.IdCount; i++) { // If any Named properties with a Kind of 0x1 actually presents in the response, isVerifyR132 should be set to false. if (ropQueryNamedPropertiesResopnse.PropertyNames[i].Kind == 0x01) { // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-OXCPRPT_R132, QueryFlags is {0}, PropertyName.Kind in the response is {1}", queryFlags, ropQueryNamedPropertiesResopnse.PropertyNames[i].Kind); isVerifyR132 = false; break; } } Site.CaptureRequirementIfIsTrue( isVerifyR132, 132, @"[In RopQueryNamedProperties ROP Request Buffer] QueryFlags: NoStrings:Named properties that have a property name identifier MUST NOT be included in the response."); } if (queryFlags == QueryFlags.NoIds) { // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R134 bool isVerifyR134 = true; // Examine every PropertyName in the ropQueryNamedPropertiesResponse. for (int i = 0; i < ropQueryNamedPropertiesResopnse.IdCount; i++) { // If any Named properties with a Kind of 0x00 actually presents in the response, isVerifyR134 should be set to false. if (ropQueryNamedPropertiesResopnse.PropertyNames[i].Kind == 0x00) { // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-OXCPRPT_R134, QueryFlags is {0}, PropertyName.Kind in the response is {1}", queryFlags, ropQueryNamedPropertiesResopnse.PropertyNames[i].Kind); isVerifyR134 = false; break; } } Site.CaptureRequirementIfIsTrue( isVerifyR134, 134, @"[In RopQueryNamedProperties ROP Request Buffer] QueryFlags: NoIds:Named properties that have a long ID (LID) MUST NOT be included in the response."); } // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R141 Site.CaptureRequirementIfAreEqual<ushort>( (ushort)ropQueryNamedPropertiesResopnse.PropertyNames.Length, ropQueryNamedPropertiesResopnse.IdCount, 141, @"[In IdCount] IdCount: 2 byte integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R14101"); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R14101 Site.CaptureRequirementIfAreEqual<ushort>( (ushort)ropQueryNamedPropertiesResopnse.PropertyIds.Length, ropQueryNamedPropertiesResopnse.IdCount, 14101, @"[In RopQueryNamedProperties ROP Response Buffer] IdCount: An integer that specifies the number of elements contained in the PropertyIds field."); Site.CaptureRequirementIfAreEqual<ushort>( (ushort)ropQueryNamedPropertiesResopnse.PropertyIds.Length, ropQueryNamedPropertiesResopnse.IdCount, 14202, @"[In RopQueryNamedProperties ROP Response Buffer] propertyIds: The number of integers contained in the array MUST equal the value specified in the IdCount field. "); bool isVerifyR238 = true; foreach (PropertyId id in ropQueryNamedPropertiesResopnse.PropertyIds) { if ((id.ID & 0x8000) != 0x8000) { isVerifyR238 = false; break; } } Site.CaptureRequirementIfIsTrue( isVerifyR238, 238, @"[In RopGetNamesFromPropertyIds ROP] Property IDs for named properties are identified by having their most significant bit set (0x8000). "); Site.CaptureRequirementIfIsTrue( isVerifyR238, 41405, @"[In Getting Property IDs for Named Properties] The property ID of a named property has the most significant bit set (0x8000)."); } if (queryFlags == QueryFlags.OtherValue) { Site.CaptureRequirementIfAreEqual<uint>( 0x00, ropQueryNamedPropertiesResopnse.ReturnValue, 87802, @"[In Processing RopQueryNamedProperties] No matter what the invalid bits that are set in the QueryFlags field of the ROP request buffer, the server return the same."); } // propertyGuid is not null means that the client specified this field in the request buffer, this field is present. if (propertyGuid != null) { // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R138 bool isVerifyR138 = true; // Examine every PropertyName's Guid return by server. for (int i = 0; i < ropQueryNamedPropertiesResopnse.PropertyNames.Length; i++) { // Check whether the Guid returned in response buffer matches the PropertyGuid specified in request buffer. if (!Common.CompareByteArray(ropQueryNamedPropertiesResopnse.PropertyNames[i].Guid, propertyGuid)) { // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-OXCPRPT_R138,PropertyGuid in request buffer is {0}, Guid in response buffer is {1}", propertyGuid.ToString(), ropQueryNamedPropertiesResopnse.PropertyNames[i].Guid.ToString()); isVerifyR138 = false; break; } } Site.CaptureRequirementIfIsTrue( isVerifyR138, 138, @"[In RopQueryNamedProperties ROP Request Buffer] PropertyGuid: A GUID that specifies the property set of properties to be returned. If this field is present, only named properties with a property set matching the GUID are returned in a successful response."); } // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R145 // The order has been verified when de-serializing the related structures and represented by the variable isOrdered. // Whether the named properties match the PropertyGUID specified in the request has been verified in MS-OXCPRPT_R138 above. Site.CaptureRequirementIfIsTrue( isOrdered, 145, @"[In RopQueryNamedProperties ROP Response Buffer] PropertyNames:The entries in this list MUST match the order of the entries in the PropertyIds field, and the number of entries MUST be equal."); } }
/// <summary> /// Verify RopQueryNamedProperties Success Response /// </summary> /// <param name="ropQueryNamedPropertiesResponse">The success response of RopQueryNamedProperties request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopQueryNamedProperties request</param> private void VerifyRopQueryNamedPropertiesSuccessResponse(RopQueryNamedPropertiesResponse ropQueryNamedPropertiesResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2972"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2972 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropQueryNamedPropertiesResponse.RopId.GetType(), 2972, @"[In RopQueryNamedProperties ROP Success Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2974"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2974 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopQueryNamedProperties, ropQueryNamedPropertiesResponse.RopId, 2974, @"[In RopQueryNamedProperties ROP Success Response Buffer,RopId (1 byte)]For this operation[RopQueryNamedProperties], this field is set to 0x5F."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2975"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2975 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropQueryNamedPropertiesResponse.InputHandleIndex.GetType(), 2975, @"[In RopQueryNamedProperties ROP Success Response Buffer]InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2976"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2976 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropQueryNamedPropertiesResponse.InputHandleIndex, 2976, @"[In RopQueryNamedProperties 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_R2978"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2978 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropQueryNamedPropertiesResponse.ReturnValue.GetType(), 2978, @"[In RopQueryNamedProperties ROP Success Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2980,the ReturnValue:{0}", ropQueryNamedPropertiesResponse.ReturnValue); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2980 bool isVerifyR2980 = ropQueryNamedPropertiesResponse.ReturnValue == SuccessReturnValue || ropQueryNamedPropertiesResponse.ReturnValue == ReturnValueForRopQueryNamedProperties; Site.CaptureRequirementIfIsTrue( isVerifyR2980, 2980, @"[In RopQueryNamedProperties ROP Success Response Buffer,ReturnValue (4 bytes)]For this response[Success Response], this field is set to 0x00000000 or 0x00040380."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2981"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2981 Site.CaptureRequirementIfAreEqual<Type>( typeof(ushort), ropQueryNamedPropertiesResponse.IdCount.GetType(), 2981, @"[In RopQueryNamedProperties ROP Success Response Buffer]IdCount (2 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2983"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2983 Site.CaptureRequirementIfAreEqual<Type>( typeof(PropertyId[]), ropQueryNamedPropertiesResponse.PropertyIds.GetType(), 2983, @"[In RopQueryNamedProperties ROP Success Response Buffer]PropertyIds (variable): An array of unsigned 16-bit integers."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2984"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2984 Site.CaptureRequirementIfAreEqual<ushort>( ropQueryNamedPropertiesResponse.IdCount, (ushort)ropQueryNamedPropertiesResponse.PropertyIds.Length, 2984, @"[In RopQueryNamedProperties ROP Success Response Buffer, PropertyIds (variable)] The number of integers in the array is specified by the IdCount field."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2987"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2987 Site.CaptureRequirementIfAreEqual<Type>( typeof(PropertyName[]), ropQueryNamedPropertiesResponse.PropertyNames.GetType(), 2987, @"[In RopQueryNamedProperties ROP Success Response Buffer]PropertyNames (variable): A list of PropertyName structures."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2988"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2988 Site.CaptureRequirementIfAreEqual<ushort>( ropQueryNamedPropertiesResponse.IdCount, (ushort)ropQueryNamedPropertiesResponse.PropertyNames.Length, 2988, @"[In RopQueryNamedProperties ROP Success Response Buffer,PropertyNames (variable)]The number of structures contained in this field is specified by the IdCount field."); }