// Token: 0x060050C4 RID: 20676 RVA: 0x0012B7A4 File Offset: 0x001299A4 public static object[] MarshalWholeObject(ADObject recipient, IRecipientSession session, string[] allAttributes) { PropertyDefinition[] array = null; PropertyDefinition[] propDefs = RUSMarshal.LdapAttributesToPropertyDefinitions(allAttributes, recipient, out array); if (recipient.ObjectState == ObjectState.New) { recipient.StampPersistableDefaultValues(); } object[] array2 = RUSMarshal.MarshalObject(propDefs, recipient); if (array.Length > 0 && recipient.ObjectState != ObjectState.New && recipient.ObjectState != ObjectState.Deleted) { bool useGlobalCatalog = session.UseGlobalCatalog; bool useConfigNC = session.UseConfigNC; session.UseConfigNC = false; if (string.Equals(recipient.Id.DescendantDN(1).Rdn.UnescapedName, "Configuration", StringComparison.OrdinalIgnoreCase)) { ADObjectId configurationNamingContext = ADSession.GetConfigurationNamingContext(session.DomainController ?? recipient.OriginatingServer, session.NetworkCredential); if (recipient.DistinguishedName.EndsWith(configurationNamingContext.DistinguishedName, StringComparison.OrdinalIgnoreCase)) { session.UseConfigNC = true; } } session.UseGlobalCatalog = false; ADRawEntry adrawEntry = null; try { adrawEntry = session.ReadADRawEntry((ADObjectId)recipient.Identity, array); if (adrawEntry == null) { throw new RusOperationException(DirectoryStrings.ExceptionObjectNotFound); } } finally { session.UseGlobalCatalog = useGlobalCatalog; session.UseConfigNC = useConfigNC; } object[] array3 = RUSMarshal.MarshalObject(array, adrawEntry); if (array3.Length > 0) { int num = array2.Length; Array.Resize <object>(ref array2, num + array3.Length); array3.CopyTo(array2, num); } } return(array2); }
internal static Organization GetRootOrgContainer(string partitionFqdn, string domainController, NetworkCredential credential) { bool flag = string.IsNullOrEmpty(domainController); ADObjectId adobjectId; if (!PartitionId.IsLocalForestPartition(partitionFqdn)) { adobjectId = ADSession.GetConfigurationNamingContext(partitionFqdn); } else if (flag) { adobjectId = ADSession.GetConfigurationNamingContextForLocalForest(); } else { adobjectId = ADSession.GetConfigurationNamingContext(domainController, credential); } ADSessionSettings sessionSettings = ADSessionSettings.FromRootOrgBootStrapSession(adobjectId); ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.NonCacheSessionFactory.CreateTopologyConfigurationSession(domainController, true, ConsistencyMode.PartiallyConsistent, flag ? null : credential, sessionSettings, 226, "GetRootOrgContainer", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ADSystemConfigurationSession.cs"); Organization[] array = topologyConfigurationSession.Find <Organization>(adobjectId, QueryScope.SubTree, null, null, 1); if (array != null && array.Length > 0) { if (string.IsNullOrEmpty(domainController) && credential == null) { InternalDirectoryRootOrganizationCache.PopulateCache(partitionFqdn, array[0]); } return(array[0]); } if (flag && (Globals.IsDatacenter || PartitionId.IsLocalForestPartition(partitionFqdn))) { throw new OrgContainerNotFoundException(); } RootDse rootDse = topologyConfigurationSession.GetRootDse(); if (rootDse.ConfigurationNamingContext.Equals(ADSession.GetConfigurationNamingContext(partitionFqdn))) { throw new OrgContainerNotFoundException(); } return(null); }
internal static EphemeralIdTable.NamingContext GetNamingContext(ADObjectId id) { if (id.IsDescendantOf(ADSession.GetConfigurationNamingContext(id.GetPartitionId().ForestFQDN))) { if (!ADSession.IsTenantIdentity(id, id.GetPartitionId().ForestFQDN)) { return(EphemeralIdTable.NamingContext.Config); } return(EphemeralIdTable.NamingContext.TenantConfig); } else { if (!ADSession.IsTenantIdentity(id, id.GetPartitionId().ForestFQDN)) { return(EphemeralIdTable.NamingContext.Domain); } if (!id.IsDescendantOf(ADSession.GetConfigurationUnitsRoot(id.GetPartitionId().ForestFQDN))) { return(EphemeralIdTable.NamingContext.Domain); } return(EphemeralIdTable.NamingContext.TenantConfig); } }