예제 #1
0
        public bool Login(Hashtable request, UUID User, out string message)
        {
            message = "";
            string ip = (string)request["ip"];

            if (ip == null)
            {
                ip = "";
            }
            ip = ip.Split(':')[0];//Remove the port
            IPAddress userIP = IPAddress.Parse(ip);

            if (IPBans.Contains(userIP))
            {
                return(false);
            }
            foreach (string ipRange in IPRangeBans)
            {
                string[] split = ipRange.Split('-');
                if (split.Length != 2)
                {
                    continue;
                }
                IPAddress low  = IPAddress.Parse(ip);
                IPAddress high = IPAddress.Parse(ip);
                NetworkUtils.IPAddressRange range = new NetworkUtils.IPAddressRange(low, high);
                if (range.IsInRange(userIP))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        public LoginResponse Login(Hashtable request, UserAccount account, IAgentInfo agentInfo, string authType, string password, out object data)
        {
            data = null;
            string ip = request != null && request.ContainsKey("ip") ? (string)request["ip"] : "127.0.0.1";

            ip = ip.Split(':')[0];//Remove the port
            IPAddress userIP = IPAddress.Parse(ip);

            if (IPBans.Contains(userIP))
            {
                return(new LLFailedLoginResponse(LoginResponseEnum.Indeterminant, "Your account cannot be accessed on this computer.", false));
            }
            foreach (string ipRange in IPRangeBans)
            {
                string[] split = ipRange.Split('-');
                if (split.Length != 2)
                {
                    continue;
                }
                IPAddress low  = IPAddress.Parse(ip);
                IPAddress high = IPAddress.Parse(ip);
                NetworkUtils.IPAddressRange range = new NetworkUtils.IPAddressRange(low, high);
                if (range.IsInRange(userIP))
                {
                    return(new LLFailedLoginResponse(LoginResponseEnum.Indeterminant, "Your account cannot be accessed on this computer.", false));
                }
            }
            return(null);
        }
예제 #3
0
        public LoginResponse Login (Hashtable request, UserAccount account, IAgentInfo agentInfo, string authType,
                                   string password, out object data)
        {
            data = null;
            string ip = request != null && request.ContainsKey ("ip") ? (string)request ["ip"] : "127.0.0.1";
            ip = ip.Split (':') [0]; //Remove the port
            IPAddress userIP = IPAddress.Parse (ip);
            if (IPBans.Contains (userIP))
                return new LLFailedLoginResponse (LoginResponseEnum.Indeterminant,
                    "Your account cannot be accessed on this computer.", false);
            
            foreach (string ipRange in IPRangeBans) {
                string [] split = ipRange.Split ('-');
                if (split.Length != 2)
                    continue;
                
                IPAddress low = IPAddress.Parse (ip);
                IPAddress high = IPAddress.Parse (ip);
                NetworkUtils.IPAddressRange range = new NetworkUtils.IPAddressRange (low, high);
                if (range.IsInRange (userIP))
                    return new LLFailedLoginResponse (LoginResponseEnum.Indeterminant,
                        "Your account cannot be accessed on this computer.", false);
            }

            return null;
        }
예제 #4
0
 public bool Login(Hashtable request, UUID User, out string message)
 {
     message = "";
     string ip = (string)request["ip"];
     if (ip == null)
         ip = "";
     ip = ip.Split(':')[0];//Remove the port
     IPAddress userIP = IPAddress.Parse(ip);
     if (IPBans.Contains(userIP))
         return false;
     foreach (string ipRange in IPRangeBans)
     {
         string[] split = ipRange.Split('-');
         if (split.Length != 2)
             continue;
         IPAddress low = IPAddress.Parse(ip);
         IPAddress high = IPAddress.Parse(ip);
         NetworkUtils.IPAddressRange range = new NetworkUtils.IPAddressRange(low, high);
         if (range.IsInRange(userIP))
             return false;
     }
     return true;
 }