internal static void ValidateSenderIPAddressRestrictions(MultiValuedProperty <IPRange> addressRanges, MultiValuedProperty <IPRange> ffoDCIPs, MultiValuedProperty <ServiceProviderSettings> serviceProviders, Task task) { if (MultiValuedPropertyBase.IsNullOrEmpty(addressRanges)) { return; } using (MultiValuedProperty <IPRange> .Enumerator enumerator = addressRanges.GetEnumerator()) { while (enumerator.MoveNext()) { IPRange ipRange = enumerator.Current; if (!MultiValuedPropertyBase.IsNullOrEmpty(ffoDCIPs)) { if (ffoDCIPs.Any((IPRange ffoDCIP) => ffoDCIP.Overlaps(ipRange))) { task.WriteError(new SenderIPAddressOverlapsFfoDCIPAddressesException(ipRange.Expression), ErrorCategory.InvalidArgument, null); } } if (!MultiValuedPropertyBase.IsNullOrEmpty(serviceProviders)) { if (serviceProviders.Any((ServiceProviderSettings serviceProvider) => serviceProvider.IPRanges != null && serviceProvider.IPRanges.Any((IPRange providerIPRange) => providerIPRange != null && providerIPRange.Overlaps(ipRange)))) { task.WriteError(new SenderIPAddressOverlapsServiceProviderIPAddressesException(ipRange.Expression), ErrorCategory.InvalidArgument, null); } } } } }
private void ValidateForEnterprise(IRMConfiguration config) { if (config.ExternalLicensingEnabled && !ExternalAuthentication.GetCurrent().Enabled) { base.WriteError(new OrganizationNotFederatedException(), ErrorCategory.InvalidOperation, base.Identity); } if (config.InternalLicensingEnabled) { Uri rmsserviceLocation = RmsClientManager.GetRMSServiceLocation(OrganizationId.ForestWideOrgId, ServiceType.Certification); if (rmsserviceLocation == null) { base.WriteError(new NoRMSServersFoundException(), ErrorCategory.InvalidOperation, base.Identity); } this.ValidateRmsVersion(rmsserviceLocation, ServiceType.CertificationService); this.ValidateRmsVersion(rmsserviceLocation, ServiceType.LicensingService); } if (!MultiValuedPropertyBase.IsNullOrEmpty(config.LicensingLocation)) { foreach (Uri uri in config.LicensingLocation) { if (string.IsNullOrEmpty(RMUtil.ConvertUriToLicenseUrl(uri))) { base.WriteError(new RmsUrlIsInvalidException(uri), ErrorCategory.InvalidOperation, base.Identity); } this.ValidateRmsVersion(uri, ServiceType.LicensingService); } } }
protected override IConfigurable PrepareDataObject() { DeliveryAgentConnector deliveryAgentConnector = (DeliveryAgentConnector)base.PrepareDataObject(); if (!MultiValuedPropertyBase.IsNullOrEmpty(this.SourceTransportServers)) { deliveryAgentConnector.SourceTransportServers = base.ResolveIdParameterCollection <ServerIdParameter, Server, ADObjectId>(this.SourceTransportServers, base.DataSession, this.RootId, null, (ExchangeErrorCategory)0, new Func <IIdentityParameter, LocalizedString>(Strings.ErrorServerNotFound), new Func <IIdentityParameter, LocalizedString>(Strings.ErrorServerNotUnique), null, null); } else { Server server = null; try { server = ((ITopologyConfigurationSession)base.DataSession).ReadLocalServer(); } catch (TransientException exception) { base.WriteError(exception, ErrorCategory.ResourceUnavailable, this.DataObject); } if (server != null && server.IsHubTransportServer && server.IsExchange2007OrLater) { deliveryAgentConnector.SourceTransportServers = new MultiValuedProperty <ADObjectId>(false, SendConnectorSchema.SourceTransportServers, new ADObjectId[] { server.Id }); } } if (!MultiValuedPropertyBase.IsNullOrEmpty(deliveryAgentConnector.SourceTransportServers)) { ManageSendConnectors.SetConnectorHomeMta(deliveryAgentConnector, (IConfigurationSession)base.DataSession); } ManageSendConnectors.SetConnectorId(deliveryAgentConnector, ((ITopologyConfigurationSession)base.DataSession).GetRoutingGroupId()); return(deliveryAgentConnector); }
protected override void ValidateWrite(List <ValidationError> errors) { base.ValidateWrite(errors); if (this.ConnectorType == TenantConnectorType.OnPremises && MultiValuedPropertyBase.IsNullOrEmpty(this.SenderIPAddresses) && this.TlsSenderCertificateName == null) { errors.Add(new PropertyValidationError(DirectoryStrings.InboundConnectorMissingTlsCertificateOrSenderIP, TenantInboundConnectorSchema.RemoteIPRanges, this)); } if (this.TlsSenderCertificateName != null && !this.RequireTls) { errors.Add(new PropertyValidationError(DirectoryStrings.InboundConnectorRequiredTlsSettingsInvalid, TenantInboundConnectorSchema.RequireTls, this)); } if (this.RestrictDomainsToIPAddresses && MultiValuedPropertyBase.IsNullOrEmpty(this.SenderIPAddresses)) { errors.Add(new PropertyValidationError(DirectoryStrings.InboundConnectorInvalidRestrictDomainsToIPAddresses, TenantInboundConnectorSchema.RestrictDomainsToIPAddresses, this)); } if (this.RestrictDomainsToIPAddresses && this.RestrictDomainsToCertificate) { errors.Add(new PropertyValidationError(DirectoryStrings.InboundConnectorInvalidIPCertificateCombinations, TenantInboundConnectorSchema.RestrictDomainsToCertificate, this)); } if (this.RestrictDomainsToCertificate && this.TlsSenderCertificateName == null) { errors.Add(new PropertyValidationError(DirectoryStrings.InboundConnectorInvalidRestrictDomainsToCertificate, TenantInboundConnectorSchema.RestrictDomainsToCertificate, this)); } if (this.ConnectorType != TenantConnectorType.OnPremises && this.CloudServicesMailEnabled) { errors.Add(new PropertyValidationError(DirectoryStrings.InboundConnectorIncorrectCloudServicesMailEnabled, TenantInboundConnectorSchema.CloudServicesMailEnabled, this)); } }
protected override void ValidateWrite(List <ValidationError> errors) { if (!(this.IsTransportRuleScoped ^ (!MultiValuedPropertyBase.IsNullOrEmpty(this.RecipientDomains) || this.AllAcceptedDomains))) { errors.Add(new PropertyValidationError(DirectoryStrings.OutboundConnectorIncorrectTransportRuleScopedParameters, TenantOutboundConnectorSchema.IsTransportRuleScoped, this)); } if (this.TlsDomain != null && this.TlsSettings != TlsAuthLevel.DomainValidation) { errors.Add(new PropertyValidationError(DirectoryStrings.OutboundConnectorTlsSettingsInvalidTlsDomainWithoutDomainValidation, TenantOutboundConnectorSchema.TlsSettings, this)); } if (this.TlsDomain == null && this.TlsSettings == TlsAuthLevel.DomainValidation) { errors.Add(new PropertyValidationError(DirectoryStrings.OutboundConnectorTlsSettingsInvalidDomainValidationWithoutTlsDomain, TenantOutboundConnectorSchema.TlsSettings, this)); } this.ValidateSmartHosts(errors); if (this.ConnectorType != TenantConnectorType.OnPremises && this.RouteAllMessagesViaOnPremises) { errors.Add(new PropertyValidationError(DirectoryStrings.OutboundConnectorIncorrectRouteAllMessagesViaOnPremises, TenantOutboundConnectorSchema.RouteAllMessagesViaOnPremises, this)); } if (this.ConnectorType != TenantConnectorType.OnPremises && this.CloudServicesMailEnabled) { errors.Add(new PropertyValidationError(DirectoryStrings.OutboundConnectorIncorrectCloudServicesMailEnabled, TenantOutboundConnectorSchema.CloudServicesMailEnabled, this)); } if (this.ConnectorType != TenantConnectorType.OnPremises && this.AllAcceptedDomains) { errors.Add(new PropertyValidationError(DirectoryStrings.InboundConnectorIncorrectAllAcceptedDomains, TenantOutboundConnectorSchema.AllAcceptedDomains, this)); } }
public static string[] ToStringArray(this MultiValuedProperty <string> stringProperty) { if (MultiValuedPropertyBase.IsNullOrEmpty(stringProperty)) { return(new string[0]); } return(stringProperty.ToArray()); }
protected override void ValidateWrite(List <ValidationError> errors) { base.ValidateWrite(errors); if (!this.AnyMatch && this.BitmaskMatch == null && MultiValuedPropertyBase.IsNullOrEmpty(this.IPAddressesMatch)) { errors.Add(new PropertyValidationError(DirectoryStrings.BitMaskOrIpAddressMatchMustBeSet, IPListProviderSchema.AnyMatch, this)); } }
protected override void ValidateWrite(List <ValidationError> errors) { base.ValidateWrite(errors); if (MultiValuedPropertyBase.IsNullOrEmpty(base.ConnectedDomains) && MultiValuedPropertyBase.IsNullOrEmpty(base.AddressSpaces)) { errors.Add(new PropertyValidationError(DirectoryStrings.NoAddressSpaces, MailGatewaySchema.AddressSpaces, this)); } if (!this.DNSRoutingEnabled && MultiValuedPropertyBase.IsNullOrEmpty(this.SmartHosts)) { errors.Add(new PropertyValidationError(DirectoryStrings.SmartHostNotSet, SmtpSendConnectorConfigSchema.SmartHosts, this)); } IPvxAddress pvxAddress = new IPvxAddress(this.SourceIPAddress); if (pvxAddress.IsMulticast || pvxAddress.IsBroadcast) { errors.Add(new PropertyValidationError(DirectoryStrings.InvalidSourceAddressSetting, SmtpSendConnectorConfigSchema.SourceIPAddress, this)); } if ((this.SmartHostAuthMechanism == SmtpSendConnectorConfig.AuthMechanisms.BasicAuth || this.SmartHostAuthMechanism == SmtpSendConnectorConfig.AuthMechanisms.BasicAuthRequireTLS) && this.AuthenticationCredential == null) { errors.Add(new PropertyValidationError(DirectoryStrings.AuthenticationCredentialNotSet, SmtpSendConnectorConfigSchema.AuthenticationCredential, this)); } if (this.DomainSecureEnabled) { if (!this.DNSRoutingEnabled) { errors.Add(new PropertyValidationError(DirectoryStrings.DomainSecureWithoutDNSRoutingEnabled, SmtpSendConnectorConfigSchema.DNSRoutingEnabled, this)); } if (this.IgnoreSTARTTLS) { errors.Add(new PropertyValidationError(DirectoryStrings.DomainSecureWithIgnoreStartTLSEnabled, SmtpSendConnectorConfigSchema.IgnoreSTARTTLS, this)); } } if (this.TlsAuthLevel != null) { if (!this.RequireTLS) { errors.Add(new PropertyValidationError(DirectoryStrings.TlsAuthLevelWithRequireTlsDisabled, SmtpSendConnectorConfigSchema.TlsAuthLevel, this)); } if (this.DomainSecureEnabled) { errors.Add(new PropertyValidationError(DirectoryStrings.TlsAuthLevelWithDomainSecureEnabled, SmtpSendConnectorConfigSchema.TlsAuthLevel, this)); } } if (this.TlsDomain != null) { if (this.TlsAuthLevel == null || this.TlsAuthLevel.Value != Microsoft.Exchange.Data.TlsAuthLevel.DomainValidation) { errors.Add(new PropertyValidationError(DirectoryStrings.TlsDomainWithIncorrectTlsAuthLevel, SmtpSendConnectorConfigSchema.TlsDomain, this)); return; } } else if (!this.DNSRoutingEnabled && this.TlsAuthLevel != null && this.TlsAuthLevel.Value == Microsoft.Exchange.Data.TlsAuthLevel.DomainValidation) { errors.Add(new PropertyValidationError(DirectoryStrings.TlsAuthLevelWithNoDomainOnSmartHost, SmtpSendConnectorConfigSchema.TlsDomain, this)); } }
private void ValidateSmartHosts(List <ValidationError> errors) { if (this.UseMXRecord && !MultiValuedPropertyBase.IsNullOrEmpty(this.SmartHosts)) { errors.Add(new PropertyValidationError(DirectoryStrings.OutboundConnectorUseMXRecordShouldBeFalseIfSmartHostsIsPresent, TenantOutboundConnectorSchema.UseMxRecord, this)); } if (!this.UseMXRecord && MultiValuedPropertyBase.IsNullOrEmpty(this.SmartHosts)) { errors.Add(new PropertyValidationError(DirectoryStrings.OutboundConnectorSmartHostShouldBePresentIfUseMXRecordFalse, TenantOutboundConnectorSchema.SmartHostsString, this)); } }
protected override IConfigurable PrepareDataObject() { ForeignConnector foreignConnector = (ForeignConnector)base.PrepareDataObject(); if (!MultiValuedPropertyBase.IsNullOrEmpty(this.SourceTransportServers)) { foreignConnector.SourceTransportServers = base.ResolveIdParameterCollection <ServerIdParameter, Server, ADObjectId>(this.SourceTransportServers, base.DataSession, this.RootId, null, (ExchangeErrorCategory)0, new Func <IIdentityParameter, LocalizedString>(Strings.ErrorServerNotFound), new Func <IIdentityParameter, LocalizedString>(Strings.ErrorServerNotUnique), null, null); if (this.SourceTransportServers.Count > 0) { ManageSendConnectors.SetConnectorHomeMta(foreignConnector, (IConfigurationSession)base.DataSession); } } return(foreignConnector); }
internal static void ValidateTlsSenderCertificateRestrictions(TlsCertificate certificate, MultiValuedProperty <SmtpX509IdentifierEx> ffoFDSmtpCerts, MultiValuedProperty <ServiceProviderSettings> serviceProviders, Task task) { if (certificate == null) { return; } if (!MultiValuedPropertyBase.IsNullOrEmpty(ffoFDSmtpCerts) && ffoFDSmtpCerts.Any((SmtpX509IdentifierEx ffoFDSmtpCert) => ffoFDSmtpCert.Matches(certificate))) { task.WriteError(new TlsSenderCertificateNameMatchesFfoFDSmtpCertificateException(certificate.ToString()), ErrorCategory.InvalidArgument, null); } if (!MultiValuedPropertyBase.IsNullOrEmpty(serviceProviders) && serviceProviders.Any((ServiceProviderSettings serviceProvider) => serviceProvider.Certificates != null && serviceProvider.Certificates.Any((TlsCertificate providerCertificate) => providerCertificate != null && providerCertificate.Equals(certificate)))) { task.WriteError(new TlsSenderCertificateNameMatchesServiceProviderCertificateException(certificate.ToString()), ErrorCategory.InvalidArgument, null); } }
private IEnumerable <RmsTemplate> AcquireRmsTemplates() { if (this.orgId == OrganizationId.ForestWideOrgId) { return(RmsClientManager.AcquireRmsTemplates(this.orgId, true)); } if (this.irmConfiguration == null || (!this.irmConfiguration.InternalLicensingEnabled && !this.displayTemplatesIfInternalLicensingDisabled)) { return(DrmEmailConstants.EmptyTemplateArray); } RMSTrustedPublishingDomain rmstrustedPublishingDomain = this.FindTPD(); if (rmstrustedPublishingDomain == null) { return(DrmEmailConstants.EmptyTemplateArray); } List <RmsTemplate> list = null; if (!MultiValuedPropertyBase.IsNullOrEmpty(rmstrustedPublishingDomain.RMSTemplates)) { list = new List <RmsTemplate>(rmstrustedPublishingDomain.RMSTemplates.Count + 2); using (MultiValuedProperty <string> .Enumerator enumerator = rmstrustedPublishingDomain.RMSTemplates.GetEnumerator()) { while (enumerator.MoveNext()) { string encodedTemplate = enumerator.Current; RmsTemplateType type = RmsTemplateType.Archived; string templateXrml = RMUtil.DecompressTemplate(encodedTemplate, out type); if (this.ShouldFetch(type)) { list.Add(RmsTemplate.CreateServerTemplateFromTemplateDefinition(templateXrml, type)); } } goto IL_CE; } } list = new List <RmsTemplate>(2); IL_CE: if (this.typeToFetch != RmsTemplateType.Archived && rmstrustedPublishingDomain.Default) { list.Add(RmsTemplate.DoNotForward); if (this.irmConfiguration.InternetConfidentialEnabled) { list.Add(RmsTemplate.InternetConfidential); } } return(list); }
private static void ValidateSmartHostRestrictions(TenantOutboundConnector tenantOutboundConnector, Task task, bool skipIpIsNotReservedValidation) { if (tenantOutboundConnector.IsChanged(TenantOutboundConnectorSchema.SmartHosts) && !MultiValuedPropertyBase.IsNullOrEmpty(tenantOutboundConnector.SmartHosts)) { MultiValuedProperty <IPRange> multiValuedProperty = null; bool flag = false; using (MultiValuedProperty <SmartHost> .Enumerator enumerator = tenantOutboundConnector.SmartHosts.GetEnumerator()) { while (enumerator.MoveNext()) { SmartHost smartHost = enumerator.Current; if (smartHost.IsIPAddress) { if (smartHost.Address.AddressFamily != AddressFamily.InterNetwork || !IPAddressValidation.IsValidIPv4Address(smartHost.Address.ToString())) { task.WriteError(new SmartHostsIPValidationFailedException(smartHost.Address.ToString()), ErrorCategory.InvalidArgument, null); } if (!skipIpIsNotReservedValidation) { if (IPAddressValidation.IsReservedIPv4Address(smartHost.Address.ToString())) { task.WriteError(new IPRangeInConnectorContainsReservedIPAddressesException(smartHost.Address.ToString()), ErrorCategory.InvalidArgument, null); } if (!flag) { if (!HygieneDCSettings.GetFfoDCPublicIPAddresses(out multiValuedProperty)) { task.WriteError(new ConnectorValidationFailedException(), ErrorCategory.ConnectionError, null); } flag = true; } if (!MultiValuedPropertyBase.IsNullOrEmpty(multiValuedProperty)) { if (multiValuedProperty.Any((IPRange ffoDCIP) => ffoDCIP.Contains(smartHost.Address))) { task.WriteError(new IPRangeInConnectorContainsReservedIPAddressesException(smartHost.Address.ToString()), ErrorCategory.InvalidArgument, null); } } } } } } } }
internal static Dns GetAndInitializeDns(Server server) { Dns dns = new Dns(); dns.Options = Provider.GetDnsOptions(server.ExternalDNSProtocolOption); MultiValuedProperty <IPAddress> externalDNSServers = server.ExternalDNSServers; if (server.ExternalDNSAdapterEnabled || MultiValuedPropertyBase.IsNullOrEmpty(externalDNSServers)) { dns.AdapterServerList(server.ExternalDNSAdapterGuid); } else { IPAddress[] array = new IPAddress[externalDNSServers.Count]; externalDNSServers.CopyTo(array, 0); dns.ServerList.Initialize(array); } return(dns); }
public void Save(IConfigurable instance) { if (this.orgId == OrganizationId.ForestWideOrgId) { throw new NotSupportedException(); } RmsTemplatePresentation rmsTemplatePresentation = instance as RmsTemplatePresentation; if (rmsTemplatePresentation == null) { throw new ArgumentException("passed in instance not of type RmsTemplatePresentation", "instance"); } Guid templateGuid = rmsTemplatePresentation.TemplateGuid; RMSTrustedPublishingDomain rmstrustedPublishingDomain = this.FindDefaultTPD(); if (rmstrustedPublishingDomain == null) { return; } if (!MultiValuedPropertyBase.IsNullOrEmpty(rmstrustedPublishingDomain.RMSTemplates)) { string text = null; string text2 = null; foreach (string text3 in rmstrustedPublishingDomain.RMSTemplates) { RmsTemplateType rmsTemplateType; string text4 = RMUtil.DecompressTemplate(text3, out rmsTemplateType); Guid templateGuidFromLicense = DrmClientUtils.GetTemplateGuidFromLicense(text4); if (templateGuidFromLicense == templateGuid && rmsTemplateType != rmsTemplatePresentation.Type) { text = text3; text2 = RMUtil.CompressTemplate(text4, rmsTemplatePresentation.Type); break; } } if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2)) { rmstrustedPublishingDomain.RMSTemplates.Remove(text); rmstrustedPublishingDomain.RMSTemplates.Add(text2); this.adSession.Save(rmstrustedPublishingDomain); } } }
protected static HybridMailflowConfiguration ConvertToHybridMailflowConfiguration(TenantInboundConnector inbound, TenantOutboundConnector outbound) { ArgumentValidator.ThrowIfNull("inbound", inbound); ArgumentValidator.ThrowIfNull("outbound", outbound); HybridMailflowConfiguration hybridMailflowConfiguration = new HybridMailflowConfiguration(); hybridMailflowConfiguration.OutboundDomains = new List <SmtpDomainWithSubdomains>(); foreach (SmtpDomainWithSubdomains smtpDomainWithSubdomains in outbound.RecipientDomains) { if (!HybridMailflowTaskBase.IsWildcardDomain(smtpDomainWithSubdomains)) { hybridMailflowConfiguration.OutboundDomains.Add(new SmtpDomainWithSubdomains(smtpDomainWithSubdomains.Address)); } } if (inbound.SenderIPAddresses != null) { hybridMailflowConfiguration.InboundIPs = new List <IPRange>(); foreach (IPRange item in inbound.SenderIPAddresses) { hybridMailflowConfiguration.InboundIPs.Add(item); } } if (!MultiValuedPropertyBase.IsNullOrEmpty(outbound.SmartHosts)) { SmartHost smartHost = outbound.SmartHosts[0]; if (smartHost.IsIPAddress) { hybridMailflowConfiguration.OnPremisesFQDN = new Fqdn(smartHost.Address.ToString()); } else { hybridMailflowConfiguration.OnPremisesFQDN = new Fqdn(smartHost.ToString()); } } if (inbound.TlsSenderCertificateName != null) { hybridMailflowConfiguration.CertificateSubject = inbound.TlsSenderCertificateName.ToString(); } hybridMailflowConfiguration.SecureMailEnabled = new bool?(inbound.RequireTls && outbound.TlsSettings != null && outbound.TlsSettings == TlsAuthLevel.DomainValidation); hybridMailflowConfiguration.CentralizedTransportEnabled = new bool?((inbound.RestrictDomainsToIPAddresses && HybridMailflowTaskBase.IsRecipientDomainsWildcard(outbound.RecipientDomains)) || outbound.RouteAllMessagesViaOnPremises); return(hybridMailflowConfiguration); }
public override void ReadData(IConfigurationSession session) { RMSTrustedPublishingDomain[] array = session.Find <RMSTrustedPublishingDomain>(null, QueryScope.SubTree, null, null, 0); if (array == null || array.Length == 0) { return; } foreach (RMSTrustedPublishingDomain rmstrustedPublishingDomain in array) { if (rmstrustedPublishingDomain.Default && !MultiValuedPropertyBase.IsNullOrEmpty(rmstrustedPublishingDomain.RMSTemplates)) { foreach (string encodedTemplate in rmstrustedPublishingDomain.RMSTemplates) { string text = null; try { RmsTemplateType rmsTemplateType; text = RMUtil.DecompressTemplate(encodedTemplate, out rmsTemplateType); if (rmsTemplateType == RmsTemplateType.Distributed) { RmsTemplate rmsTemplate = RmsTemplate.CreateServerTemplateFromTemplateDefinition(text, rmsTemplateType); this.templates.Add(rmsTemplate.Id, rmsTemplate); this.estimatedSize += rmsTemplate.ItemSize + 16L; } } catch (FormatException arg) { RmsConfiguration.Tracer.TraceError <string, FormatException>((long)this.GetHashCode(), "Failed to read template {0}. Error {1}", text, arg); } catch (InvalidRpmsgFormatException arg2) { RmsConfiguration.Tracer.TraceError <string, InvalidRpmsgFormatException>((long)this.GetHashCode(), "Failed to read template {0}. Error {1}", text, arg2); } catch (RightsManagementException arg3) { RmsConfiguration.Tracer.TraceError <string, RightsManagementException>((long)this.GetHashCode(), "Failed to read template {0}. Error {1}", text, arg3); } } } } }
protected override void PrepareRecipientObject(TDataObject recipient) { TaskLogger.LogEnter(); base.PrepareRecipientObject(recipient); if (base.Fields.Contains(ADRecipientSchema.ModeratedBy)) { MultiValuedProperty <ModeratorIDParameter> multiValuedProperty = (MultiValuedProperty <ModeratorIDParameter>)base.Fields[ADRecipientSchema.ModeratedBy]; int num = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled ? 10 : 25; if (multiValuedProperty != null && multiValuedProperty.Count > num) { base.WriteError(new RecipientTaskException(Strings.ErrorTooManyModerators(num)), ExchangeErrorCategory.Client, null); } recipient.ModeratedBy = RecipientTaskHelper.GetModeratedByAdObjectIdFromParameterID(base.TenantGlobalCatalogSession, this.ModeratedBy, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), recipient, new Task.ErrorLoggerDelegate(base.WriteError)); } if (base.Fields.IsModified(ADRecipientSchema.ArbitrationMailbox)) { if (this.ArbitrationMailbox != null) { ADRecipient adrecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.ArbitrationMailbox, (IRecipientSession)base.DataSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(this.ArbitrationMailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(this.ArbitrationMailbox.ToString())), ExchangeErrorCategory.Client); if (adrecipient.RecipientTypeDetails != RecipientTypeDetails.ArbitrationMailbox) { base.WriteError(new RecipientTaskException(Strings.ErrorInvalidArbitrationMbxType(adrecipient.Identity.ToString())), ExchangeErrorCategory.Client, recipient.Identity); } if (MultiValuedPropertyBase.IsNullOrEmpty((ADMultiValuedProperty <ADObjectId>)adrecipient[ADUserSchema.ApprovalApplications])) { base.WriteError(new RecipientTaskException(Strings.ErrorInvalidArbitrationMbxTypeForModerationAndAutogroup(adrecipient.Identity.ToString())), ExchangeErrorCategory.Client, recipient.Identity); } if (!recipient.OrganizationId.Equals(adrecipient.OrganizationId)) { base.WriteError(new RecipientTaskException(Strings.ErrorArbitrationMbxCrossOrg(adrecipient.Identity.ToString())), ExchangeErrorCategory.Client, recipient.Identity); } recipient.ArbitrationMailbox = adrecipient.Id; } else { recipient.ArbitrationMailbox = null; } } TaskLogger.LogExit(); }
internal static void AdjustAddressSpaces(MailGateway connector) { if (MultiValuedPropertyBase.IsNullOrEmpty(connector.AddressSpaces)) { return; } MultiValuedProperty<AddressSpace> multiValuedProperty = new MultiValuedProperty<AddressSpace>(); foreach (AddressSpace addressSpace in connector.AddressSpaces) { if (addressSpace.IsLocal != connector.IsScopedConnector) { multiValuedProperty.Add(addressSpace); } } if (multiValuedProperty.Count > 0) { foreach (AddressSpace addressSpace2 in multiValuedProperty) { AddressSpace item = addressSpace2.ToggleScope(); connector.AddressSpaces.Remove(addressSpace2); connector.AddressSpaces.Add(item); } } }
protected override void ResolveLocalSecondaryIdentities() { base.ResolveLocalSecondaryIdentities(); TPublicObject tpublicObject = (TPublicObject)((object)this.GetDynamicParameters()); this.SetMultiReferenceParameter <DeliveryRecipientIdParameter>(ADRecipientSchema.AcceptMessagesOnlyFrom, this.AcceptMessagesOnlyFrom, tpublicObject, new GetRecipientDelegate <DeliveryRecipientIdParameter>(this.GetRecipient), new ValidateRecipientDelegate(this.ValidateMessageDeliveryRestrictionIndividual)); this.SetMultiReferenceParameter <DeliveryRecipientIdParameter>(ADRecipientSchema.AcceptMessagesOnlyFromDLMembers, this.AcceptMessagesOnlyFromDLMembers, tpublicObject, new GetRecipientDelegate <DeliveryRecipientIdParameter>(this.GetRecipient), new ValidateRecipientDelegate(this.ValidateMessageDeliveryRestrictionGroup)); if (base.Fields.IsModified(ADRecipientSchema.AcceptMessagesOnlyFromSendersOrMembers)) { tpublicObject.AcceptMessagesOnlyFrom.Clear(); tpublicObject.AcceptMessagesOnlyFromDLMembers.Clear(); if (this.AcceptMessagesOnlyFromSendersOrMembers != null) { MultiValuedProperty <ADObjectId> multiValuedProperty; MultiValuedProperty <ADObjectId> multiValuedProperty2; SetMailEnabledRecipientObjectTask <TIdentity, TPublicObject, TDataObject> .ResolveAndSeparateMessageDeliveryRestrictionRecipientIdentities(this.AcceptMessagesOnlyFromSendersOrMembers, "AcceptMessagesOnlyFromSendersOrMembers", base.TenantGlobalCatalogSession, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), new Task.ErrorLoggerDelegate(base.WriteError), out multiValuedProperty, out multiValuedProperty2); if (multiValuedProperty != null) { tpublicObject.AcceptMessagesOnlyFromDLMembers = multiValuedProperty; } if (multiValuedProperty2 != null) { tpublicObject.AcceptMessagesOnlyFrom = multiValuedProperty2; } } } this.SetMultiReferenceParameter <DeliveryRecipientIdParameter>(ADRecipientSchema.RejectMessagesFrom, this.RejectMessagesFrom, tpublicObject, new GetRecipientDelegate <DeliveryRecipientIdParameter>(this.GetRecipient), new ValidateRecipientDelegate(this.ValidateMessageDeliveryRestrictionIndividual)); this.SetMultiReferenceParameter <DeliveryRecipientIdParameter>(ADRecipientSchema.RejectMessagesFromDLMembers, this.RejectMessagesFromDLMembers, tpublicObject, new GetRecipientDelegate <DeliveryRecipientIdParameter>(this.GetRecipient), new ValidateRecipientDelegate(this.ValidateMessageDeliveryRestrictionGroup)); if (base.Fields.IsModified(ADRecipientSchema.RejectMessagesFromSendersOrMembers)) { tpublicObject.RejectMessagesFrom.Clear(); tpublicObject.RejectMessagesFromDLMembers.Clear(); if (this.RejectMessagesFromSendersOrMembers != null) { MultiValuedProperty <ADObjectId> multiValuedProperty3; MultiValuedProperty <ADObjectId> multiValuedProperty4; SetMailEnabledRecipientObjectTask <TIdentity, TPublicObject, TDataObject> .ResolveAndSeparateMessageDeliveryRestrictionRecipientIdentities(this.RejectMessagesFromSendersOrMembers, "RejectMessagesFromSendersOrMembers", base.TenantGlobalCatalogSession, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), new Task.ErrorLoggerDelegate(base.WriteError), out multiValuedProperty3, out multiValuedProperty4); if (multiValuedProperty3 != null) { tpublicObject.RejectMessagesFromDLMembers = multiValuedProperty3; } if (multiValuedProperty4 != null) { tpublicObject.RejectMessagesFrom = multiValuedProperty4; } } } if (base.Fields.IsModified(ADRecipientSchema.BypassModerationFromSendersOrMembers)) { tpublicObject.BypassModerationFrom.Clear(); tpublicObject.BypassModerationFromDLMembers.Clear(); if (this.BypassModerationFromSendersOrMembers != null) { MultiValuedProperty <ADObjectId> multiValuedProperty5; MultiValuedProperty <ADObjectId> multiValuedProperty6; SetMailEnabledRecipientObjectTask <TIdentity, TPublicObject, TDataObject> .ResolveAndSeparateMessageDeliveryRestrictionRecipientIdentities(this.BypassModerationFromSendersOrMembers, "BypassModerationFromSendersOrMembers", base.TenantGlobalCatalogSession, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), new Task.ErrorLoggerDelegate(base.WriteError), out multiValuedProperty5, out multiValuedProperty6); if (multiValuedProperty5 != null) { tpublicObject.BypassModerationFromDLMembers = multiValuedProperty5; } if (multiValuedProperty6 != null) { tpublicObject.BypassModerationFrom = multiValuedProperty6; } } } this.SetMultiReferenceParameter <RecipientIdParameter>(ADRecipientSchema.GrantSendOnBehalfTo, this.GrantSendOnBehalfTo, tpublicObject, new GetRecipientDelegate <RecipientIdParameter>(this.GetRecipient), new ValidateRecipientDelegate(this.ValidateGrantSendOnBehalfTo)); if (tpublicObject.IsChanged(ADRecipientSchema.PrimarySmtpAddress) && tpublicObject.IsChanged(ADRecipientSchema.WindowsEmailAddress) && tpublicObject.PrimarySmtpAddress != tpublicObject.WindowsEmailAddress) { base.ThrowTerminatingError(new TaskArgumentException(Strings.ErrorPrimarySmtpAndWindowsAddressDifferent), ExchangeErrorCategory.Client, null); } if (base.Fields.Contains(ADRecipientSchema.ModeratedBy)) { MultiValuedProperty <ModeratorIDParameter> multiValuedProperty7 = (MultiValuedProperty <ModeratorIDParameter>)base.Fields[ADRecipientSchema.ModeratedBy]; if (multiValuedProperty7 != null && multiValuedProperty7.Count > 25) { base.WriteError(new RecipientTaskException(Strings.ErrorTooManyModerators(25)), ExchangeErrorCategory.Client, null); } this.SetMultiReferenceParameter <ModeratorIDParameter>(ADRecipientSchema.ModeratedBy, this.ModeratedBy, tpublicObject, new GetRecipientDelegate <ModeratorIDParameter>(this.GetRecipient), new ValidateRecipientDelegate(RecipientTaskHelper.ValidateModeratedBy)); } if (this.ArbitrationMailbox != null) { this.arbitrationMbx = (ADRecipient)base.GetDataObject <ADRecipient>(this.ArbitrationMailbox, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(this.ArbitrationMailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(this.ArbitrationMailbox.ToString())), ExchangeErrorCategory.Client); if (MultiValuedPropertyBase.IsNullOrEmpty((ADMultiValuedProperty <ADObjectId>) this.arbitrationMbx[ADUserSchema.ApprovalApplications])) { base.ThrowTerminatingError(new RecipientTaskException(Strings.ErrorInvalidArbitrationMbxTypeForModerationAndAutogroup(this.arbitrationMbx.Identity.ToString())), ExchangeErrorCategory.Client, null); } if (this.arbitrationMbx.RecipientTypeDetails != RecipientTypeDetails.ArbitrationMailbox) { base.ThrowTerminatingError(new RecipientTaskException(Strings.ErrorInvalidArbitrationMbxType(this.ArbitrationMailbox.ToString())), ExchangeErrorCategory.Client, null); } } }
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); }
public override void ReadData(IConfigurationSession session) { IRMConfiguration irmconfiguration = IRMConfiguration.Read(session); this.JournalReportDecryptionEnabled = irmconfiguration.JournalReportDecryptionEnabled; this.ClientAccessServerEnabled = irmconfiguration.ClientAccessServerEnabled; this.SearchEnabled = irmconfiguration.SearchEnabled; this.ExternalLicensingEnabled = irmconfiguration.ExternalLicensingEnabled; this.InternalLicensingEnabled = irmconfiguration.InternalLicensingEnabled; this.TransportDecryptionSetting = irmconfiguration.TransportDecryptionSetting; this.InternetConfidentialEnabled = irmconfiguration.InternetConfidentialEnabled; this.EDiscoverySuperUserEnabled = irmconfiguration.EDiscoverySuperUserEnabled; this.ServerCertificatesVersion = (byte)irmconfiguration.ServerCertificatesVersion; this.estimatedSize += 10; if (irmconfiguration.ServiceLocation != null) { this.ServiceLocation = irmconfiguration.ServiceLocation; this.estimatedSize += irmconfiguration.ServiceLocation.OriginalString.Length * 2; } if (irmconfiguration.PublishingLocation != null) { this.PublishingLocation = irmconfiguration.PublishingLocation; this.estimatedSize += irmconfiguration.PublishingLocation.OriginalString.Length * 2; } if (irmconfiguration.LicensingLocation != null && !MultiValuedPropertyBase.IsNullOrEmpty(irmconfiguration.LicensingLocation)) { this.LicensingLocations = new List <Uri>(irmconfiguration.LicensingLocation.Count + 1); foreach (Uri uri in irmconfiguration.LicensingLocation) { if (uri != null) { this.LicensingLocations.Add(uri); this.estimatedSize += uri.OriginalString.Length * 2; } } } if (irmconfiguration.RMSOnlineKeySharingLocation != null) { this.RMSOnlineKeySharingLocation = irmconfiguration.RMSOnlineKeySharingLocation; this.estimatedSize += irmconfiguration.RMSOnlineKeySharingLocation.OriginalString.Length * 2; } if (base.OrganizationId == OrganizationId.ForestWideOrgId) { Uri firstOrgServiceLocation = RmsConfiguration.Instance.GetFirstOrgServiceLocation(ServiceType.ClientLicensor); if (firstOrgServiceLocation != null && !this.LicensingLocations.Contains(firstOrgServiceLocation)) { this.LicensingLocations.Add(firstOrgServiceLocation); this.estimatedSize += firstOrgServiceLocation.OriginalString.Length * 2; } } else if (irmconfiguration.PublishingLocation != null && !this.LicensingLocations.Contains(irmconfiguration.PublishingLocation)) { this.LicensingLocations.Add(irmconfiguration.PublishingLocation); this.estimatedSize += irmconfiguration.PublishingLocation.OriginalString.Length * 2; } else if (irmconfiguration.ServiceLocation != null && !this.LicensingLocations.Contains(irmconfiguration.ServiceLocation)) { this.LicensingLocations.Add(irmconfiguration.ServiceLocation); this.estimatedSize += irmconfiguration.ServiceLocation.OriginalString.Length * 2; } if (base.OrganizationId == OrganizationId.ForestWideOrgId && (!this.InternalLicensingEnabled || RmsClientManager.FirstOrgTemplateCacheVersion != this.ServerCertificatesVersion)) { RmsClientManager.TemplateCacheForFirstOrg = null; } }
// Token: 0x06006071 RID: 24689 RVA: 0x00147C32 File Offset: 0x00145E32 protected bool IsNullOrEmptyMvp(object templateValue) { return(base.PolicyProperty.IsMultivalued && MultiValuedPropertyBase.IsNullOrEmpty((MultiValuedPropertyBase)templateValue)); }