protected override void InternalValidate() { base.InternalValidate(); if (base.HasErrors) { return; } if (base.Fields.IsModified("AssociatedAcceptedDomains")) { NewInboundConnector.ValidateAssociatedAcceptedDomains(this.AssociatedAcceptedDomains, base.DataSession, this.DataObject, this.RootId, this, new Func <IIdentityParameter, IConfigDataProvider, ObjectId, LocalizedString?, LocalizedString?, IConfigurable>(base.GetDataObject <AcceptedDomain>)); } if (this.DataObject.SenderDomains == null) { base.WriteError(new LocalizedException(new LocalizedString("Sender Domain cannot be null.")), ErrorCategory.InvalidArgument, null); } bool flag = false; if (this.DataObject.SenderIPAddresses != null && this.DataObject.Enabled) { flag = true; NewInboundConnector.ValidateSenderIPAddresses(this.DataObject.SenderIPAddresses, this, this.BypassValidation); NewInboundConnector.CheckSenderIpAddressesOverlap(base.DataSession, this.DataObject, this); } if (this.DataObject.ConnectorType == TenantConnectorType.OnPremises) { bool flag2 = flag || this.DataObject.IsChanged(TenantInboundConnectorSchema.ConnectorType); bool flag3 = this.DataObject.IsChanged(TenantInboundConnectorSchema.ConnectorType) || this.DataObject.IsChanged(TenantInboundConnectorSchema.TlsSenderCertificateName); if ((flag2 || flag3) && !this.BypassValidation) { MultiValuedProperty <IPRange> ffoDCIPs; MultiValuedProperty <SmtpX509IdentifierEx> ffoFDSmtpCerts; MultiValuedProperty <ServiceProviderSettings> serviceProviders; if (!HygieneDCSettings.GetSettings(out ffoDCIPs, out ffoFDSmtpCerts, out serviceProviders)) { base.WriteError(new ConnectorValidationFailedException(), ErrorCategory.ConnectionError, null); } if (flag2) { NewInboundConnector.ValidateSenderIPAddressRestrictions(this.DataObject.SenderIPAddresses, ffoDCIPs, serviceProviders, this); } if (flag3) { NewInboundConnector.ValidateTlsSenderCertificateRestrictions(this.DataObject.TlsSenderCertificateName, ffoFDSmtpCerts, serviceProviders, this); } } } }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (base.HasErrors) { return; } if (base.Fields.IsModified("AssociatedAcceptedDomains")) { NewInboundConnector.ValidateAssociatedAcceptedDomains(this.AssociatedAcceptedDomains, base.DataSession, this.DataObject, this.RootId, this, new Func <IIdentityParameter, IConfigDataProvider, ObjectId, LocalizedString?, LocalizedString?, IConfigurable>(base.GetDataObject <AcceptedDomain>)); } NewInboundConnector.ValidateSenderIPAddresses(this.DataObject.SenderIPAddresses, this, this.BypassValidation); if (this.DataObject.ConnectorType == TenantConnectorType.OnPremises && !this.BypassValidation) { MultiValuedProperty <IPRange> ffoDCIPs; MultiValuedProperty <SmtpX509IdentifierEx> ffoFDSmtpCerts; MultiValuedProperty <ServiceProviderSettings> serviceProviders; if (!HygieneDCSettings.GetSettings(out ffoDCIPs, out ffoFDSmtpCerts, out serviceProviders)) { base.WriteError(new ConnectorValidationFailedException(), ErrorCategory.ConnectionError, null); } NewInboundConnector.ValidateSenderIPAddressRestrictions(this.DataObject.SenderIPAddresses, ffoDCIPs, serviceProviders, this); NewInboundConnector.ValidateTlsSenderCertificateRestrictions(this.DataObject.TlsSenderCertificateName, ffoFDSmtpCerts, serviceProviders, this); } IEnumerable <TenantInboundConnector> enumerable = base.DataSession.FindPaged <TenantInboundConnector>(null, ((IConfigurationSession)base.DataSession).GetOrgContainerId().GetDescendantId(this.DataObject.ParentPath), false, null, ADGenericPagedReader <TenantInboundConnector> .DefaultPageSize); foreach (TenantInboundConnector tenantInboundConnector in enumerable) { if (StringComparer.OrdinalIgnoreCase.Equals(this.DataObject.Name, tenantInboundConnector.Name)) { base.WriteError(new ErrorInboundConnectorAlreadyExistsException(tenantInboundConnector.Name), ErrorCategory.InvalidOperation, null); break; } } NewInboundConnector.CheckSenderIpAddressesOverlap(base.DataSession, this.DataObject, this); TaskLogger.LogExit(); }