aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2013-07-14 09:21:28 -0700
committerDiva Canto2013-07-14 09:21:28 -0700
commitc61ff917ef99a00d4062f264ed10c2a662585e8a (patch)
treec624d0237759bc402f33473bf12f753c45b29135
parentChange the auth token to be the user's sessionid. (diff)
downloadopensim-SC_OLD-c61ff917ef99a00d4062f264ed10c2a662585e8a.zip
opensim-SC_OLD-c61ff917ef99a00d4062f264ed10c2a662585e8a.tar.gz
opensim-SC_OLD-c61ff917ef99a00d4062f264ed10c2a662585e8a.tar.bz2
opensim-SC_OLD-c61ff917ef99a00d4062f264ed10c2a662585e8a.tar.xz
Authenticate ChildAgentUpdate too.
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs3
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs42
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs3
4 files changed, 32 insertions, 18 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index dfe60aa..9fc048b 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -171,9 +171,10 @@ namespace OpenSim.Framework
171 /// Soon to be decommissioned 171 /// Soon to be decommissioned
172 /// </summary> 172 /// </summary>
173 /// <param name="cAgent"></param> 173 /// <param name="cAgent"></param>
174 public void CopyFrom(ChildAgentDataUpdate cAgent) 174 public void CopyFrom(ChildAgentDataUpdate cAgent, UUID sid)
175 { 175 {
176 AgentID = new UUID(cAgent.AgentID); 176 AgentID = new UUID(cAgent.AgentID);
177 SessionID = sid;
177 178
178 // next: ??? 179 // next: ???
179 Size = new Vector3(); 180 Size = new Vector3();
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index 1dc8053..3f0a031 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Framework.Tests
100 cadu.AVHeight = Size1.Z; 100 cadu.AVHeight = Size1.Z;
101 101
102 AgentPosition position2 = new AgentPosition(); 102 AgentPosition position2 = new AgentPosition();
103 position2.CopyFrom(cadu); 103 position2.CopyFrom(cadu, position1.SessionID);
104 104
105 Assert.IsTrue( 105 Assert.IsTrue(
106 position2.AgentID == position1.AgentID 106 position2.AgentID == position1.AgentID
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ea7081c..b07faa2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4202,10 +4202,18 @@ namespace OpenSim.Region.Framework.Scenes
4202 4202
4203 if (childAgentUpdate != null) 4203 if (childAgentUpdate != null)
4204 { 4204 {
4205 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 4205 if (cAgentData.SessionID == childAgentUpdate.ControllingClient.SessionId)
4206 return true; 4206 {
4207 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
4208 return true;
4209 }
4210 else
4211 {
4212 m_log.WarnFormat("[SCENE]: Attempt to update agent {0} with invalid session id {1}", childAgentUpdate.UUID, cAgentData.SessionID);
4213 Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}",
4214 childAgentUpdate.UUID, childAgentUpdate.ControllingClient.SessionId, cAgentData.SessionID));
4215 }
4207 } 4216 }
4208
4209 return false; 4217 return false;
4210 } 4218 }
4211 4219
@@ -4221,20 +4229,24 @@ namespace OpenSim.Region.Framework.Scenes
4221 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 4229 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
4222 if (childAgentUpdate != null) 4230 if (childAgentUpdate != null)
4223 { 4231 {
4224 // I can't imagine *yet* why we would get an update if the agent is a root agent.. 4232 if (childAgentUpdate.ControllingClient.SessionId == cAgentData.SessionID)
4225 // however to avoid a race condition crossing borders..
4226 if (childAgentUpdate.IsChildAgent)
4227 { 4233 {
4228 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40); 4234 // I can't imagine *yet* why we would get an update if the agent is a root agent..
4229 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8); 4235 // however to avoid a race condition crossing borders..
4230 uint tRegionX = RegionInfo.RegionLocX; 4236 if (childAgentUpdate.IsChildAgent)
4231 uint tRegionY = RegionInfo.RegionLocY; 4237 {
4232 //Send Data to ScenePresence 4238 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
4233 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); 4239 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
4234 // Not Implemented: 4240 uint tRegionX = RegionInfo.RegionLocX;
4235 //TODO: Do we need to pass the message on to one of our neighbors? 4241 uint tRegionY = RegionInfo.RegionLocY;
4242 //Send Data to ScenePresence
4243 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY);
4244 // Not Implemented:
4245 //TODO: Do we need to pass the message on to one of our neighbors?
4246 }
4236 } 4247 }
4237 4248 else
4249 m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}", childAgentUpdate.UUID, cAgentData.SessionID);
4238 return true; 4250 return true;
4239 } 4251 }
4240 4252
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c5cca22..990ef6e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2927,7 +2927,7 @@ namespace OpenSim.Region.Framework.Scenes
2927 cadu.Velocity = Velocity; 2927 cadu.Velocity = Velocity;
2928 2928
2929 AgentPosition agentpos = new AgentPosition(); 2929 AgentPosition agentpos = new AgentPosition();
2930 agentpos.CopyFrom(cadu); 2930 agentpos.CopyFrom(cadu, ControllingClient.SessionId);
2931 2931
2932 // Let's get this out of the update loop 2932 // Let's get this out of the update loop
2933 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); 2933 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); });
@@ -3266,6 +3266,7 @@ namespace OpenSim.Region.Framework.Scenes
3266 3266
3267 cAgent.AgentID = UUID; 3267 cAgent.AgentID = UUID;
3268 cAgent.RegionID = Scene.RegionInfo.RegionID; 3268 cAgent.RegionID = Scene.RegionInfo.RegionID;
3269 cAgent.SessionID = ControllingClient.SessionId;
3269 3270
3270 cAgent.Position = AbsolutePosition; 3271 cAgent.Position = AbsolutePosition;
3271 cAgent.Velocity = m_velocity; 3272 cAgent.Velocity = m_velocity;