aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2011-01-27 02:16:41 +0100
committerMelanie2011-01-27 02:16:41 +0100
commit11c742a5a8b1edd97923cc445aa43e0ba92f1bce (patch)
tree08221312c1d40942466d2e119be1f8103808a89b
parentReproduce a corner case behavior for llListReplaceList (diff)
downloadopensim-SC_OLD-11c742a5a8b1edd97923cc445aa43e0ba92f1bce.zip
opensim-SC_OLD-11c742a5a8b1edd97923cc445aa43e0ba92f1bce.tar.gz
opensim-SC_OLD-11c742a5a8b1edd97923cc445aa43e0ba92f1bce.tar.bz2
opensim-SC_OLD-11c742a5a8b1edd97923cc445aa43e0ba92f1bce.tar.xz
Make bans work for teleport. Now teleport will complete block if the user
is not allowed on the estate. If the user is allowed on no parcel, the teleport will also be blocked. If the user is allowed on a parcel, but not the desired one, the user will be shifted to the closest allowed location.
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs99
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs2
4 files changed, 56 insertions, 57 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index eb150d9..4bf2477 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -281,6 +281,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
281 return; 281 return;
282 } 282 }
283 283
284 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId))
285 {
286 sp.ControllingClient.SendTeleportFailed("The destination region has refused access");
287 return;
288 }
289
284 sp.ControllingClient.SendTeleportStart(teleportFlags); 290 sp.ControllingClient.SendTeleportStart(teleportFlags);
285 291
286 // the avatar.Close below will clear the child region list. We need this below for (possibly) 292 // the avatar.Close below will clear the child region list. We need this below for (possibly)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 5be6486..aaf7bf3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -264,13 +264,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
264 264
265 foreach (Scene s in m_sceneList) 265 foreach (Scene s in m_sceneList)
266 { 266 {
267 if (s.RegionInfo.RegionHandle == destination.RegionHandle) 267 if (s.RegionInfo.RegionID == destination.RegionID)
268 {
269 //m_log.Debug("[LOCAL COMMS]: Found region to send QueryAccess");
270 return s.QueryAccess(id); 268 return s.QueryAccess(id);
271 }
272 } 269 }
273 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
274 return false; 270 return false;
275 } 271 }
276 272
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a4f630a..fc4110b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3387,12 +3387,11 @@ namespace OpenSim.Region.Framework.Scenes
3387 sp = null; 3387 sp = null;
3388 } 3388 }
3389 3389
3390 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3391 3390
3392 //On login test land permisions 3391 //On login test land permisions
3393 if (vialogin) 3392 if (vialogin)
3394 { 3393 {
3395 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3394 if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y))
3396 { 3395 {
3397 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); 3396 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString());
3398 return false; 3397 return false;
@@ -3417,8 +3416,13 @@ namespace OpenSim.Region.Framework.Scenes
3417 3416
3418 try 3417 try
3419 { 3418 {
3420 if (!AuthorizeUser(agent, out reason)) 3419 // Always check estate if this is a login. Always
3421 return false; 3420 // check if banned regions are to be blacked out.
3421 if (vialogin || (!m_seeIntoBannedRegion))
3422 {
3423 if (!AuthorizeUser(agent.AgentID, out reason))
3424 return false;
3425 }
3422 } 3426 }
3423 catch (Exception e) 3427 catch (Exception e)
3424 { 3428 {
@@ -3527,21 +3531,26 @@ namespace OpenSim.Region.Framework.Scenes
3527 return true; 3531 return true;
3528 } 3532 }
3529 3533
3530 private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) 3534 private bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
3531 { 3535 {
3532 3536 reason = String.Empty;
3533 bool banned = land.IsBannedFromLand(agent.AgentID); 3537
3534 bool restricted = land.IsRestrictedFromLand(agent.AgentID); 3538 ILandObject land = LandChannel.GetLandObject(posX, posY);
3539 if (land == null)
3540 return false;
3541
3542 bool banned = land.IsBannedFromLand(agentID);
3543 bool restricted = land.IsRestrictedFromLand(agentID);
3535 3544
3536 if (banned || restricted) 3545 if (banned || restricted)
3537 { 3546 {
3538 ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); 3547 ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY);
3539 if (nearestParcel != null) 3548 if (nearestParcel != null)
3540 { 3549 {
3541 //Move agent to nearest allowed 3550 //Move agent to nearest allowed
3542 Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); 3551 Vector3 newPosition = GetParcelCenterAtGround(nearestParcel);
3543 agent.startpos.X = newPosition.X; 3552 posX = newPosition.X;
3544 agent.startpos.Y = newPosition.Y; 3553 posY = newPosition.Y;
3545 } 3554 }
3546 else 3555 else
3547 { 3556 {
@@ -3597,19 +3606,19 @@ namespace OpenSim.Region.Framework.Scenes
3597 /// <param name="reason">outputs the reason to this string</param> 3606 /// <param name="reason">outputs the reason to this string</param>
3598 /// <returns>True if the region accepts this agent. False if it does not. False will 3607 /// <returns>True if the region accepts this agent. False if it does not. False will
3599 /// also return a reason.</returns> 3608 /// also return a reason.</returns>
3600 protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) 3609 protected virtual bool AuthorizeUser(UUID agentID, out string reason)
3601 { 3610 {
3602 reason = String.Empty; 3611 reason = String.Empty;
3603 3612
3604 if (!m_strictAccessControl) return true; 3613 if (!m_strictAccessControl) return true;
3605 if (Permissions.IsGod(agent.AgentID)) return true; 3614 if (Permissions.IsGod(agentID)) return true;
3606 3615
3607 if (AuthorizationService != null) 3616 if (AuthorizationService != null)
3608 { 3617 {
3609 if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString(),out reason)) 3618 if (!AuthorizationService.IsAuthorizedForRegion(agentID.ToString(), RegionInfo.RegionID.ToString(),out reason))
3610 { 3619 {
3611 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", 3620 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region",
3612 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3621 agentID, RegionInfo.RegionName);
3613 //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName); 3622 //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName);
3614 return false; 3623 return false;
3615 } 3624 }
@@ -3617,10 +3626,10 @@ namespace OpenSim.Region.Framework.Scenes
3617 3626
3618 if (m_regInfo.EstateSettings != null) 3627 if (m_regInfo.EstateSettings != null)
3619 { 3628 {
3620 if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID)) 3629 if (m_regInfo.EstateSettings.IsBanned(agentID))
3621 { 3630 {
3622 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", 3631 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user is on the banlist",
3623 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3632 agentID, RegionInfo.RegionName);
3624 reason = String.Format("Denied access to region {0}: You have been banned from that region.", 3633 reason = String.Format("Denied access to region {0}: You have been banned from that region.",
3625 RegionInfo.RegionName); 3634 RegionInfo.RegionName);
3626 return false; 3635 return false;
@@ -3637,7 +3646,7 @@ namespace OpenSim.Region.Framework.Scenes
3637 if (groupsModule != null) 3646 if (groupsModule != null)
3638 { 3647 {
3639 GroupMembershipData[] GroupMembership = 3648 GroupMembershipData[] GroupMembership =
3640 groupsModule.GetMembershipData(agent.AgentID); 3649 groupsModule.GetMembershipData(agentID);
3641 3650
3642 if (GroupMembership != null) 3651 if (GroupMembership != null)
3643 { 3652 {
@@ -3666,44 +3675,16 @@ namespace OpenSim.Region.Framework.Scenes
3666 m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); 3675 m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
3667 3676
3668 if (!m_regInfo.EstateSettings.PublicAccess && 3677 if (!m_regInfo.EstateSettings.PublicAccess &&
3669 !m_regInfo.EstateSettings.HasAccess(agent.AgentID) && 3678 !m_regInfo.EstateSettings.HasAccess(agentID) &&
3670 !groupAccess) 3679 !groupAccess)
3671 { 3680 {
3672 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", 3681 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the estate",
3673 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3682 agentID, RegionInfo.RegionName);
3674 reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", 3683 reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
3675 RegionInfo.RegionName); 3684 RegionInfo.RegionName);
3676 return false; 3685 return false;
3677 } 3686 }
3678 3687
3679 // TODO: estate/region settings are not properly hooked up
3680 // to ILandObject.isRestrictedFromLand()
3681 // if (null != LandChannel)
3682 // {
3683 // // region seems to have local Id of 1
3684 // ILandObject land = LandChannel.GetLandObject(1);
3685 // if (null != land)
3686 // {
3687 // if (land.isBannedFromLand(agent.AgentID))
3688 // {
3689 // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user has been banned from land",
3690 // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3691 // reason = String.Format("Denied access to private region {0}: You are banned from that region.",
3692 // RegionInfo.RegionName);
3693 // return false;
3694 // }
3695
3696 // if (land.isRestrictedFromLand(agent.AgentID))
3697 // {
3698 // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
3699 // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3700 // reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
3701 // RegionInfo.RegionName);
3702 // return false;
3703 // }
3704 // }
3705 // }
3706
3707 return true; 3688 return true;
3708 } 3689 }
3709 3690
@@ -5173,6 +5154,22 @@ namespace OpenSim.Region.Framework.Scenes
5173 // child agent creation, thereby emulating the SL behavior. 5154 // child agent creation, thereby emulating the SL behavior.
5174 public bool QueryAccess(UUID agentID) 5155 public bool QueryAccess(UUID agentID)
5175 { 5156 {
5157 string reason;
5158
5159 if (!AuthorizeUser(agentID, out reason))
5160 {
5161 m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
5162 return false;
5163 }
5164
5165 float posX = 128.0f;
5166 float posY = 128.0f;
5167
5168 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
5169 {
5170 m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
5171 return false;
5172 }
5176 return true; 5173 return true;
5177 } 5174 }
5178 } 5175 }
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 6d01f80..89832f4 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -115,7 +115,7 @@ namespace OpenSim.Server.Handlers.Simulation
115 DoChildAgentDelete(request, responsedata, agentID, action, regionID); 115 DoChildAgentDelete(request, responsedata, agentID, action, regionID);
116 return responsedata; 116 return responsedata;
117 } 117 }
118 else if (method.Equals("QUERYACCESSS")) 118 else if (method.Equals("QUERYACCESS"))
119 { 119 {
120 DoQueryAccess(request, responsedata, agentID, regionID); 120 DoQueryAccess(request, responsedata, agentID, regionID);
121 return responsedata; 121 return responsedata;