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();
        }
Beispiel #2
0
 protected override void InternalProcessRecord()
 {
     base.InternalProcessRecord();
     if (ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(this.DataObject))
     {
         ExchangeServiceVDirHelper.ForceAnonymous(this.DataObject.MetabasePath);
     }
 }
Beispiel #3
0
        protected bool FilterBackendVdir(ExchangeVirtualDirectory vdir)
        {
            if (this.ShowMailboxVirtualDirectories || this.ShowBackEndVirtualDirectories)
            {
                return(false);
            }
            if (ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(vdir))
            {
                return(true);
            }
            Server server = (Server)base.GetDataObject <Server>(new ServerIdParameter(vdir.Server), base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound(vdir.Server.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(vdir.Server.ToString())));

            return(server.IsE15OrLater && !server.IsCafeServer && server.IsMailboxServer);
        }
Beispiel #4
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            if (!this.IsInSetup && this.DataObject.ExchangeVersion.IsOlderThan(ADMobileVirtualDirectory.MinimumSupportedExchangeObjectVersion))
            {
                base.WriteError(new TaskException(Strings.ErrorSetOlderVirtualDirectory(this.DataObject.Identity.ToString(), this.DataObject.ExchangeVersion.ToString(), ADMobileVirtualDirectory.MinimumSupportedExchangeObjectVersion.ToString())), ErrorCategory.InvalidArgument, null);
            }
            string metabasePath = this.DataObject.MetabasePath;

            if (!IisUtility.Exists(metabasePath))
            {
                base.WriteError(new WebObjectNotFoundException(Strings.ErrorObjectNotFound(metabasePath)), ErrorCategory.ObjectNotFound, metabasePath);
                return;
            }
            if (ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(this.DataObject) && !this.IsInSetup)
            {
                bool flag = false;
                for (int i = 0; i < this.InvalidParametersOnMbxRole.Length; i++)
                {
                    if (base.Fields.Contains(this.InvalidParametersOnMbxRole[i]))
                    {
                        this.WriteError(new InvalidArgumentForServerRoleException(this.InvalidParametersOnMbxRole[i], DirectoryStrings.ServerRoleCafe), ErrorCategory.InvalidArgument, this.DataObject, false);
                        flag = true;
                    }
                }
                if (flag)
                {
                    return;
                }
            }
            bool flag2 = IisUtility.SSLEnabled(metabasePath);

            if (this.DataObject.BasicAuthEnabled && !flag2)
            {
                this.WriteWarning(Strings.WarnBasicAuthInClear);
            }
            if (this.DataObject.ClientCertAuth != ClientCertAuthTypes.Ignore && this.DataObject.ClientCertAuth != ClientCertAuthTypes.Accepted && this.DataObject.ClientCertAuth != ClientCertAuthTypes.Required)
            {
                base.WriteError(new ArgumentException(Strings.InvalidCertAuthValue, "ClientCertAuth"), ErrorCategory.InvalidArgument, null);
                return;
            }
            if (this.DataObject.ClientCertAuth == ClientCertAuthTypes.Required && !flag2)
            {
                base.WriteError(new ArgumentException(Strings.CertAuthWithoutSSLError, "ClientCertAuth"), ErrorCategory.InvalidArgument, null);
            }
        }
Beispiel #5
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();
        }
Beispiel #6
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();
        }
Beispiel #7
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            ADMobileVirtualDirectory dataObject = this.DataObject;

            MobileSyncVirtualDirectoryHelper.SetToMetabase(dataObject, this);
            if (base.Fields.Contains("InstallIsapiFilter") && this.InstallIsapiFilter)
            {
                try
                {
                    MobileSyncVirtualDirectoryHelper.InstallIsapiFilter(this.DataObject, !ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(this.DataObject));
                }
                catch (Exception ex)
                {
                    TaskLogger.Trace("Exception occurred in InstallIsapiFilter(): {0}", new object[]
                    {
                        ex.Message
                    });
                    this.WriteWarning(Strings.ActiveSyncMetabaseIsapiInstallFailure);
                    throw;
                }
            }
            TaskLogger.LogExit();
        }