// Token: 0x0600005E RID: 94 RVA: 0x00002DEC File Offset: 0x00000FEC public IAutodMiniRecipient GetNextUserFromSortedList(SmtpAddress emailAddress) { IRecipientSession recipientSession = DirectorySessionFactory.Default.CreateRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 66, "GetNextUserFromSortedList", "f:\\15.00.1497\\sources\\dev\\autodisc\\src\\AutoDiscoverV2\\TenantRepository.cs"); this.logger.AppendGenericInfo("GetOnPremUser", "Start Ad lookup"); QueryFilter filter = new AndFilter(new QueryFilter[] { new OrFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientTypeDetails, RecipientTypeDetails.UserMailbox), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientTypeDetails, RecipientTypeDetails.MailUser) }), new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ADUserSchema.UserPrincipalName, emailAddress.Address) }); ADRawEntry[] array = recipientSession.Find(null, QueryScope.SubTree, filter, null, 1, new PropertyDefinition[] { ADUserSchema.UserPrincipalName, ADRecipientSchema.ExternalEmailAddress }); if (array != null) { ADRawEntry adrawEntry = array.FirstOrDefault <ADRawEntry>(); if (adrawEntry != null) { return(new AutodMiniRecipient(adrawEntry)); } } return(null); }
internal override IConfigurationSession CreateSession() { PartitionId partitionIdByAcceptedDomainName = ADAccountPartitionLocator.GetPartitionIdByAcceptedDomainName(this.Organization.RawIdentity); ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerId(partitionIdByAcceptedDomainName.ForestFQDN, null, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, false); return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.RescopeToSubtree(sessionSettings), 480, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\AddSecondaryDomainTask.cs")); }
// Token: 0x06000FB5 RID: 4021 RVA: 0x00040414 File Offset: 0x0003E614 public IEnumerable <ConnectionSettings> GetConnectionSettingsMatchingEmail(SmtpAddress email) { Office365ConnectionSettings connectionSettings = null; this.log.ExecuteMonitoredOperation(ConnectionSettingsDiscoveryMetadata.GetOffice365ConnectionSettings, delegate { try { ADSessionSettings sessionSettings = ADSessionSettings.FromTenantAcceptedDomain(email.Domain); ITenantRecipientSession recipientSession = DirectorySessionFactory.Default.CreateTenantRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 78, "GetConnectionSettingsMatchingEmail", "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\ConnectionSettingsDiscovery\\ConnectionSettingsProviders\\O365ConnectionSettingsProvider.cs"); MiniRecipient adUser = null; Action action = delegate() { adUser = recipientSession.FindByProxyAddress <MiniRecipient>(new SmtpProxyAddress(email.ToString(), true)); }; bool flag = false; int i = 0; while (i < 1) { i++; try { action(); flag = true; break; } catch (DataSourceTransientException ex) { this.log.Trace("Caught an exception from directory while trying to find an AD user object for email address {0}. Exception: {1}", new object[] { email, ex }); } catch (DataSourceOperationException ex2) { this.log.Trace("Caught an exception from directory while trying to find an AD user object for email address {0}. Exception: {1}", new object[] { email, ex2 }); } } if (!flag) { i++; action(); } if (adUser != null) { connectionSettings = new Office365ConnectionSettings(adUser); } else { this.log.Trace("Found Office365 connection settings for email address {0} when AD user object does not exist", new object[] { email }); connectionSettings = new Office365ConnectionSettings(); } } catch (CannotResolveTenantNameException exception) { this.log.LogException(exception, "Failed to find Office365 connection settings for email address {0}. No tenant exists with domain name: ", new object[] { email, email.Domain }); } }); if (connectionSettings != null) { this.log.LogOperationResult(ConnectionSettingsDiscoveryMetadata.Office365ConnectionSettingsFound, email.Domain, true); yield return(new ConnectionSettings(this, connectionSettings, null)); } this.log.LogOperationResult(ConnectionSettingsDiscoveryMetadata.Office365ConnectionSettingsFound, email.Domain, false); yield break; }
// Token: 0x06000676 RID: 1654 RVA: 0x00017FA4 File Offset: 0x000161A4 void IWritableAD.ResetAllowFileRestoreDsFlag(Guid mdbGuid, AmServerName lastMountedServerName, AmServerName masterServerName) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 108, "ResetAllowFileRestoreDsFlag", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Shared\\WritableADHelper.cs"); Database database = topologyConfigurationSession.FindDatabaseByGuid <Database>(mdbGuid); if (database == null) { AmTrace.Error("Failed to find Db using dbGuid {0}", new object[] { mdbGuid }); return; } if (!database.AllowFileRestore) { AmTrace.Debug("Skipped to update legacy AllowFileRestore database '{0}'.)", new object[] { database.Name }); return; } MiniServer miniServer = topologyConfigurationSession.FindMiniServerByName(masterServerName.NetbiosName, WritableADHelper.s_propertiesNeededFromServer); if (miniServer == null) { AmTrace.Error("Failed to find Server using {0}", new object[] { masterServerName }); return; } MiniServer sourceServer = null; if (!AmServerName.IsNullOrEmpty(lastMountedServerName)) { sourceServer = topologyConfigurationSession.FindMiniServerByName(lastMountedServerName.NetbiosName, WritableADHelper.s_propertiesNeededFromServer); } AmTrace.Debug("Reset AllowFileRestore. Database '{0}', legdn='{1}'. Setting owning server: '{2}'.", new object[] { database.Name, database.ExchangeLegacyDN, miniServer.Id }); database.AllowFileRestore = false; WritableADHelper.SaveDatabasePropertiesOnMultipleServerSites(topologyConfigurationSession, database, sourceServer, miniServer, true); }
protected override ADRawEntry LoadExecutingUser(IIdentity identity, IList <PropertyDefinition> properties) { this.LinkedAccountUser = ((PartnerApplicationRunspaceConfiguration.LinkedAccountIdentity)identity).LinkedAccountUser; this.recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(this.LinkedAccountUser.Id), 224, "LoadExecutingUser", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\rbac\\PartnerApplicationRunspaceConfiguration.cs"); return(this.LinkedAccountUser); }
protected override IConfigDataProvider CreateSession() { return(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopes(base.RootOrgContainerId, base.ExecutingUserOrganizationId, base.ExecutingUserOrganizationId, true), 115, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Monitoring\\Tasks\\TestOAuthConnectivity.cs")); }
internal static SIPFEServerConfiguration Find() { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 563, "Find", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\SIPFEServerConfiguration.cs"); return(SIPFEServerConfiguration.Find(LocalServer.GetServer(), tenantOrTopologyConfigurationSession)); }
public static ServiceEndpoint GetMsoEndpoint() { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 66, "GetMsoEndpoint", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\ForwardSync\\MsoSyncService.cs"); ServiceEndpointContainer endpointContainer = topologyConfigurationSession.GetEndpointContainer(); return(endpointContainer.GetEndpoint("MSOSyncEndpoint")); }
public OWAAppDataProviderForNonMailboxUser(string domain, IRecipientSession adRecipientSession, ADSessionSettings adSessionSettings, bool isUserScope, string action) { this.domain = domain; this.adRecipientSession = adRecipientSession; this.isUserScope = isUserScope; }
public MserveTargetConnection(int localServerVersion, MserveTargetServerConfig config, EnhancedTimeSpan syncInterval, TestShutdownAndLeaseDelegate testShutdownAndLease, EdgeSyncLogSession logSession) : base(localServerVersion, config, syncInterval, logSession, ExTraceGlobals.TargetConnectionTracer) { this.testShutdownAndLease = testShutdownAndLease; this.config = config; this.InitializeTenantMEUSyncControlCache(); this.InitializeClientToken(); this.configSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 313, ".ctor", "f:\\15.00.1497\\sources\\dev\\EdgeSync\\src\\Mserve\\MserveTargetConnection.cs"); if (EdgeSyncSvc.EdgeSync != null && EdgeSyncSvc.EdgeSync.AppConfig != null) { this.duplicatedAddEntriesCacheSize = EdgeSyncSvc.EdgeSync.AppConfig.DuplicatedAddEntriesCacheSize; this.podSiteStartRange = EdgeSyncSvc.EdgeSync.AppConfig.PodSiteStartRange; this.podSiteEndRange = EdgeSyncSvc.EdgeSync.AppConfig.PodSiteEndRange; this.trackDuplicatedAddEntries = EdgeSyncSvc.EdgeSync.AppConfig.TrackDuplicatedAddEntries; if (!this.trackDuplicatedAddEntries) { this.duplicatedAddEntriesCacheSize = 0; } } }
internal OwaFblHandler() : this(DirectorySessionFactory.NonCacheSessionFactory.CreateTenantRecipientSession(false, ConsistencyMode.FullyConsistent, ADSessionSettings.FromConsumerOrganization(), 72, ".ctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\common\\FBL\\OwaFblHandler.cs")) { }
private static T[] FindVirtualDirectoriesForServer <T>(string serverFqdn) where T : ExchangeVirtualDirectory, new() { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 124, "FindVirtualDirectoriesForServer", "f:\\15.00.1497\\sources\\dev\\admin\\src\\ecp\\WebServices\\VirtualDirectoryConfiguration.cs"); Server server = string.IsNullOrEmpty(serverFqdn) ? topologyConfigurationSession.FindLocalServer() : topologyConfigurationSession.FindServerByFqdn(serverFqdn); if (server == null) { return(new T[0]); } return(topologyConfigurationSession.Find <T>(server.Id, QueryScope.SubTree, null, null, 0)); }
public static OrganizationId ResolveOrganizationByRealm(string realm) { if (string.IsNullOrEmpty(realm)) { throw new ArgumentNullException("realm"); } OrganizationId result = null; if (OAuthConfigHelper.isMultiTenancyEnabled) { try { Guid externalDirectoryOrganizationId; ADSessionSettings adsessionSettings; if (Guid.TryParse(realm, out externalDirectoryOrganizationId)) { adsessionSettings = ADSessionSettings.FromExternalDirectoryOrganizationId(externalDirectoryOrganizationId); } else { SmtpDomain smtpDomain; if (!SmtpDomain.TryParse(realm, out smtpDomain)) { throw new RealmFormatInvalidException(DirectoryStrings.ErrorRealmFormatInvalid(realm)); } adsessionSettings = ADSessionSettings.FromTenantAcceptedDomain(realm); } return(adsessionSettings.CurrentOrganizationId); } catch (CannotResolveExternalDirectoryOrganizationIdException innerException) { throw new RealmNotFoundException(DirectoryStrings.ErrorRealmNotFound(realm), innerException); } catch (CannotResolveTenantNameException innerException2) { throw new RealmNotFoundException(DirectoryStrings.ErrorRealmNotFound(realm), innerException2); } } result = OrganizationId.ForestWideOrgId; IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 306, "ResolveOrganizationByRealm", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\OAuth\\OAuthConfigHelper.cs"); if (tenantOrTopologyConfigurationSession.GetAcceptedDomainByDomainName(realm) == null) { AuthConfig authConfig = AuthConfig.Read(tenantOrTopologyConfigurationSession); if (!realm.Equals(authConfig.Realm)) { if (OAuthConfigHelper.GetAuthServers().FirstOrDefault((AuthServer server) => realm.Equals(server.Realm, StringComparison.OrdinalIgnoreCase)) == null) { throw new RealmNotFoundException(DirectoryStrings.ErrorRealmNotFound(realm)); } } } return(result); }
// Token: 0x06001573 RID: 5491 RVA: 0x00079F18 File Offset: 0x00078118 public static IRecipientSession GetAdRecipientSession(Guid externalDirectoryOrganizationId) { ADSessionSettings sessionSettings = (externalDirectoryOrganizationId != Guid.Empty) ? ADSessionSettings.FromExternalDirectoryOrganizationId(externalDirectoryOrganizationId) : ADSessionSettings.FromRootOrgScopeSet(); return(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 31, "GetAdRecipientSession", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\MailboxProcessor\\MailboxProcessorHelpers\\ADHelper.cs")); }
// Token: 0x060000E9 RID: 233 RVA: 0x00009C9C File Offset: 0x00007E9C protected override ADMobileVirtualDirectory CreateOnCacheMiss(string vDirObjectId, ref bool shouldAdd) { if (string.IsNullOrEmpty(vDirObjectId)) { throw new ArgumentNullException("vDirObjectId"); } int num = vDirObjectId.LastIndexOf('/'); string forestFqdn; ADObjectId adobjectId; if (num == -1) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.AlgorithmTracer, null, "VDir header from Cafe server: {0} contains only vDirObjectId. Read data using local forest.", vDirObjectId); forestFqdn = string.Empty; adobjectId = this.ParseObjectGuid(vDirObjectId); } else { forestFqdn = vDirObjectId.Substring(num + 1); adobjectId = this.ParseObjectGuid(vDirObjectId.Substring(0, num)); } if (adobjectId == null) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.AlgorithmTracer, null, "ObjectGuid could not be parsed from vDir header: {0}", vDirObjectId.Substring(0, num)); shouldAdd = false; return(null); } ADMobileVirtualDirectory admobileVirtualDirectory = null; try { string suitableDomainController = this.GetSuitableDomainController(forestFqdn); if (!string.IsNullOrEmpty(suitableDomainController)) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(suitableDomainController, true, ConsistencyMode.IgnoreInvalid, null, ADSessionSettings.FromRootOrgScopeSet(), 108, "CreateOnCacheMiss", "f:\\15.00.1497\\sources\\dev\\AirSync\\src\\AirSync\\ADObjIdToVDirMap.cs"); admobileVirtualDirectory = topologyConfigurationSession.Read <ADMobileVirtualDirectory>(adobjectId); AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.AlgorithmTracer, null, "VDir object read from AD and cached: {0}", vDirObjectId); } else { AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.AlgorithmTracer, null, "Failure looking up vDir object {0}", vDirObjectId); } } catch (ADTransientException ex) { AirSyncDiagnostics.TraceError <string, string>(ExTraceGlobals.AlgorithmTracer, null, "ADTransientException looking up vDir object {0}: {1}", vDirObjectId, ex.Message); } if (admobileVirtualDirectory == null) { shouldAdd = false; } return(admobileVirtualDirectory); }
private IRecipientSession ReconstructRecipientSession(PartitionId partitionId, OrganizationId orgId) { ADSessionSettings sessionSettings = Datacenter.IsMultiTenancyEnabled() ? ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId) : ADSessionSettings.FromAccountPartitionRootOrgScopeSet(partitionId); return(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 307, "ReconstructRecipientSession", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\IsMemberOfProvider\\IsMemberOfResolver.cs")); }
private void StampModeratedTransportExpiry() { byte[] policyTag = null; string text = string.Empty; int retentionPeriod = 2; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(this.mbxTransportMailItem.OrganizationId), 361, "StampModeratedTransportExpiry", "f:\\15.00.1497\\sources\\dev\\MailboxTransport\\src\\MailboxTransportDelivery\\StoreDriver\\agents\\approval\\ApprovalEngine.cs"); ADObjectId descendantId = tenantOrTopologyConfigurationSession.GetOrgContainerId().GetDescendantId(ApprovalApplication.ParentPathInternal); ADObjectId childId = descendantId.GetChildId("ModeratedRecipients"); ApprovalEngine.diag.TraceDebug <ADObjectId>((long)this.GetHashCode(), "Reading ModeratedRecipient app from {0}", childId); if (childId != null) { ApprovalApplication approvalApplication = tenantOrTopologyConfigurationSession.Read <ApprovalApplication>(childId); if (approvalApplication != null) { ADObjectId elcretentionPolicyTag = approvalApplication.ELCRetentionPolicyTag; ApprovalEngine.diag.TraceDebug <ADObjectId>((long)this.GetHashCode(), "Read ModeratedRecipient, now reading Recipient Policy Tag {0}", elcretentionPolicyTag); RetentionPolicyTag retentionPolicyTag = null; if (elcretentionPolicyTag != null) { retentionPolicyTag = tenantOrTopologyConfigurationSession.Read <RetentionPolicyTag>(elcretentionPolicyTag); } else { IConfigurationSession configurationSession = SharedConfiguration.CreateScopedToSharedConfigADSession(this.mbxTransportMailItem.OrganizationId); if (configurationSession != null) { IList <RetentionPolicyTag> defaultRetentionPolicyTag = ApprovalUtils.GetDefaultRetentionPolicyTag(configurationSession, ApprovalApplicationId.ModeratedRecipient, 1); if (defaultRetentionPolicyTag != null && defaultRetentionPolicyTag.Count > 0) { retentionPolicyTag = defaultRetentionPolicyTag[0]; } } } if (retentionPolicyTag != null) { ADPagedReader <ElcContentSettings> elccontentSettings = retentionPolicyTag.GetELCContentSettings(); using (IEnumerator <ElcContentSettings> enumerator = elccontentSettings.GetEnumerator()) { if (enumerator.MoveNext()) { ElcContentSettings elcContentSettings = enumerator.Current; retentionPeriod = (int)elcContentSettings.AgeLimitForRetention.Value.TotalDays; } } policyTag = retentionPolicyTag.RetentionId.ToByteArray(); } } } }); if (!adoperationResult.Succeeded) { if (adoperationResult.Exception is TransientException) { throw adoperationResult.Exception; } text = adoperationResult.Exception.ToString(); ApprovalEngine.diag.TraceError <string>((long)this.GetHashCode(), "Can't get PolicyTag guid {0}, NDRing.", text); } if (policyTag == null) { ApprovalEngine.diag.TraceError((long)this.GetHashCode(), "PolicyTag not read. NDRing"); string text2 = this.mbxTransportMailItem.OrganizationId.ToString(); StoreDriverDeliveryDiagnostics.LogEvent(MailboxTransportEventLogConstants.Tuple_ApprovalCannotStampExpiry, text2, new object[] { text2, text }); throw new SmtpResponseException(AckReason.ApprovalCannotReadExpiryPolicy); } if (retentionPeriod < 2) { retentionPeriod = 2; } else if (retentionPeriod > 30) { retentionPeriod = 30; } this.messageItem[ItemSchema.RetentionDate] = ExDateTime.UtcNow.AddDays((double)retentionPeriod); this.messageItem[StoreObjectSchema.RetentionPeriod] = retentionPeriod; this.messageItem[StoreObjectSchema.PolicyTag] = policyTag; }
protected override IConfigDataProvider CreateSession() { return(DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 147, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageSecurity\\ExchangeCertificate\\ExportExchangeCertificate.cs")); }
private void ResolveServer() { if (this.serverObject != null) { return; } ITopologyConfigurationSession session = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 66, "ResolveServer", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\ResubmitRequest\\ResubmitRequestDataProvider.cs"); Server server = null; IEnumerable <Server> objects = this.serverIdentity.GetObjects <Server>(null, session); IEnumerator <Server> enumerator = objects.GetEnumerator(); try { if (!enumerator.MoveNext()) { throw new LocalizedException(Strings.ErrorServerNotFound(this.serverIdentity)); } server = enumerator.Current; if (enumerator.MoveNext()) { throw new LocalizedException(Strings.ErrorServerNotUnique(this.serverIdentity)); } } finally { enumerator.Dispose(); } this.serverObject = server; }
protected override void InternalValidate() { base.InternalValidate(); if (base.HasErrors) { return; } GetExchangeCertificate.PrepareParameters(this); this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server))); if (!this.serverObject.IsE14OrLater) { base.WriteError(new ArgumentException(Strings.RemoteCertificateExchangeVersionNotSupported(this.serverObject.Name)), ErrorCategory.InvalidArgument, null); } base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 189, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageSecurity\\ExchangeCertificate\\ExportExchangeCertificate.cs"), this.serverObject, false, new DataAccessTask <Server> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope)); if (string.IsNullOrEmpty(this.Thumbprint)) { base.WriteError(new ArgumentException(Strings.ExceptionEmptyStringNotAllowed, "Thumbprint"), ErrorCategory.InvalidArgument, null); } this.Thumbprint = ManageExchangeCertificate.UnifyThumbprintFormat(this.Thumbprint); if (!string.IsNullOrEmpty(this.FileName) && (File.Exists(this.FileName) || File.Exists(this.FileName + ".pfx"))) { base.WriteError(new ArgumentException(Strings.CertificateInvalidFileName(this.serverObject.Name), "FileName"), ErrorCategory.InvalidArgument, null); } }
// Token: 0x06000675 RID: 1653 RVA: 0x00017E78 File Offset: 0x00016078 bool IWritableAD.SetDatabaseLegacyDnAndOwningServer(Guid mdbGuid, AmServerName lastMountedServerName, AmServerName masterServerName, bool isForceUpdate) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 43, "SetDatabaseLegacyDnAndOwningServer", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Shared\\WritableADHelper.cs"); Database database = topologyConfigurationSession.FindDatabaseByGuid <Database>(mdbGuid); if (database == null) { AmTrace.Error("Failed to find Db using dbGuid {0}", new object[] { mdbGuid }); return(false); } MiniServer miniServer = topologyConfigurationSession.FindMiniServerByName(masterServerName.NetbiosName, WritableADHelper.s_propertiesNeededFromServer); if (miniServer == null) { AmTrace.Error("Failed to find Server using {0}", new object[] { masterServerName }); return(false); } if (isForceUpdate || !database.Server.Equals(miniServer.Id)) { MiniServer sourceServer = null; if (!AmServerName.IsNullOrEmpty(lastMountedServerName)) { sourceServer = topologyConfigurationSession.FindMiniServerByName(lastMountedServerName.NetbiosName, WritableADHelper.s_propertiesNeededFromServer); } AmTrace.Debug("SetDatabaseLegacyDnAndOwningServer. Database '{0}', legdn='{1}'. Setting owning server: '{2}'.", new object[] { database.Name, database.ExchangeLegacyDN, miniServer.Id }); database.Server = miniServer.Id; WritableADHelper.SaveDatabasePropertiesOnMultipleServerSites(topologyConfigurationSession, database, sourceServer, miniServer, true); return(true); } AmTrace.Debug("Skipped to update legacy dn and owning server for database '{0}' since they are up to date. (owningserver={1})", new object[] { database.Name, database.Server }); return(false); }
public SeederInstanceContainer(RpcSeederArgs rpcArgs, ConfigurationArgs configArgs) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 66, ".ctor", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\seeder\\seederinstancecontainer.cs"); Database database = null; Exception ex = null; try { database = topologyConfigurationSession.FindDatabaseByGuid <Database>(configArgs.IdentityGuid); } catch (ADTransientException ex2) { ex = ex2; } catch (ADExternalException ex3) { ex = ex3; } catch (ADOperationException ex4) { ex = ex4; } if (ex != null) { throw new SeedPrepareException(ReplayStrings.CouldNotFindDatabase(configArgs.IdentityGuid.ToString(), ex.ToString()), ex); } this.m_seederArgs = rpcArgs; this.m_configArgs = configArgs; this.m_seedDatabase = rpcArgs.SeedDatabase; this.m_seedCiFiles = (rpcArgs.SeedCiFiles && !database.IsPublicFolderDatabase); if (this.m_seedDatabase) { if (this.m_seedCiFiles) { this.m_databaseSeeder = new DatabaseSeederInstance(rpcArgs, configArgs, new SeedCompletionCallback(this.LaunchCiFileSeeder), null); } else { this.m_databaseSeeder = new DatabaseSeederInstance(rpcArgs, configArgs, null, null); } } if (this.m_seedCiFiles) { this.m_ciFilesSeeder = new CiFilesSeederInstance(rpcArgs, configArgs); } }
protected override bool InternalTryValidate(ADRawEntry adObject, out RuleValidationException validationException) { validationException = null; OrganizationValidationRuleDefinition organizationValidationRuleDefinition = base.RuleDefinition as OrganizationValidationRuleDefinition; if (!Datacenter.IsMultiTenancyEnabled()) { ExTraceGlobals.AccessCheckTracer.TraceDebug <string, bool>((long)this.GetHashCode(), "OrganizationValidationRule.InternalTryValidate('{0}') return '{1}'. - not datacenter mode.", adObject.GetDistinguishedNameOrName(), true); return(true); } OrganizationId organizationId = (OrganizationId)adObject[ADObjectSchema.OrganizationId]; ADSessionSettings sessionSettings = OrganizationId.ForestWideOrgId.Equals(organizationId) ? ADSessionSettings.FromRootOrgScopeSet() : ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(organizationId); IConfigurationSession session = DirectorySessionFactory.Default.CreateTenantConfigurationSession(adObject.OriginatingServer, true, ConsistencyMode.IgnoreInvalid, sessionSettings, 377, "InternalTryValidate", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ValidationRules\\ValidationRule.cs"); ExchangeConfigurationUnit exchangeConfigurationUnit = ProvisioningCache.Instance.TryAddAndGetOrganizationData <ExchangeConfigurationUnit>(CannedProvisioningCacheKeys.OrganizationCUContainer, organizationId, () => session.Read <ExchangeConfigurationUnit>(organizationId.ConfigurationUnit)); if (exchangeConfigurationUnit == null) { ExTraceGlobals.AccessCheckTracer.TraceDebug <string, bool>((long)this.GetHashCode(), "OrganizationValidationRule.InternalTryValidate('{0}') return '{1}'. - organization (ExchangeConfigurationUnit) object is not found.", adObject.GetDistinguishedNameOrName(), true); return(true); } foreach (ValidationRuleExpression validationRuleExpression in organizationValidationRuleDefinition.OverridingAllowExpressions) { bool flag = true; foreach (PropertyDefinition propertyDefinition in validationRuleExpression.QueryFilter.FilterProperties()) { if (!exchangeConfigurationUnit.propertyBag.Contains((ProviderPropertyDefinition)propertyDefinition)) { ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string>((long)this.GetHashCode(), "ExpressionFilterValidationRule.InternalTryValidate({0}). Missing Property {1}.", exchangeConfigurationUnit.GetDistinguishedNameOrName(), propertyDefinition.Name); flag = false; break; } } if (flag && OpathFilterEvaluator.FilterMatches(validationRuleExpression.QueryFilter, exchangeConfigurationUnit)) { ExTraceGlobals.AccessCheckTracer.TraceDebug <string, bool, string>((long)this.GetHashCode(), "OrganizationValidationRule.InternalTryValidate('{0}') return '{1}'. - matched filter: {2}.", adObject.GetDistinguishedNameOrName(), true, validationRuleExpression.QueryString); return(true); } } foreach (ValidationRuleExpression validationRuleExpression2 in organizationValidationRuleDefinition.RestrictionExpressions) { bool flag2 = true; foreach (PropertyDefinition propertyDefinition2 in validationRuleExpression2.QueryFilter.FilterProperties()) { if (!exchangeConfigurationUnit.propertyBag.Contains((ProviderPropertyDefinition)propertyDefinition2)) { ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string>((long)this.GetHashCode(), "ExpressionFilterValidationRule.InternalTryValidate({0}). Missing Property {1}.", exchangeConfigurationUnit.GetDistinguishedNameOrName(), propertyDefinition2.Name); flag2 = false; break; } } if (flag2 && OpathFilterEvaluator.FilterMatches(validationRuleExpression2.QueryFilter, exchangeConfigurationUnit)) { validationException = new RuleValidationException(base.GetValidationRuleErrorMessage(adObject, validationRuleExpression2.QueryString)); return(false); } } return(true); }
protected override void InternalProcessRecord() { base.InternalProcessRecord(); ADComputer adcomputer = null; ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 213, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\ComponentStates\\SetServerComponentState.cs"); string fqdn = this.serverId.Fqdn; string text = fqdn; int num = fqdn.IndexOf('.'); if (num > 0) { text = fqdn.Substring(0, num); } Server server = topologyConfigurationSession.FindServerByName(text); if (server == null) { topologyConfigurationSession.UseConfigNC = false; topologyConfigurationSession.UseGlobalCatalog = true; adcomputer = topologyConfigurationSession.FindComputerByHostName(text); if (adcomputer == null) { base.WriteError(new ADServerNotFoundException(fqdn), ErrorCategory.InvalidArgument, null); } } if (!this.LocalOnly) { if (server != null) { server.ComponentStates = ServerComponentStates.UpdateRemoteState(server.ComponentStates, this.Requester, this.Component, this.State); topologyConfigurationSession.Save(server); } else { adcomputer.ComponentStates = ServerComponentStates.UpdateRemoteState(adcomputer.ComponentStates, this.Requester, this.Component, this.State); topologyConfigurationSession.Save(adcomputer); } } if (!this.RemoteOnly) { string serverFqdn = (server != null) ? server.Fqdn : adcomputer.DnsHostName; TimeSpan invokeTimeout = TimeSpan.FromSeconds((double)this.TimeoutInSeconds); Exception ex = null; try { InvokeWithTimeout.Invoke(delegate() { ServerComponentStates.UpdateLocalState(serverFqdn, this.Requester, this.Component, this.State); }, null, invokeTimeout, true, null); } catch (IOException ex2) { ex = ex2; } catch (UnauthorizedAccessException ex3) { ex = ex3; } catch (SecurityException ex4) { ex = ex4; } if (ex != null && this.LocalOnly) { base.WriteError(new ArgumentException(Strings.SetServerComponentStateServerUnreachable(serverFqdn, ex.Message)), ErrorCategory.ResourceUnavailable, null); } } }
private static ExchangeRole GetRootRoleForRoleType(RoleType roleType) { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 185, "GetRootRoleForRoleType", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\rbac\\PartnerApplicationRunspaceConfiguration.cs"); ExchangeRole[] array = tenantOrTopologyConfigurationSession.Find <ExchangeRole>(null, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleSchema.RoleType, roleType), null, ADGenericPagedReader <ExchangeRole> .DefaultPageSize); ExchangeRole[] array2 = Array.FindAll <ExchangeRole>(array, (ExchangeRole r) => r.IsRootRole); if (array2.Length == 0) { return(null); } if (array2.Length == 1) { return(array2[0]); } throw new DataSourceOperationException(Strings.ErrorFoundMultipleRootRole(roleType.ToString())); }
protected override IConfigDataProvider CreateSession() { return(DirectorySessionFactory.Default.CreateTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 72, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\ContentIndex\\SetSearchDocumentFormat.cs")); }
protected override ExchangeConfigurationUnit CreateOnCacheMiss(OrganizationId orgId, ref bool shouldAdd) { shouldAdd = false; if (orgId == OrganizationId.ForestWideOrgId) { return(null); } ExchangeConfigurationUnit org = null; ADNotificationAdapter.TryRunADOperation(delegate() { ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId), 135, "CreateOnCacheMiss", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationSettings\\OrganizationSettingsContext.cs"); org = tenantConfigurationSession.Read <ExchangeConfigurationUnit>(orgId.ConfigurationUnit); }); shouldAdd = true; return(org); }
// Token: 0x0600084C RID: 2124 RVA: 0x0001B327 File Offset: 0x00019527 protected virtual IConfigurationSession GetConfigSession(ADSessionSettings settings) { return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.FullyConsistent, settings, 101, "GetConfigSession", "f:\\15.00.1497\\sources\\dev\\clients\\src\\Owa2\\Server\\Core\\configuration\\MobileDevicePolicyCache.cs")); }
private static Uri GetEndpoint(string serviceEndpointId) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 129, "GetEndpoint", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\FederationProvisioning\\LiveConfiguration.cs"); ServiceEndpointContainer endpointContainer = topologyConfigurationSession.GetEndpointContainer(); ServiceEndpoint endpoint = endpointContainer.GetEndpoint(serviceEndpointId); return(new Uri(endpoint.Uri.AbsoluteUri, UriKind.Absolute)); }
// Token: 0x0600005D RID: 93 RVA: 0x00002D98 File Offset: 0x00000F98 public ADRecipient GetOnPremUser(SmtpAddress emailAddress) { IRecipientSession recipientSession = DirectorySessionFactory.Default.CreateRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 49, "GetOnPremUser", "f:\\15.00.1497\\sources\\dev\\autodisc\\src\\AutoDiscoverV2\\TenantRepository.cs"); this.logger.AppendGenericInfo("GetOnPremUser", "Start Ad lookup"); return(recipientSession.FindByProxyAddress(new SmtpProxyAddress(emailAddress.Address, false))); }