Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerObject"/> class.
 /// </summary>
 /// <param name="name">The name of the server object.</param>
 /// <param name="type">The type of the server object.</param>
 /// <param name="control">The control of the server object.</param>
 public ServerObject(string name, ServerObjectType type, object control)
 {
     Name     = name;
     Type     = type;
     Control  = control;
     IsLoaded = false;
 }
        private TreeViewItem GetTreeViewItem(string name, string imageSource, ServerObjectType type)
        {
            var retval     = new TreeViewItem();
            var stackPanel = new StackPanel {
                Orientation = Orientation.Horizontal
            };

            if (!string.IsNullOrEmpty(imageSource))
            {
                stackPanel.Children.Add(new Image {
                    Source = new BitmapImage(new Uri(imageSource, UriKind.Relative)), Height = 16, Width = 16
                });
            }

            stackPanel.Children.Add(new TextBlock(new Run(string.Format(" {0} ", name))));

            retval.Header    = stackPanel;
            retval.Tag       = new ServerObject(name, type, retval);
            retval.Selected += TreeItemSelected;
            retval.Expanded += TreeItemExpanded;

            return(retval);
        }
 private void BTN_LookupTables_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.LookupTable;
     PropulateServerObjects();
 }
Exemplo n.º 4
0
 private void BTN_CustomFields_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.CustomField;
     PropulateServerObjects();
 }
Exemplo n.º 5
0
 private void BTN_Resources_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.Resource;
     PropulateServerObjects();
 }
Exemplo n.º 6
0
        public static void GetObject2(ServerObjectType objType, ObjectToOperate objToOperate)
        {
            Condition.IsTrue(objType == globalObj && isFirstObjectGot);
            Condition.IsTrue(objToOperate == ObjectToOperate.SecondObject);

            isSecondObjectGot = true;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Verify the RopDeleteProperties operation related requirements.
        /// </summary>
        /// <param name="ropDeletePropertiesResponse">The RopDeleteProperties response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopDeleteProperties operation is acting on </param>
        private void VerifyRopDeleteProperties(RopDeletePropertiesResponse ropDeletePropertiesResponse, ServerObjectType objectType)
        {
            // Since the RopDeleteProperties ROP response was parsed successfully, MS-OXCPRPT_R48402 can be captured directly.
            Site.CaptureRequirement(
                 48402,
                 @"[In Processing RopDeleteProperties] The server responds with a RopDeleteProperties ROP response buffer. ");

            if (ropDeletePropertiesResponse.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(
                        11401,
                        @"[In RopDeleteProperties ROP] This operation [RopDeleteProperties ROP] 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(
                        11402,
                        @"[In RopDeleteProperties ROP] This operation [RopDeleteProperties ROP] 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(
                        11403,
                        @"[In RopDeleteProperties ROP] This operation [RopDeleteProperties ROP] is valid on Attachment 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(
                        11404,
                        @"[In RopDeleteProperties ROP] This operation [RopDeleteProperties ROP] is valid on Logon objects.");
                }

                if (ropDeletePropertiesResponse.PropertyProblemCount != 0)
                {
                    // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                    Site.CaptureRequirement(
                       120,
                       @"[In RopDeleteProperties ROP Response Buffer] PropertyProblems (variable): An array of PropertyProblem structures ([MS-OXCDATA] section 2.7).");
                }

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                       119,
                       @"[In RopDeleteProperties ROP Response Buffer] PropertyProblemCount: 2 bytes integer.");
            }

            if (ropDeletePropertiesResponse.ReturnValue == 0x8004010F)
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                        "MS-OXCDATA",
                        2055,
                        @"[In Additional Error Codes] The numeric value (hex) for error code NotFound is 0x8004010F, %x0F.01.04.80.");
            }

            ushort numberOfPropertyProblem = 0;
            if (ropDeletePropertiesResponse.PropertyProblemCount != 0x00)
            {
                numberOfPropertyProblem = (ushort)ropDeletePropertiesResponse.PropertyProblems.Length;
            }

            Site.CaptureRequirementIfAreEqual<ushort>(
                numberOfPropertyProblem,
                ropDeletePropertiesResponse.PropertyProblemCount,
                11901,
                @"[In RopDeleteProperties ROP Response Buffer] PropertyProblemCount: An integer that specifies the number of elements contained in the PropertyProblems field.");

            if (ropDeletePropertiesResponse.PropertyProblemCount != 0x00)
            {
                for (int counter = 0; counter < ropDeletePropertiesResponse.PropertyProblems.Length; counter++)
                {
                    this.VerifyPropertyProblemSturctureInCDATA();
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Verify the RopGetPropertiesList operation related requirements.
        /// </summary>
        /// <param name="ropGetPropertiesListResponse">The RopGetPropertiesList response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopGetPropertiesList operation is acting on.</param>
        private void VerifyRopGetPropertiesList(RopGetPropertiesListResponse ropGetPropertiesListResponse, ServerObjectType objectType)
        {
            // Since the RopGetPropertiesList ROP response was parsed successfully, MS-OXCPRPT_R47102 can be captured directly.
            Site.CaptureRequirement(
              47102,
              @"[In Processing RopGetPropertiesList] The server responds with a RopGetPropertiesList ROP response buffer.");

            if (ropGetPropertiesListResponse.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(
                        9701,
                        @"[In RopGetPropertiesList ROP] This operation[RopGetPropertiesList ROP] 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(
                        9702,
                        @"[In RopGetPropertiesList ROP] This operation[RopGetPropertiesList ROP] 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(
                        9703,
                        @"[In RopGetPropertiesList ROP] This operation[RopGetPropertiesList ROP] is valid on Attachment 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(
                        9704,
                        @"[In RopGetPropertiesList ROP] This operation[RopGetPropertiesList ROP] is valid on Logon objects.");
                }
            }

            if (ropGetPropertiesListResponse.PropertyTagCount != 0x00)
            {
                foreach (PropertyTag propertyTag in ropGetPropertiesListResponse.PropertyTags)
                {
                    this.VerifyPropertyTagInCDATA(propertyTag);
                }
            }

            ushort numberOfPropertyTag = 0;
            if (ropGetPropertiesListResponse.PropertyTagCount > 0)
            {
                numberOfPropertyTag = (ushort)ropGetPropertiesListResponse.PropertyTags.Length;

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                   100,
                   @"[In RopGetPropertiesList ROP Response Buffer] PropertyTags (variable): An array of PropertyTag structures ([MS-OXCDATA] section 2.9). ");
            }

            Site.CaptureRequirementIfAreEqual<ushort>(
                numberOfPropertyTag,
                ropGetPropertiesListResponse.PropertyTagCount,
                9903,
                @"[In RopGetPropertiesList ROP Response Buffer] PropertyTagCount: An integer that specifies the number of property tags contained in the PropertyTags field.");

            // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
            Site.CaptureRequirement(
                99,
                @"[In RopGetPropertiesList ROP Response Buffer] PropertyTagCount: 2 bytes integer.");
        }
Exemplo n.º 9
0
        /// <summary>
        /// Verify the RopDeletePropertiesNoReplicate operation related requirements.
        /// </summary>
        /// <param name="ropDeletePropertiesNoReplicateResponse">The RopDeletePropertiesNoReplicate response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopDeletePropertiesNoReplicate operation is acting on.</param>
        private void VerifyRopDeletePropertiesNoReplicate(RopDeletePropertiesNoReplicateResponse ropDeletePropertiesNoReplicateResponse, ServerObjectType objectType)
        {
            if (ropDeletePropertiesNoReplicateResponse.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(
                        837,
                        @"[In RopDeletePropertiesNoReplicate] This ROP is supported for 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(
                        839,
                        @"[In RopDeletePropertiesNoReplicate] This ROP is supported for 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(
                        841,
                        @"[In RopDeletePropertiesNoReplicate] This ROP is supported for Attachment 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(
                        843,
                        @"[In RopDeletePropertiesNoReplicate] This ROP is supported for Logon objects.");
                }

                if (ropDeletePropertiesNoReplicateResponse.PropertyProblemCount != 0)
                {
                    // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                    Site.CaptureRequirement(
                        84407,
                         @"[In RopDeletePropertiesNoReplicate ROP Response Buffer] PropertyProblems (variable): An array of PropertyProblem structures ([MS-OXCDATA] section 2.7).");
                }

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                      84405,
                      @"[In RopDeletePropertiesNoReplicate ROP Response Buffer] PropertyProblemCount: 2 bytes integer.");
            }

            if (ropDeletePropertiesNoReplicateResponse.ReturnValue == 0x8004010F)
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                        "MS-OXCDATA",
                        2055,
                        @"[In Additional Error Codes] The numeric value (hex) for error code NotFound is 0x8004010F, %x0F.01.04.80.");
            }

            ushort numberOfPropertyProblem = 0;

            if (ropDeletePropertiesNoReplicateResponse.PropertyProblemCount > 0)
            {
                for (int counter = 0; counter < ropDeletePropertiesNoReplicateResponse.PropertyProblems.Length; counter++)
                {
                    this.VerifyPropertyProblemSturctureInCDATA();
                }

                numberOfPropertyProblem = (ushort)ropDeletePropertiesNoReplicateResponse.PropertyProblems.Length;
            }

            Site.CaptureRequirementIfAreEqual<ushort>(
                numberOfPropertyProblem,
                ropDeletePropertiesNoReplicateResponse.PropertyProblemCount,
                84406,
                @"[In RopDeletePropertiesNoReplicate ROP Response Buffer] PropertyProblemCount: An integer that specifies the number of elements contained in the PropertyProblems field.");
        }
 private void BTN_CustomFields_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.CustomField;
     PropulateServerObjects();
 }
        private TreeViewItem GetSeparatorTreeViewItem(string name, string imageSource, ServerObjectType type)
        {
            var retval = GetTreeViewItem(name, imageSource, type);

            retval.Items.Add(string.Empty);

            return(retval);
        }
 private void BTN_Calendars_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.Calendar;
     PropulateServerObjects();
 }
 private void BTN_Resources_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.Resource;
     PropulateServerObjects();
 }
 private void BTN_Projects_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.Project;
     PropulateServerObjects();
 }
Exemplo n.º 15
0
        /// <summary>
        /// Verify Common Object properties related requirements.
        /// </summary>
        /// <param name="propertyTag">A property tag both identifies a property and gives the data type its value.</param>
        /// <param name="ropGetPropertiesSecificResponse">The RopGetPropertiesSpecific response buffer structure.</param>
        /// <param name="objectType">Server object type.</param>
        private void VerifyCommonProperties(PropertyTag propertyTag, RopGetPropertiesSpecificResponse ropGetPropertiesSecificResponse, ServerObjectType objectType)
        {
            // Identifies the property
            ushort propertyId = propertyTag.PropertyId;

            foreach (PropertyValue propertyVal in ropGetPropertiesSecificResponse.RowData.PropertyValues)
            {
                // The value of the property. Its syntax is specified by the PropertyType field of the tag, and its semantics by the PropertyId field of the tag, defined in MS-OXCDATA section 2.12.4 TaggedPropertyValue
                uint propertyValue = Common.ConvertByteArrayToUint(propertyVal.Value);

                switch (propertyId)
                {
                    // According to MS-OXPROPS section 2.575 PidTagAccess, if PropertyId is 0x0FF4, it means the property is PidTagAccess.
                    case 0x0FF4:
                        {
                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R311
                            // According to MS-OXCDATA section 2.8.1.1 StandardPropertyRow, Flag is equal to 0x00 to Indicates that all property values are present and without error.
                            Site.CaptureRequirementIfAreEqual<uint>(
                                0x00,
                                ropGetPropertiesSecificResponse.RowData.Flag,
                                311,
                                @"[In PidTagAccess Property] Type: PtypInteger32 ([MS-OXCDATA] section 2.11.1)");

                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R14
                            int notUsedbits = ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008 | 0x00000010 | 0x00000020);
                            bool isVerifyR14 = (propertyValue & notUsedbits) == 0;

                            Site.CaptureRequirementIfIsTrue(
                                isVerifyR14,
                                14,
                                @"[In PidTagAccess Property] The value is a bitwise-OR of zero or more values[0x00000001,0x00000002,0x00000004,0x00000008,0x00000010,0x00000020] from the following table.");
                        }

                        break;

                    // According to MS-OXPROPS 2.577 PidTagAccessLevel, if PropertyId is 0x0FF7, it means the property is PidTagAccessLevel.
                    case 0x0FF7:
                        {
                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R312
                            // According to MS-OXCDATA section 2.8.1.1 StandardPropertyRow, Flag is equal to 0x00 to Indicates that all property values are present and without error.
                            Site.CaptureRequirementIfAreEqual<uint>(
                                0x00,
                                ropGetPropertiesSecificResponse.RowData.Flag,
                                312,
                                @"[In PidTagAccessLevel Property] Type: PtypInteger32 ([MS-OXCDATA] section 2.11.1)");

                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R26
                            bool isVerifyR26 = (propertyValue == 0x00000000) ||
                                               (propertyValue == 0x00000001);

                            Site.CaptureRequirementIfIsTrue(
                                isVerifyR26,
                                26,
                                @"[In PidTagAccessLevel Property] This value of this property MUST be one of the values in the following table. [0x00000000, 0x00000001].");

                            Site.CaptureRequirementIfAreNotEqual<ServerObjectType>(
                              ServerObjectType.Folder,
                              objectType,
                              2401,
                              @"[In PidTagAccessLevel Property] This property does not apply to Folder objects.");

                            Site.CaptureRequirementIfAreNotEqual<ServerObjectType>(
                                ServerObjectType.Logon,
                                objectType,
                                2402,
                                @"[In PidTagAccessLevel Property] This property does not apply to Logon objects.");
                        }

                        break;

                    // According to MS-OXPROPS 2.701 PidTagChangeKey, if PropertyId is 0x65E2, it means the property is PidTagChangeKey
                    case 0x65E2:
                        {
                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R313
                            // According to MS-OXCDATA section 2.8.1.1 StandardPropertyRow, Flag is equal to 0x00 to Indicates that all property values are present and without error.
                            Site.CaptureRequirementIfAreEqual<uint>(
                                0x00,
                                ropGetPropertiesSecificResponse.RowData.Flag,
                                313,
                                @"[In PidTagChangeKey Property] Type: PtypBinary ([MS-OXCDATA] section 2.11.1)");
                        }

                        break;

                    // According to MS-OXPROPS 2.724 PidTagCreationTime, if PropertyId is 0x3007, it means the property is PidTagCreationTime
                    case 0x3007:
                        {
                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R314
                            // According to MS-OXCDATA section 2.8.1.1 StandardPropertyRow, Flag is equal to 0x00 to indicate that all property values are present and without error.
                            Site.CaptureRequirementIfAreEqual<uint>(
                                0x00,
                                ropGetPropertiesSecificResponse.RowData.Flag,
                                314,
                                @"[In PidTagCreationTime Property] Type: PtypTime ([MS-OXCDATA] section 2.11.1)");
                        }

                        break;

                    // According to MS-OXPROPS 2.883 PidTagLastModifierName, if PropertyId is 0x3FFA, it means the property is PidTagLastModifierName.
                    case 0x3FFA:
                        {
                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R315.
                            // According to MS-OXCDATA section 2.8.1.1 StandardPropertyRow, Flag is equal to 0x00 to indicate that all property values are present and without error.
                            Site.CaptureRequirementIfAreEqual<ushort>(
                                0x00,
                                ropGetPropertiesSecificResponse.RowData.Flag,
                                315,
                                @"[In PidTagLastModifierName Property] Type: PtypString ([MS-OXCDATA] section 2.11.1)");

                            // The property value should be the user who creates the object.
                            string result = Encoding.Unicode.GetString(ropGetPropertiesSecificResponse.RowData.PropertyValues[0].Value).TrimEnd('\0').ToLower();
                            Site.CaptureRequirementIfAreEqual<string>(
                                Common.GetConfigurationPropertyValue("UserName", this.Site).ToLower(),
                                result,
                                34,
                                @"[In PidTagLastModifierName Property] The PidTagLastModifierName property ([MS-OXPROPS] section 2.757) contains the name of the last mail user to modify the object.");

                            Site.CaptureRequirementIfAreNotEqual<ServerObjectType>(
                                 ServerObjectType.Folder,
                                 objectType,
                                 3401,
                                 @"[In PidTagLastModifierName Property] This property does not apply to Folder objects.");

                            Site.CaptureRequirementIfAreNotEqual<ServerObjectType>(
                                ServerObjectType.Logon,
                                objectType,
                                3402,
                                @"[In PidTagLastModifierName Property] This property does not apply to Logon objects.");
                        }

                        break;

                    // According to MS-OXPROPS 2.831 PidTagLastModificationTime, if PropertyId is 0x3008, it means the property is PidTagLastModificationTime.
                    case 0x3008:
                        {
                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R316
                            // According to MS-OXCDATA section 2.8.1.1 StandardPropertyRow, Flag is equal to 0x00 to indicate that all property values are present and without error.
                            Site.CaptureRequirementIfAreEqual<uint>(
                                0x00,
                                ropGetPropertiesSecificResponse.RowData.Flag,
                                316,
                                @"[In PidTagLastModificationTimeProperty] Type: PtypTime ([MS-OXCDATA] section 2.11.1)");
                        }

                        break;

                    // According to MS-OXPROPS 2.1059 PidTagSearchKey, if PropertyId is 0x300B, it means the property is PidTagSearchKey
                    case 0x300B:
                        {
                            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R319
                            // According to MS-OXCDATA section 2.8.1.1 StandardPropertyRow, Flag is equal to 0x00 to indicate that all property values are present and without error.
                            Site.CaptureRequirementIfAreEqual<uint>(
                                0x00,
                                ropGetPropertiesSecificResponse.RowData.Flag,
                                319,
                                @"[In PidTagSearchKey Property] Type: PtypBinary ([MS-OXCDATA] section 2.11.1).");

                            Site.CaptureRequirementIfAreNotEqual<ServerObjectType>(
                                ServerObjectType.Folder,
                                objectType,
                                5501,
                                @"[In PidTagSearchKey Property] This property does not apply to Folder objects.");

                            Site.CaptureRequirementIfAreNotEqual<ServerObjectType>(
                                ServerObjectType.Logon,
                               objectType,
                               5502,
                               @"[In PidTagSearchKey Property] This property does not apply to Logon objects. ");
                        }

                        break;

                    default:
                        break;
                }
            }
        }
Exemplo n.º 16
0
        /// <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.");
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Verify the RopGetPropertiesAll operation related requirements.
        /// </summary>
        /// <param name="ropGetPropertiesAllResponse">The RopGetPropertiesAll response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopGetPropertiesAll operation is acting on.</param>
        /// <param name="isPropertySizeLimitZero">Indicates if the PropertySizeLimit is set to 0.</param>
        /// <param name="isPropertyLagerThanLimit">Indicates if the property size is larger than the limit.</param>
        /// <param name="isUnicode">Indicates if string properties are to be encoded in the Unicode format in the ROP response buffer.</param>
        /// <param name="isValueContainsNotEnoughMemory">Indicates if returned property is larger than the limit or not.</param>
        private void VerifyRopGetPropertiesAll(RopGetPropertiesAllResponse ropGetPropertiesAllResponse, ServerObjectType objectType, bool isPropertySizeLimitZero, bool isPropertyLagerThanLimit, bool isUnicode, bool isValueContainsNotEnoughMemory)
        {
            // Since the RopGetPropertiesAll ROP response was parsed successfully, MS-OXCPRPT_R90703 can be captured directly.
            Site.CaptureRequirement(
                 90703,
                 @"[In Processing RopGetPropertiesAll] The server responds with a RopGetPropertiesAll ROP response buffer");

            if (ropGetPropertiesAllResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None))
            {
                bool containString8 = false;
                bool containString = false;
                bool hasString = false;
                foreach (TaggedPropertyValue value in ropGetPropertiesAllResponse.PropertyValues)
                {
                    if (value.PropertyTag.PropertyType == (uint)0x001e)
                    {
                        containString8 = true;
                        hasString = true;
                    }
                    else if (value.PropertyTag.PropertyType == (uint)0x001f)
                    {
                        containString = true;
                        hasString = true;
                    }
                }

                if (hasString)
                {
                    if (isUnicode)
                    {
                        Site.CaptureRequirementIfIsTrue(
                           !containString8 && containString,
                           8502,
                           @"[In RopGetPropertiesAll ROP Request Buffer] WantUnicode: A Boolean value that is nonzero if string properties that are requested with PtypUnspecified ([MS-OXCDATA] section 2.11.1) as the property type are to be encoded in the Unicode format in the ROP response buffer. ");  
                    }
                    else
                    {
                        Site.CaptureRequirementIfIsFalse(
                           containString,
                           8702,
                           @"[In RopGetPropertiesAll ROP Request Buffer] WantUnicode: If WantUnicode is set to zero, the string properties that are requested with PtypUnspecified as the property type are to be encoded in MBCS format.");
                    }
                }

                bool isReturnPropertyTypeNotPtypUnspecified = true;
                foreach (TaggedPropertyValue value in ropGetPropertiesAllResponse.PropertyValues)
                {
                    if (value.PropertyTag.PropertyType == 0x0000)
                    {
                        isReturnPropertyTypeNotPtypUnspecified = false;
                        break;
                    }
                }

                Site.CaptureRequirementIfIsTrue(
                    isReturnPropertyTypeNotPtypUnspecified,
                    "MS-OXCDATA",
                    2720,
                    @"[In Property Value Types] PtypUnspecified(PT_UNSPECIFIED) is 
                Any: this property type value matches any type; a server MUST return the actual type in its response. Servers MUST NOT return this type in response to a client request other than NspiGetIDsFromNames or the RopGetPropertyIdsFromNames ROP request ([MS-OXCROPS] section 2.2.8.1). with Property Type Value 0x0000,%x00.00.");

                if (isPropertySizeLimitZero)
                {
                    bool isPropertyLimitedByBufferSize = true;
                    foreach (TaggedPropertyValue value in ropGetPropertiesAllResponse.PropertyValues)
                    {
                        if (value.Value != null && value.Size() > 0xBABE)
                        {
                            isPropertyLimitedByBufferSize = false;
                            break;
                        }
                    }

                    Site.CaptureRequirementIfIsTrue(
                        isPropertyLimitedByBufferSize,
                        84,
                        @"[In RopGetPropertiesAll ROP Request Buffer] PropertySizeLimit: If this value[PropertySizeLimit] is zero, the property values are only limited by the size of the ROP[RopGetPropertiesAll] response buffer.");
                }

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R9201
                // numberOfPropertyValues indicates the number of elements in PropertyValues.
                ushort numberOfPropertyValues = 0;
                if (ropGetPropertiesAllResponse.PropertyValues != null)
                {
                    numberOfPropertyValues = (ushort)ropGetPropertiesAllResponse.PropertyValues.Length;
                }

                Site.CaptureRequirementIfAreEqual<ushort>(
                    numberOfPropertyValues,
                    ropGetPropertiesAllResponse.PropertyValueCount,
                    9201,
                    @"[In RopGetPropertiesAll ROP Response Buffer] PropertyValueCount: An integer that specifies the number of elements in the PropertyValues field.");

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                        92,
                        @"[In RopGetPropertiesAll ROP Response Buffer] PropertyValueCount: 2 bytes integer.");

                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(
                        8001,
                        @"[In RopGetPropertiesAll ROP] This operation [RopGetPropertiesAll ROP] 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(
                        8002,
                        @"[In RopGetPropertiesAll ROP] This operation [RopGetPropertiesAll ROP] 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(
                        8003,
                        @"[In RopGetPropertiesAll ROP] This operation [RopGetPropertiesAll ROP] is valid on Attachment 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(
                        8004,
                        @"[In RopGetPropertiesAll ROP] This operation [RopGetPropertiesAll ROP] is valid on Logon objects.");
                }
            }

            if (Common.IsRequirementEnabled(86703, this.Site))
            {
                if (this.cprptCurrentType == ServerObjectType.Message || this.cprptCurrentType == ServerObjectType.Attachment)
                {
                    if (isPropertyLagerThanLimit)
                    {
                        // If MS-OXCPRPT_R86703 is enabled, when the property is a PtypBinary type, a PtypObject type, or a string property, 
                        // the NotEnoughMemory (0x8007000E) will be returned, if the value is larger than either the available space in the ROP response buffer or the size specified in the PropertySizeLimit field of the ROP request buffer.
                        // MS-OXCPRPT_R86703 is captured in model. This requirement is captured here since the requirements from other protocols cannot be handled in model.
                        Site.CaptureRequirementIfIsTrue(
                            isValueContainsNotEnoughMemory,
                            "MS-OXCDATA",
                            2052,
                            @"[In Additional Error Codes] NotEnoughMemory (E_NOMEMORY, MAPI_E_NOT_ENOUGH_MEMORY) will be returned, On get, indicates that the property or column value is too large to be retrieved by the request, and the property value needs to be accessed with the RopOpenStream ROP ([MS-OXCROPS] section 2.2.9.1).");
                    }
                }
            }

            if (ropGetPropertiesAllResponse.PropertyValueCount != 0x00)
            {
                foreach (TaggedPropertyValue propertyValue in ropGetPropertiesAllResponse.PropertyValues)
                {
                    this.VerifyPropertyTagInCDATA(propertyValue.PropertyTag);
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Verify the RopCopyProperties operation related requirements.
        /// </summary>
        /// <param name="ropCopyPropertiesResponse">The RopCopyProperties response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopCopyProperties operation is acting on.</param>
        /// <param name="copyFlags">CopyFlags parameter in request of RopCopyProperties.</param>
        /// <param name="isPropertyFound">Indicates the property is found or not.</param>
        private void VerifyRopCopyProperties(
            RopCopyPropertiesResponse ropCopyPropertiesResponse,
            ServerObjectType objectType,
            CopyFlags copyFlags,
            bool isPropertyFound)
        {
            // Since the RopCopyProperties ROP response was parsed successfully, MS-OXCPRPT_R50003 can be captured directly.
            Site.CaptureRequirement(
                50003,
                @"[In Processing RopCopyProperties] The server responds with a RopCopyProperties ROP response buffer.");

            if (ropCopyPropertiesResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None))
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                  16801,
                  @"[In RopCopyProperties ROP Response Buffer] DestHandleIndex: 4 bytes integer.");

                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(
                        14901,
                        @"[In RopCopyProperties ROP] This operation [RopCopyProperties ROP] 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(
                        14902,
                        @"[In RopCopyProperties ROP] This operation [RopCopyProperties ROP] 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(
                        14903,
                        @"[In RopCopyProperties ROP] This operation [RopCopyProperties ROP] is valid on Attachment objects.");
                }

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                165,
                @"[In RopCopyProperties ROP Response Buffer] propertyProblemCount: 2 bytes integer.");

                Site.CaptureRequirementIfAreEqual<ushort>(
                      ropCopyPropertiesResponse.PropertyProblemCount,
                      (ushort)ropCopyPropertiesResponse.PropertyProblems.Length,
                      16502,
                      @"[In RopCopyProperties ROP Response Buffer] propertyProblemCount: An integer that specifies the number of elements contained in the PropertyProblems field. ");

                if (ropCopyPropertiesResponse.PropertyProblemCount != 0)
                {
                    // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                    Site.CaptureRequirement(
                        167,
                        @"[In RopCopyProperties ROP Response Buffer] PropertyProblems (variable): An array of PropertyProblem structures ([MS-OXCDATA] section 2.7).");

                    for (int counter = 0; counter < ropCopyPropertiesResponse.PropertyProblems.Length; counter++)
                    {
                        this.VerifyPropertyProblemSturctureInCDATA();
                    }
                }

                Site.CaptureRequirementIfIsTrue(
                   isPropertyFound,
                   500,
                   @"[In Processing RopCopyProperties] The server MUST copy or move the properties specified from the source object to the destination object.");
            }

            if (ropCopyPropertiesResponse.ReturnValue == 0x80070057)
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    "MS-OXCDATA",
                      904,
                     @"[In Error Codes] The numeric value (hex) for error code InvalidParameter is 0x80070057, %x57.00.07.80.");
            }

            if (ropCopyPropertiesResponse.ReturnValue == 0x80040102)
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    "MS-OXCDATA",
                      928,
                     @"[In Error Codes] The numeric value (hex) for error code NotSupported is 0x80040102, %x02.01.04.80.");
            }

            if (ropCopyPropertiesResponse.ReturnValue.Equals((uint)CPRPTErrorCode.NullDestinationObject))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R168");

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R168
                // The value of DestHandleIndex is not 0 means this field is present.
                Site.CaptureRequirementIfAreNotEqual<uint>(
                    0,
                    ropCopyPropertiesResponse.DestHandleIndex,
                    168,
                    @"[In RopCopyProperties ROP Response Buffer] DestHandleIndex: The DestHandleIndex field MUST be set to the value of the DestHandleIndex field of the ROP request buffer. ");

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R737
                // The value of PropertyProblemCount is 0 means this field is not present.
                Site.CaptureRequirementIfAreEqual<ushort>(
                    0,
                    ropCopyPropertiesResponse.PropertyProblemCount,
                    737,
                    @"[In RopCopyProperties ROP Response Buffer] PropertyProblemCount: This field MUST NOT be present if the ReturnValue field is set to NullDestinationObject (0x00000503).");

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R738
                // PropertyProblems is null means this field is not present.
                Site.CaptureRequirementIfIsNull(
                    ropCopyPropertiesResponse.PropertyProblems,
                    738,
                    @"[In RopCopyProperties ROP Response Buffer] propertyProblems: This field MUST NOT be present if the ReturnValue field is set to NullDestinationObject (0x00000503).");
            }
            else
            {
                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R170
                // The value of DestHandleIndex is 0 means this field is not present.
                Site.CaptureRequirementIfAreEqual<uint>(
                    0,
                    ropCopyPropertiesResponse.DestHandleIndex,
                    170,
                    @"[In RopCopyProperties ROP Response Buffer] DestHandleIndex: The DestHandleIndex field MUST NOT be present if the ReturnValue field is set to any value other than NullDestinationObject (0x00000503).");
            }

            if ((objectType == ServerObjectType.Folder) && (copyFlags == CopyFlags.Move))
            {
                if (Common.IsRequirementEnabled(882, this.Site))
                {
                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)CPRPTErrorCode.NotSupported,
                        ropCopyPropertiesResponse.ReturnValue,
                        882,
                        @"[In Processing RopCopyProperties] Implementation does return NotSupported error, if the original object is a Folder object and the CopyFlags field has the Move flag set.(Microsoft Exchange Server 2007 and above follow this behavior)");
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Verify the RopSetPropertiesNoReplicate operation related requirements.
        /// </summary>
        /// <param name="ropSetPropertiesNoReplicateResponse">The RopSetPropertiesNoReplicate response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopSetPropertiesNoReplicate operation is acting on.</param>
        private void VerifyRopSetPropertiesNoReplicate(RopSetPropertiesNoReplicateResponse ropSetPropertiesNoReplicateResponse, ServerObjectType objectType)
        {
            if (ropSetPropertiesNoReplicateResponse.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(
                        826,
                        @"[In RopSetPropertiesNoReplicate ROP] This ROP is supported for 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(
                        828,
                        @"[In RopSetPropertiesNoReplicate ROP] This ROP is supported for 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(
                        830,
                        @"[In RopSetPropertiesNoReplicate ROP] This ROP is supported for Attachment 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(
                        832,
                        @"[In RopSetPropertiesNoReplicate ROP] This ROP is supported for Logon objects.");
                }

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                  83307,
                  @"[In RopSetPropertiesNoReplicate ROP Response Buffer] propertyProblemCount: 2 bytes integer.");
            }

            ushort numberOfPropertyProblem = 0;
            if (ropSetPropertiesNoReplicateResponse.PropertyProblemCount != 0)
            {
                for (int counter = 0; counter < ropSetPropertiesNoReplicateResponse.PropertyProblems.Length; counter++)
                {
                    this.VerifyPropertyProblemSturctureInCDATA();
                }

                numberOfPropertyProblem = (ushort)ropSetPropertiesNoReplicateResponse.PropertyProblems.Length;
            }

            Site.CaptureRequirementIfAreEqual<ushort>(
             numberOfPropertyProblem,
             ropSetPropertiesNoReplicateResponse.PropertyProblemCount,
             83308,
             @"[In RopSetPropertiesNoReplicate ROP Response Buffer] propertyProblemCount: An integer that specifies the number of elements contained in the PropertyProblems field.");
        }
Exemplo n.º 20
0
        /// <summary>
        /// Verify the RopCopyTo operation related requirements.
        /// </summary>
        /// <param name="ropCopyToResponse">The RopCopyTo response buffer structure.</param>
        /// <param name="copyToCondition">The condition to generate the corresponding error codes.</param>
        /// <param name="objectType">Indicates which object type the RopCopyProperties operation is acting on.</param>
        /// <param name="copyFlags">Indicates the copy flags.</param>
        private void VerifyRopCopyTo(RopCopyToResponse ropCopyToResponse, CopyToCondition copyToCondition, ServerObjectType objectType, CopyFlags copyFlags)
        {
            // Since the RopCopyTo ROP response was parsed successfully, MS-OXCPRPT_R50702 can be captured directly.
            Site.CaptureRequirement(
                50702,
                @"[In Processing RopCopyTo] The server responds with a RopCopyTo ROP response buffer.");

            if (ropCopyToResponse.ReturnValue == (uint)CPRPTErrorCode.NotSupported)
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    "MS-OXCDATA",
                     928,
                     @"[In Error Codes] The numeric value (hex) for error code NotSupported is 0x80040102, %x02.01.04.80.");
            }

            if (ropCopyToResponse.ReturnValue == (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(
                        17201,
                        @"[In RopCopyTo ROP] This operation [RopCopyTo ROP] is valid on Message objects.");
                }

                if (objectType == ServerObjectType.Folder)
                {
                    if (copyFlags == CopyFlags.Move)
                    {
                        if (Common.IsRequirementEnabled(5070511, this.Site))
                        {
                            // If the implementation return a successful response, it means it doesn't return NotSupported error. So it can be capture directly.
                            Site.CaptureRequirement(
                                5070511,
                                @"[In Processing RopCopyTo] Implementation does not return a NotSupported error (0x80040102), if the original object is a Folder object and the CopyFlags field has the Move flag set. (Microsoft Exchange Server 2007 and above follow this behavior.)");
                        }
                    }

                    // 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(
                        17203,
                        @"[In RopCopyTo ROP] This operation [RopCopyTo ROP] 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(
                        17202,
                        @"[In RopCopyTo ROP] This operation [RopCopyTo ROP] is valid on Attachment objects.");
                }

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                   192,
                   @"[In RopCopyTo ROP Response Buffer] propertyProblemCount: 2 bytes integer.");

                if (ropCopyToResponse.PropertyProblemCount != 0)
                {
                    for (int counter = 0; counter < ropCopyToResponse.PropertyProblems.Length; counter++) 
                    {
                        this.VerifyPropertyProblemSturctureInCDATA();
                    }

                    Site.CaptureRequirementIfAreEqual<ushort>(
                        ropCopyToResponse.PropertyProblemCount,
                        (ushort)ropCopyToResponse.PropertyProblems.Length,
                        19201,
                        @"[In RopCopyTo ROP Response Buffer] propertyProblemCount: An integer that specifies the number of elements contained in the PropertyProblems field. ");

                    // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                    Site.CaptureRequirement(
                        193,
                        @"[In RopCopyTo ROP Response Buffer] propertyProblems (variable): An array of PropertyProblem structures ([MS-OXCDATA] section 2.7).");
                }

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    19601,
                    @"[In RopCopyTo ROP Response Buffer] DestHandleIndex (4 bytes):  An integer.");
            }

            if (ropCopyToResponse.ReturnValue.Equals((uint)CPRPTErrorCode.NullDestinationObject))
            {
                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R195
                // The value of DestHandleIndex is not 0 means this field is present.
                Site.CaptureRequirementIfAreEqual<uint>(
                    1,
                    ropCopyToResponse.DestHandleIndex,
                    196,
                    @"[In RopCopyTo ROP Response Buffer] DestHandleIndex: The DestHandleIndex field MUST be set to the value of the DestHandleIndex field of the ROP request buffer");

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R739
                // The value of PropertyProblemCount is 0 means this field is not present.
                Site.CaptureRequirementIfAreEqual<ushort>(
                    0,
                    ropCopyToResponse.PropertyProblemCount,
                    739,
                    @"[In RopCopyTo ROP Response Buffer] PropertyProblemCount: This field MUST NOT be present if the ReturnValue field is set to NullDestinationObject (0x00000503).");

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R740
                // PropertyProblems is null means this field is not present.
                Site.CaptureRequirementIfIsNull(
                    ropCopyToResponse.PropertyProblems,
                    740,
                    @"[In RopCopyTo ROP Response Buffer] PropertyProblems: This field MUST NOT be present if the ReturnValue field is set to NullDestinationObject (0x00000503).");
            }
            else
            {
                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R197
                // The value of DestHandleIndex is 0 means this field is not present.
                Site.CaptureRequirementIfAreEqual<uint>(
                     0,
                     ropCopyToResponse.DestHandleIndex,
                    197,
                    @"[In RopCopyTo ROP Response Buffer] DestHandleIndex: The DestHandleIndex field MUST NOT be present if the ReturnValue field is set to any value other than NullDestinationObject (0x00000503).");
            }

            if (copyToCondition == CopyToCondition.SourceContainsDest)
            {
                if (objectType == ServerObjectType.Folder)
                {
                    if (Common.IsRequirementEnabled(89603, this.Site))
                    {
                        Site.CaptureRequirementIfAreEqual<uint>(
                            (uint)CPRPTErrorCode.FolderCycle,
                            ropCopyToResponse.ReturnValue,
                            89603,
                            @"[In Processing RopCopyTo] Implementation does return error code ""0x8004060B"" with name ""FolderCycle"" when The source folder contains the destination folder.(Microsoft Exchange Server 2007 and above follow this behavior)");
                    }
                }
            }
            else if (copyToCondition == CopyToCondition.SourceDestNotCompatible)
            {
                // CopyToCondition.SourceDestNotCompatible means source object and destination object are not compatible with each other for the copy operation.
                bool isR890Satisfied = ropCopyToResponse.ReturnValue == (uint)CPRPTErrorCode.NotSupported;

                if (Common.IsRequirementEnabled(890, this.Site))
                {
                    // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R890
                    Site.CaptureRequirementIfIsTrue(
                        isR890Satisfied,
                        890,
                        @"[In Processing RopCopyTo] Implementation does return error code ""0x80040102"" with name ""NotSupported"",  when ""The source object and destination object are not compatible with each other for the copy operation."" (Microsoft Exchange Server 2007 and above follow this behavior)");

                    Site.CaptureRequirementIfIsTrue(
                        isR890Satisfied,
                        150,
                        @"[In RopCopyProperties ROP] Also, the source and destination object MUST be of the same type.");
                }
            }
            else if (copyToCondition == CopyToCondition.SourceDestHasSubObjWithSameDisplayName)
            {
                // CopyToCondition.SourceDestHasSubObjWithSameDisplayName means a sub-object cannot be copied because there is already a sub-object existing 
                // in the destination object with the same display name (PidTagDisplayName) as the sub-object to be copied.
                if (Common.IsRequirementEnabled(899, this.Site))
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R899, the return error code value is: {0}", ropCopyToResponse.ReturnValue);

                    // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R899
                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)CPRPTErrorCode.CollidingNames,
                        ropCopyToResponse.ReturnValue,
                        899,
                        @"[In Processing RopCopyTo] Implementation does return error code ""0x80040604"" with name ""CollidingNames"", when a subobject cannot be copied because there is already a subobject existing in the destination object with the same display name, which is specified in the PidTagDisplayName property ([MS-OXCFOLD] section 2.2.2.2.2.4), as the subobject to be copied.(Microsoft Exchange Server 2007 and above follow this behavior)");
                }
            }
            else if (copyToCondition == CopyToCondition.SourceMessageContainsDestMessage && Common.IsRequirementEnabled(89601, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R89601, the return error code value is: {0}", ropCopyToResponse.ReturnValue);

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R89601
                Site.CaptureRequirementIfAreEqual<uint>(
                    (uint)CPRPTErrorCode.MessageCycle,
                    ropCopyToResponse.ReturnValue,
                    89601,
                    @"[In Appendix A: Product Behavior] Implementation does return error code ""0x00000504"" with name ""MessageCycle"" when the source message directly contains the destination message. (Exchange 2007 and above follow this behavior.)");
            }
            else if (copyToCondition == CopyToCondition.SourceMessageIndirectlyContainsDestMessage && Common.IsRequirementEnabled(89604, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R89604, the return error code value is: {0}", ropCopyToResponse.ReturnValue);

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R89604
                Site.CaptureRequirementIfAreEqual<uint>(
                    (uint)CPRPTErrorCode.MessageCycle,
                    ropCopyToResponse.ReturnValue,
                    89604,
                    @"[In Appendix A: Product Behavior] Implementation does return error code ""0x00000504"" with name ""MessageCycle"" when the source message indirectly contains the destination message. (Exchange 2007 and above follow this behavior.)");            
            }
        }
Exemplo n.º 21
0
        public static void GetObject1(ServerObjectType objType, ObjectToOperate objToOperate)
        {
            Condition.IsTrue(objToOperate == ObjectToOperate.FirstObject || objToOperate == ObjectToOperate.FifthObject);

            isFirstObjectGot = true;
            globalObj = objType;
        }
Exemplo n.º 22
0
        /// <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>
        /// This method is used to get object for different object types.
        /// </summary>
        /// <param name="objType">Specifies the object type.</param>
        /// <param name="objToOperate">Specifies which objects to operate.</param>
        public void GetObject(ServerObjectType objType, ObjectToOperate objToOperate)
        {
            this.cprptCurrentObj = objToOperate;

            if (objType == ServerObjectType.Logon)
            {
                this.cprptFirstHandle = this.cprptFirstObjectHandle = this.cprptCurrentHandle = this.cprptLogonHandle;
            }

            if (objType == ServerObjectType.Folder)
            {
                switch (objToOperate)
                {
                    case ObjectToOperate.FirstObject:
                        this.cprptFirstHandle = this.cprptFirstObjectHandle = this.cprptCurrentHandle = cprptFolderHandle[0];
                        break;
                    case ObjectToOperate.SecondObject:
                        this.cprptSecondHandle = this.cprptSecondObjectHandle = cprptFolderHandle[1];
                        break;
                    case ObjectToOperate.ThirdObject:
                        this.cprptCurrentHandle = cprptFolderHandle[2];
                        break;
                    case ObjectToOperate.FourthObject:
                        this.cprptCurrentHandle = cprptFolderHandle[3];
                        break;
                    case ObjectToOperate.FifthObject:
                        this.cprptCurrentHandle = cprptFolderHandle[1];
                        break;
                    default:
                        Site.Assert.Fail("Invalid ObjectToOperate enum value {0}.", objToOperate);
                        break;
                }
            }

            if (objType == ServerObjectType.Message)
            {
                switch (objToOperate)
                {
                    case ObjectToOperate.FirstObject:
                        this.cprptFirstHandle = this.cprptFirstObjectHandle = this.cprptCurrentHandle = cprptMessageHandle[0];
                        break;
                    case ObjectToOperate.SecondObject:
                        this.cprptSecondHandle = this.cprptSecondObjectHandle = cprptMessageHandle[1];
                        break;
                    case ObjectToOperate.ThirdObject:
                        this.cprptCurrentHandle = cprptMessageHandle[2];
                        break;
                    case ObjectToOperate.FourthObject:
                        this.cprptCurrentHandle = cprptMessageHandle[3];
                        break;
                    default:
                        Site.Assert.Fail("Invalid ObjectToOperate enum value {0}.", objToOperate);
                        break;
                }
            }

            if (objType == ServerObjectType.Attachment)
            {
                switch (objToOperate)
                {
                    case ObjectToOperate.FirstObject:
                        this.cprptFirstHandle = this.cprptFirstObjectHandle = this.cprptCurrentHandle = cprptAttachmentHandle[0];
                        break;
                    case ObjectToOperate.SecondObject:
                        this.cprptSecondHandle = this.cprptSecondObjectHandle = cprptAttachmentHandle[1];
                        break;
                    case ObjectToOperate.ThirdObject:
                        this.cprptCurrentHandle = cprptAttachmentHandle[2];
                        break;
                    case ObjectToOperate.FourthObject:
                        this.cprptCurrentHandle = cprptAttachmentHandle[3];
                        break;
                    default:
                        Site.Assert.Fail("Invalid ObjectToOperate enum value {0}.", objToOperate);
                        break;
                }
            }

            #region Set property

            TaggedPropertyValue[] taggedPropertyValueArray = new TaggedPropertyValue[1];
            RopSetPropertiesResponse ropSetPropertiesResponse;
            if (objType == ServerObjectType.Attachment)
            {
                // Add this property to attachment1.
                this.cprptCurrentType = ServerObjectType.Attachment;
                taggedPropertyValueArray[0] = this.GetTaggedPropertyTag(ObjectToOperate.FirstObject);
                taggedPropertyValueArray[0].Value = Common.AddInt16LengthBeforeBinaryArray(taggedPropertyValueArray[0].Value);
                ropSetPropertiesResponse = this.RopSetProperties(cprptAttachmentHandle[0], taggedPropertyValueArray, true);
                Site.Assert.AreEqual<uint>(0, ropSetPropertiesResponse.ReturnValue, "The properties should be set for the first object successfully.");
                RopSaveChangesAttachmentResponse ropSaveAttachmentResponse = this.RopSaveChangesAttachment(cprptAttachmentHandle[0], true);
                Site.Assert.AreEqual<uint>(0, ropSaveAttachmentResponse.ReturnValue, "The changes on Attachment should be saved successfully.");
                this.RopSaveChangesMessage(cprptMessageHandle[0], true);

                // Add this property to attachment2.
                taggedPropertyValueArray[0] = this.GetTaggedPropertyTag(ObjectToOperate.SecondObject);
                taggedPropertyValueArray[0].Value = Common.AddInt16LengthBeforeBinaryArray(taggedPropertyValueArray[0].Value);
                this.RopSetProperties(cprptAttachmentHandle[1], taggedPropertyValueArray, true);
                this.RopSaveChangesAttachment(cprptAttachmentHandle[1], true);
                this.RopSaveChangesMessage(cprptMessageHandle[0], true);
            }

            if (objType == ServerObjectType.Message)
            {
                // Add this property to message1.
                this.cprptCurrentType = ServerObjectType.Message;
                taggedPropertyValueArray[0] = this.GetTaggedPropertyTag(ObjectToOperate.FirstObject);
                taggedPropertyValueArray[0].Value = Common.AddInt16LengthBeforeBinaryArray(taggedPropertyValueArray[0].Value);
                this.RopSetProperties(cprptMessageHandle[0], taggedPropertyValueArray, true);
                this.RopSaveChangesMessage(cprptMessageHandle[0], true);

                // Add this property to message2.
                taggedPropertyValueArray[0] = this.GetTaggedPropertyTag(ObjectToOperate.SecondObject);
                taggedPropertyValueArray[0].Value = Common.AddInt16LengthBeforeBinaryArray(taggedPropertyValueArray[0].Value);
                this.RopSetProperties(cprptMessageHandle[1], taggedPropertyValueArray, true);
                this.RopSaveChangesMessage(cprptMessageHandle[1], true);
            }

            if (objType == ServerObjectType.Folder)
            {
                // Add this property to folder1.
                this.cprptCurrentType = ServerObjectType.Folder;
                taggedPropertyValueArray[0] = this.GetTaggedPropertyTag(ObjectToOperate.FirstObject);
                taggedPropertyValueArray[0].Value = Common.AddInt16LengthBeforeBinaryArray(taggedPropertyValueArray[0].Value);
                this.RopSetProperties(cprptFolderHandle[0], taggedPropertyValueArray, true);

                // Add this property to folder2.
                taggedPropertyValueArray[0] = this.GetTaggedPropertyTag(ObjectToOperate.SecondObject);
                taggedPropertyValueArray[0].Value = Common.AddInt16LengthBeforeBinaryArray(taggedPropertyValueArray[0].Value);
                this.RopSetProperties(cprptFolderHandle[1], taggedPropertyValueArray, true);

                // Set PTagRulesData property for folder1 and folder2
                taggedPropertyValueArray[0] = this.GetTaggedPropertyTag(ObjectToOperate.ThirdObject);
                taggedPropertyValueArray[0].Value = Common.AddInt16LengthBeforeBinaryArray(taggedPropertyValueArray[0].Value);
                this.RopSetProperties(cprptFolderHandle[0], taggedPropertyValueArray, true);
                this.RopSetProperties(cprptFolderHandle[1], taggedPropertyValueArray, true);
            }

            if (objType == ServerObjectType.Logon)
            {
                // Add this property to logon.
                this.cprptCurrentType = ServerObjectType.Logon;
                taggedPropertyValueArray[0] = this.GetTaggedPropertyTag(ObjectToOperate.FirstObject);
                this.RopSetProperties(this.cprptLogonHandle, taggedPropertyValueArray, true);
            }

            // Set current type.
            this.cprptCurrentType = objType;

            #endregion
        }
Exemplo n.º 24
0
        /// <summary>
        /// Verify the RopGetNamesFromPropertyIds operation related requirements.
        /// </summary>
        /// <param name="propertyIdCount">The PropertyIdCount parameter in the request buffer which indicates the number of PropertyId.</param>
        /// <param name="propertyIds">A list of PropertyId in the request buffer.</param>
        /// <param name="ropGetNamesFromPropertyIdsResponse">The RopGetNamesFromPropertyIds response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopGetNamesFromPropertyIds operation is acting on.</param>
        private void VerifyRopGetNamesFromPropertyIds(
            ushort propertyIdCount,
            PropertyId[] propertyIds,
            RopGetNamesFromPropertyIdsResponse ropGetNamesFromPropertyIdsResponse,
            ServerObjectType objectType)
        {
            // Since the RopGetNamesFromPropertyIds ROP response was parsed successfully, MS-OXCPRPT_R51802 can be captured directly.
            Site.CaptureRequirement(
                51802,
                @"[In Processing RopGetNamesFromPropertyIds] The server responds with a RopGetNamesFromPropertyIds ROP response buffer.");

            if (ropGetNamesFromPropertyIdsResponse.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(
                        23701,
                        @"[In RopGetNamesFromPropertyIds ROP] This operation [RopGetNamesFromPropertyIds ROP] 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(
                        23703,
                        @"[In RopGetNamesFromPropertyIds ROP] This operation [RopGetNamesFromPropertyIds ROP] 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(
                        23702,
                        @"[In RopGetNamesFromPropertyIds ROP] This operation [RopGetNamesFromPropertyIds ROP] is valid on Attachment 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(
                        23704,
                        @"[In RopGetNamesFromPropertyIds ROP] This operation [RopGetNamesFromPropertyIds ROP] is valid on Logon objects.");
                }

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                  248,
                  @"[In RopGetNamesFromPropertyIds ROP Response Buffer] PropertyNameCount: 2 bytes integer.");

                if (ropGetNamesFromPropertyIdsResponse.PropertyNameCount != 0)
                {
                    // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                    Site.CaptureRequirement(
                          250,
                          @"[In RopGetNamesFromPropertyIds ROP Response Buffer] PropertyNames (variable): An array of PropertyName structures ([MS-OXCDATA] section 2.6).");
                }

                // Add the debug information
                Site.Log.Add(
                    LogEntryKind.Debug,
                    "Verify MS-OXCPRPT_R658, PropertyNameCount is {0}, ProertyNames is {1}",
                    ropGetNamesFromPropertyIdsResponse.PropertyNameCount,
                    ropGetNamesFromPropertyIdsResponse.PropertyNames);
            }

            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R249
            Site.CaptureRequirementIfAreEqual<ushort>(
                propertyIdCount,
                ropGetNamesFromPropertyIdsResponse.PropertyNameCount,
                249,
                @"[In RopGetNamesFromPropertyIds ROP Response Buffer] PropertyNameCount: This value MUST be equal to the value of the PropertyIdCount field of the ROP request buffer. ");

            Site.CaptureRequirementIfAreEqual<ushort>(
               propertyIdCount,
               (ushort)ropGetNamesFromPropertyIdsResponse.PropertyNames.Length,
               24802,
               @"[In RopGetNamesFromPropertyIds ROP Response Buffer] propertyNameCount: An integer that specifies the number of structures contained in the PropertyNames field. ");

            // Examine each property ID in the request message and each associated PropertyName in the response message.The order of the ID and Name matches.
            for (int i = 0; i < propertyIds.Length; i++)
            {
                if (propertyIds[i].ID < 0x8000)
                {
                    // Add the debug information
                    Site.Log.Add(
                        LogEntryKind.Debug,
                        "Verify MS-OXCPRPT_R518,The PropertyId requested is {0}, The GUID response in PropertyName is {1}, The expected value of GUID is {2}",
                        propertyIds[i].ID,
                        ropGetNamesFromPropertyIdsResponse.PropertyNames[i].Guid.ToString(),
                        this.valuePSMAPI.ToString());

                    // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R518
                    // Check whether the PropertyName's GUID is PS-MAPI
                    bool isVerifyR518 = Common.CompareByteArray(ropGetNamesFromPropertyIdsResponse.PropertyNames[i].Guid, this.valuePSMAPI);

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR518,
                        518,
                        @"[In Processing RopGetNamesFromPropertyIds] For each property ID in the PropertyIds field of the ROP request buffer, the server MUST perform the following: If the property ID is less than 0x8000, the associated PropertyName structure ([MS-OXCDATA] section 2.6.1) contained in the PropertyNames field of the ROP response buffer MUST be composed as follows: The structure's GUID field is set to the PS_MAPI property set ([MS-OXPROPS] section 1.3.2).");

                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R519");

                    Site.CaptureRequirementIfAreEqual<byte>(
                        0x00,
                        ropGetNamesFromPropertyIdsResponse.PropertyNames[i].Kind,
                        519,
                        @"[In Processing RopGetNamesFromPropertyIds] For each property ID in the PropertyIds field of the ROP request buffer, the server MUST perform the following: If the property ID is less than 0x8000, the associated PropertyName structure ([MS-OXCDATA] section 2.6.1) contained in the PropertyNames field of the ROP response buffer MUST be composed as follows:: The structure's Kind field is set to 0x00.");

                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCPRPT_R520");

                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)propertyIds[i].ID,
                        (uint)ropGetNamesFromPropertyIdsResponse.PropertyNames[i].LID,
                        520,
                        @"[In Processing RopGetNamesFromPropertyIds] For each property ID in the PropertyIds field of the ROP request buffer, the server MUST perform the following: If the property ID is less than 0x8000, the associated PropertyName structure ([MS-OXCDATA] section 2.6.1) contained in the PropertyNames field of the ROP response buffer MUST be composed as follows:: The structure's LID field is set to the property ID.");
                }
            }

            bool isCDATAR25Valid = true;
            bool isCDATAR27Valid = true;
            foreach (PropertyName propertyName in ropGetNamesFromPropertyIdsResponse.PropertyNames)
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    "MS-OXCDATA",
                    30,
                    @"[In PropertyName Structure] Name (optional) (variable):  The value is a Unicode (UTF-16 format) string, followed by two zero bytes as terminating null characters, that identifies the property within its property set.");

                Site.CaptureRequirementIfIsNotNull(
                    propertyName.Guid,
                    "MS-OXCDATA",
                    21,
                    @"[In PropertyName Structure] GUID (16 bytes):  The GUID that identifies the property set for the named property.");

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    "MS-OXCDATA",
                    26,
                    @"[In PropertyName Structure] LID (optional) (4 bytes):  An unsigned integer that identifies the named property within its property set.");

                if ((propertyName.LID != 0x00 && propertyName.Kind != 0x00) || ((propertyName.Kind == 0x01 || propertyName.Kind == 0x0ff) && propertyName.LID != 0x00))
                {
                    isCDATAR25Valid = false;
                }

                if ((propertyName.NameSize != null && propertyName.Kind != 0x01) || ((propertyName.Kind == 0x00 || propertyName.Kind == 0x0ff) && propertyName.NameSize != null))
                {
                    isCDATAR27Valid = false;
                }
            }

            Site.CaptureRequirementIfIsTrue(
                isCDATAR25Valid,
                "MS-OXCDATA",
                25,
                @"[In PropertyName Structure] LID (optional) (4 bytes): This field is present only if the value of the Kind field is equal to 0x00.");

            Site.CaptureRequirementIfIsTrue(
               isCDATAR27Valid,
               "MS-OXCDATA",
               27,
               @"[In PropertyName Structure] NameSize (optional) (1 byte):  This field is present only if the value of the Kind field is equal to 0x01.");

            Site.CaptureRequirementIfIsTrue(
               isCDATAR27Valid,
               "MS-OXCDATA",
               29,
               @"[In PropertyName Structure] Name (optional) (variable): This field is present only if Kind is equal to 0x01.");

            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R521
            // The property ID values has been verified that have an associated PropertyName.
            // Server will set the PropertyName value according to the PropertyId. So if the returned PropertyNames is not null, this requirement can be verified.
            Site.CaptureRequirementIfIsNotNull(
                ropGetNamesFromPropertyIdsResponse.PropertyNames,
                521,
                @"[In Processing RopGetNamesFromPropertyIds] For each property ID in the PropertyIds field of the ROP request buffer, the server MUST perform the following: For property IDs that have an associated PropertyName structure, the server MUST return the PropertyName structure associated with the property ID.");

            // Since the RopGetNamesFromPropertyIds ROP response was parsed successfully, MS-OXCPRPT_R230 can be captured directly.
            Site.CaptureRequirement(
                230,
                @"[In RopGetNamesFromPropertyIds ROP] The RopGetNamesFromPropertyIds ROP ([MS-OXCROPS] section 2.2.8.2) maps concrete property IDs to abstract, client-defined named properties");
        }
Exemplo n.º 25
0
 private void BTN_Projects_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.Project;
     PropulateServerObjects();
 }
Exemplo n.º 26
0
        /// <summary>
        /// Verify the RopOpenStream operation related requirements.
        /// </summary>
        /// <param name="ropOpenStreamResponse">The RopOpenStream response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopOpenStream operation is acting on.</param>
        /// <param name="isPropertyTagExist">A boolean value indicates if the property tag exist for the object or not.</param>
        /// <param name="openFlag">Specifies OpenModeFlags for RopOpenStream.</param>
        private void VerifyRopOpenStream(RopOpenStreamResponse ropOpenStreamResponse, ServerObjectType objectType, bool isPropertyTagExist, OpenModeFlags openFlag)
        {
            if (!isPropertyTagExist && openFlag != OpenModeFlags.Create)
            {
                // Error code NotFound value is 0x8004010F
                bool isR891Satisfied = ropOpenStreamResponse.ReturnValue == 0x8004010F;
                if (isR891Satisfied)
                {
                    // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                    Site.CaptureRequirement(
                        "MS-OXCDATA",
                        2055,
                        @"[In Additional Error Codes] The numeric value (hex) for error code NotFound is 0x8004010F, %x0F.01.04.80.");
                }

                if (Common.IsRequirementEnabled(891, this.Site))
                {
                    // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R891
                    Site.CaptureRequirementIfIsTrue(
                        isR891Satisfied,
                        891,
                        @"[In Processing RopOpenStream] Implementation does return error ""0x8004010F"" with name ""NotFound"", when The property tag does not exist for the object, and it cannot be created because the Create bit was not specified in OpenModeFlags field.(Microsoft Exchange Server 2007 and above follow this behavior)");
                }
            }
            else
            {
                // Since the RopOpenStream ROP response was parsed successfully, MS-OXCPRPT_R537 can be captured directly.
                Site.CaptureRequirement(
                    537,
                    @"[In Processing RopOpenStream] The server responds with a RopOpenStream ROP response buffer.");

                // If this operation is performed successfully, that means this operation opens a property as a Stream object.
                Site.CaptureRequirement(
                    251,
                    @"[In RopOpenStream ROP] The RopOpenStream ROP ([MS-OXCROPS] section 2.2.9.1) opens a property as a Stream object.");
                if (ropOpenStreamResponse.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(
                            25301,
                            @"[In RopOpenStream ROP] This operation [RopOpenStream ROP] 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(
                            25302,
                            @"[In RopOpenStream ROP] This operation [RopOpenStream ROP] 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(
                            25303,
                            @"[In RopOpenStream ROP] This operation [RopOpenStream ROP] is valid on Attachment objects.");
                    }

                    // If the OpenStream operation succeeds, it means the StreamSize filed has been set by server internally with the current number of BYTES in the stream.
                    // So this requirement can be verified directly. 
                    Site.CaptureRequirement(
                        276,
                        @"[In RopOpenStream ROP Response Buffer]StreamSize (4 bytes).");

                    // If the OpenStream operation succeeds, it means the StreamSize filed has been set by server internally with the current number of BYTES in the stream.
                    // So this requirement can be verified directly. 
                    Site.CaptureRequirement(
                       27601,
                       @"[In RopOpenStream ROP Response Buffer]StreamSize: An integer that specifies the number of bytes in the opened stream. ");
                }
            }
        }
Exemplo n.º 27
0
 private void BTN_Calendars_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.Calendar;
     PropulateServerObjects();
 }
Exemplo n.º 28
0
        /// <summary>
        /// Verify the RopGetPropertiesSpecific operation related requirements.
        /// </summary>
        /// <param name="ropGetPropertiesSpecificResponse">The RopGetPropertiesSpecific response buffer structure.</param>
        /// <param name="objectType">Indicates which object type the RopGetPropertiesSpecific 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>
        /// <param name="isPropertySizeLimitZero">Indicates if PropertySizeLimit is set to 0.</param>
        /// <param name="isPropertyLagerThanLimit">Indicates if returned value size is larger than the size limit.</param>
        /// <param name="isValueContainsNotEnoughMemory">Indicates if the value is larger than limit or not.</param>
        private void VerifyRopGetPropertiesSpecific(
            RopGetPropertiesSpecificResponse ropGetPropertiesSpecificResponse,
            ServerObjectType objectType,
            bool isOrdered,
            bool isPropertySizeLimitZero,
            bool isPropertyLagerThanLimit,
            bool isValueContainsNotEnoughMemory)
        {
            // Since the RopGetPropertiesSpecific ROP response was parsed successfully, MS-OXCPRPT_R45602 can be captured directly.
            Site.CaptureRequirement(
                45602,
                @"[In Processing RopGetPropertiesSpecific] The server responds with a RopGetPropertiesSpecific ROP response buffer. ");

            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R56
            // Since the return value is in order, it verifies the return value is returned in order as the properties specified in the PropertyTags field. So MS-OXCPRPT_R56 can be captured.
            Site.CaptureRequirementIfIsTrue(
                isOrdered,
                56,
                @"[In RopGetPropertiesSpecific ROP] The RopGetPropertiesSpecific ROP ([MS-OXCROPS] section 2.2.8.3) queries for and returns the values of properties specified in the PropertyTags field.");

            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R45702
            // Since the response for RopGetPropertiesSpecific doesn't contain PropertyTags information, if the returned values for PropertyTags fields in RopGetPropertiesSpecific are same with the setting values in RopSetProperties. 
            // It means the properties to be returned are specified in the PropertyTags field of the request. 
            Site.CaptureRequirementIfIsTrue(
                isOrdered,
                45702,
                @"[In Processing RopGetPropertiesSpecific] The properties to be returned are specified in the PropertyTags field of the ROP request buffer.");

            // The order has been verified when de-serializing the related structures and represented by the variable isOrdered.
            Site.CaptureRequirementIfIsTrue(
               isOrdered,
               "MS-OXCDATA",
               64,
               @"[In PropertyRow Structures] For the RopGetPropertiesSpecific ROP, property values are returned in the order that the properties were requested.");

            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R45701
            // The order has been verified when de-serializing the related structures and represented by the variable isOrdered.
            Site.CaptureRequirementIfIsTrue(
                isOrdered,
                45701,
                @"[In Processing RopGetPropertiesSpecific] The server MUST order properties in the PropertyValues field of the ROP response buffer in the same order in which properties are specified in the PropertyTags field.");

            // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R76
            // The order has been verified when de-serializing the related structures and represented by the variable isOrdered.
            Site.CaptureRequirementIfIsTrue(
                isOrdered,
                76,
                @"[In RopGetPropertiesSpecific ROP Response Buffer] RowData (variable): A PropertyRow structure ([MS-OXCDATA] section 2.8.1) that contains the values of the properties specified in the ROP request buffer.");

            if (isPropertySizeLimitZero)
            {
                bool isPropertyLimitedByBufferSize = false;
                uint len = 0;
                foreach (PropertyValue value in ropGetPropertiesSpecificResponse.RowData.PropertyValues)
                {
                    len = len + (uint)value.Size();
                }

                isPropertyLimitedByBufferSize = len < uint.MaxValue;

                Site.CaptureRequirementIfIsTrue(
                    isPropertyLimitedByBufferSize,
                    62,
                    @"[In RopGetPropertiesSpecific ROP Request Buffer] PropertySizeLimit: If this value is zero, the property values are limited only by the size of the ROP response buffer. ");
            }

            if (ropGetPropertiesSpecificResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None))
            {
                switch (objectType)
                {
                    case 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(
                            5801,
                            @"[In RopGetPropertiesSpecific ROP] Message objects are supported for this operation [RopGetPropertiesSpecific ROP].");
                        break;
                    case 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(
                            5803,
                            @"[In RopGetPropertiesSpecific ROP] Attachment objects are supported for this operation [RopGetPropertiesSpecific ROP].");
                        break;
                    case 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(
                            5802,
                            @"[In RopGetPropertiesSpecific ROP] Folder objects are supported for this operation [RopGetPropertiesSpecific ROP].");
                        break;
                    case 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(
                            5804,
                            @"[In RopGetPropertiesSpecific ROP] Logon objects are supported for this operation [RopGetPropertiesSpecific ROP].");
                        break;
                    default:
                        Site.Assert.Fail("The returned server object type is {0}, which is invalid.", objectType);
                        break;
                }
            }

            if (Common.IsRequirementEnabled(86703, this.Site))
            {
                if (this.cprptCurrentType == ServerObjectType.Message || this.cprptCurrentType == ServerObjectType.Attachment)
                {
                    if (isPropertyLagerThanLimit)
                    {
                        // If MS-OXCPRPT_R86703 is enabled, when the property is a PtypBinary type, a PtypObject type, or a string property, 
                        // the NotEnoughMemory (0x8007000E) will be returned, if the value is larger than either the available space in the ROP response buffer or the size specified in the PropertySizeLimit field of the ROP request buffer.
                        // MS-OXCPRPT_R86703 is captured in model. This requirement is captured here since the requirements from other protocols cannot be handled in model.
                        Site.CaptureRequirementIfIsTrue(
                             isValueContainsNotEnoughMemory,
                             "MS-OXCDATA",
                             2052,
                             @"[In Additional Error Codes] NotEnoughMemory (E_NOMEMORY, MAPI_E_NOT_ENOUGH_MEMORY) will be returned, On get, indicates that the property or column value is too large to be retrieved by the request, and the property value needs to be accessed with the RopOpenStream ROP ([MS-OXCROPS] section 2.2.9.1).");
                    }
                }
            }
        }
Exemplo n.º 29
0
 private void BTN_LookupTables_Click(object sender, EventArgs e)
 {
     _selectedServerObject = ServerObjectType.LookupTable;
     PropulateServerObjects();
 }
Exemplo n.º 30
0
 public void GetProperties(ServerObjectType objtype)
 {
     NumProperties = EMEServ.GetProperties((Int16)objtype, ref ptrProperties[0]);
     Properties = (object[])ptrProperties[0];
 }