public static void ValidateIfAcceptedDomainsCanBeRoutedWithConnectors(TenantOutboundConnector dataObject, IConfigDataProvider dataSession, Task task, bool dataObjectDeleted = false)
        {
            ArgumentValidator.ThrowIfNull("dataObject", dataObject);
            ArgumentValidator.ThrowIfNull("dataSession", dataSession);
            ArgumentValidator.ThrowIfNull("task", task);
            if (!VariantConfiguration.InvariantNoFlightingSnapshot.Transport.EnforceOutboundConnectorAndAcceptedDomainsRestriction.Enabled)
            {
                return;
            }
            if (!dataObjectDeleted && dataObject.Enabled && dataObject.ConnectorType == TenantConnectorType.OnPremises && dataObject.AllAcceptedDomains)
            {
                return;
            }
            List <SmtpDomainWithSubdomains> nonAuthoritativeAcceptedDomains = ManageTenantOutboundConnectors.GetNonAuthoritativeAcceptedDomains(dataSession);

            if (nonAuthoritativeAcceptedDomains == null)
            {
                return;
            }
            List <SmtpDomainWithSubdomains> source;

            if (!ManageTenantOutboundConnectors.ValidateIfConnectorsCanRouteDomains(ManageTenantOutboundConnectors.GetOutboundConnectorsToValidate(dataSession, dataObjectDeleted ? null : dataObject), nonAuthoritativeAcceptedDomains, out source))
            {
                task.WriteWarning(Strings.AcceptedDomainsCannotBeRoutedByOutboundConnector(string.Join(",", from d in source
                                                                                                       select d.Domain)));
            }
        }
 public static void ValidateOutboundConnectorDataObject(TenantOutboundConnector tenantOutboundConnector, Task task, IConfigDataProvider dataSession, bool skipIpIsNotReservedValidation)
 {
     ManageTenantOutboundConnectors.ValidateUseMxRecordRestriction(tenantOutboundConnector, task);
     ManageTenantOutboundConnectors.ValidateSmartHostRestrictions(tenantOutboundConnector, task, skipIpIsNotReservedValidation);
     ManageTenantOutboundConnectors.ValidateRouteAllMessagesViaOnPremisesParameter(tenantOutboundConnector, dataSession, task);
     ManageTenantOutboundConnectors.ValidateRecipientDomainsParameter(tenantOutboundConnector, task);
 }
        public static bool ValidateIfAcceptedDomainCanBeRoutedUsingConnectors(IConfigDataProvider dataSession, SmtpDomainWithSubdomains acceptedDomain)
        {
            ArgumentValidator.ThrowIfNull("dataSession", dataSession);
            ArgumentValidator.ThrowIfNull("acceptedDomain", acceptedDomain);
            TenantOutboundConnector[]       connectors = (TenantOutboundConnector[])dataSession.Find <TenantOutboundConnector>(null, null, true, null);
            List <SmtpDomainWithSubdomains> list;

            return(ManageTenantOutboundConnectors.ValidateIfConnectorsCanRouteDomains(connectors, new SmtpDomainWithSubdomains[]
            {
                acceptedDomain
            }, out list));
        }
Exemplo n.º 4
0
 protected override void InternalValidate()
 {
     base.InternalValidate();
     try
     {
         ManageTenantOutboundConnectors.ValidateIfAcceptedDomainsCanBeRoutedWithConnectors(base.DataObject, base.DataSession, this, true);
         IEnumerable <TransportRule> source;
         if (Utils.TryGetTransportRules(base.DataSession, new Utils.TransportRuleSelectionDelegate(Utils.RuleHasOutboundConnectorReference), out source, base.DataObject.Name) && source.Any <TransportRule>())
         {
             base.WriteError(new ConnectorIncorrectUsageConnectorStillReferencedException(), ErrorCategory.InvalidOperation, null);
         }
     }
     catch (ParserException exception)
     {
         base.WriteError(exception, ErrorCategory.InvalidData, null);
     }
 }
Exemplo n.º 5
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            LocalizedException ex = ManageTenantOutboundConnectors.ValidateConnectorNameReferences(this.DataObject, this.CurrentName, base.DataSession);

            if (ex != null)
            {
                base.WriteError(ex, ErrorCategory.InvalidArgument, null);
            }
            ManageTenantOutboundConnectors.ValidateOutboundConnectorDataObject(this.DataObject, this, base.DataSession, this.BypassValidation);
            ManageTenantOutboundConnectors.ValidateIfAcceptedDomainsCanBeRoutedWithConnectors(this.DataObject, base.DataSession, this, false);
            TaskLogger.LogExit();
        }
Exemplo n.º 6
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            ManageTenantOutboundConnectors.ValidateOutboundConnectorDataObject(this.DataObject, this, base.DataSession, this.BypassValidation);
            IEnumerable <TenantOutboundConnector> enumerable = base.DataSession.FindPaged <TenantOutboundConnector>(null, ((IConfigurationSession)base.DataSession).GetOrgContainerId().GetDescendantId(this.DataObject.ParentPath), false, null, ADGenericPagedReader <TenantOutboundConnector> .DefaultPageSize);

            foreach (TenantOutboundConnector tenantOutboundConnector in enumerable)
            {
                if (StringComparer.OrdinalIgnoreCase.Equals(this.DataObject.Name, tenantOutboundConnector.Name))
                {
                    base.WriteError(new ErrorOutboundConnectorAlreadyExistsException(tenantOutboundConnector.Name), ErrorCategory.InvalidOperation, null);
                    break;
                }
            }
            ManageTenantOutboundConnectors.ValidateIfAcceptedDomainsCanBeRoutedWithConnectors(this.DataObject, base.DataSession, this, false);
            TaskLogger.LogExit();
        }
Exemplo n.º 7
0
 protected override void InternalProcessRecord()
 {
     ManageTenantOutboundConnectors.ClearSmartHostsListIfNecessary(this.DataObject);
     base.InternalProcessRecord();
 }
 internal static void ValidateIfOutboundConnectorToRouteDomainIsPresent(IConfigDataProvider dataSession, AcceptedDomain dataObject, Task.TaskWarningLoggingDelegate errorWriter)
 {
     if (VariantConfiguration.InvariantNoFlightingSnapshot.Transport.EnforceOutboundConnectorAndAcceptedDomainsRestriction.Enabled && dataObject.DomainType != AcceptedDomainType.Authoritative && !ManageTenantOutboundConnectors.ValidateIfAcceptedDomainCanBeRoutedUsingConnectors(dataSession, dataObject.DomainName))
     {
         errorWriter(Strings.OutboundConnectorToRouteAcceptedDomainNotFound);
     }
 }