コード例 #1
0
        protected void PopulateDomainNamingContexts(string partitionFqdn)
        {
            TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
            ADServerInfo defaultServerInfo = this.GetDefaultServerInfo(partitionFqdn);

            if (string.IsNullOrEmpty(defaultServerInfo.WritableNC) || string.IsNullOrEmpty(defaultServerInfo.RootDomainNC))
            {
                PooledLdapConnection pooledLdapConnection = LdapConnectionPool.CreateOneTimeConnection(null, defaultServerInfo, LocatorFlags.None);
                try
                {
                    if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.WritableNC) && !TopologyProvider.IsAdamTopology())
                    {
                        this.LogRootDSEReadFailureAndThrow("domainNamingContext", defaultServerInfo.FqdnPlusPort);
                    }
                    this.domainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.WritableNC);
                    if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.RootDomainNC) && !TopologyProvider.IsAdamTopology())
                    {
                        this.LogRootDSEReadFailureAndThrow("rootDomainNamingContext", defaultServerInfo.FqdnPlusPort);
                    }
                    this.rootDomainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.RootDomainNC);
                    return;
                }
                finally
                {
                    pooledLdapConnection.ReturnToPool();
                }
            }
            this.domainNCs[partitionFqdn]     = ADObjectId.ParseExtendedDN(defaultServerInfo.WritableNC);
            this.rootDomainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(defaultServerInfo.RootDomainNC);
        }
コード例 #2
0
        protected void PopulateConfigNamingContexts(string partitionFqdn)
        {
            TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
            ADServerInfo configDCInfo = this.GetConfigDCInfo(partitionFqdn, true);

            if (string.IsNullOrEmpty(configDCInfo.ConfigNC) || string.IsNullOrEmpty(configDCInfo.SchemaNC))
            {
                PooledLdapConnection pooledLdapConnection = LdapConnectionPool.CreateOneTimeConnection(null, configDCInfo, LocatorFlags.None);
                try
                {
                    if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.ConfigNC))
                    {
                        this.LogRootDSEReadFailureAndThrow("configurationNamingContext", configDCInfo.FqdnPlusPort);
                    }
                    this.configNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.ConfigNC);
                    if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.SchemaNC))
                    {
                        this.LogRootDSEReadFailureAndThrow("schemaNamingContext", configDCInfo.FqdnPlusPort);
                    }
                    this.schemaNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.SchemaNC);
                    return;
                }
                finally
                {
                    pooledLdapConnection.ReturnToPool();
                }
            }
            this.configNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(configDCInfo.ConfigNC);
            this.schemaNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(configDCInfo.SchemaNC);
        }
コード例 #3
0
        // Token: 0x0600043A RID: 1082 RVA: 0x0001807C File Offset: 0x0001627C
        internal static ADObjectIdWithString ParseDNStringSyntax(string value, Guid partitionGuid, OrganizationId orgId)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            string arg;
            string extendedDN;

            ADObjectIdWithString.ParseStringValue(value, out arg, out extendedDN);
            ADObjectId adobjectId = ADObjectId.ParseExtendedDN(extendedDN, partitionGuid, orgId);

            ExTraceGlobals.ADObjectTracer.TraceDebug <string>(0L, "ADObjectIdWithString.ParseDNStringSyntax - Initialized with string part {0}", arg);
            return(new ADObjectIdWithString(arg, adobjectId));
        }
コード例 #4
0
ファイル: ADSession.cs プロジェクト: YHZX2013/exchange_diff
        private static ADObjectId GetNamingContext(ADSession.ADNamingContext context, string domainController, NetworkCredential credential)
        {
            PooledLdapConnection pooledLdapConnection = null;
            ADObjectId           result = null;

            try
            {
                string partitionFqdn = Globals.IsMicrosoftHostedOnly ? ADServerSettings.GetPartitionFqdnFromADServerFqdn(domainController) : TopologyProvider.LocalForestFqdn;
                pooledLdapConnection = ConnectionPoolManager.GetConnection(ConnectionType.DomainController, partitionFqdn, credential, domainController, 389);
                switch (context)
                {
                case ADSession.ADNamingContext.RootDomain:
                    result = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.RootDomainNC);
                    break;

                case ADSession.ADNamingContext.Domain:
                    result = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.WritableNC);
                    break;

                case (ADSession.ADNamingContext) 3:
                    break;

                case ADSession.ADNamingContext.Config:
                    result = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.ConfigNC);
                    break;

                default:
                    if (context == ADSession.ADNamingContext.Schema)
                    {
                        result = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.SchemaNC);
                    }
                    break;
                }
            }
            finally
            {
                if (pooledLdapConnection != null)
                {
                    pooledLdapConnection.ReturnToPool();
                }
            }
            return(result);
        }
コード例 #5
0
        public static PropertyReference ParseFromADString(string adString)
        {
            ADObjectId targetADObjectId = ADObjectId.ParseExtendedDN(adString);

            return(new PropertyReference(targetADObjectId));
        }