aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2011-04-21 22:34:49 +0200
committerMelanie2011-04-21 22:34:49 +0200
commit282e116f948d431b570f7c17425cfc0a8ea767a2 (patch)
treeb6e878e4458133f20029e3cdead091141fc734e0
parentMerge branch 'queuetest' into careminster-presence-refactor (diff)
downloadopensim-SC_OLD-282e116f948d431b570f7c17425cfc0a8ea767a2.zip
opensim-SC_OLD-282e116f948d431b570f7c17425cfc0a8ea767a2.tar.gz
opensim-SC_OLD-282e116f948d431b570f7c17425cfc0a8ea767a2.tar.bz2
opensim-SC_OLD-282e116f948d431b570f7c17425cfc0a8ea767a2.tar.xz
Honor agent limit for region crossings and teleports
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs11
2 files changed, 25 insertions, 10 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index 92afa75..a621d84 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -46,17 +46,21 @@ namespace OpenSim.Data.MySQL
46 { 46 {
47 string[] words = query.Split(new char[] {' '}); 47 string[] words = query.Split(new char[] {' '});
48 48
49 bool valid = false;
50
49 for (int i = 0 ; i < words.Length ; i++) 51 for (int i = 0 ; i < words.Length ; i++)
50 { 52 {
51 if (words[i].Length < 3) 53 if (words[i].Length > 2)
52 { 54 valid = true;
53 if (i != words.Length - 1) 55// if (words[i].Length < 3)
54 Array.Copy(words, i + 1, words, i, words.Length - i - 1); 56// {
55 Array.Resize(ref words, words.Length - 1); 57// if (i != words.Length - 1)
56 } 58// Array.Copy(words, i + 1, words, i, words.Length - i - 1);
59// Array.Resize(ref words, words.Length - 1);
60// }
57 } 61 }
58 62
59 if (words.Length == 0) 63 if ((!valid) || words.Length == 0)
60 return new UserAccountData[0]; 64 return new UserAccountData[0];
61 65
62 if (words.Length > 2) 66 if (words.Length > 2)
@@ -67,14 +71,14 @@ namespace OpenSim.Data.MySQL
67 if (words.Length == 1) 71 if (words.Length == 1)
68 { 72 {
69 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm); 73 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
70 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%"); 74 cmd.Parameters.AddWithValue("?search", words[0] + "%");
71 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 75 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
72 } 76 }
73 else 77 else
74 { 78 {
75 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast)", m_Realm); 79 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast)", m_Realm);
76 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); 80 cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%");
77 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); 81 cmd.Parameters.AddWithValue("?searchLast", words[1] + "%");
78 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); 82 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
79 } 83 }
80 84
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index eed5ebc..e29b51c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5191,6 +5191,17 @@ namespace OpenSim.Region.Framework.Scenes
5191 return true; 5191 return true;
5192 } 5192 }
5193 5193
5194 int num = m_sceneGraph.GetNumberOfScenePresences();
5195
5196 if (num >= RegionInfo.RegionSettings.AgentLimit)
5197 {
5198 if (!Permissions.IsAdministrator(cAgentData.AgentID))
5199 {
5200 reason = "The region is full";
5201 return false;
5202 }
5203 }
5204
5194 if (!AuthorizeUser(agentID, out reason)) 5205 if (!AuthorizeUser(agentID, out reason))
5195 { 5206 {
5196 // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); 5207 // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);