/// <summary> /// Verify RopGetPropertyIdsFromNames Failure Response /// </summary> /// <param name="ropGetPropertyIdsFromNamesResponse">The failure response of RopGetPropertyIdsFromNames request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopGetPropertyIdsFromNames request</param> private void VerifyRopGetPropertyIdsFromNamesFailureResponse(RopGetPropertyIdsFromNamesResponse ropGetPropertyIdsFromNamesResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2624"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2624 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetPropertyIdsFromNamesResponse.RopId.GetType(), 2624, @"[In RopGetPropertyIdsFromNames ROP Failure Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2626"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2626 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopGetPropertyIdsFromNames, ropGetPropertyIdsFromNamesResponse.RopId, 2626, @"[In RopGetPropertyIdsFromNames ROP Failure Response Buffer,RopId (1 byte)]For this operation[RopGetPropertyIdsFromNames], this field is set to 0x56."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2627"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2627 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetPropertyIdsFromNamesResponse.InputHandleIndex.GetType(), 2627, @"[In RopGetPropertyIdsFromNames ROP Failure Response Buffer]InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2628"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2628 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropGetPropertyIdsFromNamesResponse.InputHandleIndex, 2628, @"[In RopGetPropertyIdsFromNames 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_R2630"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2630 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropGetPropertyIdsFromNamesResponse.ReturnValue.GetType(), 2630, @"[In RopGetPropertyIdsFromNames ROP Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2632"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2632 Site.CaptureRequirementIfAreNotEqual<uint>( SuccessReturnValue, ropGetPropertyIdsFromNamesResponse.ReturnValue, 2632, @"[In RopGetPropertyIdsFromNames ROP Failure Response Buffer,ReturnValue (4 bytes)]For this response[Failure Response ], this field is set to a value other than 0x00000000."); }
/// <summary> /// Verify the RopCopyTo operation related requirements. /// </summary> /// <param name="propertyNameCount">The PropertyNameCount parameter in the request buffer.</param> /// <param name="propertyNames">A list of PropertyName in the request buffer.</param> /// <param name="flags">The Flags set by client in the request buffer.</param> /// <param name="ropGetPropertyIdsFromNamesResponse">The RopCopyTo response buffer structure.</param> /// <param name="isOrdered">A boolean value which indicates whether the order of elements in request/response buffer is right.</param> /// <param name="objectType">Indicates which object type the RopGetPropertyIdsFromNames operation is acting on.</param> /// <param name="isPropertyNameExisting">A boolean value indicates whether the queried PropertyNames exists on server.</param> /// <param name="isNamesAndIdsMapping">A boolean value indicates whether the Names and the returned Ids are mapping.</param> private void VerifyRopGetPropertyIdsFromNames( ushort propertyNameCount, PropertyName[] propertyNames, byte flags, RopGetPropertyIdsFromNamesResponse ropGetPropertyIdsFromNamesResponse, bool isOrdered, ServerObjectType objectType, bool isPropertyNameExisting, bool isNamesAndIdsMapping) { // Since the RopGetPropertyIdsFromNames ROP response was parsed successfully, MS-OXCPRPT_R52502 can be captured directly. Site.CaptureRequirement( 52502, @"[In Processing RopGetPropertyIdsFromNames] The server responds with a RopGetPropertyIdsFromNames ROP response buffer."); // Since the RopGetPropertyIdsFromNames ROP response was parsed successfully, MS-OXCPRPT_R41404 can be captured directly. Site.CaptureRequirement( 41404, @"[In Getting Property IDs for Named Properties] The client provides a property set and an identifier in either integer or string form, and the server returns the property ID, which the client uses for any operations performed on that property."); if (propertyNames[0].Kind == 0x00) { Site.CaptureRequirementIfAreNotEqual<ushort>( 0x0000, ropGetPropertyIdsFromNamesResponse.PropertyIds[0].ID, 225, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] PropertyIds: Reasons a name couldn't be mapped include: Use of the PS_MAPI namespace and not specifying 0x00 for the Kind field of the PropertyName structure ([MS-OXCDATA] section 2.6.1)."); } if (flags != 0x02 && isPropertyNameExisting) { Site.CaptureRequirementIfAreNotEqual<ushort>( 0x0000, ropGetPropertyIdsFromNamesResponse.PropertyIds[0].ID, 226, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] PropertyIds: Reasons a name couldn't be mapped include:The name wasn't found in the mapping table and the Flags field of the ROP request buffer was not set to 0x02."); } if (ropGetPropertyIdsFromNamesResponse.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( 20701, @"[In RopGetPropertyIdsFromNames ROP] This operation [RopGetPropertyIdsFromNames ROP] is valid on Message objects."); } if (objectType == ServerObjectType.Attachment) { // 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( 20702, @"[In RopGetPropertyIdsFromNames ROP] This operation [RopGetPropertyIdsFromNames ROP] is valid on Attachment objects."); } if (objectType == ServerObjectType.Folder) { // 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( 20703, @"[In RopGetPropertyIdsFromNames ROP] This operation [RopGetPropertyIdsFromNames ROP] is valid on Folder objects."); } if (objectType == ServerObjectType.Logon) { // 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( 20704, @"[In RopGetPropertyIdsFromNames ROP] This operation [RopGetPropertyIdsFromNames ROP] is valid on Logon objects."); } // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 215, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] PropertyIdCount: 2 bytes integer."); Site.CaptureRequirementIfAreEqual<ushort>( (ushort)ropGetPropertyIdsFromNamesResponse.PropertyIds.Length, ropGetPropertyIdsFromNamesResponse.PropertyIdCount, 21502, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] PropertyIdCount: An integer that specifies the number of property IDs contained in the PropertyIds field. "); if (propertyNameCount != 0) { Site.CaptureRequirementIfAreEqual<ushort>( propertyNameCount, ropGetPropertyIdsFromNamesResponse.PropertyIdCount, 216, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] PropertyIdCount: The value of this field MUST be equal to the value of the PropertyNameCount field of the ROP request buffer unless the value of the PropertyNameCount field is zero."); } } // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R218 bool isVerifyR218 = true; for (int i = 0; i < ropGetPropertyIdsFromNamesResponse.PropertyIds.Length; i++) { // Check that every element's size in PropertyIds is 16-bit if (Marshal.SizeOf(ropGetPropertyIdsFromNamesResponse.PropertyIds[i]) != 2) { // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-OXCPRPT_R218, The actual length of PropertyId is {0}", Marshal.SizeOf(ropGetPropertyIdsFromNamesResponse.PropertyIds[i])); isVerifyR218 = false; break; } } Site.CaptureRequirementIfIsTrue( isVerifyR218, 218, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] propertyIds (variable): An array of 16-bit integers. "); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R222 // The order has been verified when de-serializing the related structures and represented by the variable isOrdered Site.CaptureRequirementIfIsTrue( isOrdered, 222, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] PropertyIds: The order of property IDs in this array MUST match the order of the named properties specified in the PropertyNames field of the ROP request buffer."); Site.CaptureRequirementIfIsTrue( isOrdered, 21801, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] PropertyIds: Each integer is a property ID that is mapped from a named property that is specified in the PropertyNames field of the ROP request buffer"); if (!((propertyNameCount == 0) && (objectType == ServerObjectType.Logon))) { // !isPropertyNameExisting means that the propertyNames doesn't exist on server. // The property flag doesn't equal 0x02 means the Create bit in the Flags parameter is not set. if (!isPropertyNameExisting && (flags != 0x02)) { for (int i = 0; i < ropGetPropertyIdsFromNamesResponse.PropertyIds.Length; i++) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R532"); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R532 // The PropertyNames don't exist on server means the PropertyNames requested are the unfound rows. // The logon user is Administrator and the test suite will not reach the server-imposed limit on property ID // mappings, so the user always has permission to create new entries and the server-imposed limit is not reached. // Since the Flags parameter doesn't have the Create flag bit set, so the "unless" condition will be still false. Site.CaptureRequirementIfAreEqual<ushort>( 0x0000, ropGetPropertyIdsFromNamesResponse.PropertyIds[i].ID, 532, @"[In Processing RopGetPropertyIdsFromNames] [If the PropertyNameCount parameter is zero, and the RopGetPropertyIdsFromNames is acting on a Logon object, the server must enumerate all PropertyNames associated with property IDs] Otherwise, the server MUST, for each entry in the PropertyNames field of the ROP request buffer, follow this procedure: 3. For unfound rows, the returned property ID MUST be 0x0000 unless all of the following conditions are true: 1.The Flags field of the ROP request buffer is set to 0x02. 2. The user has permission to create new entries. 3. The server-imposed limit on property ID mappings specified later in this section hasn't yet been reached."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R220"); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R220 // The PropertyNames don't exist on server and the Flags parameter doesn't have the Create flag bit set means // the names could not be mapped. Site.CaptureRequirementIfAreEqual<ushort>( 0x0000, ropGetPropertyIdsFromNamesResponse.PropertyIds[i].ID, 220, @"[In RopGetPropertyIdsFromNames ROP Response Buffer] PropertyIds: If a named property cannot be mapped, the associated entry in the PropertyIds field MUST be 0x0000."); } } // !isPropertyNameExisting means the propertyNames don't exist on server // flags equals to 0x02 means the Flags parameter has the Create flag bit set. // The logon user is Administrator and the test suite will not reach the server-imposed limit on property ID // mappings, so the user always has permission to create new entries and the server-imposed limit is not reached. // If all of these above condition are met, it means the returned id is newly assigned. if (!isPropertyNameExisting && (flags == 0x02)) { for (int i = 0; i < ropGetPropertyIdsFromNamesResponse.PropertyIds.Length; i++) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R534"); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R534 Site.CaptureRequirementIfAreNotEqual<ushort>( 0xFFFF, ropGetPropertyIdsFromNamesResponse.PropertyIds[i].ID, 534, @"[In Processing RopGetPropertyIdsFromNames] [If the PropertyNameCount parameter is zero, and the RopGetPropertyIdsFromNames is acting on a Logon object, the server must enumerate all PropertyNames associated with property IDs] Otherwise, the server MUST, for each entry in the PropertyNames field of the ROP request buffer, follow this procedure: 4. [If the above conditions in step three are all met, a new property ID is registered for the named property.] The newly assigned property ID MUST NOT be equal to 0xFFFF."); // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R535 Site.CaptureRequirementIfIsTrue( ropGetPropertyIdsFromNamesResponse.PropertyIds[i].ID > 0x8000, 535, @"[In Processing RopGetPropertyIdsFromNames] [If the PropertyNameCount parameter is zero, and the RopGetPropertyIdsFromNames is acting on a Logon object, the server must enumerate all PropertyNames associated with property IDs] Otherwise, the server MUST, for each entry in the PropertyNames field of the ROP request buffer, follow this procedure: 4. [If the above conditions in step three are all met, a new property ID is registered for the named property.] The newly assigned property ID MUST be greater than 0x8000."); } } // When the PropertyNames requested exist on the server, then the server can find the property ID associated with the PropertyName. if (isPropertyNameExisting) { // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R531 // Whether the PropertyNames queried and the returned Ids are mapping has been verified and represented as the Boolean value isNameAndIdMapping. Site.CaptureRequirementIfIsTrue( isNamesAndIdsMapping, 531, @"[In Processing RopGetPropertyIdsFromNames] [If the PropertyNameCount parameter is zero, and the RopGetPropertyIdsFromNames is acting on a Logon object, the server must enumerate all PropertyNames associated with property IDs] Otherwise, the server MUST, for each entry in the PropertyNames field of the ROP request buffer, follow this procedure: 2. Find the property ID registered for the named property that matches the PropertyName structure as follows: If the Kind field is set to 0x00, the named property has a LID that matches the value of the LID field of the PropertyName structure."); for (int i = 0; i < ropGetPropertyIdsFromNamesResponse.PropertyIds.Length; i++) { if (Common.CompareByteArray(propertyNames[i].Guid, this.valuePSMAPI)) { // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R642 Site.CaptureRequirementIfAreEqual<ushort>( (ushort)propertyNames[i].LID, ropGetPropertyIdsFromNamesResponse.PropertyIds[i].ID, 642, @"[In Processing RopGetPropertyIdsFromNames] [If the PropertyNameCount parameter is zero, and the RopGetPropertyIdsFromNames is acting on a Logon object, the server must enumerate all PropertyNames associated with property IDs] Otherwise, the server MUST, for each entry in the PropertyNames field of the ROP request buffer, follow this procedure: 1. If the GUID field of the PropertyName structure ([MS-OXCDATA] section 2.6.1) in the ROP request buffer specifies the PS_MAPI property set, the returned property ID is obtained from the LID field."); } } } } // The parser has ensured the field satisfied the format, otherwise the response cannot be received. Site.CaptureRequirement( 198, @"[In RopGetPropertyIdsFromNames ROP] The RopGetPropertyIdsFromNames ROP ([MS-OXCROPS] section 2.2.8.1) maps abstract, client-defined named properties to concrete 16-bit property IDs (of which 15 bits are significant)."); }
/// <summary> /// Verify RopGetPropertyIdsFromNames Success Response /// </summary> /// <param name="ropGetPropertyIdsFromNamesResponse">The success response of RopGetPropertyIdsFromNames request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopGetPropertyIdsFromNames request</param> private void VerifyRopGetPropertyIdsFromNamesSuccessResponse(RopGetPropertyIdsFromNamesResponse ropGetPropertyIdsFromNamesResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2609"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2609 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetPropertyIdsFromNamesResponse.RopId.GetType(), 2609, @"[In RopGetPropertyIdsFromNames ROP Success Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2611"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2611 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopGetPropertyIdsFromNames, ropGetPropertyIdsFromNamesResponse.RopId, 2611, @"[In RopGetPropertyIdsFromNames ROP Success Response Buffer,RopId (1 byte)]For this operation[RopGetPropertyIdsFromNames], this field is set to 0x56."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2612"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2612 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetPropertyIdsFromNamesResponse.InputHandleIndex.GetType(), 2612, @"[In RopGetPropertyIdsFromNames ROP Success Response Buffer]InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2613"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2613 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropGetPropertyIdsFromNamesResponse.InputHandleIndex, 2613, @"[In RopGetPropertyIdsFromNames 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_R2615"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2615 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropGetPropertyIdsFromNamesResponse.ReturnValue.GetType(), 2615, @"[In RopGetPropertyIdsFromNames ROP Success Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2617"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2617 Site.CaptureRequirementIfAreEqual<uint>( SuccessReturnValue, ropGetPropertyIdsFromNamesResponse.ReturnValue, 2617, @"[In RopGetPropertyIdsFromNames 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_R2618"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2618 Site.CaptureRequirementIfAreEqual<Type>( typeof(ushort), ropGetPropertyIdsFromNamesResponse.PropertyIdCount.GetType(), 2618, @"[In RopGetPropertyIdsFromNames ROP Success Response Buffer]PropertyIdCount (2 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2620"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2620 Site.CaptureRequirementIfAreEqual<Type>( typeof(PropertyId[]), ropGetPropertyIdsFromNamesResponse.PropertyIds.GetType(), 2620, @"[In RopGetPropertyIdsFromNames 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_R2621"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2621 Site.CaptureRequirementIfAreEqual<int>( ropGetPropertyIdsFromNamesResponse.PropertyIdCount, ropGetPropertyIdsFromNamesResponse.PropertyIds.Length, 2621, @"[In RopGetPropertyIdsFromNames ROP Success Response Buffer,PropertyIds (variable)]The number of structures contained in this field is specified by the PropertyIdCount field."); }