Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
	bin/OpenSimDefaults.ini
This commit is contained in:
Melanie
2013-07-25 16:55:23 +01:00
9 changed files with 359 additions and 86 deletions

View File

@@ -230,6 +230,8 @@ namespace OpenSim.Region.Framework.Scenes
public bool m_seeIntoBannedRegion = false;
public int MaxUndoCount = 5;
public bool SeeIntoRegion { get; set; }
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
public bool LoginLock = false;
@@ -861,9 +863,11 @@ namespace OpenSim.Region.Framework.Scenes
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20);
PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
if (RegionInfo.NonphysPrimMin > 0)
{
@@ -3910,15 +3914,10 @@ namespace OpenSim.Region.Framework.Scenes
try
{
// Always check estate if this is a login. Always
// check if banned regions are to be blacked out.
if (vialogin || (!m_seeIntoBannedRegion))
if (!AuthorizeUser(agent, SeeIntoRegion, out reason))
{
if (!AuthorizeUser(agent, out reason))
{
m_authenticateHandler.RemoveCircuit(agent.circuitcode);
return false;
}
m_authenticateHandler.RemoveCircuit(agent.circuitcode);
return false;
}
}
catch (Exception e)
@@ -4158,7 +4157,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="reason">outputs the reason to this string</param>
/// <returns>True if the region accepts this agent. False if it does not. False will
/// also return a reason.</returns>
protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason)
protected virtual bool AuthorizeUser(AgentCircuitData agent, bool bypassAccessControl, out string reason)
{
reason = String.Empty;
@@ -4193,52 +4192,59 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!");
}
List<UUID> agentGroups = new List<UUID>();
if (m_groupsModule != null)
// We only test the things below when we want to cut off
// child agents from being present in the scene for which their root
// agent isn't allowed. Otherwise, we allow child agents. The test for
// the root is done elsewhere (QueryAccess)
if (!bypassAccessControl)
{
GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID);
List<UUID> agentGroups = new List<UUID>();
if (GroupMembership != null)
if (m_groupsModule != null)
{
for (int i = 0; i < GroupMembership.Length; i++)
agentGroups.Add(GroupMembership[i].GroupID);
GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID);
if (GroupMembership != null)
{
for (int i = 0; i < GroupMembership.Length; i++)
agentGroups.Add(GroupMembership[i].GroupID);
}
else
{
m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!");
}
}
bool groupAccess = false;
UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups;
if (estateGroups != null)
{
foreach (UUID group in estateGroups)
{
if (agentGroups.Contains(group))
{
groupAccess = true;
break;
}
}
}
else
{
m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!");
m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
}
}
bool groupAccess = false;
UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups;
if (estateGroups != null)
{
foreach (UUID group in estateGroups)
if (!RegionInfo.EstateSettings.PublicAccess &&
!RegionInfo.EstateSettings.HasAccess(agent.AgentID) &&
!groupAccess)
{
if (agentGroups.Contains(group))
{
groupAccess = true;
break;
}
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
RegionInfo.RegionName);
return false;
}
}
else
{
m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
}
if (!RegionInfo.EstateSettings.PublicAccess &&
!RegionInfo.EstateSettings.HasAccess(agent.AgentID) &&
!groupAccess)
{
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
RegionInfo.RegionName);
return false;
}
// TODO: estate/region settings are not properly hooked up
// to ILandObject.isRestrictedFromLand()
@@ -4402,6 +4408,20 @@ namespace OpenSim.Region.Framework.Scenes
}
childAgentUpdate.ChildAgentDataUpdate(cAgentData);
int ntimes = 20;
if (cAgentData.SenderWantsToWaitForRoot)
{
while (childAgentUpdate.IsChildAgent && ntimes-- > 0)
Thread.Sleep(1000);
m_log.DebugFormat(
"[SCENE]: Found presence {0} {1} {2} in {3} after {4} waits",
childAgentUpdate.Name, childAgentUpdate.UUID, childAgentUpdate.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 20 - ntimes);
if (childAgentUpdate.IsChildAgent)
return false;
}
return true;
}
return false;
@@ -4459,10 +4479,6 @@ namespace OpenSim.Region.Framework.Scenes
m_log.WarnFormat(
"[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout",
agentID, RegionInfo.RegionName);
// else
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Found presence {0} {1} {2} in {3} after {4} waits",
// sp.Name, sp.UUID, sp.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 10 - ntimes);
return sp;
}
@@ -5873,7 +5889,7 @@ Environment.Exit(1);
try
{
if (!AuthorizeUser(aCircuit, out reason))
if (!AuthorizeUser(aCircuit, false, out reason))
{
// m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
return false;

View File

@@ -29,7 +29,9 @@ using System;
using System.Xml;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Timers;
using Timer = System.Timers.Timer;
using OpenMetaverse;
using log4net;
using Nini.Config;
@@ -1154,9 +1156,8 @@ namespace OpenSim.Region.Framework.Scenes
MovementFlag = 0;
// DIVA NOTE: I moved TriggerOnMakeRootAgent out of here and into the end of
// CompleteMovement. We don't want modules doing heavy computation before CompleteMovement
// is over.
m_scene.EventManager.TriggerOnMakeRootAgent(this);
}
public int GetStateSource()
@@ -1502,6 +1503,26 @@ namespace OpenSim.Region.Framework.Scenes
}
private bool WaitForUpdateAgent(IClientAPI client)
{
// Before UpdateAgent, m_originRegionID is UUID.Zero; after, it's non-Zero
int count = 20;
while (m_originRegionID.Equals(UUID.Zero) && count-- > 0)
{
m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.RegionInfo.RegionName);
Thread.Sleep(200);
}
if (m_originRegionID.Equals(UUID.Zero))
{
// Movement into region will fail
m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived", client.Name);
return false;
}
return true;
}
/// <summary>
/// Complete Avatar's movement into the region.
/// </summary>
@@ -1519,6 +1540,13 @@ namespace OpenSim.Region.Framework.Scenes
"[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
client.Name, Scene.RegionInfo.RegionName, AbsolutePosition);
// Make sure it's not a login agent. We don't want to wait for updates during login
if ((m_teleportFlags & TeleportFlags.ViaLogin) == 0)
// Let's wait until UpdateAgent (called by departing region) is done
if (!WaitForUpdateAgent(client))
// The sending region never sent the UpdateAgent data, we have to refuse
return;
Vector3 look = Velocity;
// if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -1540,10 +1568,11 @@ namespace OpenSim.Region.Framework.Scenes
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
MakeRootAgent(AbsolutePosition, flying);
// Tell the client that we're totally ready
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
// Remember in HandleUseCircuitCode, we delayed this to here
// This will also send the initial data to clients when TP to a neighboring region.
// Not ideal, but until we know we're TP-ing from a neighboring region, there's not much we can do
if (m_teleportFlags > 0)
SendInitialDataToMe();
@@ -1600,10 +1629,6 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
// DIVA NOTE: moved this here from MakeRoot. We don't want modules making heavy
// computations before CompleteMovement is over
m_scene.EventManager.TriggerOnMakeRootAgent(this);
}
/// <summary>