// Token: 0x060005B4 RID: 1460 RVA: 0x0001FDCB File Offset: 0x0001DFCB internal ADServerSettingsChangedException(LocalizedString message, ADServerSettings serverSettings) : base(message) { if (serverSettings == null) { throw new ArgumentNullException("serverSettings"); } this.serverSettings = serverSettings; }
// Token: 0x0600061B RID: 1563 RVA: 0x000211EC File Offset: 0x0001F3EC internal static bool UseAggregateSession(ADSessionSettings sessionSettings) { ADServerSettings externalServerSettings = ADSessionSettings.ExternalServerSettings; ADDriverContext processADContext = ADSessionSettings.GetProcessADContext(); bool flag = processADContext != null && processADContext.Mode == ContextMode.Setup; bool flag2 = externalServerSettings != null && externalServerSettings.ForceADInTemplateScope; bool flag3 = !ConfigBase <AdDriverConfigSchema> .GetConfig <bool>("ConsumerMailboxScenarioDisabled"); return(flag3 && TemplateTenantConfiguration.IsTemplateTenant(sessionSettings.CurrentOrganizationId) && !sessionSettings.ForceADInTemplateScope && !flag2 && !flag); }
internal override Fqdn ConfigurationDomainController(string partitionFqdn) { Fqdn fqdn = this.userConfigurationDomainController; if (fqdn != null && ADServerSettings.IsServerNamePartitionSameAsPartitionId(fqdn, partitionFqdn)) { return(fqdn); } return(base.ConfigurationDomainController(partitionFqdn)); }
internal override Fqdn PreferredGlobalCatalog(string partitionFqdn) { Fqdn fqdn = this.userPreferredGlobalCatalog; if (fqdn != null && ADServerSettings.IsServerNamePartitionSameAsPartitionId(fqdn, partitionFqdn)) { return(fqdn); } return(base.PreferredGlobalCatalog(partitionFqdn)); }
// Token: 0x060000DB RID: 219 RVA: 0x000048A8 File Offset: 0x00002AA8 protected void CheckDomainControllerParameterConsistency(string dcName) { if (!string.IsNullOrEmpty(dcName) && this.SessionSettings.PartitionId != null) { string forestFQDN = this.SessionSettings.PartitionId.ForestFQDN; if (!ADServerSettings.IsServerNamePartitionSameAsPartitionId(dcName, forestFQDN)) { throw new DomainControllerFromWrongDomainException(DirectoryStrings.WrongDCForCurrentPartition(dcName, forestFQDN)); } } }
private static ADObjectId GetNamingContext(ADSession.ADNamingContext context, string domainController, NetworkCredential credential) { PooledLdapConnection pooledLdapConnection = null; ADObjectId result = null; try { string partitionFqdn = Globals.IsMicrosoftHostedOnly ? ADServerSettings.GetPartitionFqdnFromADServerFqdn(domainController) : TopologyProvider.LocalForestFqdn; pooledLdapConnection = ConnectionPoolManager.GetConnection(ConnectionType.DomainController, partitionFqdn, credential, domainController, 389); switch (context) { case ADSession.ADNamingContext.RootDomain: result = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.RootDomainNC); break; case ADSession.ADNamingContext.Domain: result = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.WritableNC); break; case (ADSession.ADNamingContext) 3: break; case ADSession.ADNamingContext.Config: result = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.ConfigNC); break; default: if (context == ADSession.ADNamingContext.Schema) { result = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.SchemaNC); } break; } } finally { if (pooledLdapConnection != null) { pooledLdapConnection.ReturnToPool(); } } return(result); }
internal void AddOrReplaceUserPreferredDC(Fqdn fqdn, out ADObjectId domain, out Fqdn replacedDc) { ADServerInfo serverInfoFromFqdn = ADServerSettings.GetServerInfoFromFqdn(fqdn, ConnectionType.DomainController); domain = new ADObjectId(serverInfoFromFqdn.WritableNC); replacedDc = null; Fqdn fqdn2; if (this.userServerPerDomain.TryGetValue(domain, out fqdn2) && string.Equals(fqdn2, serverInfoFromFqdn.Fqdn)) { return; } lock (this.dictLock) { Dictionary <ADObjectId, Fqdn> dictionary = new Dictionary <ADObjectId, Fqdn>(this.userServerPerDomain); this.userServerPerDomain.TryGetValue(domain, out replacedDc); dictionary[domain] = fqdn; this.userServerPerDomain = dictionary; this.cachedUserPreferredDCList = new MultiValuedProperty <Fqdn>(this.userServerPerDomain.Values); } }
private static void LogEventProcessADContextChanged() { string text = "<null>"; string text2 = text; string text3 = text; string text4 = text; if (ADSessionSettings.processContext != null) { ADServerSettings serverSettings = ADSessionSettings.processContext.ServerSettings; string text5 = serverSettings.PreferredGlobalCatalog(TopologyProvider.LocalForestFqdn); if (!string.IsNullOrEmpty(text5)) { text3 = text5; } text5 = serverSettings.ConfigurationDomainController(TopologyProvider.LocalForestFqdn); if (!string.IsNullOrEmpty(text5)) { text4 = text5; } if (serverSettings.PreferredDomainControllers.Count > 0) { StringBuilder stringBuilder = new StringBuilder(); foreach (Fqdn fqdn in serverSettings.PreferredDomainControllers) { stringBuilder.AppendLine(fqdn); } text2 = stringBuilder.ToString(); } } Globals.LogEvent(DirectoryEventLogConstants.Tuple_DSC_EVENT_PREFERRED_TOPOLOGY, null, new object[] { text2, text3, text4 }); }
internal void SetUserConfigurationDomainController(Fqdn fqdn) { ADServerSettings.GetServerInfoFromFqdn(fqdn, ConnectionType.DomainController); this.userConfigurationDomainController = fqdn; }
internal void SetUserPreferredGlobalCatalog(Fqdn fqdn) { ADServerSettings.GetServerInfoFromFqdn(fqdn, ConnectionType.GlobalCatalog); this.userPreferredGlobalCatalog = fqdn; }
public static string DistinguishedNameFromCanonicalName(string canonicalName, ADServerSettings serverSettings) { if (canonicalName.IndexOf('/') != canonicalName.LastIndexOf('/') && !canonicalName.EndsWith("\\/")) { canonicalName = canonicalName.TrimEnd(new char[] { '/' }); } if (!canonicalName.Contains("/")) { canonicalName += "/"; } string text = null; uint err = 0U; bool flag = NativeHelpers.TryDsCrackNames(canonicalName, ExtendedNameFormat.NameCanonical, ExtendedNameFormat.NameFullyQualifiedDN, serverSettings, out text, out err); bool flag2 = ADObjectId.IsValidDistinguishedName(text); if (!flag || !flag2) { throw new NameConversionException(DirectoryStrings.ErrorConversionFailedWithError(canonicalName, err)); } return(text); }
private static bool TryDsCrackNames(string input, ExtendedNameFormat formatOffered, ExtendedNameFormat formatDesired, ADServerSettings serverSettings, out string result, out uint err) { if (input == null) { throw new ArgumentNullException("input"); } if (formatOffered != ExtendedNameFormat.NameCanonical && formatOffered != ExtendedNameFormat.NameFullyQualifiedDN) { throw new ArgumentException(DirectoryStrings.ExArgumentException("formatOffered", formatOffered.ToString()), "formatOffered"); } if (formatDesired != ExtendedNameFormat.NameCanonical && formatDesired != ExtendedNameFormat.NameFullyQualifiedDN) { throw new ArgumentException(DirectoryStrings.ExArgumentException("formatDesired", formatDesired.ToString()), "formatDesired"); } result = null; err = 0U; SafeDsNameResultHandle safeDsNameResultHandle = null; SafeDsBindHandle safeDsBindHandle = null; NativeMethods.DsNameFlags dsNameFlags = NativeMethods.DsNameFlags.SyntacticalOnly; bool result2; try { if (formatOffered == ExtendedNameFormat.NameCanonical) { string[] array = input.Split(new char[] { '/' }); if (array.Length == 0) { return(false); } if (array.Length > 1 && array[1].Length > 0) { dsNameFlags = NativeMethods.DsNameFlags.NoFlags; string text = array[0]; ExTraceGlobals.ADTopologyTracer.TraceDebug <string>(0L, "Calling DsBind for domain {0}", text ?? "<null>"); if (text.Length == 0) { return(false); } string domainControllerName = null; string distinguishedName = NativeHelpers.DistinguishedNameFromCanonicalName(text); if (serverSettings == null) { serverSettings = ADSessionSettings.ExternalServerSettings; } if (serverSettings != null) { domainControllerName = serverSettings.GetPreferredDC(new ADObjectId(distinguishedName)); } err = NativeMethods.DsBind(domainControllerName, text, out safeDsBindHandle); if (err != 0U) { return(false); } } } if (safeDsBindHandle == null) { safeDsBindHandle = new SafeDsBindHandle(); } ExTraceGlobals.ADTopologyTracer.TraceDebug(0L, "Calling DsCrackNames with input={0}, formatOffered={1}, formatDesired={2}, flags={3}", new object[] { input, formatOffered, formatDesired, dsNameFlags }); err = NativeMethods.DsCrackNames(safeDsBindHandle, dsNameFlags, formatOffered, formatDesired, 1U, new string[] { input }, out safeDsNameResultHandle); if (err != 0U) { result2 = false; } else { NativeMethods.DsNameResult dsNameResult = new NativeMethods.DsNameResult(); Marshal.PtrToStructure(safeDsNameResultHandle.DangerousGetHandle(), dsNameResult); uint cItems = dsNameResult.cItems; if (cItems < 1U) { result2 = false; } else { NativeMethods.DsNameResultItem dsNameResultItem = new NativeMethods.DsNameResultItem(); Marshal.PtrToStructure(dsNameResult.rItems, dsNameResultItem); if (dsNameResultItem.status != 0) { err = (uint)dsNameResultItem.status; result2 = false; } else if (dsNameResultItem.name == null) { result2 = false; } else { result = dsNameResultItem.name; result2 = true; } } } } finally { if (safeDsBindHandle != null) { safeDsBindHandle.Dispose(); } if (safeDsNameResultHandle != null) { safeDsNameResultHandle.Dispose(); } } return(result2); }
internal override bool TryFailover(out ADServerSettings newServerSettings, out string failToFailOverReason, bool forestWideAffinityRequested = false) { throw new NotSupportedException("TryFailover setter is not supported on SetupServerSettings"); }
internal ADDriverContext(ADServerSettings serverSettings, ContextMode mode) { this.serverSettings = serverSettings; this.mode = mode; }