aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs114
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs43
2 files changed, 99 insertions, 58 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c132c5d..96e45ed 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -230,6 +230,8 @@ namespace OpenSim.Region.Framework.Scenes
230 public bool m_seeIntoBannedRegion = false; 230 public bool m_seeIntoBannedRegion = false;
231 public int MaxUndoCount = 5; 231 public int MaxUndoCount = 5;
232 232
233 public bool SeeIntoRegion { get; set; }
234
233 // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; 235 // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
234 public bool LoginLock = false; 236 public bool LoginLock = false;
235 237
@@ -861,9 +863,11 @@ namespace OpenSim.Region.Framework.Scenes
861 //Animation states 863 //Animation states
862 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 864 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
863 865
866
867 MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20);
868
864 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 869 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
865 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 870 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
866
867 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); 871 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
868 if (RegionInfo.NonphysPrimMin > 0) 872 if (RegionInfo.NonphysPrimMin > 0)
869 { 873 {
@@ -3910,15 +3914,10 @@ namespace OpenSim.Region.Framework.Scenes
3910 3914
3911 try 3915 try
3912 { 3916 {
3913 // Always check estate if this is a login. Always 3917 if (!AuthorizeUser(agent, SeeIntoRegion, out reason))
3914 // check if banned regions are to be blacked out.
3915 if (vialogin || (!m_seeIntoBannedRegion))
3916 { 3918 {
3917 if (!AuthorizeUser(agent, out reason)) 3919 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3918 { 3920 return false;
3919 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3920 return false;
3921 }
3922 } 3921 }
3923 } 3922 }
3924 catch (Exception e) 3923 catch (Exception e)
@@ -4158,7 +4157,7 @@ namespace OpenSim.Region.Framework.Scenes
4158 /// <param name="reason">outputs the reason to this string</param> 4157 /// <param name="reason">outputs the reason to this string</param>
4159 /// <returns>True if the region accepts this agent. False if it does not. False will 4158 /// <returns>True if the region accepts this agent. False if it does not. False will
4160 /// also return a reason.</returns> 4159 /// also return a reason.</returns>
4161 protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) 4160 protected virtual bool AuthorizeUser(AgentCircuitData agent, bool bypassAccessControl, out string reason)
4162 { 4161 {
4163 reason = String.Empty; 4162 reason = String.Empty;
4164 4163
@@ -4193,51 +4192,58 @@ namespace OpenSim.Region.Framework.Scenes
4193 m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!"); 4192 m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!");
4194 } 4193 }
4195 4194
4196 List<UUID> agentGroups = new List<UUID>(); 4195 // We only test the things below when we want to cut off
4197 4196 // child agents from being present in the scene for which their root
4198 if (m_groupsModule != null) 4197 // agent isn't allowed. Otherwise, we allow child agents. The test for
4198 // the root is done elsewhere (QueryAccess)
4199 if (!bypassAccessControl)
4199 { 4200 {
4200 GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID); 4201 List<UUID> agentGroups = new List<UUID>();
4201 4202
4202 if (GroupMembership != null) 4203 if (m_groupsModule != null)
4203 { 4204 {
4204 for (int i = 0; i < GroupMembership.Length; i++) 4205 GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID);
4205 agentGroups.Add(GroupMembership[i].GroupID); 4206
4206 } 4207 if (GroupMembership != null)
4207 else 4208 {
4208 { 4209 for (int i = 0; i < GroupMembership.Length; i++)
4209 m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!"); 4210 agentGroups.Add(GroupMembership[i].GroupID);
4211 }
4212 else
4213 {
4214 m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!");
4215 }
4210 } 4216 }
4211 }
4212 4217
4213 bool groupAccess = false; 4218 bool groupAccess = false;
4214 UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups; 4219 UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups;
4215 4220
4216 if (estateGroups != null) 4221 if (estateGroups != null)
4217 {
4218 foreach (UUID group in estateGroups)
4219 { 4222 {
4220 if (agentGroups.Contains(group)) 4223 foreach (UUID group in estateGroups)
4221 { 4224 {
4222 groupAccess = true; 4225 if (agentGroups.Contains(group))
4223 break; 4226 {
4227 groupAccess = true;
4228 break;
4229 }
4224 } 4230 }
4225 } 4231 }
4226 } 4232 else
4227 else 4233 {
4228 { 4234 m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
4229 m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); 4235 }
4230 }
4231 4236
4232 if (!RegionInfo.EstateSettings.PublicAccess && 4237 if (!RegionInfo.EstateSettings.PublicAccess &&
4233 !RegionInfo.EstateSettings.HasAccess(agent.AgentID) && 4238 !RegionInfo.EstateSettings.HasAccess(agent.AgentID) &&
4234 !groupAccess) 4239 !groupAccess)
4235 { 4240 {
4236 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", 4241 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
4237 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 4242 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
4238 reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", 4243 reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
4239 RegionInfo.RegionName); 4244 RegionInfo.RegionName);
4240 return false; 4245 return false;
4246 }
4241 } 4247 }
4242 4248
4243 // TODO: estate/region settings are not properly hooked up 4249 // TODO: estate/region settings are not properly hooked up
@@ -4402,6 +4408,20 @@ namespace OpenSim.Region.Framework.Scenes
4402 } 4408 }
4403 4409
4404 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 4410 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
4411
4412 int ntimes = 20;
4413 if (cAgentData.SenderWantsToWaitForRoot)
4414 {
4415 while (childAgentUpdate.IsChildAgent && ntimes-- > 0)
4416 Thread.Sleep(1000);
4417
4418 m_log.DebugFormat(
4419 "[SCENE]: Found presence {0} {1} {2} in {3} after {4} waits",
4420 childAgentUpdate.Name, childAgentUpdate.UUID, childAgentUpdate.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 20 - ntimes);
4421
4422 if (childAgentUpdate.IsChildAgent)
4423 return false;
4424 }
4405 return true; 4425 return true;
4406 } 4426 }
4407 return false; 4427 return false;
@@ -4459,10 +4479,6 @@ namespace OpenSim.Region.Framework.Scenes
4459 m_log.WarnFormat( 4479 m_log.WarnFormat(
4460 "[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout", 4480 "[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout",
4461 agentID, RegionInfo.RegionName); 4481 agentID, RegionInfo.RegionName);
4462// else
4463// m_log.DebugFormat(
4464// "[SCENE PRESENCE]: Found presence {0} {1} {2} in {3} after {4} waits",
4465// sp.Name, sp.UUID, sp.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 10 - ntimes);
4466 4482
4467 return sp; 4483 return sp;
4468 } 4484 }
@@ -5873,7 +5889,7 @@ Environment.Exit(1);
5873 5889
5874 try 5890 try
5875 { 5891 {
5876 if (!AuthorizeUser(aCircuit, out reason)) 5892 if (!AuthorizeUser(aCircuit, false, out reason))
5877 { 5893 {
5878 // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); 5894 // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
5879 return false; 5895 return false;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1225c2e..c78fe62 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -29,7 +29,9 @@ using System;
29using System.Xml; 29using System.Xml;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Threading;
32using System.Timers; 33using System.Timers;
34using Timer = System.Timers.Timer;
33using OpenMetaverse; 35using OpenMetaverse;
34using log4net; 36using log4net;
35using Nini.Config; 37using Nini.Config;
@@ -1154,9 +1156,8 @@ namespace OpenSim.Region.Framework.Scenes
1154 1156
1155 MovementFlag = 0; 1157 MovementFlag = 0;
1156 1158
1157 // DIVA NOTE: I moved TriggerOnMakeRootAgent out of here and into the end of 1159 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1158 // CompleteMovement. We don't want modules doing heavy computation before CompleteMovement 1160
1159 // is over.
1160 } 1161 }
1161 1162
1162 public int GetStateSource() 1163 public int GetStateSource()
@@ -1502,6 +1503,26 @@ namespace OpenSim.Region.Framework.Scenes
1502 1503
1503 } 1504 }
1504 1505
1506 private bool WaitForUpdateAgent(IClientAPI client)
1507 {
1508 // Before UpdateAgent, m_originRegionID is UUID.Zero; after, it's non-Zero
1509 int count = 20;
1510 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0)
1511 {
1512 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.RegionInfo.RegionName);
1513 Thread.Sleep(200);
1514 }
1515
1516 if (m_originRegionID.Equals(UUID.Zero))
1517 {
1518 // Movement into region will fail
1519 m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived", client.Name);
1520 return false;
1521 }
1522
1523 return true;
1524 }
1525
1505 /// <summary> 1526 /// <summary>
1506 /// Complete Avatar's movement into the region. 1527 /// Complete Avatar's movement into the region.
1507 /// </summary> 1528 /// </summary>
@@ -1519,6 +1540,13 @@ namespace OpenSim.Region.Framework.Scenes
1519 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", 1540 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
1520 client.Name, Scene.RegionInfo.RegionName, AbsolutePosition); 1541 client.Name, Scene.RegionInfo.RegionName, AbsolutePosition);
1521 1542
1543 // Make sure it's not a login agent. We don't want to wait for updates during login
1544 if ((m_teleportFlags & TeleportFlags.ViaLogin) == 0)
1545 // Let's wait until UpdateAgent (called by departing region) is done
1546 if (!WaitForUpdateAgent(client))
1547 // The sending region never sent the UpdateAgent data, we have to refuse
1548 return;
1549
1522 Vector3 look = Velocity; 1550 Vector3 look = Velocity;
1523 1551
1524 // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1552 // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -1540,10 +1568,11 @@ namespace OpenSim.Region.Framework.Scenes
1540 1568
1541 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1569 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1542 MakeRootAgent(AbsolutePosition, flying); 1570 MakeRootAgent(AbsolutePosition, flying);
1571
1572 // Tell the client that we're totally ready
1543 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1573 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1574
1544 // Remember in HandleUseCircuitCode, we delayed this to here 1575 // Remember in HandleUseCircuitCode, we delayed this to here
1545 // This will also send the initial data to clients when TP to a neighboring region.
1546 // Not ideal, but until we know we're TP-ing from a neighboring region, there's not much we can do
1547 if (m_teleportFlags > 0) 1576 if (m_teleportFlags > 0)
1548 SendInitialDataToMe(); 1577 SendInitialDataToMe();
1549 1578
@@ -1600,10 +1629,6 @@ namespace OpenSim.Region.Framework.Scenes
1600// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1629// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1601// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1630// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1602 1631
1603 // DIVA NOTE: moved this here from MakeRoot. We don't want modules making heavy
1604 // computations before CompleteMovement is over
1605 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1606
1607 } 1632 }
1608 1633
1609 /// <summary> 1634 /// <summary>