From 7f727bd33eef49b90c751d21ba8c69ef375f2cf7 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 26 Feb 2009 22:37:02 +0000 Subject: This adds a new osGetAgentIP function with threat level set to High. It isn't tested, but it doesn't break anything else. The reason for this function is to let in world tools be used to coordiante out of world network services that need access to client ip addresses. --- .../Shared/Api/Implementation/OSSL_Api.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7834a83..e008ff4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -30,6 +30,7 @@ using System.Collections; using System.Collections.Generic; using System.Runtime.Remoting.Lifetime; using System.Text; +using System.Net; using OpenMetaverse; using Nini.Config; using OpenSim; @@ -548,6 +549,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); } + // Functions that get information from the agent itself. + // + // osGetAgentIP - this is used to determine the IP address of + //the client. This is needed to help configure other in world + //resources based on the IP address of the clients connected. + //I think High is a good risk level for this, as it is an + //information leak. + public string osGetAgentIP(string agent) + { + CheckThreatLevel(ThreatLevel.High, "osGetAgentIP"); + + UUID avatarID = (UUID)agent; + + m_host.AddScriptLPS(1); + if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence) + { + ScenePresence target = (ScenePresence)World.Entities[avatarID]; + EndPoint ep = target.ControllingClient.GetClientInfo().userEP; + if (ep is IPEndPoint) + { + IPEndPoint ip = (IPEndPoint)ep; + return ip.Address.ToString(); + } + } + // fall through case, just return nothing + return ""; + } + // Adam's super super custom animation functions public void osAvatarPlayAnimation(string avatar, string animation) { -- cgit v1.1