Пример #1
0
        TravelingAgentInfo CreateTravelInfo(AgentCircuitData agentCircuit, GridRegion region, bool fromLogin, out TravelingAgentInfo existing)
        {
            HGTravelingData hgt = m_Database.Get(agentCircuit.SessionID);

            existing = null;

            if (hgt != null)
            {
                // Very important! Override whatever this agent comes with.
                // UserAgentService always sets the IP for every new agent
                // with the original IP address.
                existing = new TravelingAgentInfo(hgt);
                agentCircuit.IPAddress = existing.ClientIPAddress;
            }

            TravelingAgentInfo travel = new TravelingAgentInfo(existing);

            travel.SessionID        = agentCircuit.SessionID;
            travel.UserID           = agentCircuit.AgentID;
            travel.GridExternalName = region.ServerURI;
            travel.ServiceToken     = agentCircuit.ServiceSessionID;

            if (fromLogin)
            {
                travel.ClientIPAddress = agentCircuit.IPAddress;
            }

            StoreTravelInfo(travel);

            return(travel);
        }
        TravelingAgentInfo UpdateTravelInfo(AgentCircuitData agentCircuit, GridRegion region)
        {
            TravelingAgentInfo travel = new TravelingAgentInfo();
            TravelingAgentInfo old    = null;

            lock (m_TravelingAgents)
            {
                if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID))
                {
                    // Very important! Override whatever this agent comes with.
                    // UserAgentService always sets the IP for every new agent
                    // with the original IP address.
                    agentCircuit.IPAddress = m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress;

                    old = m_TravelingAgents[agentCircuit.SessionID];
                }

                m_TravelingAgents[agentCircuit.SessionID] = travel;
            }
            travel.UserID           = agentCircuit.AgentID;
            travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
            travel.ServiceToken     = agentCircuit.ServiceSessionID;
            if (old != null)
            {
                travel.ClientIPAddress = old.ClientIPAddress;
            }

            return(old);
        }
Пример #3
0
        public bool VerifyClient(UUID sessionID, string reportedIP)
        {
            if (m_BypassClientVerification)
            {
                return(true);
            }

            m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.",
                              sessionID, reportedIP);

            HGTravelingData hgt = m_Database.Get(sessionID);

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

            TravelingAgentInfo travel = new TravelingAgentInfo(hgt);

            bool result = travel.ClientIPAddress == reportedIP;

            if (!result && !string.IsNullOrEmpty(m_MyExternalIP))
            {
                result = reportedIP == m_MyExternalIP; // NATed
            }
            m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {2}; result is {3}",
                              reportedIP, travel.ClientIPAddress, m_MyExternalIP, result);

            return(result);
        }
Пример #4
0
        public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
        {
            m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
                              agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
            // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
            GridRegion region = new GridRegion(gatekeeper);

            region.ServerURI        = gatekeeper.ServerURI;
            region.ExternalHostName = finalDestination.ExternalHostName;
            region.InternalEndPoint = finalDestination.InternalEndPoint;
            region.RegionName       = finalDestination.RegionName;
            region.RegionID         = finalDestination.RegionID;
            region.RegionLocX       = finalDestination.RegionLocX;
            region.RegionLocY       = finalDestination.RegionLocY;

            // Generate a new service session
            agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
            TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);

            bool   success      = false;
            string myExternalIP = string.Empty;
            string gridName     = gatekeeper.ServerURI;

            m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName);

            if (m_GridName == gridName)
            {
                success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
            }
            else
            {
                success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);
            }

            if (!success)
            {
                m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
                                  agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);

                // restore the old travel info
                lock (m_TravelingAgents)
                    m_TravelingAgents[agentCircuit.SessionID] = old;

                return(false);
            }

            m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
            // else set the IP addresses associated with this client
            if (clientIP != null)
            {
                m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.Address.ToString();
            }
            m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP;
            return(true);
        }
Пример #5
0
 public TravelingAgentInfo(TravelingAgentInfo old)
 {
     if (old != null)
     {
         SessionID        = old.SessionID;
         UserID           = old.UserID;
         GridExternalName = old.GridExternalName;
         ServiceToken     = old.ServiceToken;
         ClientIPAddress  = old.ClientIPAddress;
     }
 }
        // We need to prevent foreign users with the same UUID as a local user
        public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName)
        {
            if (!m_TravelingAgents.ContainsKey(sessionID))
            {
                return(false);
            }

            TravelingAgentInfo travel = m_TravelingAgents[sessionID];

            return(travel.GridExternalName == thisGridExternalName);
        }
Пример #7
0
        // We need to prevent foreign users with the same UUID as a local user
        public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName)
        {
            HGTravelingData hgt = m_Database.Get(sessionID);

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

            TravelingAgentInfo travel = new TravelingAgentInfo(hgt);

            return(travel.GridExternalName.ToLower() == thisGridExternalName.ToLower());
        }
Пример #8
0
        public bool VerifyAgent(UUID sessionID, string token)
        {
            HGTravelingData hgt = m_Database.Get(sessionID);

            if (hgt == null)
            {
                m_log.DebugFormat("[USER AGENT SERVICE]: Token verification for session {0}: no such session", sessionID);
                return(false);
            }

            TravelingAgentInfo travel = new TravelingAgentInfo(hgt);

            m_log.DebugFormat("[USER AGENT SERVICE]: Verifying agent token {0} against {1}", token, travel.ServiceToken);
            return(travel.ServiceToken == token);
        }
Пример #9
0
        private void StoreTravelInfo(TravelingAgentInfo travel)
        {
            if (travel == null)
            {
                return;
            }

            HGTravelingData hgt = new HGTravelingData();

            hgt.SessionID = travel.SessionID;
            hgt.UserID    = travel.UserID;
            hgt.Data      = new Dictionary <string, string>();
            hgt.Data["GridExternalName"] = travel.GridExternalName;
            hgt.Data["ServiceToken"]     = travel.ServiceToken;
            hgt.Data["ClientIPAddress"]  = travel.ClientIPAddress;

            m_Database.Store(hgt);
        }
Пример #10
0
        TravelingAgentInfo UpdateTravelInfo(AgentCircuitData agentCircuit, GridRegion region)
        {
            TravelingAgentInfo travel = new TravelingAgentInfo();
            TravelingAgentInfo old    = null;

            lock (m_TravelingAgents)
            {
                if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID))
                {
                    old = m_TravelingAgents[agentCircuit.SessionID];
                }

                m_TravelingAgents[agentCircuit.SessionID] = travel;
            }
            travel.UserID           = agentCircuit.AgentID;
            travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
            travel.ServiceToken     = agentCircuit.ServiceSessionID;
            if (old != null)
            {
                travel.ClientIPAddress = old.ClientIPAddress;
            }

            return(old);
        }
Пример #11
0
        TravelingAgentInfo UpdateTravelInfo(AgentCircuitData agentCircuit, GridRegion region)
        {
            TravelingAgentInfo travel = new TravelingAgentInfo();
            TravelingAgentInfo old = null;
            lock (m_TravelingAgents)
            {
                if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID))
                {
                    old = m_TravelingAgents[agentCircuit.SessionID];
                }

                m_TravelingAgents[agentCircuit.SessionID] = travel;
            }
            travel.UserID = agentCircuit.AgentID;
            travel.GridExternalName = region.ExternalHostName + ":" + region.HttpPort;
            travel.ServiceToken = agentCircuit.ServiceSessionID;
            if (old != null)
                travel.ClientToken = old.ClientToken;

            return old;
        }
Пример #12
0
        public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
        {
            m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
                              agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);

            string gridName = gatekeeper.ServerURI;

            UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID);

            if (account == null)
            {
                m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname);
                reason = "Forbidden to launch your agents from here";
                return(false);
            }

            // Is this user allowed to go there?
            if (m_GridName != gridName)
            {
                if (m_ForeignTripsAllowed.ContainsKey(account.UserLevel))
                {
                    bool allowed = m_ForeignTripsAllowed[account.UserLevel];

                    if (m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsAllowedExceptions))
                    {
                        allowed = false;
                    }

                    if (!m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsDisallowedExceptions))
                    {
                        allowed = true;
                    }

                    if (!allowed)
                    {
                        reason = "Your world does not allow you to visit the destination";
                        m_log.InfoFormat("[USER AGENT SERVICE]: Agents not permitted to visit {0}. Refusing service.", gridName);
                        return(false);
                    }
                }
            }


            // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
            GridRegion region = new GridRegion(gatekeeper);

            region.ServerURI        = gatekeeper.ServerURI;
            region.ExternalHostName = finalDestination.ExternalHostName;
            region.InternalEndPoint = finalDestination.InternalEndPoint;
            region.RegionName       = finalDestination.RegionName;
            region.RegionID         = finalDestination.RegionID;
            region.RegionLocX       = finalDestination.RegionLocX;
            region.RegionLocY       = finalDestination.RegionLocY;

            // Generate a new service session
            agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
            TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);

            bool   success      = false;
            string myExternalIP = string.Empty;

            m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName);

            if (m_GridName == gridName)
            {
                success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
            }
            else
            {
                success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);
                if (success)
                {
                    // Report them as nowhere
                    m_PresenceService.ReportAgent(agentCircuit.SessionID, UUID.Zero);
                }
            }

            if (!success)
            {
                m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
                                  agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);

                // restore the old travel info
                lock (m_TravelingAgents)
                {
                    if (old == null)
                    {
                        m_TravelingAgents.Remove(agentCircuit.SessionID);
                    }
                    else
                    {
                        m_TravelingAgents[agentCircuit.SessionID] = old;
                    }
                }

                return(false);
            }

            m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
            // else set the IP addresses associated with this client
            if (clientIP != null)
            {
                m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.Address.ToString();
            }
            m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP;

            return(true);
        }
Пример #13
0
        public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason)
        {
            m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
                              agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI);

            string gridName = gatekeeper.ServerURI;

            UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID);

            if (account == null)
            {
                m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname);
                reason = "Forbidden to launch your agents from here";
                return(false);
            }

            // Is this user allowed to go there?
            if (m_GridName != gridName)
            {
                if (m_ForeignTripsAllowed.ContainsKey(account.UserLevel))
                {
                    bool allowed = m_ForeignTripsAllowed[account.UserLevel];

                    if (m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsAllowedExceptions))
                    {
                        allowed = false;
                    }

                    if (!m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsDisallowedExceptions))
                    {
                        allowed = true;
                    }

                    if (!allowed)
                    {
                        reason = "Your world does not allow you to visit the destination";
                        m_log.InfoFormat("[USER AGENT SERVICE]: Agents not permitted to visit {0}. Refusing service.", gridName);
                        return(false);
                    }
                }
            }


            // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
            GridRegion region = new GridRegion(gatekeeper);

            region.ServerURI        = gatekeeper.ServerURI;
            region.ExternalHostName = finalDestination.ExternalHostName;
            region.InternalEndPoint = finalDestination.InternalEndPoint;
            region.RegionName       = finalDestination.RegionName;
            region.RegionID         = finalDestination.RegionID;
            region.RegionLocX       = finalDestination.RegionLocX;
            region.RegionLocY       = finalDestination.RegionLocY;

            // Generate a new service session
            agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
            TravelingAgentInfo old    = null;
            TravelingAgentInfo travel = CreateTravelInfo(agentCircuit, region, fromLogin, out old);

            bool   success      = false;
            string myExternalIP = string.Empty;

            m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}, desired region: {2}", m_GridName, gridName, region.RegionID);

            if (m_GridName == gridName)
            {
                success = m_GatekeeperService.LoginAgent(source, agentCircuit, finalDestination, out reason);
            }
            else
            {
                success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);
            }

            if (!success)
            {
                m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
                                  agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);

                if (old != null)
                {
                    StoreTravelInfo(old);
                }
                else
                {
                    m_Database.Delete(agentCircuit.SessionID);
                }

                return(false);
            }

            // Everything is ok

            // Update the perceived IP Address of our grid
            m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
            travel.MyIpAddress = myExternalIP;

            StoreTravelInfo(travel);

            return(true);
        }
Пример #14
0
        public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason)
        {
            m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
                              agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI);

            string gridName = gatekeeper.ServerURI.ToLowerInvariant();

            UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID);

            if (account == null)
            {
                m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname);
                reason = "Forbidden to launch your agents from here";
                return(false);
            }

            // Is this user allowed to go there?
            if (m_GridName != gridName)
            {
                if (m_ForeignTripsAllowed.ContainsKey(account.UserLevel))
                {
                    bool allowed = m_ForeignTripsAllowed[account.UserLevel];

                    if (m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsAllowedExceptions))
                    {
                        allowed = false;
                    }

                    if (!m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsDisallowedExceptions))
                    {
                        allowed = true;
                    }

                    if (!allowed)
                    {
                        reason = "Your world does not allow you to visit the destination";
                        m_log.InfoFormat("[USER AGENT SERVICE]: Agents not permitted to visit {0}. Refusing service.", gridName);
                        return(false);
                    }
                }
            }

            // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
            GridRegion region = new GridRegion(gatekeeper);

            region.ServerURI        = gatekeeper.ServerURI;
            region.ExternalHostName = finalDestination.ExternalHostName;
            region.InternalEndPoint = finalDestination.InternalEndPoint;
            region.RegionName       = finalDestination.RegionName;
            region.RegionID         = finalDestination.RegionID;
            region.RegionLocX       = finalDestination.RegionLocX;
            region.RegionLocY       = finalDestination.RegionLocY;

            // Generate a new service session
            agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
            TravelingAgentInfo old    = null;
            TravelingAgentInfo travel = CreateTravelInfo(agentCircuit, region, fromLogin, out old);

            if (!fromLogin && old != null && !string.IsNullOrEmpty(old.ClientIPAddress))
            {
                m_log.DebugFormat("[USER AGENT SERVICE]: stored IP = {0}. Old circuit IP: {1}", old.ClientIPAddress, agentCircuit.IPAddress);
                agentCircuit.IPAddress = old.ClientIPAddress;
            }

            bool success = false;

            m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}, desired region: {2}", m_GridName, gridName, region.RegionID);

            if (m_GridName.Equals(gridName, StringComparison.InvariantCultureIgnoreCase))
            {
                success = m_GatekeeperService.LoginAgent(source, agentCircuit, finalDestination, out reason);
            }
            else
            {
                //TODO: Should there not be a call to QueryAccess here?
                EntityTransferContext ctx = new EntityTransferContext();
                success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, ctx, out reason);
            }

            if (!success)
            {
                m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
                                  agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);

                if (old != null)
                {
                    StoreTravelInfo(old);
                }
                else
                {
                    m_Database.Delete(agentCircuit.SessionID);
                }

                return(false);
            }

            // Everything is ok

            StoreTravelInfo(travel);

            return(true);
        }
Пример #15
0
        TravelingAgentInfo CreateTravelInfo(AgentCircuitData agentCircuit, GridRegion region, bool fromLogin, out TravelingAgentInfo existing)
        {
            HGTravelingData hgt = m_Database.Get(agentCircuit.SessionID);
            existing = null;

            if (hgt != null)
            {
                // Very important! Override whatever this agent comes with.
                // UserAgentService always sets the IP for every new agent
                // with the original IP address.
                existing = new TravelingAgentInfo(hgt);
                agentCircuit.IPAddress = existing.ClientIPAddress;
            }

            TravelingAgentInfo travel = new TravelingAgentInfo(existing);
            travel.SessionID = agentCircuit.SessionID;
            travel.UserID = agentCircuit.AgentID;
            travel.GridExternalName = region.ServerURI;
            travel.ServiceToken = agentCircuit.ServiceSessionID;

            if (fromLogin)
                travel.ClientIPAddress = agentCircuit.IPAddress;

            StoreTravelInfo(travel);

            return travel;
        }
Пример #16
0
        TravelingAgentInfo UpdateTravelInfo(AgentCircuitData agentCircuit, GridRegion region)
        {
            TravelingAgentInfo travel = new TravelingAgentInfo();
            TravelingAgentInfo old = null;
            lock (m_TravelingAgents)
            {
                if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID))
                {
                    // Very important! Override whatever this agent comes with.
                    // UserAgentService always sets the IP for every new agent
                    // with the original IP address.
                    agentCircuit.IPAddress = m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress;

                    old = m_TravelingAgents[agentCircuit.SessionID];
                }

                m_TravelingAgents[agentCircuit.SessionID] = travel;
            }
            travel.UserID = agentCircuit.AgentID;
            travel.GridExternalName = region.ServerURI;
            travel.ServiceToken = agentCircuit.ServiceSessionID;
            if (old != null)
                travel.ClientIPAddress = old.ClientIPAddress;

            return old;
        }
Пример #17
0
 public TravelingAgentInfo(TravelingAgentInfo old)
 {
     if (old != null)
     {
         SessionID = old.SessionID;
         UserID = old.UserID;
         GridExternalName = old.GridExternalName;
         ServiceToken = old.ServiceToken;
         ClientIPAddress = old.ClientIPAddress;
         MyIpAddress = old.MyIpAddress;
     }
 }
Пример #18
0
        private void StoreTravelInfo(TravelingAgentInfo travel)
        {
            if (travel == null)
                return;

            HGTravelingData hgt = new HGTravelingData();
            hgt.SessionID = travel.SessionID;
            hgt.UserID = travel.UserID;
            hgt.Data = new Dictionary<string, string>();
            hgt.Data["GridExternalName"] = travel.GridExternalName;
            hgt.Data["ServiceToken"] = travel.ServiceToken;
            hgt.Data["ClientIPAddress"] = travel.ClientIPAddress;
            hgt.Data["MyIPAddress"] = travel.MyIpAddress;

            m_Database.Store(hgt);
        }
Пример #19
0
        public bool VerifyAgent(UUID sessionID, string token)
        {
            HGTravelingData hgt = m_Database.Get(sessionID);
            if (hgt == null)
            {
                m_log.DebugFormat("[USER AGENT SERVICE]: Token verification for session {0}: no such session", sessionID);
                return false;
            }

            TravelingAgentInfo travel = new TravelingAgentInfo(hgt);
            m_log.DebugFormat("[USER AGENT SERVICE]: Verifying agent token {0} against {1}", token, travel.ServiceToken);
            return travel.ServiceToken == token;
        }
Пример #20
0
        public bool VerifyClient(UUID sessionID, string reportedIP)
        {
            if (m_BypassClientVerification)
                return true;

            m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.", 
                sessionID, reportedIP);

            HGTravelingData hgt = m_Database.Get(sessionID);
            if (hgt == null)
                return false;

            TravelingAgentInfo travel = new TravelingAgentInfo(hgt);

            bool result = travel.ClientIPAddress == reportedIP || travel.MyIpAddress == reportedIP; // NATed

            m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}",
                                reportedIP, travel.ClientIPAddress, travel.MyIpAddress, result);

            return result;
        }
Пример #21
0
        // We need to prevent foreign users with the same UUID as a local user
        public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName)
        {
            HGTravelingData hgt = m_Database.Get(sessionID);
            if (hgt == null)
                return false;

            TravelingAgentInfo travel = new TravelingAgentInfo(hgt);

            return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower();
        }