public ActiveDirectorySite(DirectoryContext context, string siteName)
 {
     this.adjacentSites = new ReadOnlySiteCollection();
     this.domains = new DomainCollection(null);
     this.servers = new ReadOnlyDirectoryServerCollection();
     this.links = new ReadOnlySiteLinkCollection();
     this.bridgeheadServers = new ReadOnlyDirectoryServerCollection();
     ValidateArgument(context, siteName);
     context = new DirectoryContext(context);
     this.context = context;
     this.name = siteName;
     DirectoryEntry directoryEntry = null;
     try
     {
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
         string str = (string) PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
         this.siteDN = "CN=Sites," + str;
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, this.siteDN);
         string escapedPath = Utils.GetEscapedPath("cn=" + this.name);
         this.cachedEntry = directoryEntry.Children.Add(escapedPath, "site");
     }
     catch (COMException exception)
     {
         throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
     }
     catch (ActiveDirectoryObjectNotFoundException)
     {
         throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", new object[] { context.Name }));
     }
     finally
     {
         if (directoryEntry != null)
         {
             directoryEntry.Dispose();
         }
     }
     this.subnets = new ActiveDirectorySubnetCollection(context, "CN=" + siteName + "," + this.siteDN);
     string transportName = "CN=IP,CN=Inter-Site Transports," + this.siteDN;
     this.RPCBridgeheadServers = new DirectoryServerCollection(context, "CN=" + siteName + "," + this.siteDN, transportName);
     transportName = "CN=SMTP,CN=Inter-Site Transports," + this.siteDN;
     this.SMTPBridgeheadServers = new DirectoryServerCollection(context, "CN=" + siteName + "," + this.siteDN, transportName);
 }
Esempio n. 2
0
		internal ActiveDirectorySite(DirectoryContext context, string siteName, bool existing)
		{
			this.adjacentSites = new ReadOnlySiteCollection();
			this.domains = new DomainCollection(null);
			this.servers = new ReadOnlyDirectoryServerCollection();
			this.links = new ReadOnlySiteLinkCollection();
			this.bridgeheadServers = new ReadOnlyDirectoryServerCollection();
			this.context = context;
			this.name = siteName;
			this.existing = existing;
			DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
			this.siteDN = string.Concat("CN=Sites,", (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext));
			this.cachedEntry = DirectoryEntryManager.GetDirectoryEntry(context, string.Concat("CN=", siteName, ",", this.siteDN));
			this.subnets = new ActiveDirectorySubnetCollection(context, string.Concat("CN=", siteName, ",", this.siteDN));
			string str = string.Concat("CN=IP,CN=Inter-Site Transports,", this.siteDN);
			this.RPCBridgeheadServers = new DirectoryServerCollection(context, (string)PropertyManager.GetPropertyValue(context, this.cachedEntry, PropertyManager.DistinguishedName), str);
			str = string.Concat("CN=SMTP,CN=Inter-Site Transports,", this.siteDN);
			this.SMTPBridgeheadServers = new DirectoryServerCollection(context, (string)PropertyManager.GetPropertyValue(context, this.cachedEntry, PropertyManager.DistinguishedName), str);
		}
Esempio n. 3
0
		public ActiveDirectorySite(DirectoryContext context, string siteName)
		{
			this.adjacentSites = new ReadOnlySiteCollection();
			this.domains = new DomainCollection(null);
			this.servers = new ReadOnlyDirectoryServerCollection();
			this.links = new ReadOnlySiteLinkCollection();
			this.bridgeheadServers = new ReadOnlyDirectoryServerCollection();
			ActiveDirectorySite.ValidateArgument(context, siteName);
			context = new DirectoryContext(context);
			this.context = context;
			this.name = siteName;
			DirectoryEntry directoryEntry = null;
			using (directoryEntry)
			{
				try
				{
					directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
					string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
					this.siteDN = string.Concat("CN=Sites,", propertyValue);
					directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, this.siteDN);
					string escapedPath = string.Concat("cn=", this.name);
					escapedPath = Utils.GetEscapedPath(escapedPath);
					this.cachedEntry = directoryEntry.Children.Add(escapedPath, "site");
				}
				catch (COMException cOMException1)
				{
					COMException cOMException = cOMException1;
					throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException);
				}
				catch (ActiveDirectoryObjectNotFoundException activeDirectoryObjectNotFoundException)
				{
					object[] name = new object[1];
					name[0] = context.Name;
					throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", name));
				}
			}
			this.subnets = new ActiveDirectorySubnetCollection(context, string.Concat("CN=", siteName, ",", this.siteDN));
			string str = string.Concat("CN=IP,CN=Inter-Site Transports,", this.siteDN);
			this.RPCBridgeheadServers = new DirectoryServerCollection(context, string.Concat("CN=", siteName, ",", this.siteDN), str);
			str = string.Concat("CN=SMTP,CN=Inter-Site Transports,", this.siteDN);
			this.SMTPBridgeheadServers = new DirectoryServerCollection(context, string.Concat("CN=", siteName, ",", this.siteDN), str);
		}
Esempio n. 4
0
        public void Save()
        {
            CheckIfDisposed();

            if (!_committed)
            {
                bool createManually = false;

                if (_appType == ApplicationPartitionType.ADApplicationPartition)
                {
                    try
                    {
                        _domainDNSEntry.CommitChanges();
                    }
                    catch (COMException e)
                    {
                        if (e.ErrorCode == unchecked((int)0x80072029))
                        {
                            // inappropriate authentication (we might have fallen back to NTLM)
                            createManually = true;
                        }
                        else
                        {
                            throw ExceptionHelper.GetExceptionFromCOMException(context, e);
                        }
                    }
                }
                else
                {
                    // for ADAM we always create the crossRef manually before creating the domainDNS object
                    createManually = true;
                }

                if (createManually)
                {
                    // we need to first save the cross ref entry
                    try
                    {
                        InitializeCrossRef(partitionName);
                        _crossRefEntry.CommitChanges();
                    }
                    catch (COMException e)
                    {
                        throw ExceptionHelper.GetExceptionFromCOMException(context, e);
                    }

                    try
                    {
                        _domainDNSEntry.CommitChanges();
                    }
                    catch (COMException e)
                    {
                        //
                        //delete the crossRef entry
                        //
                        DirectoryEntry partitionsEntry = _crossRefEntry.Parent;
                        try
                        {
                            partitionsEntry.Children.Remove(_crossRefEntry);
                        }
                        catch (COMException e2)
                        {
                            throw ExceptionHelper.GetExceptionFromCOMException(e2);
                        }

                        throw ExceptionHelper.GetExceptionFromCOMException(context, e);
                    }

                    // if the crossRef is created manually we need to refresh the cross ref entry to get the changes that were made 
                    // due to the creation of the partition
                    try
                    {
                        _crossRefEntry.RefreshCache();
                    }
                    catch (COMException e)
                    {
                        throw ExceptionHelper.GetExceptionFromCOMException(context, e);
                    }
                }

                // When we create a domainDNS object on DC1 (Naming Master = DC2),
                // then internally DC1 will contact DC2 to create the disabled crossRef object.
                // DC2 will force replicate the crossRef object to DC1. DC1 will then create
                // the domainDNS object and enable the crossRef on DC1 (not DC2). 
                // Here we need to force replicate the enabling of the crossRef to the FSMO (DC2)
                // so that we can later add replicas (which need to modify an attribute on the crossRef
                // on DC2, the FSMO, and can only be done if the crossRef on DC2 is enabled)
                // get the ntdsa name of the server on which the partition is created
                DirectoryEntry rootDSE = directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
                string primaryServerNtdsaName = (string)PropertyManager.GetPropertyValue(context, rootDSE, PropertyManager.DsServiceName);

                // get the DN of the crossRef entry that needs to be replicated to the fsmo role
                if (_appType == ApplicationPartitionType.ADApplicationPartition)
                {
                    // for AD we may not have the crossRef entry yet
                    GetCrossRefEntry();
                }
                string crossRefDN = (string)PropertyManager.GetPropertyValue(context, _crossRefEntry, PropertyManager.DistinguishedName);

                // Now set the operational attribute "replicateSingleObject" on the Rootdse of the fsmo role
                // to <ntdsa name of the source>:<DN of the crossRef object which needs to be replicated>
                DirectoryContext fsmoContext = Utils.GetNewDirectoryContext(GetNamingRoleOwner(), DirectoryContextType.DirectoryServer, context);
                DirectoryEntry fsmoRootDSE = DirectoryEntryManager.GetDirectoryEntry(fsmoContext, WellKnownDN.RootDSE);

                try
                {
                    fsmoRootDSE.Properties[PropertyManager.ReplicateSingleObject].Value = primaryServerNtdsaName + ":" + crossRefDN;
                    fsmoRootDSE.CommitChanges();
                }
                catch (COMException e)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(context, e);
                }
                finally
                {
                    fsmoRootDSE.Dispose();
                }

                // the partition has been created
                _committed = true;

                // commit the replica locations information or security reference domain if applicable
                if ((_cachedDirectoryServers != null) || (_securityRefDomainModified))
                {
                    if (_cachedDirectoryServers != null)
                    {
                        _crossRefEntry.Properties[PropertyManager.MsDSNCReplicaLocations].AddRange(_cachedDirectoryServers.GetMultiValuedProperty());
                    }
                    if (_securityRefDomainModified)
                    {
                        _crossRefEntry.Properties[PropertyManager.MsDSSDReferenceDomain].Value = _securityRefDomain;
                    }
                    try
                    {
                        _crossRefEntry.CommitChanges();
                    }
                    catch (COMException e)
                    {
                        throw ExceptionHelper.GetExceptionFromCOMException(context, e);
                    }
                }
            }
            else
            {
                // just save the crossRef entry for teh directory servers and the 
                // security reference domain information
                if ((_cachedDirectoryServers != null) || (_securityRefDomainModified))
                {
                    try
                    {
                        // we should already have the crossRef entries as some attribute on it has already 
                        // been modified
                        Debug.Assert(_crossRefEntry != null, "ApplicationPartition::Save - crossRefEntry on already committed partition which is being modified is null.");
                        _crossRefEntry.CommitChanges();
                    }
                    catch (COMException e)
                    {
                        throw ExceptionHelper.GetExceptionFromCOMException(context, e);
                    }
                }
            }

            // invalidate cached info
            _cachedDirectoryServers = null;
            _securityRefDomainModified = false;
        }
Esempio n. 5
0
        internal ActiveDirectorySite(DirectoryContext context, string siteName, bool existing)
        {
            Debug.Assert(existing == true);

            this.context = context;
            _name = siteName;
            this.existing = existing;

            DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
            _siteDN = "CN=Sites," + (string)PropertyManager.GetPropertyValue(context, de, PropertyManager.ConfigurationNamingContext);

            cachedEntry = DirectoryEntryManager.GetDirectoryEntry(context, "CN=" + siteName + "," + _siteDN);
            _subnets = new ActiveDirectorySubnetCollection(context, "CN=" + siteName + "," + _siteDN);

            string transportDN = "CN=IP,CN=Inter-Site Transports," + _siteDN;
            _RPCBridgeheadServers = new DirectoryServerCollection(context, (string)PropertyManager.GetPropertyValue(context, cachedEntry, PropertyManager.DistinguishedName), transportDN);
            transportDN = "CN=SMTP,CN=Inter-Site Transports," + _siteDN;
            _SMTPBridgeheadServers = new DirectoryServerCollection(context, (string)PropertyManager.GetPropertyValue(context, cachedEntry, PropertyManager.DistinguishedName), transportDN);
        }
Esempio n. 6
0
        public ActiveDirectorySite(DirectoryContext context, string siteName)
        {
            ValidateArgument(context, siteName);

            //  work with copy of the context
            context = new DirectoryContext(context);

            this.context = context;
            _name = siteName;

            // bind to the rootdse to get the configurationnamingcontext
            DirectoryEntry de = null;
            try
            {
                de = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                string config = (string)PropertyManager.GetPropertyValue(context, de, PropertyManager.ConfigurationNamingContext);
                _siteDN = "CN=Sites," + config;
                // bind to the site container
                de = DirectoryEntryManager.GetDirectoryEntry(context, _siteDN);

                string rdn = "cn=" + _name;
                rdn = Utils.GetEscapedPath(rdn);
                cachedEntry = de.Children.Add(rdn, "site");
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }
            catch (ActiveDirectoryObjectNotFoundException)
            {
                // this is the case where the context is a config set and we could not find an ADAM instance in that config set
                throw new ActiveDirectoryOperationException(Res.GetString(Res.ADAMInstanceNotFoundInConfigSet, context.Name));
            }
            finally
            {
                if (de != null)
                    de.Dispose();
            }

            _subnets = new ActiveDirectorySubnetCollection(context, "CN=" + siteName + "," + _siteDN);
            string transportDN = "CN=IP,CN=Inter-Site Transports," + _siteDN;
            _RPCBridgeheadServers = new DirectoryServerCollection(context, "CN=" + siteName + "," + _siteDN, transportDN);
            transportDN = "CN=SMTP,CN=Inter-Site Transports," + _siteDN;
            _SMTPBridgeheadServers = new DirectoryServerCollection(context, "CN=" + siteName + "," + _siteDN, transportDN);
        }
Esempio n. 7
0
		public void Save()
		{
			base.CheckIfDisposed();
			if (this.committed)
			{
				if (this.cachedDirectoryServers != null || this.securityRefDomainModified)
				{
					try
					{
						this.crossRefEntry.CommitChanges();
					}
					catch (COMException cOMException1)
					{
						COMException cOMException = cOMException1;
						throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException);
					}
				}
			}
			else
			{
				bool flag = false;
				if (this.appType != ApplicationPartitionType.ADApplicationPartition)
				{
					flag = true;
				}
				else
				{
					try
					{
						this.domainDNSEntry.CommitChanges();
					}
					catch (COMException cOMException3)
					{
						COMException cOMException2 = cOMException3;
						if (cOMException2.ErrorCode != -2147016663)
						{
							throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException2);
						}
						else
						{
							flag = true;
						}
					}
				}
				if (flag)
				{
					try
					{
						this.InitializeCrossRef(this.partitionName);
						this.crossRefEntry.CommitChanges();
					}
					catch (COMException cOMException5)
					{
						COMException cOMException4 = cOMException5;
						throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException4);
					}
					try
					{
						this.domainDNSEntry.CommitChanges();
					}
					catch (COMException cOMException9)
					{
						COMException cOMException6 = cOMException9;
						DirectoryEntry parent = this.crossRefEntry.Parent;
						try
						{
							parent.Children.Remove(this.crossRefEntry);
						}
						catch (COMException cOMException8)
						{
							COMException cOMException7 = cOMException8;
							throw ExceptionHelper.GetExceptionFromCOMException(cOMException7);
						}
						throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException6);
					}
					try
					{
						this.crossRefEntry.RefreshCache();
					}
					catch (COMException cOMException11)
					{
						COMException cOMException10 = cOMException11;
						throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException10);
					}
				}
				DirectoryEntry cachedDirectoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
				string propertyValue = (string)PropertyManager.GetPropertyValue(this.context, cachedDirectoryEntry, PropertyManager.DsServiceName);
				if (this.appType == ApplicationPartitionType.ADApplicationPartition)
				{
					this.GetCrossRefEntry();
				}
				string str = (string)PropertyManager.GetPropertyValue(this.context, this.crossRefEntry, PropertyManager.DistinguishedName);
				DirectoryContext newDirectoryContext = Utils.GetNewDirectoryContext(this.GetNamingRoleOwner(), DirectoryContextType.DirectoryServer, this.context);
				DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(newDirectoryContext, WellKnownDN.RootDSE);
				try
				{
					try
					{
						directoryEntry.Properties[PropertyManager.ReplicateSingleObject].Value = string.Concat(propertyValue, ":", str);
						directoryEntry.CommitChanges();
					}
					catch (COMException cOMException13)
					{
						COMException cOMException12 = cOMException13;
						throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException12);
					}
				}
				finally
				{
					directoryEntry.Dispose();
				}
				this.committed = true;
				if (this.cachedDirectoryServers != null || this.securityRefDomainModified)
				{
					if (this.cachedDirectoryServers != null)
					{
						this.crossRefEntry.Properties[PropertyManager.MsDSNCReplicaLocations].AddRange(this.cachedDirectoryServers.GetMultiValuedProperty());
					}
					if (this.securityRefDomainModified)
					{
						this.crossRefEntry.Properties[PropertyManager.MsDSSDReferenceDomain].Value = this.securityRefDomain;
					}
					try
					{
						this.crossRefEntry.CommitChanges();
					}
					catch (COMException cOMException15)
					{
						COMException cOMException14 = cOMException15;
						throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException14);
					}
				}
			}
			this.cachedDirectoryServers = null;
			this.securityRefDomainModified = false;
		}
 public void Save()
 {
     base.CheckIfDisposed();
     if (this.committed)
     {
         goto Label_021F;
     }
     bool flag = false;
     if (this.appType == ApplicationPartitionType.ADApplicationPartition)
     {
         try
         {
             this.domainDNSEntry.CommitChanges();
             goto Label_004B;
         }
         catch (COMException exception)
         {
             if (exception.ErrorCode != -2147016663)
             {
                 throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception);
             }
             flag = true;
             goto Label_004B;
         }
     }
     flag = true;
 Label_004B:
     if (flag)
     {
         try
         {
             this.InitializeCrossRef(base.partitionName);
             this.crossRefEntry.CommitChanges();
         }
         catch (COMException exception2)
         {
             throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception2);
         }
         try
         {
             this.domainDNSEntry.CommitChanges();
         }
         catch (COMException exception3)
         {
             DirectoryEntry parent = this.crossRefEntry.Parent;
             try
             {
                 parent.Children.Remove(this.crossRefEntry);
             }
             catch (COMException exception4)
             {
                 throw ExceptionHelper.GetExceptionFromCOMException(exception4);
             }
             throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception3);
         }
         try
         {
             this.crossRefEntry.RefreshCache();
         }
         catch (COMException exception5)
         {
             throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception5);
         }
     }
     DirectoryEntry cachedDirectoryEntry = base.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
     string str = (string) PropertyManager.GetPropertyValue(base.context, cachedDirectoryEntry, PropertyManager.DsServiceName);
     if (this.appType == ApplicationPartitionType.ADApplicationPartition)
     {
         this.GetCrossRefEntry();
     }
     string str2 = (string) PropertyManager.GetPropertyValue(base.context, this.crossRefEntry, PropertyManager.DistinguishedName);
     DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.GetNamingRoleOwner(), DirectoryContextType.DirectoryServer, base.context), WellKnownDN.RootDSE);
     try
     {
         directoryEntry.Properties[PropertyManager.ReplicateSingleObject].Value = str + ":" + str2;
         directoryEntry.CommitChanges();
     }
     catch (COMException exception6)
     {
         throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception6);
     }
     finally
     {
         directoryEntry.Dispose();
     }
     this.committed = true;
     if ((this.cachedDirectoryServers == null) && !this.securityRefDomainModified)
     {
         goto Label_024C;
     }
     if (this.cachedDirectoryServers != null)
     {
         this.crossRefEntry.Properties[PropertyManager.MsDSNCReplicaLocations].AddRange(this.cachedDirectoryServers.GetMultiValuedProperty());
     }
     if (this.securityRefDomainModified)
     {
         this.crossRefEntry.Properties[PropertyManager.MsDSSDReferenceDomain].Value = this.securityRefDomain;
     }
     try
     {
         this.crossRefEntry.CommitChanges();
         goto Label_024C;
     }
     catch (COMException exception7)
     {
         throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception7);
     }
 Label_021F:
     if ((this.cachedDirectoryServers != null) || this.securityRefDomainModified)
     {
         try
         {
             this.crossRefEntry.CommitChanges();
         }
         catch (COMException exception8)
         {
             throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception8);
         }
     }
 Label_024C:
     this.cachedDirectoryServers = null;
     this.securityRefDomainModified = false;
 }
        public void Save()
        {
            base.CheckIfDisposed();
            if (this.committed)
            {
                goto Label_021F;
            }
            bool flag = false;

            if (this.appType == ApplicationPartitionType.ADApplicationPartition)
            {
                try
                {
                    this.domainDNSEntry.CommitChanges();
                    goto Label_004B;
                }
                catch (COMException exception)
                {
                    if (exception.ErrorCode != -2147016663)
                    {
                        throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception);
                    }
                    flag = true;
                    goto Label_004B;
                }
            }
            flag = true;
Label_004B:
            if (flag)
            {
                try
                {
                    this.InitializeCrossRef(base.partitionName);
                    this.crossRefEntry.CommitChanges();
                }
                catch (COMException exception2)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception2);
                }
                try
                {
                    this.domainDNSEntry.CommitChanges();
                }
                catch (COMException exception3)
                {
                    DirectoryEntry parent = this.crossRefEntry.Parent;
                    try
                    {
                        parent.Children.Remove(this.crossRefEntry);
                    }
                    catch (COMException exception4)
                    {
                        throw ExceptionHelper.GetExceptionFromCOMException(exception4);
                    }
                    throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception3);
                }
                try
                {
                    this.crossRefEntry.RefreshCache();
                }
                catch (COMException exception5)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception5);
                }
            }
            DirectoryEntry cachedDirectoryEntry = base.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
            string         str = (string)PropertyManager.GetPropertyValue(base.context, cachedDirectoryEntry, PropertyManager.DsServiceName);

            if (this.appType == ApplicationPartitionType.ADApplicationPartition)
            {
                this.GetCrossRefEntry();
            }
            string         str2           = (string)PropertyManager.GetPropertyValue(base.context, this.crossRefEntry, PropertyManager.DistinguishedName);
            DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.GetNamingRoleOwner(), DirectoryContextType.DirectoryServer, base.context), WellKnownDN.RootDSE);

            try
            {
                directoryEntry.Properties[PropertyManager.ReplicateSingleObject].Value = str + ":" + str2;
                directoryEntry.CommitChanges();
            }
            catch (COMException exception6)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception6);
            }
            finally
            {
                directoryEntry.Dispose();
            }
            this.committed = true;
            if ((this.cachedDirectoryServers == null) && !this.securityRefDomainModified)
            {
                goto Label_024C;
            }
            if (this.cachedDirectoryServers != null)
            {
                this.crossRefEntry.Properties[PropertyManager.MsDSNCReplicaLocations].AddRange(this.cachedDirectoryServers.GetMultiValuedProperty());
            }
            if (this.securityRefDomainModified)
            {
                this.crossRefEntry.Properties[PropertyManager.MsDSSDReferenceDomain].Value = this.securityRefDomain;
            }
            try
            {
                this.crossRefEntry.CommitChanges();
                goto Label_024C;
            }
            catch (COMException exception7)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception7);
            }
Label_021F:
            if ((this.cachedDirectoryServers != null) || this.securityRefDomainModified)
            {
                try
                {
                    this.crossRefEntry.CommitChanges();
                }
                catch (COMException exception8)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception8);
                }
            }
Label_024C:
            this.cachedDirectoryServers    = null;
            this.securityRefDomainModified = false;
        }