Ejemplo n.º 1
0
 public Domain()
     : base()
 {
     trustCollection = null;
     parent = null;
     children = new DomainCollection();
 }
 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);
 }
Ejemplo n.º 3
0
        public TrustRelationshipInformationCollection GetAllTrustRelationships()
        {
            TrustRelationshipInformationCollection trustcollection = new TrustRelationshipInformationCollection();

            DomainCollection dmc = this.Domains;

            if (dmc != null && dmc.Count > 0)
            {
                foreach (Domain dm in dmc)
                {
                    TrustRelationshipInformationCollection dmtrusts = dm.GetAllTrustRelationships();
                    if (dmtrusts != null && dmtrusts.Count > 0)
                    {
                        foreach (TrustRelationshipInformation trust in dmtrusts)
                        {
                            trustcollection.Add(trust);
                        }
                    }
                }
            }

            return(trustcollection);
        }
Ejemplo n.º 4
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);
		}
Ejemplo n.º 5
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);
		}
Ejemplo n.º 6
0
 private static List<DomainTree> GetDomainTree(DomainCollection forest)
 {
     return (from Domain domain in forest select new DomainTree() {Name = domain.Name, Subdomains = GetDomainTree(domain.Children)}).ToList();
 }