internal static bool IsTenantIdentity(ADObjectId id, string partitionFqdn) { if (ADSession.IsBoundToAdam || id.DomainId == null) { return(false); } if (!string.Equals(id.GetPartitionId().ForestFQDN, partitionFqdn, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Object partition FQDN doesn't match partitionFqdn parameter."); } ADObjectId configurationNamingContext = ADSession.GetConfigurationNamingContext(partitionFqdn); if (id.Equals(configurationNamingContext)) { return(false); } ADObjectId domainNamingContext = ADSession.GetDomainNamingContext(partitionFqdn); if (id.Equals(domainNamingContext)) { return(false); } ADObjectId configurationUnitsRoot = ADSession.GetConfigurationUnitsRoot(partitionFqdn); if (id.IsDescendantOf(configurationUnitsRoot)) { return(true); } ADObjectId hostedOrganizationsRoot = ADSession.GetHostedOrganizationsRoot(partitionFqdn); return(id.IsDescendantOf(hostedOrganizationsRoot) && !id.Equals(hostedOrganizationsRoot)); }
internal override ADSessionSettings FromAllTenantsOrRootOrgAutoDetect(ADObjectId id) { if (id == null) { throw new ArgumentNullException("id"); } if (id.DomainId == null) { ExTraceGlobals.GetConnectionTracer.TraceDebug <string>(0L, "FromAllTenantsOrRootOrgAutoDetect(): Value '{0}' passed to id parameter doesn't have DomainId initialized, falling back to RootOrg scope set", id.ToString()); return(ADSessionSettings.FromRootOrgScopeSet()); } PartitionId partitionId = id.GetPartitionId(); if (!ADAccountPartitionLocator.IsKnownPartition(partitionId)) { ExTraceGlobals.GetConnectionTracer.TraceDebug <string>(0L, "FromAllTenantsOrRootOrgAutoDetect(): Value '{0}' passed to id parameter doesn't match any known partition, falling back to RootOrg scope set", id.ToString()); return(ADSessionSettings.FromRootOrgScopeSet()); } ExTraceGlobals.GetConnectionTracer.TraceDebug <string, string>(0L, "FromAllTenantsOrRootOrgAutoDetect(): Value '{0}' passed to id parameter matches partition {1}, returning settings bound to that partition", id.ToString(), partitionId.ToString()); if (ADSession.IsTenantIdentity(id, partitionId.ForestFQDN)) { return(ADSessionSettings.FromAllTenantsObjectId(id)); } if (!TopologyProvider.IsAdamTopology()) { return(ADSessionSettings.FromAccountPartitionRootOrgScopeSet(id.GetPartitionId())); } return(ADSessionSettings.FromRootOrgScopeSet()); }
internal static void InitializeForestModeFlagForLocalForest() { string localForestFqdn = TopologyProvider.LocalForestFqdn; try { ADSession.IsTenantConfigInDomainNC(localForestFqdn); } catch (OrgContainerNotFoundException) { if (Globals.IsDatacenter) { if (Globals.IsMicrosoftHostedOnly) { InternalDirectoryRootOrganizationCache.InitializeForestModeFlagForSetup(localForestFqdn, TenantCULocation.DomainNC); } else { InternalDirectoryRootOrganizationCache.InitializeForestModeFlagForSetup(localForestFqdn, TenantCULocation.ConfigNC); } } else { InternalDirectoryRootOrganizationCache.InitializeForestModeFlagForSetup(localForestFqdn, TenantCULocation.ConfigNC); } } finally { InternalDirectoryRootOrganizationCache.GetTenantCULocation(localForestFqdn); } }
internal static IDirectorySession CreateScopedSession(IDirectorySession session, ADSessionSettings underSessionSettings) { bool flag = object.Equals(session.SessionSettings.PartitionId, underSessionSettings.PartitionId); IConfigurationSession configurationSession = session as IConfigurationSession; IDirectorySession directorySession; if (configurationSession != null) { directorySession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(flag ? configurationSession.DomainController : null, configurationSession.ReadOnly, configurationSession.ConsistencyMode, flag ? configurationSession.NetworkCredential : null, underSessionSettings, 395, "CreateScopedSession", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADSession.cs"); } else { IRecipientSession recipientSession = session as IRecipientSession; if (recipientSession.SessionSettings.IncludeSoftDeletedObjects) { underSessionSettings.IncludeSoftDeletedObjects = true; directorySession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(flag ? recipientSession.DomainController : null, flag ? recipientSession.SearchRoot : null, recipientSession.Lcid, recipientSession.ReadOnly, recipientSession.ConsistencyMode, flag ? recipientSession.NetworkCredential : null, underSessionSettings, recipientSession.ConfigScope, 410, "CreateScopedSession", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADSession.cs"); } else { directorySession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(flag ? recipientSession.DomainController : null, flag ? recipientSession.SearchRoot : null, recipientSession.Lcid, recipientSession.ReadOnly, recipientSession.ConsistencyMode, flag ? recipientSession.NetworkCredential : null, underSessionSettings, 422, "CreateScopedSession", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADSession.cs"); } if (recipientSession.IsReducedRecipientSession()) { directorySession = DirectorySessionFactory.Default.GetReducedRecipientSession((IRecipientSession)directorySession, 434, "CreateScopedSession", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADSession.cs"); } } ADSession.CopySettableSessionProperties(session, directorySession); return(directorySession); }
internal static void CopySettableSessionPropertiesAndSettings(IDirectorySession oldSession, IDirectorySession newSession) { if (oldSession != null) { ADSession.CopySettableSessionProperties(oldSession, newSession); ADSessionSettings.CloneSettableProperties(oldSession.SessionSettings, newSession.SessionSettings); } }
public static string GetCurrentConfigDC(PartitionId partitionId) { if (partitionId != null) { return(ADSession.GetCurrentConfigDC(partitionId.ForestFQDN)); } return(ADSession.GetCurrentConfigDCForLocalForest()); }
public static void VerifyIsWithinScopes(ADRawEntry obj, ADScope readScope, IList <ADScopeCollection> writeScopes, ADScopeCollection invalidScopes, bool emptyObjectSessionOnException) { ADScopeException ex; if (!ADSession.TryVerifyIsWithinScopes(obj, readScope, writeScopes, invalidScopes, emptyObjectSessionOnException, out ex)) { throw ex; } }
internal static IDirectorySession RescopeSessionToTenantSubTree(IDirectorySession session) { if (session == null) { throw new ArgumentNullException("session"); } if (session.ConfigScope == ConfigScopes.TenantLocal) { return(ADSession.CreateScopedSession(session, ADSessionSettings.RescopeToSubtree(session.SessionSettings))); } return(session); }
// Token: 0x0600108B RID: 4235 RVA: 0x0004FC28 File Offset: 0x0004DE28 internal static ScopeSet GetAllTenantsDefaultScopeSet(string partitionFqdn) { ADScope item = new ADScope(ADSession.GetHostedOrganizationsRoot(partitionFqdn), null); ADScopeCollection item2 = new ADScopeCollection(new List <ADScope>(1) { item }); return(new ScopeSet(item, new List <ADScopeCollection>(1) { item2 }, new ADScope(ADSession.GetHostedOrganizationsRoot(partitionFqdn), null), null)); }
// Token: 0x0600103A RID: 4154 RVA: 0x0004EB34 File Offset: 0x0004CD34 public static DirectoryAttribute GetRangedPropertyValue(ADPropertyDefinition propertyDefinition, SearchResultAttributeCollection attributeCollection, out IntRange returnedRange) { DirectoryAttribute result = null; returnedRange = null; string text; IntRange propertyRangeFromLdapName = RangedPropertyHelper.GetPropertyRangeFromLdapName(propertyDefinition.LdapDisplayName, out text); if (attributeCollection.Contains(propertyDefinition.LdapDisplayName)) { returnedRange = propertyRangeFromLdapName; result = attributeCollection[propertyDefinition.LdapDisplayName]; } else { string attributeNameWithRange = ADSession.GetAttributeNameWithRange(text, propertyRangeFromLdapName.LowerBound.ToString(), "*"); if (attributeCollection.Contains(attributeNameWithRange)) { returnedRange = new IntRange(propertyRangeFromLdapName.LowerBound, int.MaxValue); result = attributeCollection[attributeNameWithRange]; } else { string value = string.Format(CultureInfo.InvariantCulture, "{0};{1}{2}-", new object[] { text, "range=", propertyRangeFromLdapName.LowerBound }); foreach (object obj in attributeCollection.AttributeNames) { string text2 = (string)obj; if (text2.StartsWith(value, StringComparison.OrdinalIgnoreCase)) { result = attributeCollection[text2]; returnedRange = RangedPropertyHelper.GetPropertyRangeFromLdapName(text2, out text); } } } } return(result); }
// Token: 0x06000354 RID: 852 RVA: 0x00012094 File Offset: 0x00010294 private static ADNotificationRequestCookie RegisterChangeNotification <T>(T dummyObject, ADObjectId baseDN, ADNotificationCallback callback, object context) where T : ADConfigurationObject, new() { if (callback == null) { throw new ArgumentNullException("callback"); } if (baseDN == null || string.IsNullOrEmpty(baseDN.DistinguishedName)) { throw new ArgumentNullException("baseDN"); } string forestFQDN = baseDN.GetPartitionId().ForestFQDN; if (!baseDN.IsDescendantOf(ADSession.GetConfigurationNamingContext(forestFQDN)) && !ADSession.IsTenantIdentity(baseDN, forestFQDN)) { throw new ArgumentException(DirectoryStrings.ExArgumentException("baseDN", baseDN), "baseDN"); } ADNotificationRequest adnotificationRequest = new ADNotificationRequest(typeof(T), dummyObject.MostDerivedObjectClass, baseDN, callback, context); ADNotificationListener.RegisterChangeNotification(adnotificationRequest); return(new ADNotificationRequestCookie(new ADNotificationRequest[] { adnotificationRequest })); }
internal static bool IsWithinScope(ADRawEntry obj, ADScope scope) { bool flag; return(ADSession.IsWithinScope(obj, scope, out flag)); }
public static bool ShouldFilterCNFObject(ADSessionSettings sessionSettings, ADObjectId id) { return(!sessionSettings.IncludeCNFObject && ADSession.IsCNFObject(id)); }
public static string GetCurrentConfigDCForLocalForest() { return(ADSession.GetCurrentConfigDC(TopologyProvider.LocalForestFqdn)); }
internal static ADObjectId GetConfigurationUnitsRoot(string partitionFqdn) { ADObjectId adobjectId = ADSession.IsTenantConfigInDomainNC(partitionFqdn) ? ADSession.GetRootDomainNamingContext(partitionFqdn) : ADSession.GetMicrosoftExchangeRoot(ADSession.GetConfigurationNamingContext(partitionFqdn)); return(adobjectId.GetChildId("CN", ADObject.ConfigurationUnits)); }
internal static ADObjectId GetConfigurationUnitsRootForLocalForest() { return(ADSession.GetConfigurationUnitsRoot(TopologyProvider.LocalForestFqdn)); }
internal static bool IsTenantConfigObjectInCorrectNC(ADObjectId tenantObjectId) { return(tenantObjectId == null || tenantObjectId.DomainId == null || ADSessionSettings.IsForefrontObject(tenantObjectId) || tenantObjectId.ToDNString().IndexOf("cn=configuration,dc=", StringComparison.OrdinalIgnoreCase) < 0 || !ADSession.IsTenantConfigInDomainNC(tenantObjectId.GetPartitionId().ForestFQDN)); }
internal static ADObjectId GetHostedOrganizationsRoot(string partitionFqdn) { return(ADSession.GetRootDomainNamingContext(partitionFqdn).GetChildId("OU", "Microsoft Exchange Hosted Organizations")); }
internal static ADObjectId GetHostedOrganizationsRootForLocalForest() { return(ADSession.GetHostedOrganizationsRoot(TopologyProvider.LocalForestFqdn)); }
internal static bool TryVerifyIsWithinScopes(ADRawEntry obj, ADScope readScope, IList <ADScopeCollection> writeScopes, ADScopeCollection exclusiveScopes, IList <ValidationRule> validationRules, bool emptyObjectSessionOnException, ConfigScopes sessionScopeHint, out ADScopeException exception) { if (readScope == null) { throw new ArgumentNullException("readScope"); } if (writeScopes == null) { throw new ArgumentNullException("writeScopes"); } exception = null; bool flag; if (!ADSession.IsWithinScope(obj, readScope, out flag)) { if (!flag || sessionScopeHint != ConfigScopes.RootOrg || ADSession.IsTenantIdentity(obj.Id, obj.Id.GetPartitionId().ForestFQDN)) { if (obj is ADObject && emptyObjectSessionOnException) { ((ADObject)obj).m_Session = null; } exception = new ADScopeException(DirectoryStrings.ErrorNotInReadScope(obj.Id.ToString())); return(false); } ExTraceGlobals.ScopeVerificationTracer.TraceDebug <ADObjectId>(0L, "ADSession::TryVerifyIsWithinScopes Allowing unfilterable object '{0}' in RootOrg-scoped session to bypass filter verification", obj.Id); } bool flag2 = false; if (exclusiveScopes != null) { foreach (ADScope scope in exclusiveScopes) { if (ADSession.IsWithinScope(obj, scope)) { flag2 = true; break; } } } foreach (ADScopeCollection adscopeCollection in writeScopes) { bool flag3 = false; foreach (ADScope adscope in adscopeCollection) { bool flag4 = false; bool flag5 = false; bool flag6 = false; if (adscope is RbacScope) { RbacScope rbacScope = (RbacScope)adscope; flag4 = rbacScope.Exclusive; flag5 = rbacScope.IsFromEndUserRole; flag6 = (rbacScope.ScopeType == ScopeType.Self); } if (!flag2 && flag4) { ExTraceGlobals.ScopeVerificationTracer.TraceDebug(0L, "ADSession::TryVerifyIsWithinScopes Ignoring scope ScopeRoot '{0}', ScopeFilter '{1}', IsWithinExclusiveScope '{2}', IsExclusive '{3}'", new object[] { (adscope.Root == null) ? "<null>" : adscope.Root.ToDNString(), (adscope.Filter == null) ? "<null>" : adscope.Filter.ToString(), flag2, flag4 }); } else { ADScope adscope2 = adscope; if (flag2 && !flag4) { if (!flag5) { ExTraceGlobals.ScopeVerificationTracer.TraceDebug(0L, "ADSession::TryVerifyIsWithinScopes Ignoring scope ScopeRoot '{0}', ScopeFilter '{1}', IsWithinExclusiveScope '{2}', IsExclusive '{3}'", new object[] { (adscope2.Root == null) ? "<null>" : adscope2.Root.ToDNString(), (adscope2.Filter == null) ? "<null>" : adscope2.Filter.ToString(), flag2, flag4 }); continue; } if (!flag6) { if (((RbacScope)adscope2).SelfFilter == null) { exception = new ADScopeException(DirectoryStrings.ExArgumentNullException("RbacScope.SelfFilter")); return(false); } adscope2 = new RbacScope(ScopeType.Self) { Root = ((RbacScope)adscope2).SelfRoot, Filter = ((RbacScope)adscope2).SelfFilter }; } } if (ADSession.IsWithinScope(obj, adscope2)) { flag3 = true; break; } } } if (!flag3) { if (obj is ADObject && emptyObjectSessionOnException) { ((ADObject)obj).m_Session = null; } exception = new ADScopeException(DirectoryStrings.ErrorNoWriteScope(obj.Id.ToString())); return(false); } } if (validationRules != null) { RuleValidationException ex = null; foreach (ValidationRule validationRule in validationRules) { if (!validationRule.TryValidate(obj, out ex)) { exception = ex; return(false); } } } return(true); }
protected TResult ExecuteSingleObjectQueryWithFallback <TResult>(Func <TSession, TResult> query, Func <TResult, List <Tuple <string, KeyType> > > getAdditionalKeys = null, IEnumerable <PropertyDefinition> properties = null) where TResult : ADRawEntry, new() { ArgumentValidator.ThrowIfNull("query", query); if (!Configuration.IsCacheEnabled(typeof(TResult))) { return(query(this.GetSession())); } Stopwatch stopwatch = Stopwatch.StartNew(); CachePerformanceTracker.StartLogging(); CompositeDirectorySession <TSession> .TraceState traceState = CompositeDirectorySession <TSession> .TraceState.None; CacheMode cacheModeForCurrentProcess = Configuration.GetCacheModeForCurrentProcess(); double num = -1.0; double num2 = -1.0; double num3 = -1.0; double num4 = -1.0; TResult tresult = default(TResult); string text = string.Empty; Guid guid = Guid.Empty; ADCacheResultState adcacheResultState = ADCacheResultState.Succeed; bool flag = true; int num5 = 0; try { Stopwatch stopwatch2 = null; ADObject adobject = null; try { TSession session = this.GetSession(); if (session.ActivityScope != null) { TSession session2 = this.GetSession(); if (session2.ActivityScope.Status == ActivityContextStatus.ActivityStarted) { TSession session3 = this.GetSession(); guid = session3.ActivityScope.ActivityId; } } if (!this.CacheSessionForDeletingOnly && (CacheMode.Read & cacheModeForCurrentProcess) != CacheMode.Disabled) { TSession session4 = this.GetSession(); if (!session4.SessionSettings.IncludeSoftDeletedObjectLinks) { if (properties != null || !typeof(TResult).Equals(typeof(ADRawEntry))) { traceState |= CompositeDirectorySession <TSession> .TraceState.CacheRead; stopwatch2 = Stopwatch.StartNew(); tresult = query(this.GetCacheSession()); CacheDirectorySession cacheDirectorySession = this.GetCacheSession() as CacheDirectorySession; if (cacheDirectorySession != null) { adcacheResultState = cacheDirectorySession.ResultState; flag = cacheDirectorySession.IsNewProxyObject; num5 = cacheDirectorySession.RetryCount; } stopwatch2.Stop(); num = (double)stopwatch2.ElapsedMilliseconds; goto IL_19A; } goto IL_19A; } } if ((CacheMode.Read & cacheModeForCurrentProcess) == CacheMode.Disabled || this.CacheSessionForDeletingOnly) { adcacheResultState = ADCacheResultState.CacheModeIsNotRead; } else { adcacheResultState = ADCacheResultState.SoftDeletedObject; } IL_19A: if (tresult != null && tresult.Id != null) { TSession session5 = this.GetSession(); if (ADSession.ShouldFilterCNFObject(session5.SessionSettings, tresult.Id)) { tresult = default(TResult); adcacheResultState = ADCacheResultState.CNFedObject; } else { TSession session6 = this.GetSession(); if (ADSession.ShouldFilterSoftDeleteObject(session6.SessionSettings, tresult.Id)) { tresult = default(TResult); adcacheResultState = ADCacheResultState.SoftDeletedObject; } else { if (tresult.Id != null && tresult.Id.DomainId != null) { TSession session7 = this.GetSession(); if (!session7.SessionSettings.PartitionId.Equals(tresult.Id.GetPartitionId())) { if (ExEnvironment.IsTest) { TSession session8 = this.GetSession(); if (session8.SessionSettings.PartitionId.ForestFQDN.EndsWith(tresult.Id.GetPartitionId().ForestFQDN, StringComparison.OrdinalIgnoreCase)) { goto IL_341; } } ExEventLog.EventTuple tuple_WrongObjectReturned = DirectoryEventLogConstants.Tuple_WrongObjectReturned; string name = typeof(TResult).Name; object[] array = new object[2]; object[] array2 = array; int num6 = 0; TSession session9 = this.GetSession(); array2[num6] = session9.SessionSettings.PartitionId.ForestFQDN; array[1] = tresult.Id.GetPartitionId().ForestFQDN; Globals.LogEvent(tuple_WrongObjectReturned, name, array); tresult = default(TResult); adcacheResultState = ADCacheResultState.WrongForest; goto IL_3E1; } } IL_341: TSession session10 = this.GetSession(); if (session10.SessionSettings.CurrentOrganizationId != OrganizationId.ForestWideOrgId) { TSession session11 = this.GetSession(); OrganizationId currentOrganizationId = session11.SessionSettings.CurrentOrganizationId; if (!tresult.Id.IsDescendantOf(currentOrganizationId.OrganizationalUnit) && !tresult.Id.IsDescendantOf(currentOrganizationId.ConfigurationUnit.Parent)) { tresult = default(TResult); adcacheResultState = ADCacheResultState.OranizationIdMismatch; } } } } } else if (tresult != null) { tresult = default(TResult); } else { adcacheResultState = ADCacheResultState.NotFound; } IL_3E1: adobject = (tresult as ADObject); } catch (Exception ex) { tresult = default(TResult); adcacheResultState = ADCacheResultState.ExceptionHappened; Globals.LogEvent(DirectoryEventLogConstants.Tuple_CallADCacheServiceFailed, typeof(TResult).Name, new object[] { ex.ToString() }); text = ex.ToString(); } if (tresult == null) { traceState |= CompositeDirectorySession <TSession> .TraceState.ADRead; stopwatch2 = Stopwatch.StartNew(); tresult = query(this.GetSession()); adobject = (tresult as ADObject); stopwatch2.Stop(); num4 = (double)stopwatch2.ElapsedMilliseconds; stopwatch2.Restart(); bool flag2 = true; if (adobject != null) { TSession session12 = this.GetSession(); if (!session12.ReadOnly && CompositeDirectorySession <TSession> .ExchangeConfigUnitCUType.Equals(adobject.GetType()) && OrganizationId.ForestWideOrgId.Equals(adobject.OrganizationId)) { ExTraceGlobals.SessionTracer.TraceWarning <string>((long)this.GetHashCode(), "Newly created ExchangeCU with organizationId equals to RootOrgId, ignored till is fully populated. DN {0}", tresult.GetDistinguishedNameOrName()); flag2 = false; } } if (tresult != null && CacheUtils.GetObjectTypeFor(tresult.GetType(), false) == ObjectType.Unknown) { flag2 = false; } if (tresult != null && ((CacheMode.SyncWrite | CacheMode.AsyncWrite) & cacheModeForCurrentProcess) != CacheMode.Disabled && tresult.Id != null && !tresult.Id.IsDeleted && flag2) { traceState |= CompositeDirectorySession <TSession> .TraceState.CacheInsert; if ((CacheMode.SyncWrite & cacheModeForCurrentProcess) != CacheMode.Disabled) { try { this.CacheInsert <TResult>(tresult, getAdditionalKeys, properties); goto IL_5C8; } catch (Exception ex2) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_CallADCacheServiceFailed, "CacheInsert", new object[] { ex2.ToString() }); text += ex2.Message; goto IL_5C8; } } TSession session13 = this.GetSession(); if (session13.ReadOnly) { this.AsyncCacheInsert <TResult>(tresult, getAdditionalKeys, properties); } else { adcacheResultState |= ADCacheResultState.WritableSession; } } IL_5C8: stopwatch2.Stop(); num3 = (double)stopwatch2.ElapsedMilliseconds; } if (adobject != null) { adobject.m_Session = this; } } finally { stopwatch.Stop(); string text2 = CachePerformanceTracker.StopLogging(); string operation = "Read"; string dn = (tresult != null) ? tresult.GetDistinguishedNameOrName() : "<NULL>"; DateTime whenReadUTC = (tresult != null) ? ((tresult.WhenReadUTC != null) ? tresult.WhenReadUTC.Value : DateTime.MinValue) : DateTime.MinValue; long elapsedMilliseconds = stopwatch.ElapsedMilliseconds; long wcfGetProcessingTime = (long)num; long wcfRemoveProcessingTime = (long)num2; long wcfPutProcessingTime = (long)num3; long adProcessingTime = (long)num4; bool isNewProxyObject = flag; int retryCount = num5; string objectType = (tresult != null) ? tresult.GetType().Name : typeof(TResult).Name; string cachePerformanceTracker = text2; Guid activityId = guid; TSession session14 = this.GetSession(); CacheProtocolLog.BeginAppend(operation, dn, whenReadUTC, elapsedMilliseconds, wcfGetProcessingTime, wcfRemoveProcessingTime, wcfPutProcessingTime, adProcessingTime, isNewProxyObject, retryCount, objectType, cachePerformanceTracker, activityId, session14.CallerInfo, string.Format("ResultState:{0};{1}", (int)adcacheResultState, text)); ExTraceGlobals.SessionTracer.TraceDebug((long)this.GetHashCode(), "ExecuteSingleObjectQueryWithFallback. Cache Mode {0}. TraceState {1}. DN {2}. WhenRead {3}. IsCached {4}.", new object[] { cacheModeForCurrentProcess, traceState, (tresult != null) ? tresult.GetDistinguishedNameOrName() : "<NULL>", (tresult != null) ? ((tresult.WhenReadUTC != null) ? tresult.WhenReadUTC.Value.ToString() : "<NULL>") : "<NULL>", tresult != null && tresult.IsCached }); ExTraceGlobals.SessionTracer.TracePerformance((long)this.GetHashCode(), "ExecuteSingleObjectQueryWithFallback. Cache Mode {0}. TraceState {1}. DN {2}. TotalTime {3}. GetCacheTime {4}. RemoveCacheTime {5}. PutCacheTime {6}. ADTime {7}. WCFDetails [{8}]", new object[] { cacheModeForCurrentProcess, traceState, (tresult != null) ? tresult.GetDistinguishedNameOrName() : "<NULL>", stopwatch.ElapsedMilliseconds, num, num2, num3, num4, text2 }); if (tresult != null) { ADProviderPerf.UpdateADDriverCacheHitRate(tresult.IsCached); } } return(tresult); }
public static bool TryVerifyIsWithinScopes(ADRawEntry obj, ADScope readScope, IList <ADScopeCollection> writeScopes, ADScopeCollection exclusiveScopes, bool emptyObjectSessionOnException, out ADScopeException exception) { return(ADSession.TryVerifyIsWithinScopes(obj, readScope, writeScopes, exclusiveScopes, null, emptyObjectSessionOnException, out exception)); }
public object[][] GetRows(int rowCount) { ADRawEntry[] propertyBags = this.GetPropertyBags(rowCount); return(ADSession.ConvertToView(propertyBags, this.requestedProperties)); }
internal static ADObjectId GetRootDomainNamingContext(string domainController, NetworkCredential credential) { return(ADSession.GetNamingContext(ADSession.ADNamingContext.RootDomain, domainController, credential)); }
internal static bool TryCreateFromBytes(byte[] bytes, Encoding encoding, out OrganizationId orgId) { orgId = null; if (bytes == null) { throw new ArgumentNullException("bytes"); } if (bytes.Length < 6) { return(false); } byte b = bytes[0]; if (b <= 0) { return(false); } int num = 1; int num2 = (int)(1 + 5 * b); ADObjectId adobjectId = null; ADObjectId adobjectId2 = null; for (int i = 0; i < (int)b; i++) { if (bytes.Length < num + 4 + 1) { return(false); } OrganizationId.ByteRepresentationTag byteRepresentationTag = (OrganizationId.ByteRepresentationTag)bytes[num++]; int num3 = BitConverter.ToInt32(bytes, num); num += 4; if (num3 < 0) { return(false); } if (num3 != 0 && bytes.Length < num2 + num3) { return(false); } switch (byteRepresentationTag) { case OrganizationId.ByteRepresentationTag.ForestWideOrgIdTag: if (num3 != 0) { return(false); } orgId = OrganizationId.ForestWideOrgId; return(true); case OrganizationId.ByteRepresentationTag.OrgUnitTag: if (adobjectId != null || !ADObjectId.TryCreateFromBytes(bytes, num2, num3, encoding, out adobjectId)) { return(false); } break; case OrganizationId.ByteRepresentationTag.ConfigUnitTag: if (adobjectId2 != null || !ADObjectId.TryCreateFromBytes(bytes, num2, num3, encoding, out adobjectId2)) { return(false); } if (!ADSession.IsTenantConfigObjectInCorrectNC(adobjectId2)) { return(false); } break; } num2 += num3; } if (adobjectId == null || adobjectId2 == null) { return(false); } orgId = new OrganizationId(); orgId.Initialize(adobjectId, adobjectId2); return(true); }
internal static ADObjectId GetRootDomainNamingContextForLocalForest() { return(ADSession.GetRootDomainNamingContext(TopologyProvider.LocalForestFqdn)); }