aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs114
1 files changed, 56 insertions, 58 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 236e9c1..6a5f84a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2547,6 +2547,7 @@ namespace OpenSim.Region.Framework.Scenes
2547 } 2547 }
2548 return 2; // StateSource.PrimCrossing 2548 return 2; // StateSource.PrimCrossing
2549 } 2549 }
2550
2550 public int GetUserFlags(UUID user) 2551 public int GetUserFlags(UUID user)
2551 { 2552 {
2552 //Unfortunately the SP approach means that the value is cached until region is restarted 2553 //Unfortunately the SP approach means that the value is cached until region is restarted
@@ -3403,12 +3404,11 @@ namespace OpenSim.Region.Framework.Scenes
3403 sp = null; 3404 sp = null;
3404 } 3405 }
3405 3406
3406 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3407 3407
3408 //On login test land permisions 3408 //On login test land permisions
3409 if (vialogin) 3409 if (vialogin)
3410 { 3410 {
3411 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3411 if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y))
3412 { 3412 {
3413 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); 3413 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString());
3414 return false; 3414 return false;
@@ -3433,8 +3433,13 @@ namespace OpenSim.Region.Framework.Scenes
3433 3433
3434 try 3434 try
3435 { 3435 {
3436 if (!AuthorizeUser(agent, out reason)) 3436 // Always check estate if this is a login. Always
3437 return false; 3437 // check if banned regions are to be blacked out.
3438 if (vialogin || (!m_seeIntoBannedRegion))
3439 {
3440 if (!AuthorizeUser(agent.AgentID, out reason))
3441 return false;
3442 }
3438 } 3443 }
3439 catch (Exception e) 3444 catch (Exception e)
3440 { 3445 {
@@ -3543,21 +3548,26 @@ namespace OpenSim.Region.Framework.Scenes
3543 return true; 3548 return true;
3544 } 3549 }
3545 3550
3546 private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) 3551 private bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
3547 { 3552 {
3548 3553 reason = String.Empty;
3549 bool banned = land.IsBannedFromLand(agent.AgentID); 3554
3550 bool restricted = land.IsRestrictedFromLand(agent.AgentID); 3555 ILandObject land = LandChannel.GetLandObject(posX, posY);
3556 if (land == null)
3557 return false;
3558
3559 bool banned = land.IsBannedFromLand(agentID);
3560 bool restricted = land.IsRestrictedFromLand(agentID);
3551 3561
3552 if (banned || restricted) 3562 if (banned || restricted)
3553 { 3563 {
3554 ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); 3564 ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY);
3555 if (nearestParcel != null) 3565 if (nearestParcel != null)
3556 { 3566 {
3557 //Move agent to nearest allowed 3567 //Move agent to nearest allowed
3558 Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); 3568 Vector3 newPosition = GetParcelCenterAtGround(nearestParcel);
3559 agent.startpos.X = newPosition.X; 3569 posX = newPosition.X;
3560 agent.startpos.Y = newPosition.Y; 3570 posY = newPosition.Y;
3561 } 3571 }
3562 else 3572 else
3563 { 3573 {
@@ -3613,19 +3623,19 @@ namespace OpenSim.Region.Framework.Scenes
3613 /// <param name="reason">outputs the reason to this string</param> 3623 /// <param name="reason">outputs the reason to this string</param>
3614 /// <returns>True if the region accepts this agent. False if it does not. False will 3624 /// <returns>True if the region accepts this agent. False if it does not. False will
3615 /// also return a reason.</returns> 3625 /// also return a reason.</returns>
3616 protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) 3626 protected virtual bool AuthorizeUser(UUID agentID, out string reason)
3617 { 3627 {
3618 reason = String.Empty; 3628 reason = String.Empty;
3619 3629
3620 if (!m_strictAccessControl) return true; 3630 if (!m_strictAccessControl) return true;
3621 if (Permissions.IsGod(agent.AgentID)) return true; 3631 if (Permissions.IsGod(agentID)) return true;
3622 3632
3623 if (AuthorizationService != null) 3633 if (AuthorizationService != null)
3624 { 3634 {
3625 if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString(),out reason)) 3635 if (!AuthorizationService.IsAuthorizedForRegion(agentID.ToString(), RegionInfo.RegionID.ToString(),out reason))
3626 { 3636 {
3627 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", 3637 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region",
3628 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3638 agentID, RegionInfo.RegionName);
3629 //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName); 3639 //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName);
3630 return false; 3640 return false;
3631 } 3641 }
@@ -3634,25 +3644,25 @@ namespace OpenSim.Region.Framework.Scenes
3634 if (m_regInfo.EstateSettings != null) 3644 if (m_regInfo.EstateSettings != null)
3635 { 3645 {
3636 int flags = GetUserFlags(agent.AgentID); 3646 int flags = GetUserFlags(agent.AgentID);
3637 if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID, flags)) 3647 if (m_regInfo.EstateSettings.IsBanned(agentID, flags))
3638 { 3648 {
3639 //Add some more info to help users 3649 //Add some more info to help users
3640 if (!m_regInfo.EstateSettings.IsBanned(agent.AgentID, 32)) 3650 if (!m_regInfo.EstateSettings.IsBanned(agentID, 32))
3641 { 3651 {
3642 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the region requires age verification", 3652 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the region requires age verification",
3643 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3653 agentID, RegionInfo.RegionName);
3644 reason = String.Format("Denied access to region (0): Region requires age verification"); 3654 reason = String.Format("Denied access to region {0}: Region requires age verification", RegionInfo.RegionName);
3645 return false; 3655 return false;
3646 } 3656 }
3647 if (!m_regInfo.EstateSettings.IsBanned(agent.AgentID, 4)) 3657 if (!m_regInfo.EstateSettings.IsBanned(agentID, 4))
3648 { 3658 {
3649 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the region requires payment info on file", 3659 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} {1} because the region requires payment info on file",
3650 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3660 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3651 reason = String.Format("Denied access to region (0): Region requires payment info on file"); 3661 reason = String.Format("Denied access to region {0}: Region requires payment info on file", RegionInfo.RegionName);
3652 return false; 3662 return false;
3653 } 3663 }
3654 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", 3664 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {3} because the user is on the banlist",
3655 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3665 agent.AgentID, RegionInfo.RegionName);
3656 reason = String.Format("Denied access to region {0}: You have been banned from that region.", 3666 reason = String.Format("Denied access to region {0}: You have been banned from that region.",
3657 RegionInfo.RegionName); 3667 RegionInfo.RegionName);
3658 return false; 3668 return false;
@@ -3669,7 +3679,7 @@ namespace OpenSim.Region.Framework.Scenes
3669 if (groupsModule != null) 3679 if (groupsModule != null)
3670 { 3680 {
3671 GroupMembershipData[] GroupMembership = 3681 GroupMembershipData[] GroupMembership =
3672 groupsModule.GetMembershipData(agent.AgentID); 3682 groupsModule.GetMembershipData(agentID);
3673 3683
3674 if (GroupMembership != null) 3684 if (GroupMembership != null)
3675 { 3685 {
@@ -3698,44 +3708,16 @@ namespace OpenSim.Region.Framework.Scenes
3698 m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); 3708 m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
3699 3709
3700 if (!m_regInfo.EstateSettings.PublicAccess && 3710 if (!m_regInfo.EstateSettings.PublicAccess &&
3701 !m_regInfo.EstateSettings.HasAccess(agent.AgentID) && 3711 !m_regInfo.EstateSettings.HasAccess(agentID) &&
3702 !groupAccess) 3712 !groupAccess)
3703 { 3713 {
3704 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", 3714 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the estate",
3705 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3715 agentID, RegionInfo.RegionName);
3706 reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", 3716 reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
3707 RegionInfo.RegionName); 3717 RegionInfo.RegionName);
3708 return false; 3718 return false;
3709 } 3719 }
3710 3720
3711 // TODO: estate/region settings are not properly hooked up
3712 // to ILandObject.isRestrictedFromLand()
3713 // if (null != LandChannel)
3714 // {
3715 // // region seems to have local Id of 1
3716 // ILandObject land = LandChannel.GetLandObject(1);
3717 // if (null != land)
3718 // {
3719 // if (land.isBannedFromLand(agent.AgentID))
3720 // {
3721 // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user has been banned from land",
3722 // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3723 // reason = String.Format("Denied access to private region {0}: You are banned from that region.",
3724 // RegionInfo.RegionName);
3725 // return false;
3726 // }
3727
3728 // if (land.isRestrictedFromLand(agent.AgentID))
3729 // {
3730 // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
3731 // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3732 // reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
3733 // RegionInfo.RegionName);
3734 // return false;
3735 // }
3736 // }
3737 // }
3738
3739 return true; 3721 return true;
3740 } 3722 }
3741 3723
@@ -5206,6 +5188,22 @@ namespace OpenSim.Region.Framework.Scenes
5206 // child agent creation, thereby emulating the SL behavior. 5188 // child agent creation, thereby emulating the SL behavior.
5207 public bool QueryAccess(UUID agentID) 5189 public bool QueryAccess(UUID agentID)
5208 { 5190 {
5191 string reason;
5192
5193 if (!AuthorizeUser(agentID, out reason))
5194 {
5195 m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
5196 return false;
5197 }
5198
5199 float posX = 128.0f;
5200 float posY = 128.0f;
5201
5202 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
5203 {
5204 m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
5205 return false;
5206 }
5209 return true; 5207 return true;
5210 } 5208 }
5211 } 5209 }