Esempio n. 1
0
        protected override void ProcessMetabaseProperties(ExchangeVirtualDirectory dataObject)
        {
            TaskLogger.LogEnter();
            base.ProcessMetabaseProperties(dataObject);
            ADOwaVirtualDirectory adowaVirtualDirectory = (ADOwaVirtualDirectory)dataObject;

            try
            {
                WebAppVirtualDirectoryHelper.UpdateFromMetabase(adowaVirtualDirectory);
                if (adowaVirtualDirectory.GzipLevel != GzipLevel.Off && !adowaVirtualDirectory.IsExchange2007OrLater && this.IsMailboxRoleInstalled(adowaVirtualDirectory))
                {
                    this.WriteWarning(Strings.OwaGzipEnabledOnLegacyVirtualDirectoryWhenMailboxRoleInstalledWarning(adowaVirtualDirectory.Id.Name));
                }
            }
            catch (Exception ex)
            {
                TaskLogger.Trace("Exception occurred: {0}", new object[]
                {
                    ex.Message
                });
                this.WriteError(new LocalizedException(Strings.OwaMetabaseGetPropertiesFailure), ErrorCategory.InvalidOperation, null, false);
            }
            finally
            {
                TaskLogger.LogExit();
            }
        }
Esempio n. 2
0
        protected override void InternalProcessMetabase()
        {
            ADOwaVirtualDirectory adowaVirtualDirectory = WebAppVirtualDirectoryHelper.FindWebAppVirtualDirectoryInSameWebSite <ADOwaVirtualDirectory>(this.DataObject, base.DataSession);

            if (adowaVirtualDirectory != null && !string.IsNullOrEmpty(adowaVirtualDirectory.DefaultDomain))
            {
                this.DataObject.DefaultDomain = adowaVirtualDirectory.DefaultDomain;
            }
            WebAppVirtualDirectoryHelper.UpdateMetabase(this.DataObject, this.DataObject.MetabasePath, true);
            if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).CmdletInfra.ReportingWebService.Enabled)
            {
                string physicalPath;
                List <MetabaseProperty> metabaseProperties;
                if (base.Role == VirtualDirectoryRole.ClientAccess)
                {
                    physicalPath       = System.IO.Path.Combine(ConfigurationContext.Setup.InstallPath, "FrontEnd\\HttpProxy\\ReportingWebService");
                    metabaseProperties = this.CreateFrontEndVdirProperies();
                }
                else
                {
                    physicalPath       = System.IO.Path.Combine(ConfigurationContext.Setup.InstallPath, "ClientAccess\\ReportingWebService");
                    metabaseProperties = this.CreateBackEndVdirProperies();
                }
                this.CreateReportingWebServiceVDir(this.DataObject.MetabasePath, physicalPath, metabaseProperties);
                if (base.Role == VirtualDirectoryRole.ClientAccess)
                {
                    string parent = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", new object[]
                    {
                        this.DataObject.MetabasePath,
                        "ReportingWebService"
                    });
                    this.CreatePartnerVDir(parent);
                }
            }
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            ADOwaVirtualDirectory adowaVirtualDirectory = WebAppVirtualDirectoryHelper.FindWebAppVirtualDirectoryInSameWebSite <ADOwaVirtualDirectory>(this.DataObject, base.DataSession);

            if (adowaVirtualDirectory != null)
            {
                WebAppVirtualDirectoryHelper.CheckTwoWebAppVirtualDirectories(this.DataObject, adowaVirtualDirectory, new Action <string>(base.WriteWarning), Strings.EcpAuthenticationNotMatchOwaWarning, Strings.EcpUrlNotMatchOwaWarning);
            }
            else
            {
                this.WriteWarning(Strings.CreateOwaForEcpWarning);
            }
            if (this.DataObject.IsChanged(ADEcpVirtualDirectorySchema.AdminEnabled) || this.DataObject.IsChanged(ADEcpVirtualDirectorySchema.OwaOptionsEnabled))
            {
                this.WriteWarning(Strings.NeedIisRestartForChangingECPFeatureWarning);
            }
            base.InternalProcessRecord();
            ADEcpVirtualDirectory dataObject = this.DataObject;

            WebAppVirtualDirectoryHelper.UpdateMetabase(dataObject, dataObject.MetabasePath, true);
            if (!ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(this.DataObject) && base.Fields.Contains("FormsAuthentication"))
            {
                ExchangeServiceVDirHelper.UpdateFrontEndHttpModule(this.DataObject, this.FormsAuthentication);
            }
            if (base.Fields.Contains("AdfsAuthentication"))
            {
                ExchangeServiceVDirHelper.SetAdfsAuthenticationModule(this.DataObject.AdfsAuthentication, false, this.DataObject);
            }
            TaskLogger.LogExit();
        }
Esempio n. 4
0
 protected override void WriteResultMetabaseFixup(ExchangeVirtualDirectory targetDataObject)
 {
     base.WriteResultMetabaseFixup(targetDataObject);
     if (WebAppVirtualDirectoryHelper.FindWebAppVirtualDirectoryInSameWebSite <ADEcpVirtualDirectory>((ExchangeWebAppVirtualDirectory)targetDataObject, base.DataSession) == null)
     {
         this.WriteWarning(Strings.CreateEcpForOwaWarning);
     }
 }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            ADE4eVirtualDirectory dataObject = this.DataObject;

            WebAppVirtualDirectoryHelper.UpdateMetabase(dataObject, dataObject.MetabasePath, true);
            TaskLogger.LogExit();
        }
        protected override void ProcessMetabaseProperties(ExchangeVirtualDirectory dataObject)
        {
            TaskLogger.LogEnter();
            base.ProcessMetabaseProperties(dataObject);
            ADEcpVirtualDirectory webAppVirtualDirectory = (ADEcpVirtualDirectory)dataObject;

            WebAppVirtualDirectoryHelper.UpdateFromMetabase(webAppVirtualDirectory);
            TaskLogger.LogExit();
        }
        protected override void InternalProcessMetabase()
        {
            ADOwaVirtualDirectory adowaVirtualDirectory = WebAppVirtualDirectoryHelper.FindWebAppVirtualDirectoryInSameWebSite <ADOwaVirtualDirectory>(this.DataObject, base.DataSession);

            if (adowaVirtualDirectory != null && !string.IsNullOrEmpty(adowaVirtualDirectory.DefaultDomain))
            {
                this.DataObject.DefaultDomain = adowaVirtualDirectory.DefaultDomain;
            }
            WebAppVirtualDirectoryHelper.UpdateMetabase(this.DataObject, this.DataObject.MetabasePath, true);
        }
 internal static void CheckTwoWebAppVirtualDirectories(ExchangeWebAppVirtualDirectory first, ExchangeWebAppVirtualDirectory second, Action <string> WriteWarning, LocalizedString authMethedNotMatch, LocalizedString urlNotMatch)
 {
     if ((first.IsModified(ExchangeWebAppVirtualDirectorySchema.BasicAuthentication) || first.IsModified(ExchangeWebAppVirtualDirectorySchema.DigestAuthentication) || first.IsModified(ExchangeWebAppVirtualDirectorySchema.FormsAuthentication) || first.IsModified(ExchangeWebAppVirtualDirectorySchema.LiveIdAuthentication) || first.IsModified(ExchangeWebAppVirtualDirectorySchema.WindowsAuthentication)) && (first.BasicAuthentication != second.BasicAuthentication || first.DigestAuthentication != second.DigestAuthentication || first.FormsAuthentication != second.FormsAuthentication || first.LiveIdAuthentication != second.LiveIdAuthentication || first.WindowsAuthentication != second.WindowsAuthentication))
     {
         WriteWarning(authMethedNotMatch);
     }
     if ((first.IsModified(ADVirtualDirectorySchema.InternalUrl) && !WebAppVirtualDirectoryHelper.IsUrlConsistent(first.InternalUrl, second.InternalUrl)) || (first.IsModified(ADVirtualDirectorySchema.ExternalUrl) && !WebAppVirtualDirectoryHelper.IsUrlConsistent(first.ExternalUrl, second.ExternalUrl)))
     {
         WriteWarning(urlNotMatch);
     }
 }
Esempio n. 9
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            ADOwaVirtualDirectory dataObject = this.DataObject;

            if (dataObject.ExchangeVersion.IsOlderThan(ADOwaVirtualDirectory.MinimumSupportedExchangeObjectVersion))
            {
                base.WriteError(new TaskException(Strings.ErrorSetOlderVirtualDirectory(dataObject.Identity.ToString(), dataObject.ExchangeVersion.ToString(), ADOwaVirtualDirectory.MinimumSupportedExchangeObjectVersion.ToString())), ErrorCategory.InvalidArgument, null);
            }
            if (dataObject.WebReadyFileTypes != null)
            {
                foreach (string text in dataObject.WebReadyFileTypes)
                {
                    if (!dataObject.WebReadyDocumentViewingSupportedFileTypes.Contains(text.ToLower()))
                    {
                        PropertyValidationError error     = new PropertyValidationError(DataStrings.ConstraintViolationValueIsNotInGivenStringArray(string.Join(",", dataObject.WebReadyDocumentViewingSupportedFileTypes.ToArray()), text), ADOwaVirtualDirectorySchema.WebReadyFileTypes, dataObject.WebReadyFileTypes);
                        DataValidationException exception = new DataValidationException(error);
                        base.WriteError(exception, ErrorCategory.InvalidArgument, this.DataObject.Identity);
                    }
                }
            }
            if (dataObject.WebReadyMimeTypes != null)
            {
                foreach (string text2 in dataObject.WebReadyMimeTypes)
                {
                    if (!dataObject.WebReadyDocumentViewingSupportedMimeTypes.Contains(text2.ToLower()))
                    {
                        PropertyValidationError error2     = new PropertyValidationError(DataStrings.ConstraintViolationValueIsNotInGivenStringArray(string.Join(",", dataObject.WebReadyDocumentViewingSupportedMimeTypes.ToArray()), text2), ADOwaVirtualDirectorySchema.WebReadyMimeTypes, dataObject.WebReadyMimeTypes);
                        DataValidationException exception2 = new DataValidationException(error2);
                        base.WriteError(exception2, ErrorCategory.InvalidArgument, this.DataObject.Identity);
                    }
                }
            }
            if (dataObject.InstantMessagingType == InstantMessagingTypeOptions.Msn && !Datacenter.IsMultiTenancyEnabled())
            {
                base.WriteError(new TaskException(Strings.ErrorMsnIsNotSupportedInEnterprise), ErrorCategory.InvalidArgument, null);
            }
            if (base.Fields.Contains("AdfsAuthentication") && this.DataObject.AdfsAuthentication)
            {
                ADEcpVirtualDirectory adecpVirtualDirectory = WebAppVirtualDirectoryHelper.FindWebAppVirtualDirectoryInSameWebSite <ADEcpVirtualDirectory>(this.DataObject, base.DataSession);
                if (adecpVirtualDirectory == null || !adecpVirtualDirectory.AdfsAuthentication)
                {
                    base.WriteError(new TaskException(Strings.CannotConfigureAdfsOwaWithoutEcpFirst), ErrorCategory.InvalidOperation, null);
                }
            }
        }
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     if (base.Fields.Contains("AdfsAuthentication") && !this.DataObject.AdfsAuthentication)
     {
         ADOwaVirtualDirectory adowaVirtualDirectory = WebAppVirtualDirectoryHelper.FindWebAppVirtualDirectoryInSameWebSite <ADOwaVirtualDirectory>(this.DataObject, base.DataSession);
         if (adowaVirtualDirectory != null && adowaVirtualDirectory.AdfsAuthentication)
         {
             base.WriteError(new TaskException(Strings.CannotDisableAdfsEcpWithoutOwaFirst), ErrorCategory.InvalidOperation, null);
         }
     }
 }
        internal static T FindWebAppVirtualDirectoryInSameWebSite <T>(ExchangeWebAppVirtualDirectory source, IConfigDataProvider dataProvider) where T : ExchangeWebAppVirtualDirectory, new()
        {
            T result = default(T);

            IConfigurable[] array = dataProvider.Find <T>(null, source.Server, true, null);
            if (array != null)
            {
                foreach (ExchangeWebAppVirtualDirectory exchangeWebAppVirtualDirectory in array)
                {
                    if (IisUtility.Exists(exchangeWebAppVirtualDirectory.MetabasePath))
                    {
                        WebAppVirtualDirectoryHelper.UpdateFromMetabase(exchangeWebAppVirtualDirectory);
                        if (string.Equals(source.WebSite, exchangeWebAppVirtualDirectory.WebSite, StringComparison.OrdinalIgnoreCase))
                        {
                            result = (T)((object)exchangeWebAppVirtualDirectory);
                            break;
                        }
                    }
                }
            }
            return(result);
        }
Esempio n. 12
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            ServerIdParameter serverIdParameter = new ServerIdParameter();
            Server            server            = (Server)base.GetDataObject <Server>(serverIdParameter, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString())));

            if (!server.IsClientAccessServer && !server.IsCafeServer)
            {
                base.ThrowTerminatingError(server.GetServerRoleError(ServerRole.ClientAccess), ErrorCategory.InvalidOperation, server);
            }
            using (ServerManager serverManager = new ServerManager())
            {
                ApplicationPool applicationPool = serverManager.ApplicationPools["MSExchangeOWAAppPool"];
                if (applicationPool == null)
                {
                    base.ThrowTerminatingError(new ADNoSuchObjectException(Strings.ErrorOWAVdirAppPoolNotExist), ErrorCategory.ObjectNotFound, serverManager.ApplicationPools);
                }
                applicationPool.ManagedPipelineMode = 0;
                serverManager.CommitChanges();
            }
            QueryFilter filter = new ComparisonFilter(ComparisonOperator.NotEqual, ADOwaVirtualDirectorySchema.OwaVersion, OwaVersions.Exchange2003or2000);

            base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(base.DataSession, typeof(ADOwaVirtualDirectory), filter, server.Identity, true));
            IConfigDataProvider dataSession = base.DataSession;
            IEnumerable <ADOwaVirtualDirectory> enumerable = dataSession.FindPaged <ADOwaVirtualDirectory>(filter, server.Identity, true, null, 0);

            foreach (ADOwaVirtualDirectory adowaVirtualDirectory in enumerable)
            {
                if (adowaVirtualDirectory.WebSite.Equals("Exchange Back End", StringComparison.OrdinalIgnoreCase))
                {
                    string metabasePath = adowaVirtualDirectory.MetabasePath;
                    try
                    {
                        base.WriteVerbose(Strings.VerboseConnectingIISVDir(metabasePath));
                        using (IisUtility.CreateIISDirectoryEntry(metabasePath))
                        {
                            if (!DirectoryEntry.Exists(metabasePath))
                            {
                                this.WriteWarning(Strings.OwaAdOrphanFound(adowaVirtualDirectory.Identity.ToString()));
                                continue;
                            }
                            if (!IisUtility.WebDirObjectExists(metabasePath, this.owaVersion))
                            {
                                base.WriteVerbose(Strings.VerboseCreatingChildVDir(this.owaVersion, metabasePath));
                                CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory();
                                createVirtualDirectory.Name   = this.owaVersion;
                                createVirtualDirectory.Parent = metabasePath;
                                createVirtualDirectory.CustomizedVDirProperties = OwaVirtualDirectoryHelper.GetVersionVDirProperties();
                                createVirtualDirectory.LocalPath = (string)IisUtility.GetIisPropertyValue("Path", createVirtualDirectory.CustomizedVDirProperties);
                                createVirtualDirectory.Initialize();
                                createVirtualDirectory.Execute();
                            }
                        }
                        OwaVirtualDirectoryHelper.CreateLegacyVDirs(metabasePath, true);
                        OwaVirtualDirectoryHelper.CreateOwaCalendarVDir(metabasePath, VirtualDirectoryRole.Mailbox);
                        if (ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(adowaVirtualDirectory))
                        {
                            WebAppVirtualDirectoryHelper.UpdateMetabase(adowaVirtualDirectory, metabasePath, true);
                        }
                    }
                    catch (COMException ex)
                    {
                        base.WriteError(new IISGeneralCOMException(ex.Message, ex.ErrorCode, ex), ErrorCategory.InvalidOperation, null);
                    }
                    if (adowaVirtualDirectory.ExchangeVersion.IsOlderThan(adowaVirtualDirectory.MaximumSupportedExchangeObjectVersion))
                    {
                        try
                        {
                            adowaVirtualDirectory.SetExchangeVersion(adowaVirtualDirectory.MaximumSupportedExchangeObjectVersion);
                            base.DataSession.Save(adowaVirtualDirectory);
                        }
                        catch (DataSourceTransientException exception)
                        {
                            base.WriteError(exception, ErrorCategory.WriteError, null);
                        }
                    }
                }
            }
            TaskLogger.LogExit();
        }
Esempio n. 13
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            bool flag = false;
            ADEcpVirtualDirectory adecpVirtualDirectory = WebAppVirtualDirectoryHelper.FindWebAppVirtualDirectoryInSameWebSite <ADEcpVirtualDirectory>(this.DataObject, base.DataSession);

            if (adecpVirtualDirectory != null)
            {
                if (this.DataObject.IsChanged(ExchangeWebAppVirtualDirectorySchema.DefaultDomain))
                {
                    adecpVirtualDirectory.DefaultDomain = this.DataObject.DefaultDomain;
                    flag = true;
                }
                WebAppVirtualDirectoryHelper.CheckTwoWebAppVirtualDirectories(this.DataObject, adecpVirtualDirectory, new Action <string>(base.WriteWarning), Strings.OwaAuthenticationNotMatchEcpWarning, Strings.OwaUrlNotMatchEcpWarning);
            }
            else
            {
                this.WriteWarning(Strings.CreateEcpForOwaWarning);
            }
            if (this.DataObject.IsChanged(ADOwaVirtualDirectorySchema.AnonymousFeaturesEnabled))
            {
                this.UpdateCalendarMetabase(this.DataObject);
            }
            if (this.DataObject.IsChanged(ADOwaVirtualDirectorySchema.IntegratedFeaturesEnabled))
            {
                this.UpdateIntegratedMetabase(this.DataObject);
            }
            if (this.DataObject.IsChanged(ExchangeWebAppVirtualDirectorySchema.LiveIdAuthentication))
            {
                this.UpdateOmaMetabase(this.DataObject);
            }
            base.InternalProcessRecord();
            ADOwaVirtualDirectory dataObject = this.DataObject;
            bool flag2 = ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(this.DataObject);

            if (dataObject.LiveIdAuthentication)
            {
                WebAppVirtualDirectoryHelper.UpdateMetabase(dataObject, dataObject.MetabasePath, true);
            }
            else
            {
                WebAppVirtualDirectoryHelper.UpdateMetabase(dataObject, dataObject.MetabasePath, flag2);
            }
            if (flag)
            {
                WebAppVirtualDirectoryHelper.UpdateMetabase(adecpVirtualDirectory, adecpVirtualDirectory.MetabasePath, true);
            }
            if (flag2)
            {
                ExchangeServiceVDirHelper.EwsAutodiscMWA.OnSetManageWCFEndpoints(this, ExchangeServiceVDirHelper.EwsAutodiscMWA.EndpointProtocol.OwaEws, false, this.DataObject);
            }
            else if (base.Fields.Contains("FormsAuthentication"))
            {
                ExchangeServiceVDirHelper.UpdateFrontEndHttpModule(this.DataObject, this.FormsAuthentication);
            }
            if (base.Fields.Contains("OAuthAuthentication"))
            {
                ExchangeServiceVDirHelper.SetOAuthAuthenticationModule(this.DataObject.OAuthAuthentication, false, this.DataObject);
            }
            if (base.Fields.Contains("AdfsAuthentication"))
            {
                ExchangeServiceVDirHelper.SetAdfsAuthenticationModule(this.DataObject.AdfsAuthentication, false, this.DataObject);
            }
            TaskLogger.LogExit();
        }
Esempio n. 14
0
        protected override void InternalProcessMetabase()
        {
            OwaVirtualDirectoryHelper.CreateOwaCalendarVDir(this.DataObject.MetabasePath, base.Role);
            if (base.Role == VirtualDirectoryRole.Mailbox)
            {
                OwaVirtualDirectoryHelper.CreateLegacyVDirs(this.DataObject.MetabasePath, false);
                try
                {
                    OwaVirtualDirectoryHelper.EnableIsapiFilter(this.DataObject, false);
                    goto IL_EB;
                }
                catch (Exception ex)
                {
                    TaskLogger.Trace("Exception occurred in EnableIsapiFilter(): {0}", new object[]
                    {
                        ex.Message
                    });
                    this.WriteWarning(Strings.OwaMetabaseIsapiInstallFailure);
                    throw;
                }
            }
            if (!Datacenter.IsMultiTenancyEnabled())
            {
                OwaVirtualDirectoryHelper.CreateOwaIntegratedVDir(this.DataObject.MetabasePath, base.Role);
                this.DataObject.IntegratedFeaturesEnabled = new bool?(true);
            }
            OwaVirtualDirectoryHelper.CreateOmaVDir(this.DataObject.MetabasePath, base.Role);
            try
            {
                OwaVirtualDirectoryHelper.EnableIsapiFilter(this.DataObject, true);
            }
            catch (Exception ex2)
            {
                TaskLogger.Trace("Exception occurred in EnableIsapiFilterForCafe(): {0}", new object[]
                {
                    ex2.Message
                });
                this.WriteWarning(Strings.OwaMetabaseIsapiInstallFailure);
                throw;
            }
            try
            {
IL_EB:
                WebAppVirtualDirectoryHelper.UpdateMetabase(this.DataObject, this.DataObject.MetabasePath, base.Role == VirtualDirectoryRole.Mailbox);
            }
            catch (Exception ex3)
            {
                TaskLogger.Trace("Exception occurred in UpdateMetabase(): {0}", new object[]
                {
                    ex3.Message
                });
                this.WriteWarning(Strings.OwaMetabaseGetPropertiesFailure);
                throw;
            }
            if (base.Role == VirtualDirectoryRole.Mailbox && Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6)
            {
                try
                {
                    Gzip.SetIisGzipMimeTypes();
                }
                catch (Exception ex4)
                {
                    TaskLogger.Trace("Exception occurred in SetIisGzipMimeTypes(): {0}", new object[]
                    {
                        ex4.Message
                    });
                    this.WriteWarning(Strings.SetIISGzipMimeTypesFailure);
                    throw;
                }
            }
        }
 protected override void StampChangesOn(IConfigurable dataObject)
 {
     WebAppVirtualDirectoryHelper.UpdateFromMetabase((ExchangeWebAppVirtualDirectory)dataObject);
     dataObject.ResetChangeTracking();
     base.StampChangesOn(dataObject);
 }
        protected override void WriteResultMetabaseFixup(ExchangeVirtualDirectory targetDataObject)
        {
            ExchangeWebAppVirtualDirectory target = (ExchangeWebAppVirtualDirectory)targetDataObject;

            WebAppVirtualDirectoryHelper.CopyMetabaseProperties(target, this.DataObject);
        }