Example #1
0
 private bool RegisterChangeNotification(IConfigurationSession session, CacheNotificationHandler cacheNotificationHandler, bool throwExceptions)
 {
     if (!OrganizationId.ForestWideOrgId.Equals(this.organizationId))
     {
         return(true);
     }
     try
     {
         this.notificationCookie = ADNotificationAdapter.RegisterChangeNotification <TConfig>(this.organizationId.ConfigurationUnit ?? session.GetOrgContainerId(), new ADNotificationCallback(TenantConfigurationCacheableItem <TConfig> .HandleChangeNotification), new CacheNotificationArgs(cacheNotificationHandler, this.organizationId));
     }
     catch (TransientException)
     {
         if (!throwExceptions)
         {
             return(false);
         }
         throw;
     }
     catch (DataSourceOperationException)
     {
         if (!throwExceptions)
         {
             return(false);
         }
         throw;
     }
     return(true);
 }
Example #2
0
 private static void SubscribeForNotifications()
 {
     if (LocalServerCache.notification == null && LocalServerCache.localServer != null)
     {
         LocalServerCache.notification = ADNotificationAdapter.RegisterChangeNotification <Server>(LocalServerCache.localServer.Id, new ADNotificationCallback(LocalServerCache.NotificationHandler));
     }
 }
 // Token: 0x0600002B RID: 43 RVA: 0x000035DC File Offset: 0x000017DC
 internal override void OnStart()
 {
     lock (ModeratedDLApplication.SyncRoot)
     {
         if (ModeratedDLApplication.refCount == 0)
         {
             MessageTrackingLog.Start("MSGTRKMA");
             Server server = null;
             ADNotificationAdapter.TryRunADOperation(delegate()
             {
                 ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 144, "OnStart", "f:\\15.00.1497\\sources\\dev\\Approval\\src\\Applications\\ModeratedDLApplication\\ModeratedDLApplication.cs");
                 this.serverConfigNotificationCookie = ADNotificationAdapter.RegisterChangeNotification <Server>(topologyConfigurationSession.GetOrgContainerId(), new ADNotificationCallback(ModeratedDLApplication.ServerChangeCallback));
                 server = topologyConfigurationSession.ReadLocalServer();
                 Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain acceptedDomain = topologyConfigurationSession.GetDefaultAcceptedDomain();
                 if (acceptedDomain != null && acceptedDomain.DomainName.SmtpDomain != null)
                 {
                     this.defaultAcceptedDomain = acceptedDomain.DomainName.SmtpDomain.Domain;
                 }
             });
             if (server == null)
             {
                 ModeratedDLApplication.diag.TraceError((long)this.GetHashCode(), "Cannot read local server for message tracking");
             }
             MessageTrackingLog.Configure(server);
         }
         ModeratedDLApplication.refCount++;
     }
     base.OnStart();
 }
Example #4
0
 private static void RegisterChangeNotification(ADObjectId adObjectId)
 {
     if (HelpProvider.notificationRequestCookie == null)
     {
         ADNotificationCallback callback = new ADNotificationCallback(HelpProvider.OnExchangeAssiatnceConfigChanged);
         HelpProvider.notificationRequestCookie = ADNotificationAdapter.RegisterChangeNotification <ExchangeAssistance>(adObjectId, callback);
         AppDomain.CurrentDomain.DomainUnload  += HelpProvider.CurrentDomain_DomainUnload;
     }
 }
Example #5
0
        public ADNotificationRequestCookie RegisterForJournalRuleNotifications(ADObjectId baseDN, ADNotificationCallback callback)
        {
            ADNotificationRequestCookie result = ADNotificationAdapter.RegisterChangeNotification <TransportRule>(baseDN, callback);

            if (this.NeedExplicitDeletedObjectSubscription)
            {
                this.VerifyRootWasRegistered <TransportRule>();
            }
            return(result);
        }
Example #6
0
        public ADNotificationRequestCookie RegisterForRemoteDomainNotifications(ADObjectId baseDN, ADNotificationCallback callback)
        {
            ADNotificationRequestCookie result = ADNotificationAdapter.RegisterChangeNotification <DomainContentConfig>(baseDN, callback);

            if (this.NeedExplicitDeletedObjectSubscription)
            {
                this.VerifyRootWasRegistered <DomainContentConfig>();
            }
            return(result);
        }
Example #7
0
        public ADNotificationRequestCookie RegisterForLocalServerReceiveConnectorNotifications(ADObjectId baseDN, ADNotificationCallback callback)
        {
            ADNotificationRequestCookie result = ADNotificationAdapter.RegisterChangeNotification <ReceiveConnector>(baseDN, callback);

            if (this.NeedExplicitDeletedObjectSubscription)
            {
                this.VerifyRootWasRegistered <ReceiveConnector>();
            }
            return(result);
        }
Example #8
0
        public ADNotificationRequestCookie RegisterForMailGatewayNotifications(ADObjectId rootId, ADNotificationCallback callback)
        {
            ADNotificationRequestCookie result = ADNotificationAdapter.RegisterChangeNotification <MailGateway>(rootId, callback);

            if (this.NeedExplicitDeletedObjectSubscription)
            {
                this.VerifyRootWasRegistered <SmtpSendConnectorConfig>();
                this.VerifyRootWasRegistered <DeliveryAgentConnector>();
                this.VerifyRootWasRegistered <ForeignConnector>();
            }
            return(result);
        }
Example #9
0
 private static void ExchangeRpcClientAccessChangeNotification(ADNotificationEventArgs args)
 {
     Configuration.GeneralTracer.TraceDebug(0L, "ExchangeRpcClientAccessChangeNotification called");
     ADNotificationAdapter.TryRunADOperation(delegate()
     {
         ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 280, "ExchangeRpcClientAccessChangeNotification", "f:\\15.00.1497\\sources\\dev\\DoMT\\src\\Service\\Configuration.cs");
         topologyConfigurationSession.ServerTimeout = Configuration.ADTimeout;
         Server server = topologyConfigurationSession.ReadLocalServer();
         if (server == null)
         {
             Configuration.GeneralTracer.TraceError(0L, "Failed to find local server in AD");
             Configuration.eventLog.LogEvent(AddressBookEventLogConstants.Tuple_FailedToFindLocalServerInAD, string.Empty, new object[0]);
             if (args == null)
             {
                 Configuration.ServiceEnabled = false;
                 return;
             }
             Configuration.stopService();
             return;
         }
         else
         {
             ExchangeRpcClientAccess exchangeRpcClientAccess = topologyConfigurationSession.Read <ExchangeRpcClientAccess>(ExchangeRpcClientAccess.FromServerId(server.Id));
             if (exchangeRpcClientAccess != null)
             {
                 if (Configuration.exchangeRCANotificationCookie == null)
                 {
                     Configuration.exchangeRCANotificationCookie = ADNotificationAdapter.RegisterChangeNotification <ExchangeRpcClientAccess>(exchangeRpcClientAccess.Id, new ADNotificationCallback(Configuration.ExchangeRpcClientAccessChangeNotification));
                 }
                 if (Configuration.EncryptionRequired != exchangeRpcClientAccess.EncryptionRequired)
                 {
                     Configuration.GeneralTracer.TraceDebug <bool, bool>(0L, "Changing EncryptionRequired from {0} to {1}", Configuration.EncryptionRequired, exchangeRpcClientAccess.EncryptionRequired);
                     Configuration.EncryptionRequired = exchangeRpcClientAccess.EncryptionRequired;
                 }
                 return;
             }
             Configuration.GeneralTracer.TraceDebug(0L, "ExchangeRpcClientAccess disabled");
             Configuration.eventLog.LogEvent(AddressBookEventLogConstants.Tuple_ExchangeRpcClientAccessDisabled, string.Empty, new object[0]);
             if (args == null)
             {
                 Configuration.ServiceEnabled = false;
                 return;
             }
             Configuration.stopService();
             return;
         }
     });
 }
Example #10
0
        protected override ADNotificationRequestCookie Register(IConfigurationSession session)
        {
            ADNotificationRequestCookie request = ADNotificationAdapter.RegisterChangeNotification <PolicyTipMessageConfig>(PerTenantPolicyNudgeRulesCollection.GetPolicyTipMessageConfigsContainerId(session), new ADNotificationCallback(base.ChangeCallback), session);
            ADNotificationRequestCookie result;

            try
            {
                result = ADNotificationAdapter.RegisterChangeNotification <TransportRule>(PerTenantPolicyNudgeRulesCollection.GetPolicyNudgeRuleContainerId(session), new ADNotificationCallback(base.ChangeCallback), session);
            }
            catch (Exception ex)
            {
                ADNotificationAdapter.UnregisterChangeNotification(request);
                throw ex;
            }
            return(result);
        }
        private static void SubscribeForNotifications()
        {
            if (FederationTrustCache.notification != null)
            {
                return;
            }
            FederationTrustCache.Tracer.TraceDebug(0L, "FederationTrustCache: getting federation trust container in AD.");
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 260, "SubscribeForNotifications", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\FederationTrustCache.cs");
            ADObjectId            orgContainerId = tenantOrTopologyConfigurationSession.GetOrgContainerId();
            ADObjectId            childId        = orgContainerId.GetChildId("Federation Trusts");

            FederationTrustCache.Tracer.TraceDebug <ADObjectId>(0L, "FederationTrustCache: found federation trust configuration object in AD. {0}", childId);
            FederationTrustCache.Tracer.TraceDebug(0L, "FederationTrustCache: registering for configuration changes in AD");
            FederationTrustCache.notification = ADNotificationAdapter.RegisterChangeNotification <FederationTrust>(childId, new ADNotificationCallback(FederationTrustCache.NotificationHandler));
            FederationTrustCache.Tracer.TraceDebug(0L, "FederationTrustCache: successfully registered for federation trust configuration changes in AD");
        }
Example #12
0
        // Token: 0x06000D80 RID: 3456 RVA: 0x00059EE8 File Offset: 0x000580E8
        private void RegisterConfigurationChangeNotification()
        {
            ADNotificationCallback callback = new ADNotificationCallback(OwaConfigurationManager.ConfigurationUpdate);

            try
            {
                this.owaCookie = ADNotificationAdapter.RegisterChangeNotification <ADOwaVirtualDirectory>(OwaConfigurationManager.virtualDirectoryDN ?? OwaConfigurationManager.session.GetOrgContainerId(), callback, null);
                if (this.configuration.IsPublicFoldersEnabledOnThisVdir && !VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.PublicFolderTreePerTenanant.Enabled)
                {
                    this.publicFolderTreeCookie     = ADNotificationAdapter.RegisterChangeNotification <PublicFolderTree>(OwaConfigurationManager.session.GetOrgContainerId(), callback, null);
                    this.publicFolderDatabaseCookie = ADNotificationAdapter.RegisterChangeNotification <PublicFolderDatabase>(OwaConfigurationManager.session.GetOrgContainerId(), callback, null);
                }
            }
            catch (Exception ex)
            {
                OwaConfigurationManager.instance.LogConfigurationException(ClientsEventLogConstants.Tuple_ADNotificationsRegistration, "Unable to register a change notification listener for AD Owa Virtual Directory. {0}", ex.Message);
                throw;
            }
        }
        // Token: 0x06000003 RID: 3 RVA: 0x0000227C File Offset: 0x0000047C
        private ADNotificationRequestCookie InstallConfigMonitor <T>(string containerName) where T : ADConfigurationObject, new()
        {
            ADNotificationRequestCookie notificationCookie = null;
            ADOperationResult           adoperationResult  = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                ADObjectId childId = this.session.GetOrgContainerId().GetChildId(containerName);
                notificationCookie = ADNotificationAdapter.RegisterChangeNotification <T>(childId, new ADNotificationCallback(this.ChangeNotificationDispatch));
            }, 3);

            if (!adoperationResult.Succeeded)
            {
                Servicelet.Tracer.TraceError <Exception>((long)this.GetHashCode(), "Notification Registration Failed: {0}", adoperationResult.Exception);
                this.eventLogger.LogEvent(MSExchangeCertificateDeploymentEventLogConstants.Tuple_NotificationException, null, new object[]
                {
                    adoperationResult.Exception
                });
            }
            return(notificationCookie);
        }
Example #14
0
        public static void Start()
        {
            Server localServer = null;

            RmsClientManagerLog.rmsLogSchema = new LogSchema("Microsoft Exchange Server", Assembly.GetExecutingAssembly().GetName().Version.ToString(), "Rms Client Manager Log", RmsClientManagerLog.Fields);
            RmsClientManagerLog.rmsLog       = new Log(RmsClientManagerUtils.GetUniqueFileNameForProcess(RmsClientManagerLog.LogSuffix, true), new LogHeaderFormatter(RmsClientManagerLog.rmsLogSchema), "RmsClientManagerLog");
            ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 254, "Start", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\rightsmanagement\\RmsClientManagerLog.cs");
                localServer = topologyConfigurationSession.FindLocalServer();
                RmsClientManagerLog.notificationCookie = ADNotificationAdapter.RegisterChangeNotification <Server>(localServer.Id, new ADNotificationCallback(RmsClientManagerLog.HandleConfigurationChange));
            });

            if (!adoperationResult.Succeeded)
            {
                RmsClientManagerLog.Tracer.TraceError <Exception>(0L, "Failed to get the local server.  Unable to load the log configuration. Error {0}", adoperationResult.Exception);
                throw new ExchangeConfigurationException(ServerStrings.FailedToReadConfiguration, adoperationResult.Exception);
            }
            RmsClientManagerLog.Configure(localServer);
        }
 private void TryRegisterForADNotifications()
 {
     if (this.adNotificationCookie == null)
     {
         lock (this.notificationLock)
         {
             if (this.adNotificationCookie == null && !this.hasUnregisteredNotification)
             {
                 ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
                 {
                     this.adNotificationCookie = ADNotificationAdapter.RegisterChangeNotification <ADConfigType>(null, new ADNotificationCallback(this.ServerChangeCallback));
                 }, 2);
                 if (!adoperationResult.Succeeded)
                 {
                     this.LogFailure(ADConfigurationLoader <ADConfigType, StateType> .FailureLocation.ADNotificationRegistration, adoperationResult.Exception);
                     this.UpdateTimer(this.failureRetryInterval);
                 }
             }
         }
     }
 }
Example #16
0
 private RoutingTypeBuilder(ITopologyConfigurationSession configSession, OrganizationCache cache) : base(configSession.GetRoutingGroupId(), configSession, cache)
 {
     ADNotificationAdapter.RegisterChangeNotification <MailGateway>(base.ConfigSession.GetOrgContainerId(), new ADNotificationCallback(base.OnChange), null);
 }
 protected override ADNotificationRequestCookie Register(IConfigurationSession session)
 {
     return(ADNotificationAdapter.RegisterChangeNotification <DomainContentConfig>(this.organizationId.ConfigurationUnit ?? session.GetOrgContainerId(), new ADNotificationCallback(base.ChangeCallback), session));
 }
Example #18
0
 public ADNotificationRequestCookie RegisterForADSiteNotifications(ADObjectId baseDN, ADNotificationCallback callback)
 {
     return(ADNotificationAdapter.RegisterChangeNotification <ADSite>(baseDN, callback));
 }
 private OptionsDataBuilder(ITopologyConfigurationSession configSession, OrganizationCache cache) : base(new ADObjectId("CN=Addressing," + configSession.GetOrgContainerId().ToDNString()), configSession, cache)
 {
     ADNotificationAdapter.RegisterChangeNotification <AddressTemplate>(base.ConfigSession.GetOrgContainerId(), new ADNotificationCallback(base.OnChange), null);
 }
Example #20
0
 public static ADNotificationRequestCookie RegisterForNonDeletedNotifications <TConfig>(ADObjectId baseDN, ADNotificationCallback callback) where TConfig : ADConfigurationObject, new()
 {
     return(ADNotificationAdapter.RegisterChangeNotification <TConfig>(baseDN, callback));
 }
 protected override ADNotificationRequestCookie Register(IConfigurationSession session)
 {
     return(ADNotificationAdapter.RegisterChangeNotification <TransportRule>(PerTenantProtectionRulesCollection.GetProtectionRuleContainerId(session), new ADNotificationCallback(base.ChangeCallback), session));
 }