Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
 }