Beispiel #1
1
		internal ReplicationConnectionCollection GetOutboundConnectionsHelper()
		{
			string siteObjectName;
			string serverObjectName;
			if (this.outbound == null)
			{
				if (this as DomainController != null)
				{
					siteObjectName = ((DomainController)this).SiteObjectName;
				}
				else
				{
					siteObjectName = ((AdamInstance)this).SiteObjectName;
				}
				string str = siteObjectName;
				DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), str);
				if (this as DomainController != null)
				{
					serverObjectName = ((DomainController)this).ServerObjectName;
				}
				else
				{
					serverObjectName = ((AdamInstance)this).ServerObjectName;
				}
				string str1 = serverObjectName;
				string[] strArrays = new string[2];
				strArrays[0] = "objectClass";
				strArrays[1] = "cn";
				ADSearcher aDSearcher = new ADSearcher(directoryEntry, string.Concat("(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings,", str1, "))"), strArrays, SearchScope.Subtree);
				SearchResultCollection searchResultCollections = null;
				DirectoryContext newDirectoryContext = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context);
				try
				{
					try
					{
						searchResultCollections = aDSearcher.FindAll();
						this.outbound = new ReplicationConnectionCollection();
						foreach (SearchResult searchResult in searchResultCollections)
						{
							ReplicationConnection replicationConnection = new ReplicationConnection(newDirectoryContext, searchResult.GetDirectoryEntry(), (string)searchResult.Properties["cn"][0]);
							this.outbound.Add(replicationConnection);
						}
					}
					catch (COMException cOMException1)
					{
						COMException cOMException = cOMException1;
						throw ExceptionHelper.GetExceptionFromCOMException(newDirectoryContext, cOMException);
					}
				}
				finally
				{
					if (searchResultCollections != null)
					{
						searchResultCollections.Dispose();
					}
					directoryEntry.Dispose();
				}
			}
			return this.outbound;
		}
 internal ReplicationConnectionCollection GetOutboundConnectionsHelper()
 {
     if (this.outbound == null)
     {
         string                 dn             = (this is DomainController) ? ((DomainController)this).SiteObjectName : ((AdamInstance)this).SiteObjectName;
         DirectoryEntry         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), dn);
         string                 str2           = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName;
         ADSearcher             searcher       = new ADSearcher(directoryEntry, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings," + str2 + "))", new string[] { "objectClass", "cn" }, SearchScope.Subtree);
         SearchResultCollection results        = null;
         DirectoryContext       context        = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context);
         try
         {
             results       = searcher.FindAll();
             this.outbound = new ReplicationConnectionCollection();
             foreach (SearchResult result in results)
             {
                 ReplicationConnection connection = new ReplicationConnection(context, result.GetDirectoryEntry(), (string)result.Properties["cn"][0]);
                 this.outbound.Add(connection);
             }
         }
         catch (COMException exception)
         {
             throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
         }
         finally
         {
             if (results != null)
             {
                 results.Dispose();
             }
             directoryEntry.Dispose();
         }
     }
     return(this.outbound);
 }
 internal ReplicationConnectionCollection GetInboundConnectionsHelper()
 {
     if (this.inbound == null)
     {
         this.inbound = new ReplicationConnectionCollection();
         DirectoryContext       context        = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context);
         string                 str            = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName;
         string                 dn             = "CN=NTDS Settings," + str;
         DirectoryEntry         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), dn);
         ADSearcher             searcher       = new ADSearcher(directoryEntry, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))", new string[] { "cn" }, SearchScope.OneLevel);
         SearchResultCollection results        = null;
         try
         {
             results = searcher.FindAll();
             foreach (SearchResult result in results)
             {
                 ReplicationConnection connection = new ReplicationConnection(context, result.GetDirectoryEntry(), (string)PropertyManager.GetSearchResultPropertyValue(result, PropertyManager.Cn));
                 this.inbound.Add(connection);
             }
         }
         catch (COMException exception)
         {
             throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
         }
         finally
         {
             if (results != null)
             {
                 results.Dispose();
             }
             directoryEntry.Dispose();
         }
     }
     return(this.inbound);
 }
Beispiel #4
0
        internal ReplicationConnectionCollection GetInboundConnectionsHelper()
        {
            string serverObjectName;

            if (this.inbound == null)
            {
                this.inbound = new ReplicationConnectionCollection();
                DirectoryContext newDirectoryContext = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context);
                if (this as DomainController != null)
                {
                    serverObjectName = ((DomainController)this).ServerObjectName;
                }
                else
                {
                    serverObjectName = ((AdamInstance)this).ServerObjectName;
                }
                string         str            = serverObjectName;
                string         str1           = string.Concat("CN=NTDS Settings,", str);
                DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), str1);
                string[]       strArrays      = new string[1];
                strArrays[0] = "cn";
                ADSearcher             aDSearcher = new ADSearcher(directoryEntry, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))", strArrays, SearchScope.OneLevel);
                SearchResultCollection searchResultCollections = null;
                try
                {
                    try
                    {
                        searchResultCollections = aDSearcher.FindAll();
                        foreach (SearchResult searchResult in searchResultCollections)
                        {
                            ReplicationConnection replicationConnection = new ReplicationConnection(newDirectoryContext, searchResult.GetDirectoryEntry(), (string)PropertyManager.GetSearchResultPropertyValue(searchResult, PropertyManager.Cn));
                            this.inbound.Add(replicationConnection);
                        }
                    }
                    catch (COMException cOMException1)
                    {
                        COMException cOMException = cOMException1;
                        throw ExceptionHelper.GetExceptionFromCOMException(newDirectoryContext, cOMException);
                    }
                }
                finally
                {
                    if (searchResultCollections != null)
                    {
                        searchResultCollections.Dispose();
                    }
                    directoryEntry.Dispose();
                }
            }
            return(this.inbound);
        }
Beispiel #5
0
        internal ReplicationConnectionCollection GetOutboundConnectionsHelper()
        {
            // this is the first time that user tries to retrieve this property, so get it from the directory
            if (_outbound == null)
            {
                // search base is the site container
                string         siteName = (this is DomainController) ? ((DomainController)this).SiteObjectName : ((AdamInstance)this).SiteObjectName;
                DirectoryEntry de       = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context), siteName);

                string     serverName = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName;
                ADSearcher adSearcher = new ADSearcher(de,
                                                       "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings," + serverName + "))",
                                                       new string[] { "objectClass", "cn" },
                                                       SearchScope.Subtree);

                SearchResultCollection results    = null;
                DirectoryContext       newContext = Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context);

                try
                {
                    results   = adSearcher.FindAll();
                    _outbound = new ReplicationConnectionCollection();

                    foreach (SearchResult result in results)
                    {
                        ReplicationConnection con = new ReplicationConnection(newContext, result.GetDirectoryEntry(), (string)result.Properties["cn"][0]);
                        _outbound.Add(con);
                    }
                }
                catch (COMException e)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(newContext, e);
                }
                finally
                {
                    if (results != null)
                    {
                        results.Dispose();
                    }

                    de.Dispose();
                }
            }

            return(_outbound);
        }
Beispiel #6
0
        internal ReplicationConnectionCollection GetInboundConnectionsHelper()
        {
            if (_inbound == null)
            {
                // construct the replicationconnection collection
                _inbound = new ReplicationConnectionCollection();
                DirectoryContext newContext = Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context);

                // this is the first time that user tries to retrieve this property, so get it from the directory
                string         serverName = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName;
                string         srchDN     = "CN=NTDS Settings," + serverName;
                DirectoryEntry de         = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context), srchDN);

                ADSearcher adSearcher = new ADSearcher(de,
                                                       "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))",
                                                       new string[] { "cn" },
                                                       SearchScope.OneLevel);
                SearchResultCollection srchResults = null;

                try
                {
                    srchResults = adSearcher.FindAll();
                    foreach (SearchResult r in srchResults)
                    {
                        ReplicationConnection con = new ReplicationConnection(newContext, r.GetDirectoryEntry(), (string)PropertyManager.GetSearchResultPropertyValue(r, PropertyManager.Cn));
                        _inbound.Add(con);
                    }
                }
                catch (COMException e)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(newContext, e);
                }
                finally
                {
                    if (srchResults != null)
                    {
                        srchResults.Dispose();
                    }

                    de.Dispose();
                }
            }

            return(_inbound);
        }
Beispiel #7
0
        internal ReplicationConnectionCollection GetOutboundConnectionsHelper()
        {
            // this is the first time that user tries to retrieve this property, so get it from the directory
            if (_outbound == null)
            {
                // search base is the site container
                string siteName = (this is DomainController) ? ((DomainController)this).SiteObjectName : ((AdamInstance)this).SiteObjectName;
                DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context), siteName);

                string serverName = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName;
                ADSearcher adSearcher = new ADSearcher(de,
                                                               "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings," + serverName + "))",
                                                               new string[] { "objectClass", "cn" },
                                                               SearchScope.Subtree);

                SearchResultCollection results = null;
                DirectoryContext newContext = Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context);

                try
                {
                    results = adSearcher.FindAll();
                    _outbound = new ReplicationConnectionCollection();

                    foreach (SearchResult result in results)
                    {
                        ReplicationConnection con = new ReplicationConnection(newContext, result.GetDirectoryEntry(), (string)result.Properties["cn"][0]);
                        _outbound.Add(con);
                    }
                }
                catch (COMException e)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(newContext, e);
                }
                finally
                {
                    if (results != null)
                        results.Dispose();

                    de.Dispose();
                }
            }

            return _outbound;
        }
Beispiel #8
0
        internal ReplicationConnectionCollection GetInboundConnectionsHelper()
        {
            if (_inbound == null)
            {
                // construct the replicationconnection collection
                _inbound = new ReplicationConnectionCollection();
                DirectoryContext newContext = Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context);

                // this is the first time that user tries to retrieve this property, so get it from the directory   
                string serverName = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName;
                string srchDN = "CN=NTDS Settings," + serverName;
                DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context), srchDN);

                ADSearcher adSearcher = new ADSearcher(de,
                                                      "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))",
                                                      new string[] { "cn" },
                                                      SearchScope.OneLevel);
                SearchResultCollection srchResults = null;

                try
                {
                    srchResults = adSearcher.FindAll();
                    foreach (SearchResult r in srchResults)
                    {
                        ReplicationConnection con = new ReplicationConnection(newContext, r.GetDirectoryEntry(), (string)PropertyManager.GetSearchResultPropertyValue(r, PropertyManager.Cn));
                        _inbound.Add(con);
                    }
                }
                catch (COMException e)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(newContext, e);
                }
                finally
                {
                    if (srchResults != null)
                        srchResults.Dispose();

                    de.Dispose();
                }
            }

            return _inbound;
        }
 internal ReplicationConnectionCollection GetOutboundConnectionsHelper()
 {
     if (this.outbound == null)
     {
         string dn = (this is DomainController) ? ((DomainController) this).SiteObjectName : ((AdamInstance) this).SiteObjectName;
         DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), dn);
         string str2 = (this is DomainController) ? ((DomainController) this).ServerObjectName : ((AdamInstance) this).ServerObjectName;
         ADSearcher searcher = new ADSearcher(directoryEntry, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings," + str2 + "))", new string[] { "objectClass", "cn" }, SearchScope.Subtree);
         SearchResultCollection results = null;
         DirectoryContext context = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context);
         try
         {
             results = searcher.FindAll();
             this.outbound = new ReplicationConnectionCollection();
             foreach (SearchResult result in results)
             {
                 ReplicationConnection connection = new ReplicationConnection(context, result.GetDirectoryEntry(), (string) result.Properties["cn"][0]);
                 this.outbound.Add(connection);
             }
         }
         catch (COMException exception)
         {
             throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
         }
         finally
         {
             if (results != null)
             {
                 results.Dispose();
             }
             directoryEntry.Dispose();
         }
     }
     return this.outbound;
 }
 internal ReplicationConnectionCollection GetInboundConnectionsHelper()
 {
     if (this.inbound == null)
     {
         this.inbound = new ReplicationConnectionCollection();
         DirectoryContext context = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context);
         string str = (this is DomainController) ? ((DomainController) this).ServerObjectName : ((AdamInstance) this).ServerObjectName;
         string dn = "CN=NTDS Settings," + str;
         DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), dn);
         ADSearcher searcher = new ADSearcher(directoryEntry, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))", new string[] { "cn" }, SearchScope.OneLevel);
         SearchResultCollection results = null;
         try
         {
             results = searcher.FindAll();
             foreach (SearchResult result in results)
             {
                 ReplicationConnection connection = new ReplicationConnection(context, result.GetDirectoryEntry(), (string) PropertyManager.GetSearchResultPropertyValue(result, PropertyManager.Cn));
                 this.inbound.Add(connection);
             }
         }
         catch (COMException exception)
         {
             throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
         }
         finally
         {
             if (results != null)
             {
                 results.Dispose();
             }
             directoryEntry.Dispose();
         }
     }
     return this.inbound;
 }