Esempio n. 1
0
        static Sku()
        {
            Sku.PKConfigurationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ProductKeyConfig.xml");
            ExchangeBuild exchangeBuild = ExchangeObjectVersion.Exchange2012.ExchangeBuild;

            Sku.ValidServerVersion = new ServerVersion((int)exchangeBuild.Major, (int)exchangeBuild.Minor, (int)exchangeBuild.Build, (int)exchangeBuild.BuildRevision);
        }
        internal static ExchangeBuild GetTextProcessorVersion(TextProcessorType textProcessorType, XElement textProcessorElement)
        {
            if (textProcessorElement == null)
            {
                throw new ArgumentNullException("textProcessorElement");
            }
            ExAssert.RetailAssert(TextProcessorType.Function <= textProcessorType && textProcessorType <= TextProcessorType.Fingerprint, "The specified textProcessorType '{0}' is out-of-range", new object[]
            {
                textProcessorType.ToString()
            });
            ExchangeBuild result = ClassificationDefinitionConstants.DefaultVersion;

            if (ClassificationDefinitionConstants.TextProcessorTypeToVersions.ContainsKey(textProcessorType))
            {
                result = ClassificationDefinitionConstants.TextProcessorTypeToVersions[textProcessorType];
            }
            else if (textProcessorType == TextProcessorType.Function)
            {
                string value = textProcessorElement.Attribute("id").Value;
                ExAssert.RetailAssert(value != null, "The functionName in the specfied textProcessorElement is null", new object[]
                {
                    textProcessorElement.ToString()
                });
                if (ClassificationDefinitionConstants.FunctionNameToVersions.ContainsKey(value))
                {
                    result = ClassificationDefinitionConstants.FunctionNameToVersions[value];
                }
            }
            return(result);
        }
Esempio n. 3
0
        private static long GetVersionIntegerFromString(string versionString)
        {
            string[] array = versionString.Split(new char[]
            {
                '.'
            });
            byte b;

            if (!byte.TryParse(array[0], out b) || b == 255)
            {
                throw new ArgumentException(DirectoryStrings.ExchangeUpgradeBucketInvalidVersionFormat(versionString));
            }
            byte maxValue = byte.MaxValue;

            if (array[1] != "*" && (!byte.TryParse(array[1], out maxValue) || maxValue == 255))
            {
                throw new ArgumentException(DirectoryStrings.ExchangeUpgradeBucketInvalidVersionFormat(versionString));
            }
            ushort maxValue2 = ushort.MaxValue;
            ushort num       = 1023;

            if (array.Length > 2 && array[2] != "*" && (!ushort.TryParse(array[2], out maxValue2) || maxValue2 == 65535))
            {
                throw new ArgumentException(DirectoryStrings.ExchangeUpgradeBucketInvalidVersionFormat(versionString));
            }
            if (array.Length > 3 && array[3] != "*" && (!ushort.TryParse(array[3], out num) || num >= 1023))
            {
                throw new ArgumentException(DirectoryStrings.ExchangeUpgradeBucketInvalidVersionFormat(versionString));
            }
            ExchangeBuild exchangeBuild = new ExchangeBuild(b, maxValue, maxValue2, num);

            return(exchangeBuild.ToInt64());
        }
Esempio n. 4
0
        public bool IsSupported(string version)
        {
            if (SupportedVersionList.skipVersionCheck)
            {
                return(false);
            }
            ExchangeBuild build = ExchangeBuild.Parse(version);

            return((from c in this.supportedVersionList
                    where c.Major == build.Major && c.Minor == build.Minor && c.Build == build.Build
                    select c).Count <ExchangeBuild>() > 0);
        }
Esempio n. 5
0
 public SupportedVersionList(string versionList)
 {
     string[] array = versionList.Split(new char[]
     {
         ';'
     });
     foreach (string text in array)
     {
         string text2 = text.Trim();
         if (!string.IsNullOrEmpty(text2))
         {
             this.supportedVersionList.Add(ExchangeBuild.Parse(text2));
         }
     }
 }
        internal static ExchangeBuild GetRulePackElementVersion(XElement rulePackElement)
        {
            ArgumentValidator.ThrowIfNull("rulePackElement", rulePackElement);
            ExchangeBuild result = ClassificationDefinitionConstants.DefaultVersion;

            while (rulePackElement != null && rulePackElement.Name.LocalName != "Rules" && rulePackElement.Name.LocalName != "Version")
            {
                rulePackElement = rulePackElement.Parent;
            }
            if (rulePackElement != null && rulePackElement.Name.LocalName == "Version")
            {
                result = ExchangeBuild.Parse(rulePackElement.Attribute("minEngineVersion").Value);
            }
            return(result);
        }
Esempio n. 7
0
        private static string GetVersionStringFromInteger(long versionInteger)
        {
            ExchangeBuild exchangeBuild = new ExchangeBuild(versionInteger);
            string        text          = exchangeBuild.Major.ToString() + ".";

            text += ((exchangeBuild.Minor == byte.MaxValue) ? "*" : (exchangeBuild.Minor.ToString() + "."));
            if (exchangeBuild.Minor != 255)
            {
                text += ((exchangeBuild.Build == ushort.MaxValue) ? "*" : (exchangeBuild.Build.ToString() + "."));
            }
            if (exchangeBuild.Build != 65535)
            {
                text += ((exchangeBuild.BuildRevision == 1023) ? "*" : exchangeBuild.BuildRevision.ToString());
            }
            return(text);
        }
Esempio n. 8
0
        // Token: 0x06005DA3 RID: 23971 RVA: 0x00142FE8 File Offset: 0x001411E8
        private void PopulateTaskPopulatedProperties()
        {
            RelocationConstraintArray relocationConstraintArray = (RelocationConstraintArray)this[OrganizationSchema.PersistedRelocationConstraints];
            MultiValuedProperty <RelocationConstraint> relocationConstraints = new MultiValuedProperty <RelocationConstraint>();

            if (relocationConstraintArray != null && relocationConstraintArray.RelocationConstraints != null)
            {
                Array.ForEach <RelocationConstraint>(relocationConstraintArray.RelocationConstraints, delegate(RelocationConstraint x)
                {
                    relocationConstraints.Add(x);
                });
            }
            if (this.AdminDisplayVersion != null)
            {
                ExchangeBuild exchangeBuild = this.AdminDisplayVersion.ExchangeBuild;
                if (this.AdminDisplayVersion.ExchangeBuild.ToString().StartsWith("14"))
                {
                    relocationConstraints.Add(new RelocationConstraint(RelocationConstraintType.TenantVersionConstraint, DateTime.MaxValue));
                }
            }
            if (this.OrganizationStatus != OrganizationStatus.Active || this.IsUpgradingOrganization || this.IsPilotingOrganization || this.IsUpgradeOperationInProgress || this.IsFfoMigrationInProgress || this.IsUpdatingServicePlan)
            {
                relocationConstraints.Add(new RelocationConstraint(RelocationConstraintType.TenantInTransitionConstraint, DateTime.MaxValue));
            }
            if (!this.IsValid)
            {
                relocationConstraints.Add(new RelocationConstraint(RelocationConstraintType.ValidationErrorConstraint, DateTime.MaxValue));
            }
            if (this.EnableAsSharedConfiguration || this.ImmutableConfiguration)
            {
                relocationConstraints.Add(new RelocationConstraint(RelocationConstraintType.SCTConstraint, DateTime.MaxValue));
            }
            if (this.UpgradeE14MbxCountForCurrentStage != null && this.UpgradeE14MbxCountForCurrentStage.Value != 0)
            {
                relocationConstraints.Add(new RelocationConstraint(RelocationConstraintType.E14MailboxesPresentContraint, DateTime.MaxValue));
            }
            if (!string.IsNullOrEmpty((string)this[ExchangeConfigurationUnitSchema.TargetForest]) || !string.IsNullOrEmpty((string)this[ExchangeConfigurationUnitSchema.RelocationSourceForestRaw]))
            {
                relocationConstraints.Add(new RelocationConstraint(RelocationConstraintType.RelocationInProgressConstraint, DateTime.MaxValue));
            }
            relocationConstraints.Sort();
            this[TenantOrganizationPresentationObjectSchema.RelocationConstraints] = relocationConstraints;
            if (this.IsTemplateTenant)
            {
                this.IsSharingConfiguration = true;
            }
        }
        protected ExchangeBuild GetCurrentRBACConfigVersion(Container rbacContainer)
        {
            if (rbacContainer == null)
            {
                throw new ArgumentNullException("rbacContainer");
            }
            ExchangeBuild exchangeBuild = rbacContainer.ExchangeVersion.ExchangeBuild;

            if (!(exchangeBuild <= RbacContainer.InitialRBACBuild))
            {
                return(exchangeBuild);
            }
            if (this.FindAnyRoleAssignment())
            {
                return(RbacContainer.E14RTMBuild);
            }
            return(RbacContainer.FirstRGRABuild);
        }
Esempio n. 10
0
        private string ExpandVersions(string connectionString)
        {
            Uri uri = new Uri(connectionString, UriKind.Absolute);
            NameValueCollection nameValueCollectionFromUri = LiveIdBasicAuthModule.GetNameValueCollectionFromUri(uri);
            string        text                 = nameValueCollectionFromUri.Get("ExchClientVer");
            string        text2                = nameValueCollectionFromUri.Get("ClientApplication");
            StringBuilder stringBuilder        = new StringBuilder();
            string        supportedEMCVersions = AppSettings.Current.SupportedEMCVersions;

            if (supportedEMCVersions.Contains("*"))
            {
                if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2) && text2.Equals("EMC", StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        ExchangeBuild exchangeBuild = ExchangeBuild.Parse(text);
                        string[]      array         = supportedEMCVersions.Split(new char[]
                        {
                            ';'
                        });
                        foreach (string text3 in array)
                        {
                            if (!string.IsNullOrEmpty(text3))
                            {
                                if (text3.Contains("*"))
                                {
                                    string[] array3 = text3.Split(new char[]
                                    {
                                        '.'
                                    });
                                    int num;
                                    int num2;
                                    if (array3.Length == 4 && int.TryParse(array3[0], out num) && num == (int)exchangeBuild.Major && (string.Equals(array3[1], "*") || (int.TryParse(array3[1], out num2) && num2 == (int)exchangeBuild.Minor && string.Equals(array3[2], "*"))))
                                    {
                                        for (int j = 1; j < 999; j++)
                                        {
                                            stringBuilder.Append(string.Format(";{0}.{1}.{2}.0", exchangeBuild.Major, exchangeBuild.Minor, j));
                                        }
                                        break;
                                    }
                                }
                                else
                                {
                                    stringBuilder.Append(string.Format(";{0}", text3));
                                }
                            }
                        }
                        goto IL_1D3;
                    }
                    catch (ArgumentException)
                    {
                        stringBuilder.Append(SupportedVersionList.DefaultVersionString);
                        goto IL_1D3;
                    }
                }
                stringBuilder.Append(SupportedVersionList.DefaultVersionString);
            }
            else
            {
                stringBuilder.Append(supportedEMCVersions);
            }
IL_1D3:
            return(stringBuilder.ToString());
        }
Esempio n. 11
0
        protected override void InternalProcessRecord()
        {
            this.configurationSession.SessionSettings.IsSharedConfigChecked = true;
            base.InternalProcessRecord();
            List <string> enabledFeatures             = (base.ServicePlanSettings == null) ? null : base.ServicePlanSettings.GetAggregatedMailboxPlanRoleAssignmentFeatures();
            List <string> enabledFeatures2            = (this.PreviousServicePlanSettings == null) ? null : this.PreviousServicePlanSettings.GetAggregatedMailboxPlanRoleAssignmentFeatures();
            RbacContainer rbacContainer               = this.configurationSession.GetRbacContainer();
            ExchangeBuild currentRBACConfigVersion    = base.GetCurrentRBACConfigVersion(rbacContainer);
            List <RoleToRAPAssignmentDefinition> list = new List <RoleToRAPAssignmentDefinition>();

            foreach (RoleToRAPAssignmentDefinition roleToRAPAssignmentDefinition in this.GetRoleAssignmentDefinitions().Assignments)
            {
                if (roleToRAPAssignmentDefinition.SatisfyCondition(enabledFeatures))
                {
                    switch (base.InvocationMode)
                    {
                    case InvocationMode.Install:
                        list.Add(roleToRAPAssignmentDefinition);
                        break;

                    case InvocationMode.BuildToBuildUpgrade:
                        if (roleToRAPAssignmentDefinition.IntroducedInBuild > currentRBACConfigVersion)
                        {
                            list.Add(roleToRAPAssignmentDefinition);
                        }
                        break;

                    case InvocationMode.ServicePlanUpdate:
                        if (!roleToRAPAssignmentDefinition.SatisfyCondition(enabledFeatures2) || roleToRAPAssignmentDefinition.IntroducedInBuild > currentRBACConfigVersion)
                        {
                            list.Add(roleToRAPAssignmentDefinition);
                        }
                        break;
                    }
                }
            }
            List <ExchangeRole> list2 = new List <ExchangeRole>();
            List <ExchangeRole> list3 = new List <ExchangeRole>();
            List <ExchangeRole> list4 = new List <ExchangeRole>();

            foreach (ExchangeRole exchangeRole in this.configurationSession.FindPaged <ExchangeRole>(this.rolesContainerId, QueryScope.OneLevel, new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleSchema.IsEndUserRole, true), null, 0))
            {
                if (exchangeRole.IsEndUserRole)
                {
                    if (this.IsRoleInFilteredList(exchangeRole, list))
                    {
                        if (this.IsAutoGroupRelatedRole(exchangeRole))
                        {
                            list3.Add(exchangeRole);
                        }
                        else
                        {
                            list2.Add(exchangeRole);
                        }
                    }
                    if (this.IsAutoGroupRelatedRole(exchangeRole))
                    {
                        list4.Add(exchangeRole);
                    }
                }
            }
            if (this.Organization == null)
            {
                using (IEnumerator <RoleAssignmentPolicy> enumerator2 = this.FindAllRoleAssignmentPolicies().GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        RoleAssignmentPolicy policy = enumerator2.Current;
                        this.CreateRAPRoleAssignments(policy, list2);
                    }
                    goto IL_455;
                }
            }
            if (!base.ServicePlanSettings.Organization.PerMBXPlanRoleAssignmentPolicyEnabled)
            {
                foreach (RoleAssignmentPolicy policy2 in this.FindAllRoleAssignmentPolicies())
                {
                    this.CreateRAPRoleAssignments(policy2, list2);
                }
                RoleAssignmentPolicy policy3     = this.FindDefaultRoleAssignmentPolicy();
                bool currentPlanAutoGroupEnabled = false;
                base.ServicePlanSettings.MailboxPlans.ForEach(delegate(ServicePlan.MailboxPlan x)
                {
                    currentPlanAutoGroupEnabled |= x.AutoGroupPermissions;
                });
                bool previousPlanAutoGroupEnabled = false;
                bool flag  = false;
                bool flag2 = false;
                if (this.PreviousServicePlanSettings != null)
                {
                    this.PreviousServicePlanSettings.MailboxPlans.ForEach(delegate(ServicePlan.MailboxPlan x)
                    {
                        previousPlanAutoGroupEnabled |= x.AutoGroupPermissions;
                    });
                    if (previousPlanAutoGroupEnabled && !this.PreviousServicePlanSettings.Organization.ShareableConfigurationEnabled)
                    {
                        flag = true;
                    }
                    else
                    {
                        flag2 = true;
                    }
                }
                else
                {
                    flag2 = true;
                }
                if (currentPlanAutoGroupEnabled && !flag)
                {
                    this.CreateRAPRoleAssignments(policy3, list3);
                }
                else if (!currentPlanAutoGroupEnabled && !flag2)
                {
                    this.RemoveRAPRoleAssignmentsIfNeeded(policy3, list4, null);
                }
            }
            else
            {
                foreach (ServicePlan.MailboxPlan mailboxPlan in base.ServicePlanSettings.MailboxPlans)
                {
                    ADUser aduser = this.FindMailboxPlanByName(mailboxPlan.Name);
                    if (aduser.RoleAssignmentPolicy == null)
                    {
                        base.WriteError(new InvalidOperationException(Strings.ErrorRBACPolicyLinkNotFound(aduser.Name)), ErrorCategory.InvalidArgument, null);
                    }
                    RoleAssignmentPolicy roleAssignmentPolicy = this.configurationSession.Read <RoleAssignmentPolicy>(aduser.RoleAssignmentPolicy);
                    if (roleAssignmentPolicy == null)
                    {
                        base.WriteError(new InvalidOperationException(Strings.ErrorRBACPolicyNotFound(aduser.RoleAssignmentPolicy.ToString())), ErrorCategory.InvalidArgument, null);
                    }
                    ServicePlan.MailboxPlan mailboxPlan2 = null;
                    if (this.PreviousServicePlanSettings != null)
                    {
                        mailboxPlan2 = this.PreviousServicePlanSettings.GetMailboxPlanByName(mailboxPlan.Name);
                    }
                    if (this.PreviousServicePlanSettings == null || mailboxPlan2 == null)
                    {
                        this.CreateRAPRoleAssignments(roleAssignmentPolicy, list2, aduser.MailboxPlanIndex);
                    }
                    bool flag3 = false;
                    bool flag4 = false;
                    if (mailboxPlan2 != null)
                    {
                        if (mailboxPlan2.AutoGroupPermissions)
                        {
                            flag3 = true;
                        }
                        else
                        {
                            flag4 = true;
                        }
                    }
                    else
                    {
                        flag4 = true;
                    }
                    if (mailboxPlan.AutoGroupPermissions && !flag3)
                    {
                        this.CreateRAPRoleAssignments(roleAssignmentPolicy, list3, aduser.MailboxPlanIndex);
                    }
                    else if (!mailboxPlan.AutoGroupPermissions && !flag4)
                    {
                        this.RemoveRAPRoleAssignmentsIfNeeded(roleAssignmentPolicy, list4, aduser.MailboxPlanIndex);
                    }
                }
            }
IL_455:
            this.StampCurrentVersionOnRBACContainer(rbacContainer);
        }
        protected override void InternalProcessRecord()
        {
            InstallCannedRbacRoleAssignments.isFfoEnvironment = (base.Fields.Contains("IsFfo") && this.IsFfo);
            this.configurationSession.SessionSettings.IsSharedConfigChecked = true;
            base.InternalProcessRecord();
            this.RemoveInvalidRoleAssignments();
            this.UpdateRoleAssignments();
            List <string> enabledFeatures  = (base.ServicePlanSettings == null) ? null : base.ServicePlanSettings.Organization.GetEnabledRoleGroupRoleAssignmentFeatures();
            List <string> enabledFeatures2 = (this.PreviousServicePlanSettings == null) ? null : this.PreviousServicePlanSettings.Organization.GetEnabledRoleGroupRoleAssignmentFeatures();

            RoleGroupRoleMapping[] roleGroupAssignmentsDefinition = this.GetRoleGroupAssignmentsDefinition();
            List <string>          cannedRoleNames = this.GetCannedRoleNames();
            List <ExchangeRole>    list            = new List <ExchangeRole>();

            foreach (ExchangeRole exchangeRole in this.configurationSession.FindPaged <ExchangeRole>(this.rolesContainerId, QueryScope.OneLevel, null, null, 0))
            {
                if (cannedRoleNames.Contains(exchangeRole.Name))
                {
                    list.Add(exchangeRole);
                }
            }
            RbacContainer rbacContainer            = this.configurationSession.GetRbacContainer();
            ExchangeBuild currentRBACConfigVersion = base.GetCurrentRBACConfigVersion(rbacContainer);

            foreach (RoleGroupRoleMapping roleGroupRoleMapping in roleGroupAssignmentsDefinition)
            {
                ADGroup adgroup = null;
                foreach (RoleAssignmentDefinition roleAssignmentDefinition in roleGroupRoleMapping.Assignments)
                {
                    bool flag = false;
                    if (roleAssignmentDefinition.SatisfyCondition(enabledFeatures))
                    {
                        switch (base.InvocationMode)
                        {
                        case InvocationMode.Install:
                            flag = true;
                            break;

                        case InvocationMode.BuildToBuildUpgrade:
                            flag = (roleAssignmentDefinition.IntroducedInBuild > currentRBACConfigVersion);
                            break;

                        case InvocationMode.ServicePlanUpdate:
                            flag = (!roleAssignmentDefinition.SatisfyCondition(enabledFeatures2) || roleAssignmentDefinition.IntroducedInBuild > currentRBACConfigVersion);
                            break;
                        }
                    }
                    if (InstallCannedRbacRoleAssignments.MonitoredDCOnlyRoleGroups.Contains(roleGroupRoleMapping.RoleGroup))
                    {
                        flag = true;
                    }
                    if (flag)
                    {
                        if (adgroup == null)
                        {
                            adgroup = this.FindCannedRoleGroupByName(roleGroupRoleMapping.RoleGroup);
                        }
                        this.CreateRoleAssignmentDefinition(roleAssignmentDefinition, adgroup, list);
                    }
                    else if (!roleAssignmentDefinition.SatisfyCondition(enabledFeatures, roleGroupAssignmentsDefinition))
                    {
                        if (this.Organization == null)
                        {
                            throw new InvalidOperationException(roleGroupRoleMapping.RoleGroup.ToString());
                        }
                        this.RemoveRoleAssignmentDefinition(roleAssignmentDefinition, list);
                    }
                }
                if (InstallCannedRbacRoleAssignments.MonitoredDCOnlyRoleGroups.Contains(roleGroupRoleMapping.RoleGroup))
                {
                    if (adgroup == null)
                    {
                        adgroup = this.FindCannedRoleGroupByName(roleGroupRoleMapping.RoleGroup);
                    }
                    this.PurgeInvalidAssignmentsFromRoleGroup(roleGroupRoleMapping, adgroup, list);
                }
            }
            ADGroup adgroup2 = this.ResolveWellKnownGuid(RoleGroup.OrganizationManagement_InitInfo.WellKnownGuid);

            if (adgroup2 == null)
            {
                base.WriteError(new ExRbacRoleGroupNotFoundException(RoleGroup.OrganizationManagement_InitInfo.WellKnownGuid, "Organization Management"), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(adgroup2);
            if ((base.ServicePlanSettings != null && base.ServicePlanSettings.Organization.PermissionManagementEnabled) || this.Organization == null)
            {
                using (List <ExchangeRole> .Enumerator enumerator2 = list.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        ExchangeRole exchangeRole2 = enumerator2.Current;
                        if (exchangeRole2.IsEndUserRole && !exchangeRole2.IsDeprecated && !this.FindRoleAssignment(exchangeRole2, adgroup2, RoleAssignmentDelegationType.DelegatingOrgWide))
                        {
                            this.CreateRoleAssignment(exchangeRole2, adgroup2, RoleAssignmentDelegationType.DelegatingOrgWide);
                        }
                    }
                    return;
                }
            }
            foreach (ExchangeRole exchangeRole3 in list)
            {
                if (exchangeRole3.IsEndUserRole && !exchangeRole3.IsDeprecated)
                {
                    this.RemoveRoleAssignmentsFromGroup(exchangeRole3, adgroup2, RoleAssignmentDelegationType.DelegatingOrgWide);
                }
            }
        }