Пример #1
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter(new object[]
            {
                base.GetType().FullName
            });
            this.CheckServerAndSetReceiveConnectorID();
            this.CheckParameters();
            this.InitializeDefaults();
            this.CalculateProperties();
            base.InternalValidate();
            if (this.AdvertiseClientSettings && (this.PermissionGroups & PermissionGroups.ExchangeUsers) != PermissionGroups.ExchangeUsers)
            {
                base.WriteError(new AdvertiseClientSettingsWithoutExchangeUsersPermissionGroupsException(), ErrorCategory.InvalidOperation, this.DataObject);
            }
            if (base.HasErrors)
            {
                return;
            }
            LocalizedException exception;

            if (!ReceiveConnectorNoMappingConflictCondition.Verify(this.DataObject, base.DataSession as IConfigurationSession, out exception))
            {
                base.WriteError(exception, ErrorCategory.InvalidOperation, this.DataObject);
            }
            TaskLogger.LogExit();
        }
Пример #2
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            string message;

            if (!NewReceiveConnector.ValidataName(this.DataObject.Name, out message))
            {
                base.WriteError(new ArgumentException(message), ErrorCategory.InvalidArgument, null);
            }
            if (base.Fields.IsModified("DefaultDomain"))
            {
                AcceptedDomainIdParameter defaultDomain = this.DefaultDomain;
                if (defaultDomain != null)
                {
                    AcceptedDomain acceptedDomain = (AcceptedDomain)base.GetDataObject <AcceptedDomain>(defaultDomain, base.DataSession, this.RootId, new LocalizedString?(Strings.ErrorDefaultDomainNotFound(defaultDomain)), new LocalizedString?(Strings.ErrorDefaultDomainNotUnique(defaultDomain)));
                    this.DataObject.DefaultDomain = acceptedDomain.Id;
                }
                else
                {
                    this.DataObject.DefaultDomain = null;
                }
            }
            LocalizedException exception;

            if (!ReceiveConnectorNoMappingConflictCondition.Verify(this.DataObject, base.DataSession as IConfigurationSession, out exception))
            {
                base.WriteError(exception, ErrorCategory.InvalidOperation, this.DataObject);
            }
            if (!this.serverObject.IsEdgeServer && (this.DataObject.AuthMechanism & AuthMechanisms.ExchangeServer) != AuthMechanisms.None && !ReceiveConnectorFqdnCondition.Verify(this.DataObject, this.serverObject, out exception))
            {
                base.WriteError(exception, ErrorCategory.InvalidOperation, this.DataObject);
            }
            if (this.DataObject.AdvertiseClientSettings && (this.DataObject.PermissionGroups & PermissionGroups.ExchangeUsers) != PermissionGroups.ExchangeUsers)
            {
                base.WriteError(new AdvertiseClientSettingsWithoutExchangeUsersPermissionGroupsException(), ErrorCategory.InvalidOperation, this.DataObject);
            }
        }
Пример #3
0
        public static bool Verify(ReceiveConnector connectorBeingAddedOrEdited, IConfigurationSession session, out LocalizedException exception)
        {
            ArgumentValidator.ThrowIfNull("connectorBeginAddedOrEdited", connectorBeingAddedOrEdited);
            ArgumentValidator.ThrowIfNull("session", session);
            IEnumerable <ReceiveConnector> enumerable = session.Find <ReceiveConnector>(connectorBeingAddedOrEdited.Id.Parent, QueryScope.OneLevel, null, null, 0);

            foreach (ReceiveConnector receiveConnector in enumerable)
            {
                if (!connectorBeingAddedOrEdited.Identity.Equals(receiveConnector.Identity))
                {
                    bool flag  = false;
                    bool flag2 = false;
                    foreach (IPBinding ipbinding in connectorBeingAddedOrEdited.Bindings)
                    {
                        if (flag2)
                        {
                            break;
                        }
                        foreach (IPBinding ipbinding2 in receiveConnector.Bindings)
                        {
                            if (ipbinding.Equals(ipbinding2))
                            {
                                flag  = true;
                                flag2 = true;
                                break;
                            }
                            if (ipbinding.AddressFamily == ipbinding2.AddressFamily)
                            {
                                if ((ipbinding.Address.Equals(IPAddress.Any) || ipbinding2.Address.Equals(IPAddress.Any)) && ipbinding.Port.Equals(ipbinding2.Port))
                                {
                                    flag2 = true;
                                    break;
                                }
                                if ((ipbinding.Address.Equals(IPAddress.IPv6Any) || ipbinding2.Address.Equals(IPAddress.IPv6Any)) && ipbinding.Port.Equals(ipbinding2.Port))
                                {
                                    flag2 = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (flag2)
                    {
                        if (connectorBeingAddedOrEdited.TransportRole != receiveConnector.TransportRole)
                        {
                            exception = new ReceiveConnectorRoleConflictException(receiveConnector.Id.ToString());
                            return(false);
                        }
                        if (flag)
                        {
                            if (ReceiveConnectorNoMappingConflictCondition.PartiallyOverlapOrEqual(connectorBeingAddedOrEdited.RemoteIPRanges, receiveConnector.RemoteIPRanges))
                            {
                                exception = new ConnectorMappingConflictException(receiveConnector.Id.ToString());
                                return(false);
                            }
                        }
                        else if (ReceiveConnectorNoMappingConflictCondition.PartiallyOverlap(connectorBeingAddedOrEdited.RemoteIPRanges, receiveConnector.RemoteIPRanges))
                        {
                            exception = new ConnectorMappingConflictException(receiveConnector.Id.ToString());
                            return(false);
                        }
                    }
                }
            }
            exception = null;
            return(true);
        }