private RoleGroupRoleMapping[] GetRoleGroupAssignmentsDefinition()
 {
     if (this.Organization == null)
     {
         if (Datacenter.IsMicrosoftHostedOnly(false))
         {
             return(Datacenter_RoleGroupDefinition.Definition);
         }
         if (Datacenter.IsPartnerHostedOnly(false))
         {
             return(Hosting_RoleGroupDefinition.Definition);
         }
         if (Datacenter.IsDatacenterDedicated(false))
         {
             return(Dedicated_RoleGroupDefinition.Definition);
         }
         return(Enterprise_RoleGroupDefinition.Definition);
     }
     else
     {
         if (Datacenter.IsPartnerHostedOnly(false))
         {
             return(HostedTenant_RoleGroupDefinition.Definition);
         }
         return(Tenant_RoleGroupDefinition.Definition);
     }
 }
        protected override void InternalProcessMetabase()
        {
            TaskLogger.LogEnter();
            base.InternalProcessMetabase();
            if (base.Role == VirtualDirectoryRole.ClientAccess && Datacenter.IsMicrosoftHostedOnly(false) && ((Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1) || Environment.OSVersion.Version.Major >= 7))
            {
                if (DirectoryEntry.Exists(this.DataObject.MetabasePath))
                {
                    TaskLogger.Trace("MultiTenancy mode: installing AuthModuleFilter isapi filter", new object[0]);
                    try
                    {
                        NewAutodiscoverVirtualDirectory.InstallAuthModuleIsapiFilter(this.DataObject);
                        goto IL_DE;
                    }
                    catch (Exception ex)
                    {
                        TaskLogger.Trace("Exception occurred in InstallIsapiFilter(): {0}", new object[]
                        {
                            ex.Message
                        });
                        this.WriteWarning(Strings.AuthModuleFilterMetabaseIsapiInstallFailure);
                        throw;
                    }
                }
                base.WriteError(new InvalidOperationException(Strings.ErrorMetabasePathNotFound(this.DataObject.MetabasePath)), ErrorCategory.InvalidOperation, this.DataObject.Identity);
            }
IL_DE:
            TaskLogger.LogExit();
        }
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (this.Identity == null && this.Server == null)
            {
                this.Server = MailboxServerIdParameter.Parse(Environment.MachineName);
            }
            MailboxServerIdParameter mailboxServerIdParameter = null;

            if (this.Server != null)
            {
                mailboxServerIdParameter = this.Server;
            }
            else if (this.Local)
            {
                mailboxServerIdParameter = MailboxServerIdParameter.Parse(Environment.MachineName);
            }
            if (mailboxServerIdParameter != null)
            {
                this.m_server = (Server)base.GetDataObject <Server>(mailboxServerIdParameter, base.DataSession, null, new LocalizedString?(Strings.ErrorMailboxServerNotFound(mailboxServerIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxServerNotUnique(mailboxServerIdParameter.ToString())));
                if (base.HasErrors || this.m_server == null)
                {
                    base.WriteError(new CouldNotFindServerObject(mailboxServerIdParameter.ToString()), ErrorCategory.InvalidOperation, mailboxServerIdParameter);
                    return;
                }
                if (!this.m_server.IsE14OrLater)
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorServerNotE14OrLater(mailboxServerIdParameter.ToString())), ErrorCategory.InvalidOperation, mailboxServerIdParameter);
                }
                if (!this.m_server.IsMailboxServer)
                {
                    base.WriteError(this.m_server.GetServerRoleError(ServerRole.Mailbox), ErrorCategory.InvalidOperation, mailboxServerIdParameter);
                    return;
                }
                string arg  = (this.Identity == null) ? "*" : this.Identity.DatabaseName;
                string text = string.Format("{0}{1}{2}", arg, '\\', this.m_server.Name);
                if (this.Identity != null && !string.IsNullOrEmpty(this.Identity.ServerName) && this.Identity.ServerName != "*")
                {
                    this.WriteWarning(Strings.GetDbcsOverridingServer(this.Identity.ServerName, this.m_server.Name, text));
                }
                this.Identity = DatabaseCopyIdParameter.Parse(text);
            }
            this.rootId = new DatabasesContainer().Id;
            QueryFilter queryFilter = new OrFilter(new QueryFilter[]
            {
                new NotFilter(new ExistsFilter(DatabaseCopySchema.ParentObjectClass)),
                new TextFilter(DatabaseCopySchema.ParentObjectClass, MailboxDatabase.MostDerivedClass, MatchOptions.FullString, MatchFlags.IgnoreCase)
            });

            if (Datacenter.IsMicrosoftHostedOnly(true))
            {
                queryFilter = QueryFilter.OrTogether(new QueryFilter[]
                {
                    queryFilter,
                    new TextFilter(DatabaseCopySchema.ParentObjectClass, PublicFolderDatabase.MostDerivedClass, MatchOptions.FullString, MatchFlags.IgnoreCase)
                });
            }
            this.Identity.SetAdditionalQueryFilter(queryFilter);
            this.Identity.AllowInvalid = true;
        }
Exemplo n.º 4
0
 protected override void InternalValidate()
 {
     if (!base.Fields.IsModified("Path"))
     {
         base.Path = System.IO.Path.Combine(ConfigurationContext.Setup.InstallPath, this.VirtualDirectoryPath);
     }
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     base.InternalValidateBasicLiveIdBasic();
     if (string.Empty.Equals(this.AppPoolIdForManagement))
     {
         base.WriteError(new ArgumentException(Strings.ErrorAppPoolIdCannotBeEmpty, "AppPoolIdForManagement"), ErrorCategory.InvalidArgument, this.DataObject.Identity);
     }
     if (Datacenter.IsMicrosoftHostedOnly(true))
     {
         string path = System.IO.Path.Combine(base.Path, "Nego2");
         if (!Directory.Exists(path))
         {
             base.WriteError(new ArgumentException(Strings.ErrorDirectoryManagementWebServiceNotFound(path), "Path"), ErrorCategory.InvalidArgument, this.DataObject.Identity);
         }
     }
 }
Exemplo n.º 5
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            IRMConfiguration dataObject = this.DataObject;

            try
            {
                this.ValidateCommon();
                this.datacenter = (Datacenter.IsMicrosoftHostedOnly(true) || Datacenter.IsPartnerHostedOnly(true));
                if (this.datacenter)
                {
                    this.ValidateForDC(dataObject);
                }
                else
                {
                    this.ValidateForEnterprise(dataObject);
                }
            }
            catch (CannotDetermineExchangeModeException exception)
            {
                base.WriteError(SetIRMConfiguration.GetExceptionInfo(exception), ErrorCategory.InvalidOperation, base.Identity);
            }
            catch (ExchangeConfigurationException exception2)
            {
                base.WriteError(SetIRMConfiguration.GetExceptionInfo(exception2), ErrorCategory.InvalidOperation, base.Identity);
            }
            catch (RightsManagementException exception3)
            {
                base.WriteError(SetIRMConfiguration.GetExceptionInfo(exception3), ErrorCategory.InvalidOperation, base.Identity);
            }
        }
        private UserWithCredential GetMonitoringAccount()
        {
            UserWithCredential result     = default(UserWithCredential);
            string             datacenter = Datacenter.IsMicrosoftHostedOnly(true) ? ".Datacenter" : string.Empty;
            ADSite             localSite  = this.ConfigSession.GetLocalSite();

            try
            {
                result = CommonTestTasks.GetDefaultTestAccount(new CommonTestTasks.ClientAccessContext
                {
                    Instance             = this,
                    MonitoringContext    = true,
                    ConfigurationSession = this.ConfigSession,
                    RecipientSession     = this.RecipientSession,
                    Site          = localSite,
                    WindowsDomain = localSite.Id.DomainId.ToCanonicalName()
                });
            }
            catch (Exception ex)
            {
                base.WriteError(new TestWebServicesTaskException(Strings.ErrorTestMailboxNotFound(ExchangeSetupContext.ScriptPath, datacenter, ex.ToString())), ErrorCategory.InvalidData, null);
            }
            if (string.IsNullOrEmpty(result.Credential.Password))
            {
                base.WriteError(new TestWebServicesTaskException(Strings.ErrorTestMailboxPasswordNotFound(result.User.Identity.ToString(), ExchangeSetupContext.ScriptPath, datacenter)), ErrorCategory.InvalidData, null);
            }
            return(result);
        }
 protected override void InternalBeginProcessing()
 {
     TaskLogger.LogEnter();
     base.InternalBeginProcessing();
     if (!Datacenter.IsMicrosoftHostedOnly(true))
     {
         base.ThrowTerminatingError(new DatacenterEnvironmentOnlyOperationException(), ErrorCategory.InvalidOperation, null);
     }
     TaskLogger.LogExit();
 }
 public ManageOrganizationTaskBase()
 {
     base.ImplementsResume               = false;
     base.IsTenantOrganization           = true;
     base.IsDatacenter                   = Datacenter.IsMicrosoftHostedOnly(false);
     base.IsPartnerHosted                = Datacenter.IsPartnerHostedOnly(false);
     base.ComponentInfoFileNames         = new List <string>();
     base.ShouldLoadDatacenterConfigFile = false;
     this.InitializeComponentInfoFileNames();
 }
Exemplo n.º 9
0
 private ADForest(string fqdn, string domainController, string globalCatalog, NetworkCredential networkCredential, bool knownForest)
 {
     this.fqdn              = fqdn;
     this.domainController  = domainController;
     this.globalCatalog     = globalCatalog;
     this.networkCredential = networkCredential;
     this.partitionId       = (Datacenter.IsMicrosoftHostedOnly(true) ? new PartitionId(fqdn) : PartitionId.LocalForest);
     this.isKnownForest     = knownForest;
     this.isLocalForest     = ADForest.IsLocalForestFqdn(fqdn);
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (!this.Force)
     {
         foreach (ADPropertyDefinition adpropertyDefinition in NewWebServicesVirtualDirectory.HostProperties)
         {
             if (!NewWebServicesVirtualDirectory.IsValidHost(this.DataObject, adpropertyDefinition) && !base.ShouldContinue(Strings.ConfirmationMessageHostCannotBeResolved(adpropertyDefinition.Name)))
             {
                 TaskLogger.LogExit();
                 return;
             }
         }
     }
     if (!(this.DataObject.WindowsAuthentication ?? true))
     {
         if (base.ExchangeRunspaceConfig != null && base.ExchangeRunspaceConfig.ConfigurationSettings != null && (base.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication == ExchangeRunspaceConfigurationSettings.ExchangeApplication.ECP || base.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication == ExchangeRunspaceConfigurationSettings.ExchangeApplication.OSP))
         {
             if (!this.Force && !base.ShouldContinue(new LocalizedString(string.Format("{0} {1}", Strings.WarningMessageSetWebServicesVirtualDirectoryWindowsAuthentication(this.Identity.ToString()), Strings.ConfirmationMessageWebServicesVirtualDirectoryContinue))))
             {
                 TaskLogger.LogExit();
                 return;
             }
         }
         else
         {
             this.WriteWarning(Strings.WarningMessageSetWebServicesVirtualDirectoryWindowsAuthentication(this.Identity.ToString()));
             if (!this.Force && !base.ShouldContinue(Strings.ConfirmationMessageWebServicesVirtualDirectoryContinue))
             {
                 TaskLogger.LogExit();
                 return;
             }
         }
     }
     this.DataObject.CertificateAuthentication = null;
     base.InternalProcessRecord();
     base.InternalEnableLiveIdNegotiateAuxiliaryModule();
     if (Datacenter.IsMicrosoftHostedOnly(true))
     {
         string text = string.Format("{0}/{1}", this.DataObject.MetabasePath, "Nego2");
         if (!IisUtility.Exists(text))
         {
             DirectoryEntry directoryEntry = IisUtility.CreateWebDirObject(this.DataObject.MetabasePath, null, "Nego2");
             IisUtility.SetProperty(directoryEntry, "AccessFlags", MetabasePropertyTypes.AccessFlags.Read | MetabasePropertyTypes.AccessFlags.Script, true);
             directoryEntry.CommitChanges();
         }
         ExchangeServiceVDirHelper.SetSplitVirtualDirectoryAuthenticationMethods(this.DataObject, text, new Task.TaskErrorLoggingDelegate(base.WriteError), this.MetabaseSetPropertiesFailureMessage);
         ExchangeServiceVDirHelper.ForceAnonymous(text);
     }
     ExchangeServiceVDirHelper.ForceAnonymous(this.DataObject.MetabasePath);
     ExchangeServiceVDirHelper.EwsAutodiscMWA.OnSetManageWCFEndpoints(this, ExchangeServiceVDirHelper.EwsAutodiscMWA.EndpointProtocol.Ews, this.WSSecurityAuthentication, this.DataObject);
     this.UpdateCompressionSettings();
     TaskLogger.LogExit();
 }
Exemplo n.º 11
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (this.IsDefaultAutoGroupPolicyTag && this.IsDefaultModeratedRecipientsPolicyTag)
            {
                base.WriteError(new ArgumentException(Strings.ErrorMultipleDefaultRetentionPolicyTag), ErrorCategory.InvalidArgument, this.DataObject.Identity);
            }
            if (this.IsDefaultAutoGroupPolicyTag)
            {
                this.DataObject.IsDefaultAutoGroupPolicyTag = true;
                this.existingDefaultPolicyTags = ApprovalUtils.GetDefaultRetentionPolicyTag((IConfigurationSession)base.DataSession, ApprovalApplicationId.AutoGroup, int.MaxValue);
            }
            else if (this.IsDefaultModeratedRecipientsPolicyTag)
            {
                this.DataObject.IsDefaultModeratedRecipientsPolicyTag = true;
                this.existingDefaultPolicyTags = ApprovalUtils.GetDefaultRetentionPolicyTag((IConfigurationSession)base.DataSession, ApprovalApplicationId.ModeratedRecipient, int.MaxValue);
            }
            if (base.ParameterSetName == "UpgradeManagedFolder" && this.ElcFolderToUpgrade == null)
            {
                return;
            }
            if (Datacenter.IsMicrosoftHostedOnly(false))
            {
                List <RetentionPolicyTag> allRetentionTags = AdTagReader.GetAllRetentionTags(this.ConfigurationSession, base.OrganizationId);
                if (allRetentionTags.Count >= 500)
                {
                    base.WriteError(new RetentionPolicyTagTaskException(Strings.ErrorTenantRetentionTagLimitReached(500)), ErrorCategory.InvalidOperation, this.DataObject);
                }
            }
            if (this.DataObject.Type == ElcFolderType.RecoverableItems && !this.contentSettingsObject.RetentionAction.Equals(RetentionActionType.MoveToArchive))
            {
                base.WriteError(new ArgumentException(Strings.ErrorDumpsterTagWrongRetentionAction), ErrorCategory.InvalidArgument, this);
            }
            if (this.DataObject.Type != ElcFolderType.All && !this.contentSettingsObject.MessageClass.Equals(ElcMessageClass.AllMailboxContent))
            {
                base.WriteError(new RetentionPolicyTagTaskException(Strings.ErrorOnlyDefaultTagAllowCustomizedMessageClass), ErrorCategory.InvalidOperation, this.DataObject);
            }
            string tagName;

            if (this.DataObject.RetentionId != Guid.Empty && !(base.DataSession as IConfigurationSession).CheckForRetentionTagWithConflictingRetentionId(this.DataObject.RetentionId, out tagName))
            {
                base.WriteError(new RetentionPolicyTagTaskException(Strings.ErrorRetentionIdConflictsWithRetentionTag(this.DataObject.RetentionId.ToString(), tagName)), ErrorCategory.InvalidOperation, this.DataObject);
            }
            ValidationError[] array = this.contentSettingsObject.Validate();
            if (array.Length > 0)
            {
                for (int i = 0; i < array.Length; i++)
                {
                    this.WriteError(new DataValidationException(array[i]), (ErrorCategory)1003, this.contentSettingsObject.Identity, array.Length - 1 == i);
                }
            }
        }
Exemplo n.º 12
0
        internal static bool IsExchangeDataCenter()
        {
            bool result = false;

            try
            {
                result = Datacenter.IsMicrosoftHostedOnly(true);
            }
            catch (CannotDetermineExchangeModeException)
            {
            }
            return(result);
        }
Exemplo n.º 13
0
 public static ServiceState GetDefaultState(ServerComponentEnum serverComponent)
 {
     ServerComponentStateManager.ComponentStateData componentStateData;
     if (!ServerComponentStateManager.defaultComponentStates.TryGetValue(serverComponent, out componentStateData))
     {
         return(ServiceState.Active);
     }
     if (!Datacenter.IsMicrosoftHostedOnly(true))
     {
         return(componentStateData.OnPremState);
     }
     return(componentStateData.DatacenterState);
 }
        private List <string> GetCannedRoleNames()
        {
            RoleDefinition[] array;
            if (InstallCannedRbacRoleAssignments.isFfoEnvironment)
            {
                array = InstallCannedRbacRoles.MergeRoleDefinitions(CannedEOPRoles_Datacenter.Definition, CannedUCCRoles_Datacenter.Definition);
            }
            else if (this.Organization == null)
            {
                if (Datacenter.IsMicrosoftHostedOnly(false))
                {
                    array = InstallCannedRbacRoles.MergeRoleDefinitions(CannedRoles_Datacenter.Definition, CannedWebServiceRoles_Datacenter.Definition);
                }
                else if (Datacenter.IsPartnerHostedOnly(false))
                {
                    array = InstallCannedRbacRoles.MergeRoleDefinitions(CannedRoles_Hosting.Definition, CannedWebServiceRoles_Hosting.Definition);
                }
                else if (Datacenter.IsDatacenterDedicated(false))
                {
                    array = InstallCannedRbacRoles.MergeRoleDefinitions(CannedRoles_Dedicated.Definition, CannedWebServiceRoles_Hosting.Definition);
                }
                else
                {
                    array = InstallCannedRbacRoles.MergeRoleDefinitions(CannedRoles_Enterprise.Definition, CannedWebServiceRoles_Enterprise.Definition);
                }
            }
            else if (Datacenter.IsPartnerHostedOnly(false))
            {
                array = InstallCannedRbacRoles.MergeRoleDefinitions(CannedRoles_HostedTenant.Definition, CannedWebServiceRoles_HostedTenant.Definition);
            }
            else
            {
                array = InstallCannedRbacRoles.MergeRoleDefinitions(CannedRoles_Tenant.Definition, CannedWebServiceRoles_Tenant.Definition);
            }
            List <string> list = new List <string>(array.Length);

            foreach (RoleDefinition roleDefinition in array)
            {
                list.Add(roleDefinition.RoleName);
                if (base.ServicePlanSettings != null && Array.BinarySearch <RoleType>(ExchangeRole.EndUserRoleTypes, roleDefinition.RoleType) >= 0)
                {
                    foreach (ServicePlan.MailboxPlan mailboxPlan in base.ServicePlanSettings.MailboxPlans)
                    {
                        list.Add(string.Format("{0}_{1}", roleDefinition.RoleName, mailboxPlan.Name));
                    }
                }
            }
            list.Sort();
            return(list);
        }
 private void CheckRoleAssignmentDefinition(RoleAssignmentDefinition roleAssignment)
 {
     if (roleAssignment.UseSafeRole)
     {
         if (!Datacenter.IsMicrosoftHostedOnly(false))
         {
             Datacenter.IsDatacenterDedicated(false);
         }
         if (Datacenter.IsMicrosoftHostedOnly(false) || Datacenter.IsDatacenterDedicated(false))
         {
             OrganizationIdParameter organization = this.Organization;
         }
     }
 }
Exemplo n.º 16
0
        internal static bool IsMicrosoftHostedOnly()
        {
            bool result = false;

            try
            {
                result = Datacenter.IsMicrosoftHostedOnly(true);
            }
            catch (CannotDetermineExchangeModeException ex)
            {
                ExTraceGlobals.CoBrandingTracer.TraceError <string>(0L, "HelpProvider::IsMicrosoftHostedOnly CannotDetermineExchangeModeException {0}.", ex.Message);
            }
            return(result);
        }
Exemplo n.º 17
0
 // Token: 0x06000312 RID: 786 RVA: 0x000109A4 File Offset: 0x0000EBA4
 internal void ValidatePartitionFqdn(string fqdn)
 {
     if (string.IsNullOrEmpty(fqdn))
     {
         throw new ArgumentNullException("fqdn");
     }
     if (!Fqdn.IsValidFqdn(fqdn.Trim()))
     {
         throw new ArgumentException(string.Format("Invalid fqdn parameter value: '{0}'", fqdn.Trim()));
     }
     if (Datacenter.IsMicrosoftHostedOnly(true) && !Datacenter.IsDatacenterDedicated(true) && !PartitionId.IsLocalForestPartition(fqdn) && !fqdn.EndsWith("outlook.com", StringComparison.OrdinalIgnoreCase) && !fqdn.EndsWith("exchangelabs.com", StringComparison.OrdinalIgnoreCase) && !fqdn.EndsWith("outlook.cn", StringComparison.OrdinalIgnoreCase) && !fqdn.EndsWith("extest.microsoft.com", StringComparison.OrdinalIgnoreCase))
     {
         throw new ArgumentException(DirectoryStrings.InvalidPartitionFqdn(fqdn));
     }
 }
Exemplo n.º 18
0
 internal static void Initialize(ExEventLog eventLog, Action stopService)
 {
     Configuration.GeneralTracer.TraceDebug(0L, "Configuration.Initialize");
     Configuration.ServiceEnabled     = true;
     Configuration.stopService        = stopService;
     Configuration.eventLog           = eventLog;
     Configuration.EncryptionRequired = true;
     Configuration.LoadAppConfig();
     Configuration.LoadRegistryConfig();
     if (Configuration.LoadADConfiguration())
     {
         Configuration.ExchangeRpcClientAccessChangeNotification(null);
     }
     Configuration.IsDatacenter = Datacenter.IsMicrosoftHostedOnly(true);
 }
 private bool TryIsDatacenter()
 {
     this.result.SetTask(Strings.InfoCheckMode);
     try
     {
         this.datacenter = (Datacenter.IsMicrosoftHostedOnly(true) || Datacenter.IsPartnerHostedOnly(true));
         this.result.SetSuccessResult(this.datacenter ? Strings.InfoDatacenterMode : Strings.InfoEnterpriseMode);
     }
     catch (CannotDetermineExchangeModeException ex)
     {
         this.result.SetFailureResult(Strings.ErrorFailedToCheckMode, ex, true);
         return(false);
     }
     return(true);
 }
Exemplo n.º 20
0
 protected override void InternalProcessComplete()
 {
     base.InternalProcessComplete();
     if (Datacenter.IsMicrosoftHostedOnly(true))
     {
         DirectoryEntry directoryEntry = IisUtility.CreateWebDirObject(this.DataObject.MetabasePath, null, "Nego2");
         IisUtility.SetProperty(directoryEntry, "AccessFlags", MetabasePropertyTypes.AccessFlags.Read | MetabasePropertyTypes.AccessFlags.Script, true);
         directoryEntry.CommitChanges();
         string nego2Path = string.Format("{0}/{1}", this.DataObject.MetabasePath, "Nego2");
         ExchangeServiceVDirHelper.SetSplitVirtualDirectoryAuthenticationMethods(this.DataObject, nego2Path, new Task.TaskErrorLoggingDelegate(base.WriteError), this.MetabaseSetPropertiesFailureMessage);
     }
     else if (base.Role == VirtualDirectoryRole.ClientAccess)
     {
         ExchangeServiceVDirHelper.CheckAndUpdateLocalhostWebBindingsIfNecessary(this.DataObject);
     }
     ExchangeServiceVDirHelper.EwsAutodiscMWA.OnNewManageWCFEndpoints(this, ExchangeServiceVDirHelper.EwsAutodiscMWA.EndpointProtocol.Ews, this.DataObject.BasicAuthentication, this.DataObject.WindowsAuthentication, this.DataObject.WSSecurityAuthentication ?? false, this.DataObject.OAuthAuthentication ?? false, this.DataObject, base.Role);
 }
        internal static RoleGroupCollection RoleGroupsToCreate()
        {
            RoleGroupCollection roleGroupCollection = new RoleGroupCollection();

            Datacenter.ExchangeSku exchangeSku = Datacenter.GetExchangeSku();
            RoleGroupRoleMapping[] definition;
            if (Datacenter.IsMicrosoftHostedOnly(false))
            {
                definition = Datacenter_RoleGroupDefinition.Definition;
            }
            else if (Datacenter.IsPartnerHostedOnly(false))
            {
                definition = Hosting_RoleGroupDefinition.Definition;
            }
            else if (Datacenter.IsDatacenterDedicated(false))
            {
                definition = Dedicated_RoleGroupDefinition.Definition;
            }
            else
            {
                definition = Enterprise_RoleGroupDefinition.Definition;
            }
            using (List <RoleGroupDefinition> .Enumerator enumerator = RoleGroupDefinitions.RoleGroups.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    RoleGroupDefinition roleGroup = enumerator.Current;
                    if (roleGroup.AlwaysCreateOnSku != null && roleGroup.AlwaysCreateOnSku.Contains(exchangeSku))
                    {
                        roleGroupCollection.Add(new RoleGroupDefinition(roleGroup));
                    }
                    else
                    {
                        RoleGroupRoleMapping roleGroupRoleMapping = definition.FirstOrDefault((RoleGroupRoleMapping x) => x.RoleGroup.Equals(roleGroup.Name, StringComparison.OrdinalIgnoreCase));
                        if (roleGroupRoleMapping != null)
                        {
                            roleGroupCollection.Add(new RoleGroupDefinition(roleGroup));
                        }
                    }
                }
            }
            return(roleGroupCollection);
        }
Exemplo n.º 22
0
        protected void FindAndUpdateDerivedRoles(ExchangeRole updatedParentRole, RoleEntry[] oldParentRoleEntries, RoleDefinition roleDefinition, ref int recursionCount)
        {
            ExTraceGlobals.AccessCheckTracer.TraceFunction(20005L, "-->FindAndUpdateDerivedRoles: updatedParentRole.Name = {0}, updatedParentRole.RoleEntries.Count = {1}, oldParentRoleEntries.Length = {2}, recursionCount = {3}", new object[]
            {
                updatedParentRole.Name,
                updatedParentRole.RoleEntries.Count,
                oldParentRoleEntries.Length,
                recursionCount
            });
            if (++recursionCount >= 1000)
            {
                return;
            }
            bool flag  = false;
            bool flag2 = this.settings.Organization == null && (Datacenter.IsMicrosoftHostedOnly(false) || Datacenter.IsDatacenterDedicated(false)) && roleDefinition.ContainsProhibitedActions(InstallCannedRbacRoles.DCProhibitedActions);
            ADPagedReader <ExchangeRole> adpagedReader = this.settings.ConfigurationSession.FindPaged <ExchangeRole>(updatedParentRole.Id, QueryScope.OneLevel, null, null, 0);

            foreach (ExchangeRole exchangeRole in adpagedReader)
            {
                this.settings.LogReadObject(exchangeRole);
                RoleEntry[]      array = this.PrepareRoleForUpgradeAndGetOldSortedEntries(exchangeRole, false);
                List <RoleEntry> value;
                if (1 == recursionCount && flag2 && exchangeRole.Name.Equals(RoleDefinition.GetDCSafeNameForRole(updatedParentRole.Name), StringComparison.OrdinalIgnoreCase))
                {
                    value = roleDefinition.GetRoleEntriesFilteringProhibitedActions(null, InstallCannedRbacRoles.DCProhibitedActions);
                    flag  = true;
                }
                else
                {
                    value = this.GetListOfRoleEntriesForChildRole(oldParentRoleEntries, array, updatedParentRole.RoleEntries.ToArray(), exchangeRole.IsChanged(ADObjectSchema.ExchangeVersion));
                }
                exchangeRole.RoleEntries = new MultiValuedProperty <RoleEntry>(value);
                this.FindAndUpdateDerivedRoles(exchangeRole, array, roleDefinition, ref recursionCount);
                this.SaveDerivedRoleAndWarnOnValidationErrors(exchangeRole);
                ExTraceGlobals.AccessCheckTracer.TraceFunction <string, int>(20005L, "----FindAndUpdateDerivedRoles: role.Name = {0}, role.RoleEntries.Count = {1}", exchangeRole.Name, exchangeRole.RoleEntries.Count);
            }
            if (1 == recursionCount && !flag)
            {
                this.CreateDCSafeRoleIfNeeded(updatedParentRole, roleDefinition);
            }
            recursionCount--;
            ExTraceGlobals.AccessCheckTracer.TraceFunction <int>(20005L, "<--FindAndUpdateDerivedRoles: recursionCount = {0}", recursionCount);
        }
Exemplo n.º 23
0
        protected override void InternalStateReset()
        {
            if (string.IsNullOrEmpty(this.Name) && string.IsNullOrEmpty(this.DisplayName))
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorNewTeamMailboxParameter), ExchangeErrorCategory.Client, null);
            }
            IList <TeamMailboxProvisioningPolicy> teamMailboxPolicies = this.GetTeamMailboxPolicies();

            if (teamMailboxPolicies == null || teamMailboxPolicies.Count == 0)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorTeamMailboxCanNotLoadPolicy), ExchangeErrorCategory.Client, null);
            }
            this.provisioningPolicy = teamMailboxPolicies[0];
            if (string.IsNullOrEmpty(this.Name))
            {
                string prefix = null;
                if (!string.IsNullOrEmpty(this.provisioningPolicy.AliasPrefix))
                {
                    prefix = this.provisioningPolicy.AliasPrefix;
                }
                else if (this.provisioningPolicy.DefaultAliasPrefixEnabled)
                {
                    prefix = (Datacenter.IsMicrosoftHostedOnly(true) ? "SMO-" : "SM-");
                }
                this.Name = TeamMailboxHelper.GenerateUniqueAliasForSiteMailbox(base.TenantGlobalCatalogSession, base.CurrentOrganizationId, this.DisplayName, prefix, Datacenter.IsMicrosoftHostedOnly(true), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
            }
            if (Datacenter.IsMicrosoftHostedOnly(true))
            {
                SiteMailboxAddressesTemplate siteMailboxAddressesTemplate = null;
                try
                {
                    siteMailboxAddressesTemplate = SiteMailboxAddressesTemplate.GetSiteMailboxAddressesTemplate(this.ConfigurationSession, base.ProvisioningCache);
                }
                catch (ErrorSiteMailboxCannotLoadAddressTemplateException exception)
                {
                    base.WriteError(exception, ExchangeErrorCategory.Client, null);
                }
                base.UserPrincipalName = RecipientTaskHelper.GenerateUniqueUserPrincipalName(base.TenantGlobalCatalogSession, this.Name, siteMailboxAddressesTemplate.UserPrincipalNameDomain, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                base.UserSpecifiedParameters["SpecificAddressTemplates"] = siteMailboxAddressesTemplate.AddressTemplates;
            }
            base.InternalStateReset();
        }
Exemplo n.º 24
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     if (Server.IsSubscribedGateway(base.GlobalConfigSession))
     {
         base.WriteError(new CannotRunOnSubscribedEdgeException(), ErrorCategory.InvalidOperation, null);
     }
     base.InternalValidate();
     if (this.SkipDomainNameValidation)
     {
         if (!TemplateTenantConfiguration.IsTemplateTenant(base.OrganizationId))
         {
             base.WriteError(new CannotBypassDomainNameValidationException(), ErrorCategory.InvalidOperation, null);
         }
     }
     else
     {
         NewAcceptedDomain.ValidateDomainName(this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
     }
     if (this.DataObject.DomainName.Equals(SmtpDomainWithSubdomains.StarDomain))
     {
         this.WriteWarning(Strings.WarnAboutStarAcceptedDomain);
     }
     NewAcceptedDomain.DomainAdditionValidator domainAdditionValidator = new NewAcceptedDomain.DomainAdditionValidator(this);
     domainAdditionValidator.ValidateAllPolicies();
     if (this.DataObject.InitialDomain)
     {
         NewAcceptedDomain.ValidateInitialDomain(this.DataObject, this.ConfigurationSession, new Task.TaskErrorLoggingDelegate(base.WriteError));
     }
     if (this.DataObject.DomainType == AcceptedDomainType.ExternalRelay && (Datacenter.IsMicrosoftHostedOnly(true) || Datacenter.IsForefrontForOfficeDatacenter()))
     {
         base.WriteError(new ExternalRelayDomainsAreNotAllowedInDatacenterAndFfoException(), ErrorCategory.InvalidOperation, null);
     }
     if (base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient) && this.CatchAllRecipient != null)
     {
         this.resolvedCatchAllRecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.CatchAllRecipient, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.CatchAllRecipientNotExists(this.CatchAllRecipient)), new LocalizedString?(Strings.CatchAllRecipientNotUnique(this.CatchAllRecipient)), ExchangeErrorCategory.Client);
     }
     AcceptedDomainUtility.ValidateCatchAllRecipient(this.resolvedCatchAllRecipient, this.DataObject, base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient), new Task.TaskErrorLoggingDelegate(base.WriteError));
     AcceptedDomainUtility.ValidateIfOutboundConnectorToRouteDomainIsPresent(base.DataSession, this.DataObject, new Task.TaskWarningLoggingDelegate(this.WriteWarning));
     AcceptedDomainUtility.ValidateMatchSubDomains(this.DataObject.MatchSubDomains, this.DataObject.DomainType, new Task.TaskErrorLoggingDelegate(base.WriteError));
     TaskLogger.LogExit();
 }
Exemplo n.º 25
0
 static Util()
 {
     try
     {
         Util.isMicrosoftHostedOnly = Datacenter.IsMicrosoftHostedOnly(true);
     }
     catch (CannotDetermineExchangeModeException)
     {
         Util.isMicrosoftHostedOnly = false;
     }
     try
     {
         Util.isPartnerHostedOnly = Datacenter.IsPartnerHostedOnly(true);
     }
     catch (CannotDetermineExchangeModeException)
     {
         Util.isPartnerHostedOnly = false;
     }
     Util.isDataCenter = Datacenter.IsMultiTenancyEnabled();
 }
Exemplo n.º 26
0
        protected void CreateDCSafeRoleIfNeeded(ExchangeRole cannedRole, RoleDefinition roleDefinition)
        {
            if (this.settings.Organization != null || !Datacenter.IsMicrosoftHostedOnly(false))
            {
                return;
            }
            if (!roleDefinition.ContainsProhibitedActions(InstallCannedRbacRoles.DCProhibitedActions))
            {
                return;
            }
            ExchangeRole exchangeRole = roleDefinition.GenerateRole(null, cannedRole.Id, null, null);

            exchangeRole.Name           = RoleDefinition.GetDCSafeNameForRole(cannedRole.Name);
            exchangeRole.RoleEntries    = new MultiValuedProperty <RoleEntry>(roleDefinition.GetRoleEntriesFilteringProhibitedActions(null, InstallCannedRbacRoles.DCProhibitedActions));
            exchangeRole.OrganizationId = this.settings.OrganizationId;
            if (exchangeRole.RoleEntries.Count != 0)
            {
                this.SaveRoleAndWarnOnFailure(exchangeRole);
            }
        }
Exemplo n.º 27
0
 static Globals()
 {
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         Globals.processName              = currentProcess.MainModule.ModuleName;
         Globals.processId                = currentProcess.Id;
         Globals.processProcessName       = currentProcess.ProcessName;
         Globals.isExchangeTestExecutable = Globals.CheckExchangeTestExecutables(Globals.processProcessName);
     }
     Globals.SetProcessNameAppName();
     Globals.logger = new ExEventLog(Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.TopologyProviderTracer.Category, "MSExchange ADAccess");
     Globals.logger.SetEventPeriod(Globals.GetIntValueFromRegistry("LogPeriod", 900, 0));
     Globals.isDatacenterFlag              = Datacenter.IsMultiTenancyEnabled();
     Globals.isMicrosoftHostedOnly         = Datacenter.IsMicrosoftHostedOnly(true);
     Globals.testPassTypeValue             = Globals.GetValueFromRegistry <string>("SOFTWARE\\Microsoft\\Exchange_Test\\v15", "TestPassType", string.Empty, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
     Globals.forceLdapLatency              = (Globals.GetValueFromRegistry <int>("SOFTWARE\\Microsoft\\Exchange_Test\\v15", "ForceLdapLatency", 0, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer) > 0);
     Globals.TenantInfoCacheTime           = Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "TenantInfoCacheTime", 1800, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
     Globals.RecipientInfoCacheTime        = Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "RecipientInfoCacheTime", 300, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
     Globals.RecipientTokenGroupsCacheTime = Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "RecipientTokenGroupsCacheTime", 900, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
     Globals.EnableNotification            = (Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "EnableNotification", 1, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer) == 0);
     Globals.LdapConnectionPoolSize        = Globals.GetValueFromRegistry <int>("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess", "LdapConnectionPoolSize", 5, Microsoft.Exchange.Diagnostics.Components.Data.Directory.ExTraceGlobals.ADTopologyTracer);
 }
        protected override void InternalProcessRecord()
        {
            ITopologyConfigurationSession topologyConfigurationSession = (ITopologyConfigurationSession)base.DataSession;
            ADObjectId   rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(base.DomainController, null);
            Organization organization       = topologyConfigurationSession.Read <Organization>(rootOrgContainerId);

            if (organization == null)
            {
                base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorOrganizationNotFound(rootOrgContainerId)), ErrorCategory.ObjectNotFound, rootOrgContainerId);
            }
            if (organization.ExchangeVersion == ExchangeObjectVersion.Exchange2003 && !topologyConfigurationSession.HasAnyServer())
            {
                base.WriteVerbose(Strings.VerboseBumpOrganizationExchangeVersion(organization.Identity.ToString(), organization.ExchangeVersion.ToString(), Organization.CurrentExchangeRootOrgVersion.ToString()));
                organization.SetExchangeVersion(Organization.CurrentExchangeRootOrgVersion);
                organization[ADLegacyVersionableObjectSchema.MinAdminVersion] = Organization.CurrentExchangeRootOrgVersion.ExchangeBuild.ToExchange2003FormatInt32();
                if (Datacenter.IsMicrosoftHostedOnly(true))
                {
                    organization[OrganizationSchema.ForestMode] = ForestModeFlags.TenantConfigInDomainNC;
                }
                topologyConfigurationSession.Save(organization);
            }
        }
Exemplo n.º 29
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            bool flag = Datacenter.IsMicrosoftHostedOnly(true);
            Dictionary <ResourceHealthComponent, bool> dictionary = flag ? InstallResourceHealthActiveFlags.dataCenterComponentMapping : InstallResourceHealthActiveFlags.enterpriseComponentMapping;

            base.WriteVerbose(new LocalizedString(string.Format("Install is {0}", flag ? "Datacenter" : "Enterprise")));
            foreach (KeyValuePair <ResourceHealthComponent, bool> keyValuePair in dictionary)
            {
                bool?flag2 = this.CheckRegistryActive(keyValuePair.Key);
                if (flag2 != null)
                {
                    base.WriteVerbose(new LocalizedString(string.Format("{0} was {1}.  Install suggests {2}.  However, we will not overwrite.", keyValuePair.Key, flag2.Value, keyValuePair.Value)));
                }
                else
                {
                    base.WriteVerbose(new LocalizedString(string.Format("Attempting to set component {0} to {1}", keyValuePair.Key, keyValuePair.Value)));
                    this.SetRegistryFlag(keyValuePair.Key, keyValuePair.Value);
                }
            }
            TaskLogger.LogExit();
        }
Exemplo n.º 30
0
 internal static bool IsDataCenterCafe(VirtualDirectoryRole role)
 {
     return(role == VirtualDirectoryRole.ClientAccess && Datacenter.IsMicrosoftHostedOnly(true));
 }