示例#1
0
        /// <summary>
        /// This method validates the requirements under
        /// LDSServiceAndQueryPolicyContainer Scenario.
        /// </summary>
        public void ValidateLDSServiceAndQueryPolicyContainer()
        {
            DirectoryEntry          requiredEntry = new DirectoryEntry();
            DirectoryEntry          childEntry = new DirectoryEntry();
            string                  configNCForLDS = "CN=Configuration," + adAdapter.LDSRootObjectName, parentAttribute;
            PropertyValueCollection objectClass;

            if (!adAdapter.GetLdsObjectByDN("CN=Services," + configNCForLDS, out requiredEntry))
            {
                DataSchemaSite.Assume.IsTrue(
                    false,
                    "CN=Services,"
                    + configNCForLDS
                    + " Object is not found in server");
            }

            //This method is for LDS/DS common requirement call for Services and QueryPolicy Container.
            LDSAndDSCommonCallForServices(requiredEntry);

            //This only present in AD/LDS.
            //MS-ADTS-Schema_R494
            if (!adAdapter.GetLdsObjectByDN("CN=Directory Service,CN=Windows NT,CN=Services,"
                                            + configNCForLDS, out requiredEntry))
            {
                DataSchemaSite.Assume.IsTrue(
                    false,
                    "CN=Directory Service,CN=Windows NT,CN=Services,"
                    + configNCForLDS
                    + " Object is not found in server");
            }
            childEntry = requiredEntry.Children.Find("CN=SCP Publication Service");

            DataSchemaSite.CaptureRequirementIfIsNotNull(
                childEntry,
                494,
                "SCP Publication Service Object is present only in AD/LDS.");

            //MS-ADTS-Schema_R495
            parentAttribute = childEntry.Parent.Name.ToString();
            DataSchemaSite.CaptureRequirementIfIsTrue(parentAttribute.Equals(
                                                          "CN=Directory Service"),
                                                      495,
                                                      @"The Parent of the SCP Publication Service Object  which is a type of Windows NT Service must be 
                Directory Service.");

            //MS-ADTS-Schema_R496
            objectClass = childEntry.Properties["objectClass"];
            DataSchemaSite.CaptureRequirementIfIsTrue(
                objectClass.Contains((object)"msDS-ServiceConnectionPointPublicationService"),
                496,
                @"The ObjectClass attribute of the SCP Publication Service Object which is a type of Windows NT Service 
                must be msDS-ServiceConnectionPointPublicationService.");
        }
        /// <summary>
        /// TestCase30 method validates the requirements under
        /// LDSWellKnownSecurityDomainPrincipal Scenario.
        /// </summary>
        public void ValidateLDSWellKnownSecurityDomainPrincipal()
        {
            DirectoryEntry dirEntry       = new DirectoryEntry();
            string         currDomain     = adAdapter.rootDomainDN;
            string         configNCForLDS = "CN=Configuration," + adAdapter.LDSRootObjectName;

            if (!adAdapter.GetLdsObjectByDN(
                    "CN=NTDS Settings,CN="
                    + adAdapter.LDSServerInstance
                    + ",CN=Servers,CN=Default-First-Site-Name,CN=Sites,"
                    + configNCForLDS,
                    out dirEntry))
            {
                DataSchemaSite.Assume.IsTrue(
                    false,
                    "CN=NTDS Settings,CN="
                    + adAdapter.LDSServerInstance
                    + ",CN=Servers,CN=Default-First-Site-Name,CN=Sites,"
                    + configNCForLDS
                    + " Object is not found in server");
            }

            //MS-ADTS-Schema_R446
            dirEntry.RefreshCache(new string[] { "msDS-PortLDAP" });
            PropertyValueCollection msDSLDAP = dirEntry.Properties["msDS-PortLDAP"];
            string msLDAPPort = msDSLDAP.Value.ToString();

            DataSchemaSite.CaptureRequirementIfAreEqual <string>(
                adAdapter.ADLDSPortNum,
                msLDAPPort,
                446,
                "In AD/LDS msDS-PortLDAP attribute of the nTDSDSA Object stores the LDAP port for the instance");

            //MS-ADTS-Schema_R447
            PropertyValueCollection msDSSLPort = dirEntry.Properties["msDS-PortSSL"];
            string msSSLPort       = msDSSLPort.Value.ToString();
            int    portNumberValue = int.Parse(adAdapter.ADLDSPortNum) + 1;

            DataSchemaSite.CaptureRequirementIfAreEqual <int>(
                portNumberValue,
                int.Parse(msSSLPort),
                447,
                "In AD/LDS msDS-PortSSL attribute of the nTDSDSA Object stores the SSL port for the instance");

            //MS-ADTS-Schema_R448
            PropertyValueCollection msDSSerAccount = dirEntry.Properties["msDS-ServiceAccount"];

            DataSchemaSite.CaptureRequirementIfIsTrue(
                msDSSerAccount.Value.ToString().Contains("CN=ForeignSecurityPrincipals"),
                448,
                @"In AD/LDS msDS-ServiceAccount attribute of the nTDSDSA Object stores  the foreignSecurityPrincipal 
                object representing the service account running this DC");

            //MS-ADTS-Schema_R453
            PropertyValueCollection msDSNamingContext = dirEntry.Properties["msDS-DefaultNamingContext"];

            //If The value is set
            DataSchemaSite.CaptureRequirementIfIsNotNull(
                msDSNamingContext,
                453,
                @"In AD/LDS msDS-DefaultNamingContext attribute of the nTDSDSA object specifies, the NC that should 
                be returned as the default NC by the defaultNamingContext attribute of the root DSE.");

            //The method to call common requirements for AD/DS and LDS.
            if (!adAdapter.GetObjectByDN("CN=Users," + currDomain, out dirEntry))
            {
                DataSchemaSite.Assume.IsTrue(
                    false,
                    "CN=Users,"
                    + currDomain
                    + " Object is not found in server");
            }
            LDSAndDSCommonCall(dirEntry);
        }