diff options
author | Tom | 2011-01-26 14:20:39 -0800 |
---|---|---|
committer | Tom | 2011-01-26 14:20:39 -0800 |
commit | 3ecf712e4dd5318442e7c853eb43299840594ce5 (patch) | |
tree | 9ba1930ba8f11daddb85e26155b61435e95c4ab8 | |
parent | Revert my previous SHA1 commit in favour of a better implementation (diff) | |
download | opensim-SC-3ecf712e4dd5318442e7c853eb43299840594ce5.zip opensim-SC-3ecf712e4dd5318442e7c853eb43299840594ce5.tar.gz opensim-SC-3ecf712e4dd5318442e7c853eb43299840594ce5.tar.bz2 opensim-SC-3ecf712e4dd5318442e7c853eb43299840594ce5.tar.xz |
Add userFlags check to isBanned. This checks bans against DenyAnonymous and DenyMinors. Note that the ban doesn't actually work yet due to some stuff mel's working on .
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/EstateSettings.cs | 23 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 |
5 files changed, 78 insertions, 10 deletions
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 2a495b0..f9c13f3 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -338,11 +338,30 @@ namespace OpenSim.Framework | |||
338 | return false; | 338 | return false; |
339 | } | 339 | } |
340 | 340 | ||
341 | public bool IsBanned(UUID avatarID) | 341 | public bool IsBanned(UUID avatarID, int userFlags) |
342 | { | 342 | { |
343 | foreach (EstateBan ban in l_EstateBans) | 343 | foreach (EstateBan ban in l_EstateBans) |
344 | if (ban.BannedUserID == avatarID) | 344 | if (ban.BannedUserID == avatarID) |
345 | return true; | 345 | return true; |
346 | |||
347 | if (!IsEstateManager(avatarID) && !HasAccess(avatarID)) | ||
348 | { | ||
349 | if (DenyMinors) | ||
350 | { | ||
351 | if ((userFlags & 32) == 0) | ||
352 | { | ||
353 | return true; | ||
354 | } | ||
355 | } | ||
356 | if (DenyAnonymous) | ||
357 | { | ||
358 | if ((userFlags & 4) == 0) | ||
359 | { | ||
360 | return true; | ||
361 | } | ||
362 | } | ||
363 | } | ||
364 | |||
346 | return false; | 365 | return false; |
347 | } | 366 | } |
348 | 367 | ||
@@ -350,7 +369,7 @@ namespace OpenSim.Framework | |||
350 | { | 369 | { |
351 | if (ban == null) | 370 | if (ban == null) |
352 | return; | 371 | return; |
353 | if (!IsBanned(ban.BannedUserID)) | 372 | if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans |
354 | l_EstateBans.Add(ban); | 373 | l_EstateBans.Add(ban); |
355 | } | 374 | } |
356 | 375 | ||
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index e7f8bfc..e131260 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs | |||
@@ -217,12 +217,12 @@ namespace OpenSim.Framework.Tests | |||
217 | BannedHostNameMask = string.Empty, | 217 | BannedHostNameMask = string.Empty, |
218 | BannedUserID = bannedUserId} | 218 | BannedUserID = bannedUserId} |
219 | ); | 219 | ); |
220 | Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); | 220 | Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not."); |
221 | Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); | 221 | Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is."); |
222 | 222 | ||
223 | es.RemoveBan(bannedUserId); | 223 | es.RemoveBan(bannedUserId); |
224 | 224 | ||
225 | Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); | 225 | Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is."); |
226 | 226 | ||
227 | es.AddEstateManager(UUID.Zero); | 227 | es.AddEstateManager(UUID.Zero); |
228 | 228 | ||
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index c023a6f..cbc2fd6 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs | |||
@@ -88,7 +88,13 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
88 | 88 | ||
89 | public void AddCapsHandler(UUID agentId) | 89 | public void AddCapsHandler(UUID agentId) |
90 | { | 90 | { |
91 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) | 91 | int flags = 0; |
92 | ScenePresence sp; | ||
93 | if (m_scene.TryGetScenePresence(agentId, out sp)) | ||
94 | { | ||
95 | flags = sp.UserFlags; | ||
96 | } | ||
97 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) | ||
92 | return; | 98 | return; |
93 | 99 | ||
94 | String capsObjectPath = GetCapsPath(agentId); | 100 | String capsObjectPath = GetCapsPath(agentId); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a4f630a..2ca82ca 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2443,7 +2443,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2443 | // If the user is banned, we won't let any of their objects | 2443 | // If the user is banned, we won't let any of their objects |
2444 | // enter. Period. | 2444 | // enter. Period. |
2445 | // | 2445 | // |
2446 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) | 2446 | int flags = 0; |
2447 | ScenePresence sp; | ||
2448 | if (TryGetScenePresence(sceneObject.OwnerID, out sp)) | ||
2449 | { | ||
2450 | flags = sp.UserFlags; | ||
2451 | } | ||
2452 | |||
2453 | |||
2454 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2447 | { | 2455 | { |
2448 | m_log.Info("[INTERREGION]: Denied prim crossing for " + | 2456 | m_log.Info("[INTERREGION]: Denied prim crossing for " + |
2449 | "banned avatar"); | 2457 | "banned avatar"); |
@@ -2472,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2472 | SceneObjectPart RootPrim = sceneObject.RootPart; | 2480 | SceneObjectPart RootPrim = sceneObject.RootPart; |
2473 | 2481 | ||
2474 | // Fix up attachment Parent Local ID | 2482 | // Fix up attachment Parent Local ID |
2475 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); | 2483 | sp = GetScenePresence(sceneObject.OwnerID); |
2476 | 2484 | ||
2477 | if (sp != null) | 2485 | if (sp != null) |
2478 | { | 2486 | { |
@@ -3617,8 +3625,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
3617 | 3625 | ||
3618 | if (m_regInfo.EstateSettings != null) | 3626 | if (m_regInfo.EstateSettings != null) |
3619 | { | 3627 | { |
3620 | if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID)) | 3628 | int flags = 0; |
3629 | ScenePresence sp; | ||
3630 | if (TryGetScenePresence(agent.AgentID, out sp)) | ||
3621 | { | 3631 | { |
3632 | flags = sp.UserFlags; | ||
3633 | } | ||
3634 | if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID, flags)) | ||
3635 | { | ||
3636 | //Add some more info to help users | ||
3637 | if (!m_regInfo.EstateSettings.IsBanned(agent.AgentID, 32)) | ||
3638 | { | ||
3639 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the region requires age verification", | ||
3640 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
3641 | reason = String.Format("Denied access to region (0): Region requires age verification"); | ||
3642 | return false; | ||
3643 | } | ||
3644 | if (!m_regInfo.EstateSettings.IsBanned(agent.AgentID, 4)) | ||
3645 | { | ||
3646 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the region requires payment info on file", | ||
3647 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
3648 | reason = String.Format("Denied access to region (0): Region requires payment info on file"); | ||
3649 | return false; | ||
3650 | } | ||
3622 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 3651 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3623 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 3652 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
3624 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", | 3653 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", |
@@ -3807,7 +3836,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3807 | 3836 | ||
3808 | // We have to wait until the viewer contacts this region after receiving EAC. | 3837 | // We have to wait until the viewer contacts this region after receiving EAC. |
3809 | // That calls AddNewClient, which finally creates the ScenePresence | 3838 | // That calls AddNewClient, which finally creates the ScenePresence |
3810 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID)) | 3839 | int flags = 0; |
3840 | ScenePresence sp; | ||
3841 | if (TryGetScenePresence(cAgentData.AgentID, out sp)) | ||
3842 | { | ||
3843 | flags = sp.UserFlags; | ||
3844 | } | ||
3845 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
3811 | { | 3846 | { |
3812 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | 3847 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); |
3813 | return false; | 3848 | return false; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6a3983f..c4ae0f0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -113,6 +113,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
113 | { | 113 | { |
114 | get { return m_attachments; } | 114 | get { return m_attachments; } |
115 | } | 115 | } |
116 | |||
116 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | 117 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); |
117 | 118 | ||
118 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); | 119 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); |
@@ -136,6 +137,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
136 | private bool m_updateflag; | 137 | private bool m_updateflag; |
137 | private byte m_movementflag; | 138 | private byte m_movementflag; |
138 | private Vector3? m_forceToApply; | 139 | private Vector3? m_forceToApply; |
140 | private int m_userFlags; | ||
141 | public int UserFlags | ||
142 | { | ||
143 | get { return m_userFlags; } | ||
144 | } | ||
145 | |||
139 | private uint m_requestedSitTargetID; | 146 | private uint m_requestedSitTargetID; |
140 | private UUID m_requestedSitTargetUUID; | 147 | private UUID m_requestedSitTargetUUID; |
141 | public bool SitGround = false; | 148 | public bool SitGround = false; |
@@ -763,6 +770,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
763 | m_localId = m_scene.AllocateLocalId(); | 770 | m_localId = m_scene.AllocateLocalId(); |
764 | 771 | ||
765 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); | 772 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); |
773 | m_userFlags = account.UserFlags; | ||
766 | 774 | ||
767 | if (account != null) | 775 | if (account != null) |
768 | m_userLevel = account.UserLevel; | 776 | m_userLevel = account.UserLevel; |