Ejemplo n.º 1
0
        protected override void InternalValidate()
        {
            if (Server.IsSubscribedGateway(base.GlobalConfigSession))
            {
                base.WriteError(new CannotRunOnSubscribedEdgeException(), ErrorCategory.InvalidOperation, null);
            }
            if (this.usageSetCount > 1)
            {
                base.WriteError(new NewSendConnectorIncorrectUsageParametersException(), ErrorCategory.InvalidOperation, null);
            }
            if (this.IsUsageSet && this.usage == NewSendConnector.UsageType.Partner)
            {
                if (!this.isDomainSecureEnabledSet)
                {
                    this.DataObject.DomainSecureEnabled = true;
                }
                if (!this.isDnsRoutingEnabledSet)
                {
                    this.DataObject.DNSRoutingEnabled = true;
                }
            }
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            bool flag;
            LocalizedException ex = NewSendConnector.CrossObjectValidate(this.DataObject, (IConfigurationSession)base.DataSession, this.localServer, this, out flag);

            if (ex != null)
            {
                base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject);
                return;
            }
            if (flag)
            {
                this.WriteWarning(Strings.WarningMultiSiteSourceServers);
            }
        }
Ejemplo n.º 2
0
        protected override void InternalProcessRecord()
        {
            if (this.dashDashConnector && (this.DataObject.IsChanged(MailGatewaySchema.AddressSpaces) || this.DataObject.IsChanged(SmtpSendConnectorConfigSchema.SmartHostsString)) && !this.force && !base.ShouldContinue(Strings.ConfirmationMessageSetEdgeSyncSendConnectorAddressSpaceOrSmartHosts))
            {
                return;
            }
            Exception ex = null;

            if (this.DataObject.DNSRoutingEnabled)
            {
                ex = NewSendConnector.CheckDNSAndSmartHostParameters(this.DataObject);
                if (ex == null)
                {
                    ex = NewSendConnector.CheckDNSAndSmartHostAuthMechanismParameters(this.DataObject);
                }
            }
            if (ex == null)
            {
                ex = NewSendConnector.CheckTLSParameters(this.DataObject);
            }
            if (this.DataObject.TlsCertificateName != null)
            {
                ex = this.ValidateCertificateForSmtp(this.DataObject);
            }
            if (ex != null)
            {
                base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject.Identity);
                return;
            }
            NewSendConnector.ClearSmartHostsListIfNecessary(this.DataObject);
            NewSendConnector.SetSmartHostAuthMechanismIfNecessary(this.DataObject);
            ManageSendConnectors.AdjustAddressSpaces(this.DataObject);
            base.InternalProcessRecord();
            if (!TopologyProvider.IsAdamTopology())
            {
                ManageSendConnectors.UpdateGwartLastModified((ITopologyConfigurationSession)base.DataSession, this.DataObject.SourceRoutingGroup, new ManageSendConnectors.ThrowTerminatingErrorDelegate(base.ThrowTerminatingError));
            }
        }
Ejemplo n.º 3
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            if (Server.IsSubscribedGateway((ITopologyConfigurationSession)base.DataSession))
            {
                base.WriteError(new CannotRunOnSubscribedEdgeException(), ErrorCategory.InvalidOperation, null);
            }
            bool flag;
            LocalizedException ex = NewSendConnector.CrossObjectValidate(this.DataObject, (IConfigurationSession)base.DataSession, this.localServer, this, out flag);

            if (ex != null)
            {
                base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject);
                return;
            }
            if (flag)
            {
                this.WriteWarning(Strings.WarningMultiSiteSourceServers);
            }
        }
Ejemplo n.º 4
0
        protected override void InternalProcessRecord()
        {
            SmtpSendConnectorConfig dataObject = this.DataObject;

            if (!TopologyProvider.IsAdamTopology() && !dataObject.Enabled && !this.force && !base.ShouldContinue(Strings.ConfirmationMessageDisableSendConnector))
            {
                return;
            }
            Exception ex = null;

            if (dataObject.DNSRoutingEnabled)
            {
                ex = NewSendConnector.CheckDNSAndSmartHostParameters(this.DataObject);
                if (ex == null)
                {
                    ex = NewSendConnector.CheckDNSAndSmartHostAuthMechanismParameters(this.DataObject);
                }
            }
            if (ex == null)
            {
                ex = NewSendConnector.CheckTLSParameters(this.DataObject);
            }
            if (ex != null)
            {
                base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject.Identity);
                return;
            }
            NewSendConnector.ClearSmartHostsListIfNecessary(this.DataObject);
            NewSendConnector.SetSmartHostAuthMechanismIfNecessary(this.DataObject);
            if (dataObject.IsScopedConnector)
            {
                ManageSendConnectors.AdjustAddressSpaces(dataObject);
            }
            base.InternalProcessRecord();
            ITopologyConfigurationSession topologyConfigurationSession = (ITopologyConfigurationSession)base.DataSession;
            SmtpSendConnectorConfig       smtpSendConnectorConfig      = null;

            try
            {
                smtpSendConnectorConfig = topologyConfigurationSession.Read <SmtpSendConnectorConfig>(this.DataObject.OriginalId);
            }
            catch (LocalizedException exception)
            {
                base.WriteError(exception, ErrorCategory.ReadError, this.DataObject);
                return;
            }
            RawSecurityDescriptor originalSecurityDescriptor = smtpSendConnectorConfig.ReadSecurityDescriptor();
            RawSecurityDescriptor rawSecurityDescriptor      = null;

            try
            {
                rawSecurityDescriptor = this.ConfigureDefaultSecurityDescriptor(originalSecurityDescriptor);
            }
            catch (LocalizedException exception2)
            {
                base.WriteError(exception2, ErrorCategory.InvalidOperation, this.DataObject);
                return;
            }
            if (rawSecurityDescriptor != null)
            {
                topologyConfigurationSession.SaveSecurityDescriptor(this.DataObject.OriginalId, rawSecurityDescriptor);
            }
            if (!TopologyProvider.IsAdamTopology())
            {
                ManageSendConnectors.UpdateGwartLastModified(topologyConfigurationSession, this.DataObject.SourceRoutingGroup, new ManageSendConnectors.ThrowTerminatingErrorDelegate(base.ThrowTerminatingError));
            }
        }
Ejemplo n.º 5
0
        private RawSecurityDescriptor ConfigureDefaultSecurityDescriptor(RawSecurityDescriptor originalSecurityDescriptor)
        {
            PrincipalPermissionList defaultPermission = NewSendConnector.GetDefaultPermission(this.isHubTransportServer);

            return(defaultPermission.AddExtendedRightsToSecurityDescriptor(originalSecurityDescriptor));
        }
Ejemplo n.º 6
0
        internal static LocalizedException CrossObjectValidate(SmtpSendConnectorConfig connector, IConfigurationSession session, Server localServer, Task task, out bool multiSiteConnector)
        {
            bool flag;
            LocalizedException ex = NewSendConnector.ValidateSourceServers(connector, session, localServer, task, out flag, out multiSiteConnector);

            if (ex != null)
            {
                return(ex);
            }
            if (!MultiValuedPropertyBase.IsNullOrEmpty(connector.AddressSpaces))
            {
                foreach (AddressSpace addressSpace in connector.AddressSpaces)
                {
                    if (!addressSpace.IsSmtpType)
                    {
                        if (flag)
                        {
                            return(new SendConnectorNonSmtpAddressSpaceOnEdgeException(addressSpace.ToString()));
                        }
                        if (connector.DNSRoutingEnabled)
                        {
                            return(new SendConnectorNonSmtpAddressSpaceOnDNSConnectorException(addressSpace.ToString()));
                        }
                    }
                    if (addressSpace.Address != null && addressSpace.Address.Equals("--", StringComparison.InvariantCulture))
                    {
                        if (!flag)
                        {
                            return(new SendConnectorDashdashAddressSpaceNotOffEdgeException());
                        }
                        if (connector.AddressSpaces.Count > 1)
                        {
                            return(new SendConnectorDashdashAddressSpaceNotUniqueException());
                        }
                    }
                }
            }
            if (!MultiValuedPropertyBase.IsNullOrEmpty(connector.SmartHosts))
            {
                foreach (SmartHost smartHost in connector.SmartHosts)
                {
                    if (smartHost.Domain != null && smartHost.Domain.ToString().Equals("--", StringComparison.InvariantCulture))
                    {
                        if (!flag)
                        {
                            return(new SendConnectorDashdashSmarthostNotOffEdgeException());
                        }
                        if (connector.SmartHosts.Count > 1)
                        {
                            return(new SendConnectorDashdashSmarthostNotUniqueException());
                        }
                    }
                }
            }
            if (flag && connector.FrontendProxyEnabled)
            {
                return(new SendConnectorProxyEnabledOnEdgeException());
            }
            if (localServer != null && localServer.IsEdgeServer)
            {
                ex = NewSendConnector.ValidateSourceIPAddress(connector);
                if (ex != null)
                {
                    return(ex);
                }
            }
            return(null);
        }