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 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 3 +++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 6 +++++
prebuild.xml | 1 +
4 files changed, 39 insertions(+)
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)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 1150d76..c3c5cec 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -67,6 +67,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetParcelMediaURL(string url);
void osSetPrimFloatOnWater(int floatYN);
+ // Avatar Info Commands
+ string osGetAgentIP(string agent);
+
// Teleport commands
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 6ba8b20..d8b9f1f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -143,6 +143,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osTeleportAgent(agent, position, lookat);
}
+ // Avatar info functions
+ public string osGetAgentIP(string agent)
+ {
+ return m_OSSL_Functions.osGetAgentIP(agent);
+ }
+
// Animation Functions
public void osAvatarPlayAnimation(string avatar, string animation)
diff --git a/prebuild.xml b/prebuild.xml
index 2531e0b..85e429d 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1895,6 +1895,7 @@
../../../../bin/
+
--
cgit v1.1