public bool Contains(TrustRelationshipInformation information) { if (information == null) throw new ArgumentNullException("information"); return InnerList.Contains(information); }
public int IndexOf(TrustRelationshipInformation information) { if (information == null) throw new ArgumentNullException("information"); return InnerList.IndexOf(information); }
public bool Contains(TrustRelationshipInformation information) { if (information == null) { throw new ArgumentNullException("information"); } return(base.InnerList.Contains(information)); }
public int IndexOf(TrustRelationshipInformation information) { Contract.Requires(information != null); Contract.Ensures(Contract.Result<int>() >= -1); Contract.Ensures(Contract.Result<int>() < this.Count); return default(int); }
public int IndexOf(TrustRelationshipInformation information) { Contract.Requires(information != null); Contract.Ensures(Contract.Result <int>() >= -1); Contract.Ensures(Contract.Result <int>() < this.Count); return(default(int)); }
public int IndexOf(TrustRelationshipInformation information) { if (information == null) { throw new ArgumentNullException("information"); } return(base.InnerList.IndexOf(information)); }
public bool Contains(TrustRelationshipInformation information) { if (information != null) { return base.InnerList.Contains(information); } else { throw new ArgumentNullException("information"); } }
public int IndexOf(TrustRelationshipInformation information) { if (information != null) { return base.InnerList.IndexOf(information); } else { throw new ArgumentNullException("information"); } }
internal TrustRelationshipInformationCollection(DirectoryContext context, string source, ArrayList trusts) { for (int i = 0; i < trusts.Count; i++) { TrustObject item = (TrustObject)trusts[i]; if (item.TrustType != TrustType.Forest && item.TrustType != (TrustType.ParentChild | TrustType.CrossLink | TrustType.External | TrustType.Forest | TrustType.Kerberos | TrustType.Unknown)) { TrustRelationshipInformation trustRelationshipInformation = new TrustRelationshipInformation(context, source, item); this.Add(trustRelationshipInformation); } } }
internal TrustRelationshipInformationCollection(DirectoryContext context, string source, ArrayList trusts) { for (int i = 0; i < trusts.Count; i++) { TrustObject obj2 = (TrustObject)trusts[i]; if ((obj2.TrustType != TrustType.Forest) && (obj2.TrustType != (TrustType.Unknown | TrustType.ParentChild))) { TrustRelationshipInformation info = new TrustRelationshipInformation(context, source, obj2); this.Add(info); } } }
internal TrustRelationshipInformationCollection(DirectoryContext context, string source, ArrayList trusts) { for (int i = 0; i < trusts.Count; i++) { TrustObject obj2 = (TrustObject) trusts[i]; if ((obj2.TrustType != TrustType.Forest) && (obj2.TrustType != (TrustType.Unknown | TrustType.ParentChild))) { TrustRelationshipInformation info = new TrustRelationshipInformation(context, source, obj2); this.Add(info); } } }
internal TrustRelationshipInformationCollection(DirectoryContext context, string source, ArrayList trusts) { for (int i = 0; i < trusts.Count; i++) { TrustObject obj = (TrustObject)trusts[i]; // we don't need self and forest trust if ((obj.TrustType == TrustType.Forest) || ((int)obj.TrustType == 7)) { continue; } TrustRelationshipInformation info = new TrustRelationshipInformation(context, source, obj); Add(info); } }
internal TrustRelationshipInformation(DirectoryContext context, string source, TrustObject obj) { string netbiosDomainName; this.context = context; this.source = source; TrustRelationshipInformation trustRelationshipInformation = this; if (obj.DnsDomainName == null) { netbiosDomainName = obj.NetbiosDomainName; } else { netbiosDomainName = obj.DnsDomainName; } trustRelationshipInformation.target = netbiosDomainName; if ((obj.Flags & 2) == 0 || (obj.Flags & 32) == 0) { if ((obj.Flags & 2) == 0) { if ((obj.Flags & 32) != 0) { this.direction = TrustDirection.Inbound; } } else { this.direction = TrustDirection.Outbound; } } else { this.direction = TrustDirection.Bidirectional; } this.type = obj.TrustType; }
public bool Contains(TrustRelationshipInformation information) { Contract.Requires(information != null); return(default(bool)); }
public void CopyTo(TrustRelationshipInformation[] array, int index) { base.InnerList.CopyTo(array, index); }
internal int Add(TrustRelationshipInformation info) { return base.InnerList.Add(info); }
public void CopyTo(TrustRelationshipInformation[] array, int index) { Contract.Requires(array != null); Contract.Requires(index >= 0); }
public TrustRelationshipInformationCollection GetAllTrustRelationships() { if (trustCollection == null) { try { DirectoryEntry rootDse = new DirectoryEntry(string.Format("LDAP://{0}/RootDSE", dName), dc.UserName, dc.Password); string defaultName = rootDse.DirContext.DefaultNamingContext; if (defaultName == null || defaultName == "") { trustCollection = null; return trustCollection; } DirectoryEntry sys = new DirectoryEntry(string.Format("LDAP://{0}/CN=System,{1}", SDSUtils.DNToDomainName(defaultName), defaultName), dc.UserName, dc.Password); DirectorySearcher ds = new DirectorySearcher(sys); ds.Filter = "(objectClass=trustedDomain)"; ds.SearchScope = SearchScope.Subtree; SearchResultCollection src = ds.FindAll(); if (src != null && src.Count > 0) { trustCollection = new TrustRelationshipInformationCollection(); foreach (SearchResult sr in src) { string sProtocol, sServer, sCNs, sDCs; SDSUtils.CrackPath(sr.Path, out sProtocol, out sServer, out sCNs, out sDCs); /*Console.WriteLine("sProtocol " + sProtocol); Console.WriteLine("sServer " + sServer); Console.WriteLine("sCNs " + sCNs); Console.WriteLine("sDCs " + sDCs);*/ string sourcename, targetname; TrustDirection trustdirection; TrustType trusttype = TrustType.Unknown; DirectoryEntry trustEntry = new DirectoryEntry(sr.Path, dc.UserName, dc.Password); int trustdir = (int)trustEntry.Properties["trustDirection"].Value; string trustDn = trustEntry.Properties["distinguishedName"].Value.ToString(); string[] splits = trustDn.Split(','); trustDn = splits[0].Substring(3); int trustattr = (int)trustEntry.Properties["trustAttributes"].Value; int trusttp = (int)trustEntry.Properties["trustType"].Value; //Note:the following implementation of how to determine the TrustType is still under investigation if (trusttp == (int)ADTrustType.TYPE_UPLEVEL) //windows 2003 trust { switch (trustattr) { case 0: trusttype = TrustType.External; //this trust is non-transitive break; case 1: //ATTRIBUTES_NON_TRANSITIVE break; case 2: //ATTRIBUTES_UPLEVEL_ONLY break; case 4: //ATTRIBUTES_QUARANTINED_DOMAIN trusttype = TrustType.External; break; case 8: //ATTRIBUTES_FOREST_TRANSITIVE trusttype = TrustType.Forest; //and this trust is transitive break; case 16: //ATTRIBUTES_CROSS_ORGANIZATION trusttype = TrustType.CrossLink; break; case 32://ATTRIBUTES_WITHIN_FOREST if (trustDn.ToLower().Contains(dName.ToLower())) trusttype = TrustType.ParentChild; else trusttype = TrustType.External; //this trust is non-transitive break; case 64: //ATTRIBUTES_TREAT_AS_EXTERNAL trusttype = TrustType.External; break; default: trusttype = TrustType.Unknown; break; } } else if (trusttp == (int)ADTrustType.TYPE_MIT) trusttype = TrustType.Kerberos; switch (trustdir) { case 1: trustdirection = TrustDirection.Inbound; sourcename = dName; targetname = trustDn; break; case 2: trustdirection = TrustDirection.Outbound; sourcename = trustDn; targetname = dName; break; case 3: trustdirection = TrustDirection.Bidirectional; sourcename = dName; targetname = trustDn; break; default: trustdirection = TrustDirection.Disabled; sourcename = targetname = ""; break; } TrustRelationshipInformation trustinfo = new TrustRelationshipInformation(sourcename, targetname, trusttype, trustdirection); trustCollection.Add(trustinfo); } } } catch { return null; } } return trustCollection; }
public TrustRelationshipInformationCollection GetAllTrustRelationships() { if (trustCollection == null) { try { DirectoryEntry rootDse = new DirectoryEntry(string.Format("LDAP://{0}/RootDSE", dName), dc.UserName, dc.Password); string defaultName = rootDse.DirContext.DefaultNamingContext; if (defaultName == null || defaultName == "") { trustCollection = null; return(trustCollection); } DirectoryEntry sys = new DirectoryEntry(string.Format("LDAP://{0}/CN=System,{1}", SDSUtils.DNToDomainName(defaultName), defaultName), dc.UserName, dc.Password); DirectorySearcher ds = new DirectorySearcher(sys); ds.Filter = "(objectClass=trustedDomain)"; ds.SearchScope = SearchScope.Subtree; SearchResultCollection src = ds.FindAll(); if (src != null && src.Count > 0) { trustCollection = new TrustRelationshipInformationCollection(); foreach (SearchResult sr in src) { string sProtocol, sServer, sCNs, sDCs; SDSUtils.CrackPath(sr.Path, out sProtocol, out sServer, out sCNs, out sDCs); /*Console.WriteLine("sProtocol " + sProtocol); * Console.WriteLine("sServer " + sServer); * Console.WriteLine("sCNs " + sCNs); * Console.WriteLine("sDCs " + sDCs);*/ string sourcename, targetname; TrustDirection trustdirection; TrustType trusttype = TrustType.Unknown; DirectoryEntry trustEntry = new DirectoryEntry(sr.Path, dc.UserName, dc.Password); int trustdir = (int)trustEntry.Properties["trustDirection"].Value; string trustDn = trustEntry.Properties["distinguishedName"].Value.ToString(); string[] splits = trustDn.Split(','); trustDn = splits[0].Substring(3); int trustattr = (int)trustEntry.Properties["trustAttributes"].Value; int trusttp = (int)trustEntry.Properties["trustType"].Value; //Note:the following implementation of how to determine the TrustType is still under investigation if (trusttp == (int)ADTrustType.TYPE_UPLEVEL) //windows 2003 trust { switch (trustattr) { case 0: trusttype = TrustType.External; //this trust is non-transitive break; case 1: //ATTRIBUTES_NON_TRANSITIVE break; case 2: //ATTRIBUTES_UPLEVEL_ONLY break; case 4: //ATTRIBUTES_QUARANTINED_DOMAIN trusttype = TrustType.External; break; case 8: //ATTRIBUTES_FOREST_TRANSITIVE trusttype = TrustType.Forest; //and this trust is transitive break; case 16: //ATTRIBUTES_CROSS_ORGANIZATION trusttype = TrustType.CrossLink; break; case 32: //ATTRIBUTES_WITHIN_FOREST if (trustDn.ToLower().Contains(dName.ToLower())) { trusttype = TrustType.ParentChild; } else { trusttype = TrustType.External; //this trust is non-transitive } break; case 64: //ATTRIBUTES_TREAT_AS_EXTERNAL trusttype = TrustType.External; break; default: trusttype = TrustType.Unknown; break; } } else if (trusttp == (int)ADTrustType.TYPE_MIT) { trusttype = TrustType.Kerberos; } switch (trustdir) { case 1: trustdirection = TrustDirection.Inbound; sourcename = dName; targetname = trustDn; break; case 2: trustdirection = TrustDirection.Outbound; sourcename = trustDn; targetname = dName; break; case 3: trustdirection = TrustDirection.Bidirectional; sourcename = dName; targetname = trustDn; break; default: trustdirection = TrustDirection.Disabled; sourcename = targetname = ""; break; } TrustRelationshipInformation trustinfo = new TrustRelationshipInformation(sourcename, targetname, trusttype, trustdirection); trustCollection.Add(trustinfo); } } } catch { return(null); } } return(trustCollection); }
public int IndexOf(TrustRelationshipInformation information) { throw new NotImplementedException(); }
public int IndexOf (TrustRelationshipInformation information) { throw new NotImplementedException (); }
/// <summary> /// Trust constructor. /// </summary> /// <param name="fqn">Fully qualified domain name.</param> /// <param name="trust">Domain trust, source of the domain information.</param> public WindowsDomainImpl(string fqn, TrustRelationshipInformation trust) { _fqn = fqn; _trustDirection = trust.TrustDirection; _trustType = trust.TrustType; }
public bool Contains(TrustRelationshipInformation information) { Contract.Requires(information != null); return default(bool); }
public bool Contains (TrustRelationshipInformation information) { throw new NotImplementedException (); }
public bool Contains(TrustRelationshipInformation information) { throw new NotImplementedException(); }
public void CopyTo (TrustRelationshipInformation[] array, int index) { throw new NotImplementedException (); }
internal int Add(TrustRelationshipInformation info) { return(base.InnerList.Add(info)); }