/// <summary>
        /// Returns true if LdapAuthenticationModeSubmit instances are equal
        /// </summary>
        /// <param name="other">Instance of LdapAuthenticationModeSubmit to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LdapAuthenticationModeSubmit other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Uuid == other.Uuid ||
                     Uuid != null &&
                     Uuid.Equals(other.Uuid)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     HostName == other.HostName ||
                     HostName != null &&
                     HostName.Equals(other.HostName)
                 ) &&
                 (
                     Port == other.Port ||

                     Port.Equals(other.Port)
                 ) &&
                 (
                     IsLdaps == other.IsLdaps ||

                     IsLdaps.Equals(other.IsLdaps)
                 ) &&
                 (
                     Account == other.Account ||
                     Account != null &&
                     Account.Equals(other.Account)
                 ) &&
                 (
                     Password == other.Password ||
                     Password != null &&
                     Password.Equals(other.Password)
                 ) &&
                 (
                     BaseDn == other.BaseDn ||
                     BaseDn != null &&
                     BaseDn.Equals(other.BaseDn)
                 ) &&
                 (
                     LdapAttributes == other.LdapAttributes ||
                     LdapAttributes != null &&
                     other.LdapAttributes != null &&
                     LdapAttributes.SequenceEqual(other.LdapAttributes)
                 ));
        }
示例#2
0
        public override bool Equals(object obj)
        {
            var otherEndpoint = obj as Endpoint;

            if (otherEndpoint == null)
            {
                return(false);
            }

            return(HostName.Equals(otherEndpoint.HostName) && VirtualHost.Equals(otherEndpoint.VirtualHost) &&
                   UserName.Equals(otherEndpoint.UserName) && Password.Equals(otherEndpoint.Password));
        }
        /// <summary>
        /// Returns true if SecurityContractDefaultConfigurationLdapAuthMode instances are equal
        /// </summary>
        /// <param name="other">Instance of SecurityContractDefaultConfigurationLdapAuthMode to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SecurityContractDefaultConfigurationLdapAuthMode other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     HostName == other.HostName ||
                     HostName != null &&
                     HostName.Equals(other.HostName)
                 ) &&
                 (
                     Port == other.Port ||

                     Port.Equals(other.Port)
                 ) &&
                 (
                     IsLdaps == other.IsLdaps ||

                     IsLdaps.Equals(other.IsLdaps)
                 ) &&
                 (
                     Account == other.Account ||
                     Account != null &&
                     Account.Equals(other.Account)
                 ) &&
                 (
                     BaseDn == other.BaseDn ||
                     BaseDn != null &&
                     BaseDn.Equals(other.BaseDn)
                 ) &&
                 (
                     LdapAttributes == other.LdapAttributes ||
                     LdapAttributes != null &&
                     other.LdapAttributes != null &&
                     LdapAttributes.SequenceEqual(other.LdapAttributes)
                 ));
        }
示例#4
0
        public void AllowStartingLocalServer([NotNull] string executable,
                                             [CanBeNull] string extraArguments = null)
        {
            if (!HostName.Equals(_localhost, StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }

            if (CanAcceptCalls())
            {
                return;
            }

            StartLocalServer(executable, extraArguments);
        }
示例#5
0
        /// <summary>
        /// Override of the equality method.
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public bool Equals(SignalRServers o)
        {
            //Check whether the compared object is null.
            if (ReferenceEquals(o, null))
            {
                return(false);
            }

            //Check whether the compared object references the same data.
            if (ReferenceEquals(this, o))
            {
                return(true);
            }

            //Check whether the SignalRServers' properties are equal.
            return(StartedAt.Equals(o.StartedAt) && HostName.Equals(o.HostName) && PublicUri.Equals(o.PublicUri) && Tools.SequenceEqual(Hubs, o.Hubs));
        }
        public async Task <bool> AllowStartingLocalServerAsync(
            [NotNull] string executable,
            [CanBeNull] string extraArguments = null)
        {
            if (!HostName.Equals(_localhost, StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            bool canAcceptCalls = await CanAcceptCallsAsync();

            if (canAcceptCalls)
            {
                return(false);
            }

            StartLocalServer(executable, extraArguments);

            return(true);
        }
示例#7
0
        /// <summary>
        /// Returns true if BlobStorageInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of BlobStorageInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BlobStorageInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     BlobName == other.BlobName ||
                     BlobName != null &&
                     BlobName.Equals(other.BlobName)
                     ) &&
                 (
                     ContainerName == other.ContainerName ||
                     ContainerName != null &&
                     ContainerName.Equals(other.ContainerName)
                 ) &&
                 (
                     CorrelationId == other.CorrelationId ||
                     CorrelationId != null &&
                     CorrelationId.Equals(other.CorrelationId)
                 ) &&
                 (
                     HostName == other.HostName ||
                     HostName != null &&
                     HostName.Equals(other.HostName)
                 ) &&
                 (
                     SasToken == other.SasToken ||
                     SasToken != null &&
                     SasToken.Equals(other.SasToken)
                 ));
        }
示例#8
0
 void CheckForConflictingUrlAclReservations()
 {
     foreach (var reservation in UrlReservation.GetAll().Where(p => p.Port == Port || p.Port == DatabaseMaintenancePort))
     {
         // exclusive or of reservation and instance - if only one of them has "localhost" then the UrlAcl will clash
         if (reservation.HostName.Equals("localhost", StringComparison.OrdinalIgnoreCase) && !HostName.Equals("localhost", StringComparison.OrdinalIgnoreCase) ||
             !reservation.HostName.Equals("localhost", StringComparison.OrdinalIgnoreCase) && HostName.Equals("localhost", StringComparison.OrdinalIgnoreCase))
         {
             throw new EngineValidationException($"Conflicting UrlAcls found - {Url} vs {reservation.Url}");
         }
     }
 }
        protected void ProcessConnect(Socket socket, object state, SocketAsyncEventArgs e, Exception exception)
        {
            if (exception != null)
            {
                m_InConnecting = false;
                OnError(exception);

                if (e != null)
                {
                    e.Dispose();
                }

                return;
            }

            if (e != null && e.SocketError != SocketError.Success)
            {
                m_InConnecting = false;
                OnError(new SocketException((int)e.SocketError));
                e.Dispose();
                return;
            }

            if (socket == null)
            {
                m_InConnecting = false;
                OnError(new SocketException((int)SocketError.ConnectionAborted));
                return;
            }

            //To walk around a MonoTouch's issue
            //one user reported in some cases the e.SocketError = SocketError.Succes but the socket is not connected in MonoTouch
            if (!socket.Connected)
            {
                m_InConnecting = false;

                var socketError = SocketError.HostUnreachable;

#if !SILVERLIGHT && !NETFX_CORE
                try
                {
                    socketError = (SocketError)socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);
                }
                catch (Exception)
                {
                    socketError = SocketError.HostUnreachable;
                }
#endif
                OnError(new SocketException((int)socketError));
                return;
            }

            if (e == null)
            {
                e = new SocketAsyncEventArgs();
            }

            e.Completed += SocketEventArgsCompleted;

            Client         = socket;
            m_InConnecting = false;

#if !SILVERLIGHT
            try
            {
                // mono may throw an exception here
                LocalEndPoint = socket.LocalEndPoint;
            }
            catch
            {
            }
#endif

            var finalRemoteEndPoint = e.RemoteEndPoint != null ? e.RemoteEndPoint : socket.RemoteEndPoint;

            if (string.IsNullOrEmpty(HostName))
            {
                HostName = GetHostOfEndPoint(finalRemoteEndPoint);
            }
            else// connect with DnsEndPoint
            {
                var finalDnsEndPoint = finalRemoteEndPoint as DnsEndPoint;

                if (finalDnsEndPoint != null)
                {
                    var hostName = finalDnsEndPoint.Host;

                    if (!string.IsNullOrEmpty(hostName) && !HostName.Equals(hostName, StringComparison.OrdinalIgnoreCase))
                    {
                        HostName = hostName;
                    }
                }
            }

#if !SILVERLIGHT && !NETFX_CORE
            try
            {
                //Set keep alive
                Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
            }
            catch
            {
            }
#endif
            OnGetSocket(e);
        }
        /// <summary>
        /// Returns true if OrgApacheJackrabbitOakSecurityAuthenticationLdapImplLdapIdentiProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheJackrabbitOakSecurityAuthenticationLdapImplLdapIdentiProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheJackrabbitOakSecurityAuthenticationLdapImplLdapIdentiProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProviderName == other.ProviderName ||
                     ProviderName != null &&
                     ProviderName.Equals(other.ProviderName)
                     ) &&
                 (
                     HostName == other.HostName ||
                     HostName != null &&
                     HostName.Equals(other.HostName)
                 ) &&
                 (
                     HostPort == other.HostPort ||
                     HostPort != null &&
                     HostPort.Equals(other.HostPort)
                 ) &&
                 (
                     HostSsl == other.HostSsl ||
                     HostSsl != null &&
                     HostSsl.Equals(other.HostSsl)
                 ) &&
                 (
                     HostTls == other.HostTls ||
                     HostTls != null &&
                     HostTls.Equals(other.HostTls)
                 ) &&
                 (
                     HostNoCertCheck == other.HostNoCertCheck ||
                     HostNoCertCheck != null &&
                     HostNoCertCheck.Equals(other.HostNoCertCheck)
                 ) &&
                 (
                     BindDn == other.BindDn ||
                     BindDn != null &&
                     BindDn.Equals(other.BindDn)
                 ) &&
                 (
                     BindPassword == other.BindPassword ||
                     BindPassword != null &&
                     BindPassword.Equals(other.BindPassword)
                 ) &&
                 (
                     SearchTimeout == other.SearchTimeout ||
                     SearchTimeout != null &&
                     SearchTimeout.Equals(other.SearchTimeout)
                 ) &&
                 (
                     AdminPoolMaxActive == other.AdminPoolMaxActive ||
                     AdminPoolMaxActive != null &&
                     AdminPoolMaxActive.Equals(other.AdminPoolMaxActive)
                 ) &&
                 (
                     AdminPoolLookupOnValidate == other.AdminPoolLookupOnValidate ||
                     AdminPoolLookupOnValidate != null &&
                     AdminPoolLookupOnValidate.Equals(other.AdminPoolLookupOnValidate)
                 ) &&
                 (
                     UserPoolMaxActive == other.UserPoolMaxActive ||
                     UserPoolMaxActive != null &&
                     UserPoolMaxActive.Equals(other.UserPoolMaxActive)
                 ) &&
                 (
                     UserPoolLookupOnValidate == other.UserPoolLookupOnValidate ||
                     UserPoolLookupOnValidate != null &&
                     UserPoolLookupOnValidate.Equals(other.UserPoolLookupOnValidate)
                 ) &&
                 (
                     UserBaseDN == other.UserBaseDN ||
                     UserBaseDN != null &&
                     UserBaseDN.Equals(other.UserBaseDN)
                 ) &&
                 (
                     UserObjectclass == other.UserObjectclass ||
                     UserObjectclass != null &&
                     UserObjectclass.Equals(other.UserObjectclass)
                 ) &&
                 (
                     UserIdAttribute == other.UserIdAttribute ||
                     UserIdAttribute != null &&
                     UserIdAttribute.Equals(other.UserIdAttribute)
                 ) &&
                 (
                     UserExtraFilter == other.UserExtraFilter ||
                     UserExtraFilter != null &&
                     UserExtraFilter.Equals(other.UserExtraFilter)
                 ) &&
                 (
                     UserMakeDnPath == other.UserMakeDnPath ||
                     UserMakeDnPath != null &&
                     UserMakeDnPath.Equals(other.UserMakeDnPath)
                 ) &&
                 (
                     GroupBaseDN == other.GroupBaseDN ||
                     GroupBaseDN != null &&
                     GroupBaseDN.Equals(other.GroupBaseDN)
                 ) &&
                 (
                     GroupObjectclass == other.GroupObjectclass ||
                     GroupObjectclass != null &&
                     GroupObjectclass.Equals(other.GroupObjectclass)
                 ) &&
                 (
                     GroupNameAttribute == other.GroupNameAttribute ||
                     GroupNameAttribute != null &&
                     GroupNameAttribute.Equals(other.GroupNameAttribute)
                 ) &&
                 (
                     GroupExtraFilter == other.GroupExtraFilter ||
                     GroupExtraFilter != null &&
                     GroupExtraFilter.Equals(other.GroupExtraFilter)
                 ) &&
                 (
                     GroupMakeDnPath == other.GroupMakeDnPath ||
                     GroupMakeDnPath != null &&
                     GroupMakeDnPath.Equals(other.GroupMakeDnPath)
                 ) &&
                 (
                     GroupMemberAttribute == other.GroupMemberAttribute ||
                     GroupMemberAttribute != null &&
                     GroupMemberAttribute.Equals(other.GroupMemberAttribute)
                 ) &&
                 (
                     UseUidForExtId == other.UseUidForExtId ||
                     UseUidForExtId != null &&
                     UseUidForExtId.Equals(other.UseUidForExtId)
                 ) &&
                 (
                     Customattributes == other.Customattributes ||
                     Customattributes != null &&
                     Customattributes.Equals(other.Customattributes)
                 ));
        }
示例#11
0
        protected void ProcessConnect(Socket socket, object state, SocketAsyncEventArgs e, Exception exception)
        {
            if (exception != null)
            {
                m_InConnecting = false;
                OnError(exception);
                e?.Dispose();
                return;
            }
            if (e != null && e.SocketError != 0)
            {
                m_InConnecting = false;
                OnError(new SocketException((int)e.SocketError));
                e.Dispose();
                return;
            }
            if (socket == null)
            {
                m_InConnecting = false;
                OnError(new SocketException(10053));
                return;
            }
            if (!socket.Connected)
            {
                m_InConnecting = false;
                SocketError socketError = SocketError.HostUnreachable;
                try
                {
                    socketError = (SocketError)socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);
                }
                catch (Exception)
                {
                    socketError = SocketError.HostUnreachable;
                }
                OnError(new SocketException((int)socketError));
                return;
            }
            if (e == null)
            {
                e = new SocketAsyncEventArgs();
            }
            e.Completed   += SocketEventArgsCompleted;
            base.Client    = socket;
            m_InConnecting = false;
            try
            {
                LocalEndPoint = socket.LocalEndPoint;
            }
            catch
            {
            }
            EndPoint endPoint = (e.RemoteEndPoint != null) ? e.RemoteEndPoint : socket.RemoteEndPoint;

            if (string.IsNullOrEmpty(HostName))
            {
                HostName = GetHostOfEndPoint(endPoint);
            }
            else
            {
                DnsEndPoint dnsEndPoint = endPoint as DnsEndPoint;
                if (dnsEndPoint != null)
                {
                    string host = dnsEndPoint.Host;
                    if (!string.IsNullOrEmpty(host) && !HostName.Equals(host, StringComparison.OrdinalIgnoreCase))
                    {
                        HostName = host;
                    }
                }
            }
            try
            {
                base.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, optionValue: true);
            }
            catch
            {
            }
            OnGetSocket(e);
        }
示例#12
0
 /// <summary>
 /// Compares the current instance to another object for value equality.
 /// </summary>
 /// <param name="host">
 /// The object to which the current instance is compared.
 /// </param>
 /// <returns>
 /// <b>true</b> if both the host name and port of both instances are the same; otherwise, <b>False</b>.
 /// </returns>
 /// <remarks>
 /// The comparison of host names is case-insensitive.
 /// </remarks>
 public bool Equals(HostInfo host)
 {
     return(HostName.Equals(host.HostName, StringComparison.CurrentCultureIgnoreCase) && Port == host.Port);
 }