private bool IsVersionSatisfiedImpl()
        {
            if (RegistryTestHook.SafetyNetVersionCheckerOverride == SafetyNetVersionCheckerOverrideEnum.DumpsterSchema)
            {
                SafetyNetVersionChecker.Tracer.TraceDebug((long)this.GetHashCode(), "SafetyNetVersionChecker.IsVersionSatisfiedImpl(): TestHook specified to force using older Dumpster request schema. Returning 'false'.");
                return(false);
            }
            if (RegistryTestHook.SafetyNetVersionCheckerOverride == SafetyNetVersionCheckerOverrideEnum.SafetyNetSchema)
            {
                SafetyNetVersionChecker.Tracer.TraceDebug((long)this.GetHashCode(), "SafetyNetVersionChecker.IsVersionSatisfiedImpl(): TestHook specified to force using newer SafetyNet request schema. Returning 'true'.");
                return(true);
            }
            IMonitoringADConfig config = Dependencies.MonitoringADConfigProvider.GetConfig(true);

            foreach (IADServer iadserver in config.Servers)
            {
                if (ServerVersion.Compare(iadserver.AdminDisplayVersion, SafetyNetVersionChecker.SafetyNetRedeliverySchemaSupportVersion) < 0)
                {
                    SafetyNetVersionChecker.Tracer.TraceDebug <string, ServerVersion, ServerVersion>((long)this.GetHashCode(), "SafetyNetVersionChecker.IsVersionSatisfiedImpl(): Server '{0}' does *NOT* meet minimum SafetyNetRedeliverySchemaSupportVersion of '{1}'. Actual: {2}", iadserver.Name, SafetyNetVersionChecker.SafetyNetRedeliverySchemaSupportVersion, iadserver.AdminDisplayVersion);
                    return(false);
                }
            }
            SafetyNetVersionChecker.Tracer.TraceDebug((long)this.GetHashCode(), "SafetyNetVersionChecker.IsVersionSatisfiedImpl(): All servers in local DAG meet minimum SafetyNetRedeliverySchemaSupportVersion.");
            return(true);
        }
Example #2
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     base.InternalProcessRecord();
     if (!base.HasErrors && base.InternalIsSharedConfigServicePlan && this.tenantCU.SupportedSharedConfigurations.Count != 0)
     {
         IConfigurationSession configurationSession = base.CreateTenantSession(this.tenantCU.OrganizationId, false, ConsistencyMode.PartiallyConsistent);
         this.tenantCU = configurationSession.Read <ExchangeConfigurationUnit>(this.tenantCU.Id);
         ITenantConfigurationSession          tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsObjectId(this.tenantCU.Id), 134, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\CompleteOrganizationUpgradeTask.cs");
         Result <ExchangeConfigurationUnit>[] array = tenantConfigurationSession.ReadMultiple <ExchangeConfigurationUnit>(this.tenantCU.SupportedSharedConfigurations.ToArray());
         ServerVersion serverVersion = new ServerVersion(ServerVersion.InstalledVersion.Major, ServerVersion.InstalledVersion.Minor, ServerVersion.InstalledVersion.Build, 0);
         bool          flag          = false;
         foreach (Result <ExchangeConfigurationUnit> result in array)
         {
             if (result.Data != null)
             {
                 ExchangeConfigurationUnit data           = result.Data;
                 ServerVersion             serverVersion2 = new ServerVersion(data.SharedConfigurationInfo.CurrentVersion.Major, data.SharedConfigurationInfo.CurrentVersion.Minor, data.SharedConfigurationInfo.CurrentVersion.Build, 0);
                 if (serverVersion2.Major < serverVersion.Major || (ServerVersion.Compare(serverVersion2, serverVersion) < 0 && this.tenantCU.SupportedSharedConfigurations.Count > 1 && !this.TryGetServerForRoleAndVersion(ServerRole.Mailbox, serverVersion2)))
                 {
                     this.tenantCU.SupportedSharedConfigurations.Remove(data.Id);
                     flag = true;
                 }
             }
         }
         if (flag)
         {
             configurationSession.Save(this.tenantCU);
         }
     }
     TaskLogger.LogExit();
 }
        // Token: 0x0600116F RID: 4463 RVA: 0x00053EF0 File Offset: 0x000520F0
        internal static int CompareBySharedConfigurationInfo(ExchangeConfigurationUnit x, ExchangeConfigurationUnit y)
        {
            int result;

            if (x == null)
            {
                if (y == null)
                {
                    result = 0;
                }
                else
                {
                    result = -1;
                }
            }
            else if (y == null)
            {
                result = 1;
            }
            else
            {
                result = ServerVersion.Compare(x.SharedConfigurationInfo.CurrentVersion, y.SharedConfigurationInfo.CurrentVersion);
            }
            return(result);
        }
Example #4
0
        // Token: 0x060019CF RID: 6607 RVA: 0x0006C278 File Offset: 0x0006A478
        private bool DoesSourceSupportExtensibleSeedingRequests()
        {
            AmServerName serverName = new AmServerName(this.sourceServerFqdn);
            Exception    ex;
            IADServer    miniServer = AmBestCopySelectionHelper.GetMiniServer(serverName, out ex);

            return(miniServer != null && ServerVersion.Compare(miniServer.AdminDisplayVersion, CiFileSeederProvider.FirstVersionSupportingExtensibleSeedingRequests) >= 0);
        }
Example #5
0
        private bool CheckServerVersion(CalendarValidationContext context, Inconsistency inconsistency)
        {
            ServerVersion serverVersion = new ServerVersion(context.RemoteUser.ExchangePrincipal.MailboxInfo.Location.ServerVersion);

            if (serverVersion.Major <= 8)
            {
                return(false);
            }
            if (inconsistency.Flag == CalendarInconsistencyFlag.OrphanedMeeting)
            {
                return(ServerVersion.Compare(serverVersion, this.supportsMeetingInquiryAfter) > 0);
            }
            return(ServerVersion.Compare(serverVersion, this.supportsRumsAfter) > 0);
        }
Example #6
0
        public static void GetListPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            dataTable.BeginLoadData();
            ServerVersion b         = (inputRow["MaxMajorVersion"] is DBNull || string.IsNullOrEmpty((string)inputRow["MaxMajorVersion"])) ? new ServerVersion(int.MaxValue, 0, 0, 0) : new ServerVersion(int.Parse((string)inputRow["MaxMajorVersion"]), int.MaxValue, 0, 0);
            ServerVersion b2        = (inputRow["MinMajorVersion"] is DBNull || string.IsNullOrEmpty((string)inputRow["MinMajorVersion"])) ? new ServerVersion(0, 0, 0, 0) : new ServerVersion(int.Parse((string)inputRow["MinMajorVersion"]), 0, 0, 0);
            ArrayList     arrayList = new ArrayList();

            if (!DDIHelper.IsEmptyValue(inputRow["ServerRole"]))
            {
                string   text  = (string)inputRow["ServerRole"];
                string[] array = text.Split(new char[]
                {
                    ','
                }, StringSplitOptions.RemoveEmptyEntries);
                if (array != null && array.Length > 0)
                {
                    foreach (string value in array)
                    {
                        ServerRole serverRole;
                        if (Enum.TryParse <ServerRole>(value, out serverRole))
                        {
                            arrayList.Add(serverRole);
                        }
                    }
                }
            }
            List <DataRow> list = new List <DataRow>(dataTable.Rows.Count);

            foreach (object obj in dataTable.Rows)
            {
                DataRow dataRow = (DataRow)obj;
                if (!ServerProperties.ServerHasRole(arrayList, (ServerRole)dataRow["ServerRole"]))
                {
                    list.Add(dataRow);
                }
                else
                {
                    ServerVersion a = (ServerVersion)dataRow["AdminDisplayVersion"];
                    if (ServerVersion.Compare(a, b) > 0 || ServerVersion.Compare(a, b2) < 0)
                    {
                        list.Add(dataRow);
                    }
                }
            }
            foreach (DataRow row in list)
            {
                dataTable.Rows.Remove(row);
            }
            dataTable.EndLoadData();
        }
Example #7
0
        private ADWebServicesVirtualDirectory[] GetVdirsToEnable()
        {
            ServerVersion b = new ServerVersion(14, 0, 100, 0);
            List <ADWebServicesVirtualDirectory>        list = new List <ADWebServicesVirtualDirectory>(1);
            IEnumerable <ADWebServicesVirtualDirectory> webServicesVirtualDirectory = base.OnPremisesSession.GetWebServicesVirtualDirectory(null);

            foreach (ADWebServicesVirtualDirectory adwebServicesVirtualDirectory in webServicesVirtualDirectory)
            {
                if (ServerVersion.Compare(adwebServicesVirtualDirectory.AdminDisplayVersion, b) >= 0 && !adwebServicesVirtualDirectory.MRSProxyEnabled)
                {
                    list.Add(adwebServicesVirtualDirectory);
                }
            }
            return(list.ToArray());
        }
        // Token: 0x0600116E RID: 4462 RVA: 0x00053E5C File Offset: 0x0005205C
        public static SharedConfiguration GetSharedConfiguration(OrganizationId orgId)
        {
            ExchangeConfigurationUnit[] array = SharedConfiguration.LoadSharedConfigurationsSorted(orgId);
            if (array == null)
            {
                return(null);
            }
            ExchangeConfigurationUnit exchangeConfigurationUnit = null;

            if (array.Length == 1)
            {
                exchangeConfigurationUnit = array[0];
            }
            else if (array.Length > 1)
            {
                ExchangeConfigurationUnit exchangeConfigurationUnit2 = null;
                int i = 0;
                while (i < array.Length)
                {
                    exchangeConfigurationUnit = array[i];
                    int num = ServerVersion.Compare(exchangeConfigurationUnit.SharedConfigurationInfo.CurrentVersion, ServerVersion.InstalledVersion);
                    if (num == 0)
                    {
                        break;
                    }
                    if (num > 0)
                    {
                        if (exchangeConfigurationUnit.SharedConfigurationInfo.CurrentVersion.Major > ServerVersion.InstalledVersion.Major && exchangeConfigurationUnit2 != null)
                        {
                            exchangeConfigurationUnit = exchangeConfigurationUnit2;
                            break;
                        }
                        break;
                    }
                    else
                    {
                        exchangeConfigurationUnit2 = array[i];
                        i++;
                    }
                }
            }
            if (exchangeConfigurationUnit != null)
            {
                return(new SharedConfiguration(orgId, exchangeConfigurationUnit));
            }
            return(null);
        }
Example #9
0
        // Token: 0x0600120A RID: 4618 RVA: 0x00038380 File Offset: 0x00036580
        internal static IEnumerable FindVirtualDirectories(string domainController, LogMessageDelegate logger)
        {
            ITopologyConfigurationSession topologyConfigurationSession = PhysicalResourceLoadBalancing.CreateGlobalConfigSession(domainController);

            PhysicalResourceLoadBalancing.LogVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(topologyConfigurationSession, typeof(ADOabVirtualDirectory), null, null, true), logger);
            ADPagedReader <ADOabVirtualDirectory>           adpagedReader = topologyConfigurationSession.FindPaged <ADOabVirtualDirectory>(null, QueryScope.SubTree, null, null, 0);
            List <ComparableEntry <ADOabVirtualDirectory> > list          = new List <ComparableEntry <ADOabVirtualDirectory> >();

            foreach (ADOabVirtualDirectory adoabVirtualDirectory in adpagedReader)
            {
                ServerVersion serverVersion = null;
                if (adoabVirtualDirectory.Server != null)
                {
                    serverVersion = Server.GetServerVersion(adoabVirtualDirectory.Server.Name);
                }
                if (!(serverVersion == null) && ServerVersion.Compare(serverVersion, PhysicalResourceLoadBalancing.E15MinVersion) >= 0)
                {
                    list.Add(new ComparableEntry <ADOabVirtualDirectory>(adoabVirtualDirectory)
                    {
                        Count = adoabVirtualDirectory.OfflineAddressBooks.Count
                    });
                    PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbFoundOabVDir(adoabVirtualDirectory.Id.ToDNString(), adoabVirtualDirectory.OfflineAddressBooks.Count), logger);
                }
            }
            list.Sort();
            int num = PhysicalResourceLoadBalancing.MaxNumOfVdirs;

            if (num > list.Count)
            {
                num = list.Count;
            }
            if (num == 0)
            {
                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbNoOabVDirReturned, logger);
            }
            List <ADObjectId> list2 = new List <ADObjectId>(num);

            for (int i = 0; i < num; i++)
            {
                list2.Add(list[i].Entry.Id);
                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbOabVDirSelected(list[i].Entry.Id.ToDNString()), logger);
            }
            return(list2);
        }
        internal static bool ValidLogSizeCompatibility(Unlimited <ByteQuantifiedSize> logMaxFileSize, Unlimited <ByteQuantifiedSize> logMaxDirectorySize, ADObjectId siteId, ITopologyConfigurationSession session)
        {
            ByteQuantifiedSize value = new ByteQuantifiedSize(2147483647UL);

            if ((!logMaxFileSize.IsUnlimited && logMaxFileSize.Value > value) || (!logMaxDirectorySize.IsUnlimited && logMaxDirectorySize.Value > value))
            {
                AndFilter filter = new AndFilter(new QueryFilter[]
                {
                    new BitMaskAndFilter(ServerSchema.CurrentServerRole, 32UL),
                    new ComparisonFilter(ComparisonOperator.Equal, ServerSchema.ServerSite, siteId)
                });
                foreach (Server server in session.FindPaged <Server>(null, QueryScope.SubTree, filter, null, 0))
                {
                    ServerVersion a = new ServerVersion(server.VersionNumber);
                    if (ServerVersion.Compare(a, EdgeSyncServiceConfig.LogSizeBreakageVersion) < 0)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(true);
        }
Example #11
0
        private bool TryLoadTopologies(out Exception e)
        {
            bool result;

            try
            {
                e = null;
                if (Interlocked.Increment(ref this.loadTopologyCount) == 1)
                {
                    ADOperationResult adoperationResult;
                    if (this.localServer == null)
                    {
                        adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
                        {
                            this.localServer = this.rootOrgConfigSession.FindLocalServer();
                        }, 3);
                        if (!adoperationResult.Succeeded)
                        {
                            e = adoperationResult.Exception;
                            ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcClientWrapper, ServerManagerLog.EventType.Error, null, string.Format("Failed find local server with Exception {0}", ServerManagerLog.GetExceptionLogString(e, ServerManagerLog.ExceptionLogOption.IncludeStack | ServerManagerLog.ExceptionLogOption.IncludeInnerException)));
                            return(false);
                        }
                        if (this.localServer.ServerSite == null)
                        {
                            ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcClientWrapper, ServerManagerLog.EventType.Error, null, "Local server doesn't have AD site");
                            return(false);
                        }
                        this.localSiteHubsFilter = new AndFilter(new QueryFilter[]
                        {
                            new BitMaskAndFilter(ServerSchema.CurrentServerRole, 32UL),
                            new ComparisonFilter(ComparisonOperator.Equal, ServerSchema.ServerSite, this.localServer.ServerSite)
                        });
                    }
                    List <Server> bridgeheadServers = new List <Server>();
                    if (!ADNotificationAdapter.TryReadConfigurationPaged <Server>(() => this.rootOrgConfigSession.FindPaged <Server>(null, QueryScope.SubTree, this.localSiteHubsFilter, null, 0), delegate(Server server)
                    {
                        ServerVersion a = new ServerVersion(server.VersionNumber);
                        if (ServerVersion.Compare(a, RpcClientWrapper.minRequiredRpcServerVersion) >= 0)
                        {
                            bridgeheadServers.Add(server);
                        }
                    }, out adoperationResult))
                    {
                        e = adoperationResult.Exception;
                        ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcClientWrapper, ServerManagerLog.EventType.Error, null, string.Format("Failed to load topology with exception {0}", ServerManagerLog.GetExceptionLogString(e, ServerManagerLog.ExceptionLogOption.IncludeStack | ServerManagerLog.ExceptionLogOption.IncludeInnerException)));
                        result = false;
                    }
                    else
                    {
                        Interlocked.Exchange <List <Server> >(ref this.localSiteBridgeheadServers, bridgeheadServers);
                        RpcClientWrapper.instance.topologyLastUpdated = DateTime.UtcNow;
                        StringBuilder stringBuilder = new StringBuilder();
                        foreach (Server server2 in bridgeheadServers)
                        {
                            stringBuilder.Append(server2.Name);
                            stringBuilder.Append(",");
                        }
                        ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcClientWrapper, ServerManagerLog.EventType.Success, null, string.Format("Sucessfully load topology with servers {0}", stringBuilder.ToString()));
                        result = true;
                    }
                }
                else
                {
                    result = true;
                }
            }
            finally
            {
                Interlocked.Decrement(ref this.loadTopologyCount);
            }
            return(result);
        }
Example #12
0
 public bool SyncPropertySetUpgradeAvailable(ServerVersion version)
 {
     return(this.IsSyncPropertySetUpgradeAllowed() && !this.IsSyncPropertySetUpgrading && ServerVersion.Compare(this.SyncPropertySetVersion, version) < 0);
 }
Example #13
0
        public static bool MailboxServerSupportsSync(MailboxSession mailboxSession)
        {
            ServerVersion a = new ServerVersion(mailboxSession.MailboxOwner.MailboxInfo.Location.ServerVersion);

            return(ServerVersion.Compare(a, SyncAssistantInvoker.OnlyCasSyncVersion) > 0);
        }
 public static bool IsSafetyNetRedeliveryRpcSupportedOnHubServer(ServerVersion hubServerVersion)
 {
     return(ServerVersion.Compare(hubServerVersion, SafetyNetVersionChecker.SafetyNetRedeliveryRequestRpcSupportVersion) >= 0);
 }
Example #15
0
 public bool TryGetRandomServerFromCurrentSite(ServerRole serverRole, ServerVersion serverVersion, ServiceTopology.RandomServerSearchType searchType, out string serverFqdn, out int foundVersion, [CallerFilePath] string callerFilePath = null, [CallerMemberName] string memberName = null, [CallerLineNumber] int callerFileLine = 0)
 {
     ServiceTopologyLog.Instance.Append(callerFilePath, memberName, callerFileLine);
     if ((this.localServerInfo.Role & serverRole) > ServerRole.None && ((ServiceTopology.RandomServerSearchType.ExactVersion == searchType && this.localServerInfo.AdminDisplayVersionNumber == serverVersion) || (searchType == ServiceTopology.RandomServerSearchType.MinimumVersion && ServerVersion.Compare(this.localServerInfo.AdminDisplayVersionNumber, serverVersion) >= 0) || (ServiceTopology.RandomServerSearchType.MinimumVersionMatchMajor == searchType && ServerVersion.Compare(this.localServerInfo.AdminDisplayVersionNumber, serverVersion) >= 0 && new ServerVersion(this.localServerInfo.VersionNumber).Major == serverVersion.Major)))
     {
         serverFqdn   = this.localServerInfo.ServerFullyQualifiedDomainName;
         foundVersion = this.localServerInfo.VersionNumber;
         return(true);
     }
     return(this.TryGetRandomServer(this.localServerInfo.Site, serverRole, serverVersion, searchType, out serverFqdn, out foundVersion, "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ServiceDiscovery\\ServiceTopology.cs", "TryGetRandomServerFromCurrentSite", 1058));
 }
Example #16
0
        public bool TryGetRandomServer(Site site, ServerRole serverRole, ServerVersion serverVersion, ServiceTopology.RandomServerSearchType searchType, out string serverFqdn, out int foundVersion, [CallerFilePath] string callerFilePath = null, [CallerMemberName] string memberName = null, [CallerLineNumber] int callerFileLine = 0)
        {
            ServiceTopologyLog.Instance.Append(callerFilePath, memberName, callerFileLine);
            List <TopologyServerInfo> list;

            if (this.siteToServersDictionary.TryGetValue(site, out list))
            {
                List <TopologyServerInfo> list2;
                if (ServiceTopology.RandomServerSearchType.ExactVersion == searchType)
                {
                    list2 = list.FindAll((TopologyServerInfo server) => (server.Role & serverRole) != ServerRole.None && !server.IsOutOfService && server.AdminDisplayVersionNumber == serverVersion);
                }
                else if (searchType == ServiceTopology.RandomServerSearchType.MinimumVersion)
                {
                    list2 = list.FindAll((TopologyServerInfo server) => (server.Role & serverRole) != ServerRole.None && !server.IsOutOfService && ServerVersion.Compare(server.AdminDisplayVersionNumber, serverVersion) >= 0);
                }
                else
                {
                    ServerVersion nextVersion = new ServerVersion(serverVersion.Major + 1, 0, 0, 0);
                    list2 = list.FindAll((TopologyServerInfo server) => (server.Role & serverRole) != ServerRole.None && !server.IsOutOfService && ServerVersion.Compare(server.AdminDisplayVersionNumber, serverVersion) >= 0 && ServerVersion.Compare(server.AdminDisplayVersionNumber, nextVersion) < 0);
                }
                if (list2.Count > 0)
                {
                    int index = ServiceTopology.Random.Next(list2.Count);
                    serverFqdn   = list2[index].ServerFullyQualifiedDomainName;
                    foundVersion = list2[index].VersionNumber;
                    return(true);
                }
            }
            serverFqdn   = null;
            foundVersion = 0;
            return(false);
        }
 public static bool IsVersionGreater(ServerVersion a, ServerVersion b)
 {
     return(ServerVersion.Compare(a, b) >= 0);
 }
Example #18
0
        public static bool CheckDataRedactionEnabled(ServerVersion target)
        {
            ServerVersion b = new ServerVersion(15, 0, 586, 0);

            return(!(target == null) && ServerVersion.Compare(target, b) >= 0);
        }