aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2008-06-21 03:29:08 +0000
committerTeravus Ovares2008-06-21 03:29:08 +0000
commita5860ad438885cbf76a36dc7958947355522b8cf (patch)
treeb392682ca7bf79e7fae18c16271980a9eead28bf
parentlots of futzing with nhibernate to make it more efficient. I (diff)
downloadopensim-SC-a5860ad438885cbf76a36dc7958947355522b8cf.zip
opensim-SC-a5860ad438885cbf76a36dc7958947355522b8cf.tar.gz
opensim-SC-a5860ad438885cbf76a36dc7958947355522b8cf.tar.bz2
opensim-SC-a5860ad438885cbf76a36dc7958947355522b8cf.tar.xz
* Adds Region ban capability to Regions. You access this by going to World->Region/Estate. Then on the Estate tab, at the lower right hand corner, clicking the 'Add' button and picking an avatar.
* It only persists across reboots for the mySQL datastore currently. * Currently have stubs in the other datastores.
-rw-r--r--OpenSim/Data/MSSQL/MSSQLDataStore.cs16
-rw-r--r--OpenSim/Data/MySQL/MySQLDataStore.cs117
-rw-r--r--OpenSim/Data/MySQL/Resources/003_RegionStore.sql5
-rw-r--r--OpenSim/Data/Null/NullDataStore.cs16
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs17
-rw-r--r--OpenSim/Framework/IClientAPI.cs3
-rw-r--r--OpenSim/Framework/RegionBanListItem.cs20
-rw-r--r--OpenSim/Framework/RegionInfo.cs24
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs84
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs1
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs45
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs70
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs86
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs37
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs5
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs17
18 files changed, 557 insertions, 17 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLDataStore.cs b/OpenSim/Data/MSSQL/MSSQLDataStore.cs
index c339d62..6bf619a 100644
--- a/OpenSim/Data/MSSQL/MSSQLDataStore.cs
+++ b/OpenSim/Data/MSSQL/MSSQLDataStore.cs
@@ -492,6 +492,22 @@ namespace OpenSim.Data.MSSQL
492 return landDataForRegion; 492 return landDataForRegion;
493 } 493 }
494 494
495 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
496 {
497 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
498 return regionbanlist;
499 }
500
501 public void AddToRegionBanlist(RegionBanListItem item)
502 {
503
504 }
505
506 public void RemoveFromRegionBanlist(RegionBanListItem item)
507 {
508
509 }
510
495 public void Commit() 511 public void Commit()
496 { 512 {
497 if (m_connection.State != ConnectionState.Open) 513 if (m_connection.State != ConnectionState.Open)
diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs
index b0f02f0..d3e7a90 100644
--- a/OpenSim/Data/MySQL/MySQLDataStore.cs
+++ b/OpenSim/Data/MySQL/MySQLDataStore.cs
@@ -50,6 +50,7 @@ namespace OpenSim.Data.MySQL
50 private const string m_terrainSelect = "select * from terrain limit 1"; 50 private const string m_terrainSelect = "select * from terrain limit 1";
51 private const string m_landSelect = "select * from land"; 51 private const string m_landSelect = "select * from land";
52 private const string m_landAccessListSelect = "select * from landaccesslist"; 52 private const string m_landAccessListSelect = "select * from landaccesslist";
53 private const string m_regionBanListSelect = "select * from regionban";
53 54
54 55
55 /// <summary> 56 /// <summary>
@@ -65,6 +66,7 @@ namespace OpenSim.Data.MySQL
65 private MySqlDataAdapter m_terrainDataAdapter; 66 private MySqlDataAdapter m_terrainDataAdapter;
66 private MySqlDataAdapter m_landDataAdapter; 67 private MySqlDataAdapter m_landDataAdapter;
67 private MySqlDataAdapter m_landAccessListDataAdapter; 68 private MySqlDataAdapter m_landAccessListDataAdapter;
69 private MySqlDataAdapter m_regionBanListDataAdapter;
68 70
69 private DataTable m_primTable; 71 private DataTable m_primTable;
70 private DataTable m_shapeTable; 72 private DataTable m_shapeTable;
@@ -72,6 +74,7 @@ namespace OpenSim.Data.MySQL
72 private DataTable m_terrainTable; 74 private DataTable m_terrainTable;
73 private DataTable m_landTable; 75 private DataTable m_landTable;
74 private DataTable m_landAccessListTable; 76 private DataTable m_landAccessListTable;
77 private DataTable m_regionBanListTable;
75 78
76 // Temporary attribute while this is experimental 79 // Temporary attribute while this is experimental
77 private bool persistPrimInventories; 80 private bool persistPrimInventories;
@@ -121,6 +124,9 @@ namespace OpenSim.Data.MySQL
121 MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection); 124 MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection);
122 m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd); 125 m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd);
123 126
127 MySqlCommand regionBanListSelectCmd = new MySqlCommand(m_regionBanListSelect, m_connection);
128 m_regionBanListDataAdapter = new MySqlDataAdapter(regionBanListSelectCmd);
129
124 130
125 lock (m_dataSet) 131 lock (m_dataSet)
126 { 132 {
@@ -133,6 +139,7 @@ namespace OpenSim.Data.MySQL
133 m_dataSet.Tables.Add(m_shapeTable); 139 m_dataSet.Tables.Add(m_shapeTable);
134 SetupShapeCommands(m_shapeDataAdapter, m_connection); 140 SetupShapeCommands(m_shapeDataAdapter, m_connection);
135 m_shapeDataAdapter.Fill(m_shapeTable); 141 m_shapeDataAdapter.Fill(m_shapeTable);
142
136 143
137 if (persistPrimInventories) 144 if (persistPrimInventories)
138 { 145 {
@@ -156,6 +163,11 @@ namespace OpenSim.Data.MySQL
156 m_dataSet.Tables.Add(m_landAccessListTable); 163 m_dataSet.Tables.Add(m_landAccessListTable);
157 setupLandAccessCommands(m_landAccessListDataAdapter, m_connection); 164 setupLandAccessCommands(m_landAccessListDataAdapter, m_connection);
158 m_landAccessListDataAdapter.Fill(m_landAccessListTable); 165 m_landAccessListDataAdapter.Fill(m_landAccessListTable);
166
167 m_regionBanListTable = createRegionBanTable();
168 m_dataSet.Tables.Add(m_regionBanListTable);
169 SetupRegionBanCommands(m_regionBanListDataAdapter, m_connection);
170 m_regionBanListDataAdapter.Fill(m_regionBanListTable);
159 } 171 }
160 } 172 }
161 /// <summary> 173 /// <summary>
@@ -577,6 +589,86 @@ namespace OpenSim.Data.MySQL
577 } 589 }
578 } 590 }
579 591
592 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
593 {
594 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
595 lock (m_dataSet)
596 {
597 DataTable regionban = m_regionBanListTable;
598 string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
599 DataRow[] rawbanlist = regionban.Select(searchExp);
600 foreach (DataRow rawbanrow in rawbanlist)
601 {
602 RegionBanListItem rbli = new RegionBanListItem();
603 LLUUID tmpvalue = LLUUID.Zero;
604
605 rbli.regionUUID = regionUUID;
606
607 if (Helpers.TryParse((string)rawbanrow["bannedUUID"], out tmpvalue))
608 rbli.bannedUUID = tmpvalue;
609
610 rbli.bannedIP = (string)rawbanrow["bannedIp"];
611 rbli.bannedIPHostMask = (string)rawbanrow["bannedIpHostMask"];
612 regionbanlist.Add(rbli);
613 }
614 return regionbanlist;
615 }
616 }
617
618 public void AddToRegionBanlist(RegionBanListItem item)
619 {
620 lock (m_dataSet)
621 {
622 DataTable regionban = m_regionBanListTable;
623 string searchExp = "regionUUID = '" + item.regionUUID.ToString() + "' AND bannedUUID = '" + item.bannedUUID.ToString() + "'";
624 DataRow[] rawbanlist = regionban.Select(searchExp);
625 if (rawbanlist.Length == 0)
626 {
627 DataRow regionbanrow = regionban.NewRow();
628 regionbanrow["regionUUID"] = item.regionUUID.ToString();
629 regionbanrow["bannedUUID"] = item.bannedUUID.ToString();
630 regionbanrow["bannedIp"] = item.bannedIP.ToString();
631 regionbanrow["bannedIpHostMask"] = item.bannedIPHostMask.ToString();
632 regionban.Rows.Add(regionbanrow);
633 }
634 Commit();
635 }
636 }
637
638 public void RemoveFromRegionBanlist(RegionBanListItem item)
639 {
640 lock (m_dataSet)
641 {
642 DataTable regionban = m_regionBanListTable;
643 string searchExp = "regionUUID = '" + item.regionUUID.ToString() + "' AND bannedUUID = '" + item.bannedUUID.ToString() + "'";
644 DataRow[] rawbanlist = regionban.Select(searchExp);
645 if (rawbanlist.Length > 0)
646 {
647 foreach (DataRow rbli in rawbanlist)
648 {
649 regionban.Rows.Remove(rbli);
650 }
651 }
652 Commit();
653 }
654 if (m_connection.State != ConnectionState.Open)
655 {
656 m_connection.Open();
657 }
658
659 using
660 (
661 MySqlCommand cmd =
662 new MySqlCommand("delete from regionban where regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID", m_connection)
663 )
664 {
665 cmd.Parameters.Add(new MySqlParameter("?regionUUID", item.regionUUID.ToString()));
666 cmd.Parameters.Add(new MySqlParameter("?bannedUUID", item.bannedUUID.ToString()));
667 cmd.ExecuteNonQuery();
668 }
669
670 }
671
580 public List<LandData> LoadLandObjects(LLUUID regionUUID) 672 public List<LandData> LoadLandObjects(LLUUID regionUUID)
581 { 673 {
582 List<LandData> landDataForRegion = new List<LandData>(); 674 List<LandData> landDataForRegion = new List<LandData>();
@@ -624,6 +716,7 @@ namespace OpenSim.Data.MySQL
624 m_terrainDataAdapter.Update(m_terrainTable); 716 m_terrainDataAdapter.Update(m_terrainTable);
625 m_landDataAdapter.Update(m_landTable); 717 m_landDataAdapter.Update(m_landTable);
626 m_landAccessListDataAdapter.Update(m_landAccessListTable); 718 m_landAccessListDataAdapter.Update(m_landAccessListTable);
719 m_regionBanListDataAdapter.Update(m_regionBanListTable);
627 720
628 m_dataSet.AcceptChanges(); 721 m_dataSet.AcceptChanges();
629 } 722 }
@@ -660,6 +753,17 @@ namespace OpenSim.Data.MySQL
660 return terrain; 753 return terrain;
661 } 754 }
662 755
756 private static DataTable createRegionBanTable()
757 {
758 DataTable regionban = new DataTable("regionban");
759 createCol(regionban, "regionUUID", typeof(String));
760 createCol(regionban, "bannedUUID", typeof(String));
761 createCol(regionban, "bannedIp", typeof(String));
762 createCol(regionban, "bannedIpHostMask", typeof(String));
763 return regionban;
764
765 }
766
663 private static DataTable createPrimTable() 767 private static DataTable createPrimTable()
664 { 768 {
665 DataTable prims = new DataTable("prims"); 769 DataTable prims = new DataTable("prims");
@@ -1553,7 +1657,20 @@ namespace OpenSim.Data.MySQL
1553 delete.Connection = conn; 1657 delete.Connection = conn;
1554 da.DeleteCommand = delete; 1658 da.DeleteCommand = delete;
1555 } 1659 }
1660 private void SetupRegionBanCommands(MySqlDataAdapter da, MySqlConnection conn)
1661 {
1662 da.InsertCommand = createInsertCommand("regionban", m_regionBanListTable);
1663 da.InsertCommand.Connection = conn;
1664
1665 da.UpdateCommand = createUpdateCommand("regionban", "regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID", m_regionBanListTable);
1666 da.UpdateCommand.Connection = conn;
1556 1667
1668 MySqlCommand delete = new MySqlCommand("delete from regionban where regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID");
1669 delete.Parameters.Add(createMySqlParameter("regionUUID", typeof(String)));
1670 delete.Parameters.Add(createMySqlParameter("bannedUUID", typeof(String)));
1671 delete.Connection = conn;
1672 da.DeleteCommand = delete;
1673 }
1557 private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn) 1674 private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn)
1558 { 1675 {
1559 da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]); 1676 da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]);
diff --git a/OpenSim/Data/MySQL/Resources/003_RegionStore.sql b/OpenSim/Data/MySQL/Resources/003_RegionStore.sql
new file mode 100644
index 0000000..cb0a614
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/003_RegionStore.sql
@@ -0,0 +1,5 @@
1BEGIN;
2
3 CREATE TABLE regionban (regionUUID VARCHAR(36) NOT NULL, bannedUUID VARCHAR(36) NOT NULL, bannedIp VARCHAR(16) NOT NULL, bannedIpHostMask VARCHAR(16) NOT NULL) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
4
5COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/Null/NullDataStore.cs b/OpenSim/Data/Null/NullDataStore.cs
index 487f72e..90cf3a1 100644
--- a/OpenSim/Data/Null/NullDataStore.cs
+++ b/OpenSim/Data/Null/NullDataStore.cs
@@ -80,6 +80,22 @@ namespace OpenSim.Data.Null
80 return new List<LandData>(); 80 return new List<LandData>();
81 } 81 }
82 82
83 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
84 {
85 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
86 return regionbanlist;
87 }
88
89 public void AddToRegionBanlist(RegionBanListItem item)
90 {
91
92 }
93
94 public void RemoveFromRegionBanlist(RegionBanListItem item)
95 {
96
97 }
98
83 public void Shutdown() 99 public void Shutdown()
84 { 100 {
85 } 101 }
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index b7086bd..ab4d283 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -1036,6 +1036,23 @@ namespace OpenSim.Data.SQLite
1036 return entry; 1036 return entry;
1037 } 1037 }
1038 1038
1039
1040 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
1041 {
1042 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
1043 return regionbanlist;
1044 }
1045
1046 public void AddToRegionBanlist(RegionBanListItem item)
1047 {
1048
1049 }
1050
1051 public void RemoveFromRegionBanlist(RegionBanListItem item)
1052 {
1053
1054 }
1055
1039 private static Array serializeTerrain(double[,] val) 1056 private static Array serializeTerrain(double[,] val)
1040 { 1057 {
1041 MemoryStream str = new MemoryStream(65536*sizeof (double)); 1058 MemoryStream str = new MemoryStream(65536*sizeof (double));
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index e4fac1f..10f8276 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -970,6 +970,9 @@ namespace OpenSim.Framework
970 970
971 971
972 void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID); 972 void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID);
973
974 void sendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID);
975
973 void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args); 976 void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args);
974 void sendEstateCovenantInformation(); 977 void sendEstateCovenantInformation();
975 void sendDetailedEstateData(LLUUID invoice,string estateName, uint estateID); 978 void sendDetailedEstateData(LLUUID invoice,string estateName, uint estateID);
diff --git a/OpenSim/Framework/RegionBanListItem.cs b/OpenSim/Framework/RegionBanListItem.cs
new file mode 100644
index 0000000..60383fb
--- /dev/null
+++ b/OpenSim/Framework/RegionBanListItem.cs
@@ -0,0 +1,20 @@
1using libsecondlife;
2using System;
3using System.Collections.Generic;
4using System.Text;
5
6namespace OpenSim.Framework
7{
8 public class RegionBanListItem
9 {
10 public LLUUID regionUUID = LLUUID.Zero;
11 public LLUUID bannedUUID = LLUUID.Zero;
12 public string bannedIP = string.Empty;
13 public string bannedIPHostMask = string.Empty;
14
15 public RegionBanListItem()
16 {
17
18 }
19 }
20}
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 979ced5..f10f25d 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Net; 30using System.Net;
30using System.Net.Sockets; 31using System.Net.Sockets;
31using System.Xml; 32using System.Xml;
@@ -210,6 +211,7 @@ namespace OpenSim.Framework
210 211
211 public LLUUID lastMapUUID = LLUUID.Zero; 212 public LLUUID lastMapUUID = LLUUID.Zero;
212 public string lastMapRefresh = "0"; 213 public string lastMapRefresh = "0";
214 public List<RegionBanListItem> regionBanlist = new List<RegionBanListItem>();
213 215
214 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 216 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
215 217
@@ -346,6 +348,28 @@ namespace OpenSim.Framework
346 configMember.performConfigurationRetrieve(); 348 configMember.performConfigurationRetrieve();
347 } 349 }
348 350
351 public bool CheckIfUserBanned(LLUUID user)
352 {
353
354 RegionBanListItem[] bl = regionBanlist.ToArray();
355
356 bool banned = false;
357
358 for (int i = 0; i < bl.Length; i++)
359 {
360 if (bl[i] == null)
361 continue;
362
363 if (bl[i].bannedUUID == user)
364 {
365 banned = true;
366 break;
367 }
368 }
369
370 return banned;
371 }
372
349 public void loadConfigurationOptionsFromMe() 373 public void loadConfigurationOptionsFromMe()
350 { 374 {
351 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID_NULL_FREE, 375 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID_NULL_FREE,
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index d538d36..165700c 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -260,13 +260,37 @@ namespace OpenSim.Grid.UserServer
260 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}", 260 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
261 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); 261 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
262 } 262 }
263 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; 263 if (!GridResp.IsFault)
264 if (handlerUserLoggedInAtLocation != null)
265 { 264 {
266 //m_log.Info("[LOGIN]: Letting other objects know about login"); 265 bool responseSuccess = true;
267 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, 266
268 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,theUser.CurrentAgent.Position.Y,theUser.CurrentAgent.Position.Z, 267
269 theUser.FirstName,theUser.SurName); 268 if (GridResp.Value != null)
269 {
270 Hashtable resp = (Hashtable)GridResp.Value;
271 if (resp.ContainsKey("success"))
272 {
273 if ((string)resp["success"] == "FALSE")
274 {
275 responseSuccess = false;
276 tryDefault = true;
277 }
278 }
279 }
280
281 if (responseSuccess)
282 {
283 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
284 if (handlerUserLoggedInAtLocation != null)
285 {
286 //m_log.Info("[LOGIN]: Letting other objects know about login");
287 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
288 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z,
289 theUser.FirstName, theUser.SurName);
290 }
291 }
292
293
270 } 294 }
271 } 295 }
272 catch (Exception) 296 catch (Exception)
@@ -340,14 +364,50 @@ namespace OpenSim.Grid.UserServer
340 // Send 364 // Send
341 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 365 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
342 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 366 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
343 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; 367
344 if (handlerUserLoggedInAtLocation != null) 368 if (!GridResp.IsFault)
369 {
370 bool responseSuccess = true;
371
372
373 if (GridResp.Value != null)
374 {
375 Hashtable resp = (Hashtable) GridResp.Value;
376 if (resp.ContainsKey("success"))
377 {
378 if ((string)resp["success"] == "FALSE")
379 {
380 responseSuccess = false;
381 tryDefault = true;
382 }
383 }
384 }
385
386 if (responseSuccess)
387 {
388 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
389 if (handlerUserLoggedInAtLocation != null)
390 {
391 m_log.Info("[LOGIN]: Letting other objects know about login");
392 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
393 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z,
394 theUser.FirstName, theUser.SurName);
395 }
396 }
397 else
398 {
399 response.CreateDeadRegionResponse();
400
401 }
402
403
404 }
405 else
345 { 406 {
346 m_log.Info("[LOGIN]: Letting other objects know about login"); 407 response.CreateDeadRegionResponse();
347 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, 408
348 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z,
349 theUser.FirstName, theUser.SurName);
350 } 409 }
410
351 } 411 }
352 412
353 catch (Exception e) 413 catch (Exception e)
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 572e98f..f205686 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -515,6 +515,7 @@ namespace OpenSim
515 //moved these here as the terrain texture has to be created after the modules are initialized 515 //moved these here as the terrain texture has to be created after the modules are initialized
516 // and has to happen before the region is registered with the grid. 516 // and has to happen before the region is registered with the grid.
517 scene.CreateTerrainTexture(false); 517 scene.CreateTerrainTexture(false);
518 scene.LoadRegionBanlist();
518 519
519 try 520 try
520 { 521 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 3b3ec3d..facee5c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2570,6 +2570,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2570 this.OutPacket(packet, ThrottleOutPacketType.Task); 2570 this.OutPacket(packet, ThrottleOutPacketType.Task);
2571 } 2571 }
2572 2572
2573 public void sendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID)
2574 {
2575 RegionBanListItem[] bl = banlist.ToArray();
2576
2577 LLUUID[] BannedUsers = new LLUUID[bl.Length];
2578
2579
2580 for (int i = 0; i < bl.Length; i++)
2581 {
2582 if (bl[i] == null)
2583 continue;
2584 BannedUsers[i] = bl[i].bannedUUID;
2585 }
2586
2587 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
2588 packet.AgentData.TransactionID = LLUUID.Random();
2589 packet.AgentData.AgentID = this.AgentId;
2590 packet.AgentData.SessionID = this.SessionId;
2591 packet.MethodData.Invoice = invoice;
2592 packet.MethodData.Method = Helpers.StringToField("setaccess");
2593
2594 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Length];
2595
2596 for (int i = 0; i < (6 + BannedUsers.Length); i++)
2597 {
2598 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
2599 }
2600 int j = 0;
2601
2602 returnblock[j].Parameter = Helpers.StringToField(estateID.ToString()); j++;
2603 returnblock[j].Parameter = Helpers.StringToField(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
2604 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
2605 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
2606 returnblock[j].Parameter = Helpers.StringToField(BannedUsers.Length.ToString()); j++;
2607 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
2608
2609 for (int i = 0; i < BannedUsers.Length; i++)
2610 {
2611 returnblock[j].Parameter = BannedUsers[i].GetBytes(); j++;
2612 }
2613 packet.ParamList = returnblock;
2614 packet.Header.Reliable = false;
2615 this.OutPacket(packet, ThrottleOutPacketType.Task);
2616 }
2617
2573 public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) 2618 public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
2574 { 2619 {
2575 RegionInfoPacket rinfopack = new RegionInfoPacket(); 2620 RegionInfoPacket rinfopack = new RegionInfoPacket();
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index bbb3163..f7de887 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -55,10 +55,14 @@ namespace OpenSim.Region.Communications.OGS1
55 private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>(); 55 private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>();
56 private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>(); 56 private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>();
57 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); 57 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
58 private List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>();
59
60
58 61
59 public BaseHttpServer httpListener; 62 public BaseHttpServer httpListener;
60 public NetworkServersInfo serversInfo; 63 public NetworkServersInfo serversInfo;
61 public BaseHttpServer httpServer; 64 public BaseHttpServer httpServer;
65
62 public string _gdebugRegionName = String.Empty; 66 public string _gdebugRegionName = String.Empty;
63 67
64 public string gdebugRegionName 68 public string gdebugRegionName
@@ -95,6 +99,8 @@ namespace OpenSim.Region.Communications.OGS1
95 // see IGridServices 99 // see IGridServices
96 public RegionCommsListener RegisterRegion(RegionInfo regionInfo) 100 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
97 { 101 {
102 m_regionsOnInstance.Add(regionInfo);
103
98 m_log.InfoFormat( 104 m_log.InfoFormat(
99 "[OGS1 GRID SERVICES]: Attempting to register region {0} with grid at {1}", 105 "[OGS1 GRID SERVICES]: Attempting to register region {0} with grid at {1}",
100 regionInfo.RegionName, serversInfo.GridURL); 106 regionInfo.RegionName, serversInfo.GridURL);
@@ -606,12 +612,47 @@ namespace OpenSim.Region.Communications.OGS1
606 612
607 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); 613 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
608 614
609 m_log.Debug("[CONNECTION DEBUGGING]: Triggering welcome for " + agentData.AgentID.ToString() + " into " + regionHandle.ToString());
610 m_localBackend.TriggerExpectUser(regionHandle, agentData);
611 615
612 m_log.Info("[OGS1 GRID SERVICES]: Welcoming new user..."); 616 RegionInfo[] regions = m_regionsOnInstance.ToArray();
617 bool banned = false;
613 618
614 return new XmlRpcResponse(); 619 for (int i = 0; i < regions.Length; i++)
620 {
621 if (regions[i] != null)
622 {
623 if (regions[i].RegionHandle == regionHandle)
624 {
625 if (regions[i].CheckIfUserBanned(agentData.AgentID))
626 {
627 banned = true;
628 break;
629 }
630 }
631 }
632 }
633
634 XmlRpcResponse resp = new XmlRpcResponse();
635
636 if (banned)
637 {
638 m_log.InfoFormat("[OGS1 GRID SERVICES]: Denying access for user {0} {1} because user is banned",agentData.firstname,agentData.lastname);
639
640 Hashtable respdata = new Hashtable();
641 respdata["success"] = "FALSE";
642 respdata["reason"] = "banned";
643 resp.Value = respdata;
644 }
645 else
646 {
647 m_log.Debug("[CONNECTION DEBUGGING]: Triggering welcome for " + agentData.AgentID.ToString() + " into " + regionHandle.ToString());
648 m_localBackend.TriggerExpectUser(regionHandle, agentData);
649 m_log.Info("[OGS1 GRID SERVICES]: Welcoming new user...");
650 Hashtable respdata = new Hashtable();
651 respdata["success"] = "TRUE";
652 resp.Value = respdata;
653
654 }
655 return resp;
615 } 656 }
616 // Grid Request Processing 657 // Grid Request Processing
617 /// <summary> 658 /// <summary>
@@ -1107,6 +1148,27 @@ namespace OpenSim.Region.Communications.OGS1
1107 /// <returns></returns> 1148 /// <returns></returns>
1108 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 1149 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
1109 { 1150 {
1151 RegionInfo[] regions = m_regionsOnInstance.ToArray();
1152 bool banned = false;
1153
1154 for (int i = 0; i < regions.Length; i++)
1155 {
1156 if (regions[i] != null)
1157 {
1158 if (regions[i].RegionHandle == regionHandle)
1159 {
1160 if (regions[i].CheckIfUserBanned(agentID))
1161 {
1162 banned = true;
1163 break;
1164 }
1165 }
1166 }
1167 }
1168
1169 if (banned)
1170 return false;
1171
1110 RegionInfo regInfo = null; 1172 RegionInfo regInfo = null;
1111 try 1173 try
1112 { 1174 {
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
index c757461..0ea2c03 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
@@ -72,6 +72,12 @@ namespace OpenSim.Region.Environment.Interfaces
72 void RemoveLandObject(LLUUID globalID); 72 void RemoveLandObject(LLUUID globalID);
73 List<LandData> LoadLandObjects(LLUUID regionUUID); 73 List<LandData> LoadLandObjects(LLUUID regionUUID);
74 74
75 List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID);
76 void AddToRegionBanlist(RegionBanListItem item);
77 void RemoveFromRegionBanlist(RegionBanListItem item);
78
79
80
75 void Shutdown(); 81 void Shutdown();
76 } 82 }
77} 83}
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
index 147e4aa..b6d2ab4 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
@@ -51,6 +51,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
51 { 51 {
52 remote_client.sendDetailedEstateData(invoice,m_scene.RegionInfo.EstateSettings.estateName,m_scene.RegionInfo.EstateSettings.estateID); 52 remote_client.sendDetailedEstateData(invoice,m_scene.RegionInfo.EstateSettings.estateName,m_scene.RegionInfo.EstateSettings.estateID);
53 remote_client.sendEstateManagersList(invoice,m_scene.RegionInfo.EstateSettings.estateManagers,m_scene.RegionInfo.EstateSettings.estateID); 53 remote_client.sendEstateManagersList(invoice,m_scene.RegionInfo.EstateSettings.estateManagers,m_scene.RegionInfo.EstateSettings.estateID);
54 remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID);
54 } 55 }
55 56
56 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, 57 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor,
@@ -206,6 +207,89 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
206 207
207 switch (estateAccessType) 208 switch (estateAccessType)
208 { 209 {
210 case 64:
211 if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
212 {
213 RegionBanListItem[] banlistcheck = m_scene.RegionInfo.regionBanlist.ToArray();
214
215 bool alreadyInList = false;
216
217 for (int i = 0; i < banlistcheck.Length; i++)
218 {
219 if (user == banlistcheck[i].bannedUUID)
220 {
221 alreadyInList = true;
222 break;
223 }
224
225 }
226 if (!alreadyInList)
227 {
228
229 RegionBanListItem item = new RegionBanListItem();
230
231 item.bannedUUID = user;
232 item.regionUUID = m_scene.RegionInfo.RegionID;
233 item.bannedIP = "0.0.0.0";
234 item.bannedIPHostMask = "0.0.0.0";
235
236 m_scene.RegionInfo.regionBanlist.Add(item);
237 m_scene.AddToRegionBanlist(item);
238
239 ScenePresence s = m_scene.GetScenePresence(user);
240 if (s != null)
241 {
242 m_scene.TeleportClientHome(user, s.ControllingClient);
243 }
244
245 }
246 else
247 {
248 remote_client.SendAlertMessage("User is already on the region ban list");
249 }
250 //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
251 remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID);
252 }
253 else
254 {
255 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
256 }
257 break;
258 case 128:
259 if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
260 {
261 RegionBanListItem[] banlistcheck = m_scene.RegionInfo.regionBanlist.ToArray();
262
263 bool alreadyInList = false;
264 RegionBanListItem listitem = null;
265
266 for (int i = 0; i < banlistcheck.Length; i++)
267 {
268 if (user == banlistcheck[i].bannedUUID)
269 {
270 alreadyInList = true;
271 listitem = banlistcheck[i];
272 break;
273 }
274
275 }
276 if (alreadyInList && listitem != null)
277 {
278 m_scene.RegionInfo.regionBanlist.Remove(listitem);
279 m_scene.RemoveFromRegionBanlist(listitem);
280 }
281 else
282 {
283 remote_client.SendAlertMessage("User is not on the region ban list");
284 }
285 //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
286 remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID);
287 }
288 else
289 {
290 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
291 }
292 break;
209 case 256: 293 case 256:
210 294
211 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 295 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
@@ -237,7 +321,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
237 321
238 default: 322 default:
239 323
240 m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta"); 324 m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString());
241 break; 325 break;
242 } 326 }
243 } 327 }
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index a242ebe..50403b9 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -743,6 +743,11 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
743 public void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID) 743 public void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID)
744 { 744 {
745 } 745 }
746
747 public void sendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID)
748 {
749 }
750
746 public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) 751 public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
747 { 752 {
748 } 753 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index cfebd14..73b3a49 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1437,6 +1437,20 @@ namespace OpenSim.Region.Environment.Scenes
1437 } 1437 }
1438 } 1438 }
1439 1439
1440 public void LoadRegionBanlist()
1441 {
1442 List<RegionBanListItem> regionbanlist = m_storageManager.DataStore.LoadRegionBanList(m_regInfo.RegionID);
1443 m_regInfo.regionBanlist = regionbanlist;
1444 }
1445 public void AddToRegionBanlist(RegionBanListItem item)
1446 {
1447 m_storageManager.DataStore.AddToRegionBanlist(item);
1448 }
1449
1450 public void RemoveFromRegionBanlist(RegionBanListItem item)
1451 {
1452 m_storageManager.DataStore.RemoveFromRegionBanlist(item);
1453 }
1440 #endregion 1454 #endregion
1441 1455
1442 #region Primitives Methods 1456 #region Primitives Methods
@@ -1854,6 +1868,18 @@ namespace OpenSim.Region.Environment.Scenes
1854 SceneObjectPart RootPrim = GetSceneObjectPart(primID); 1868 SceneObjectPart RootPrim = GetSceneObjectPart(primID);
1855 if (RootPrim != null) 1869 if (RootPrim != null)
1856 { 1870 {
1871 if (m_regInfo.CheckIfUserBanned(RootPrim.OwnerID))
1872 {
1873 SceneObjectGroup grp = RootPrim.ParentGroup;
1874 if (grp != null)
1875 {
1876 DeleteSceneObject(grp);
1877 }
1878
1879 m_log.Info("[INTERREGION]: Denied prim crossing for banned avatar");
1880
1881 return false;
1882 }
1857 if (RootPrim.Shape.PCode == (byte)PCode.Prim) 1883 if (RootPrim.Shape.PCode == (byte)PCode.Prim)
1858 { 1884 {
1859 SceneObjectGroup grp = RootPrim.ParentGroup; 1885 SceneObjectGroup grp = RootPrim.ParentGroup;
@@ -2333,6 +2359,13 @@ namespace OpenSim.Region.Environment.Scenes
2333 { 2359 {
2334 if (regionHandle == m_regInfo.RegionHandle) 2360 if (regionHandle == m_regInfo.RegionHandle)
2335 { 2361 {
2362 if (m_regInfo.CheckIfUserBanned(agent.AgentID))
2363 {
2364 m_log.WarnFormat(
2365 "[CONNECTION DEBUGGING]: Denied access to: {0} [{1}] at {2} because the user is on the region banlist",
2366 agent.AgentID, regionHandle, RegionInfo.RegionName);
2367 }
2368
2336 capsPaths[agent.AgentID] = agent.CapsPath; 2369 capsPaths[agent.AgentID] = agent.CapsPath;
2337 2370
2338 if (!agent.child) 2371 if (!agent.child)
@@ -3599,5 +3632,9 @@ namespace OpenSim.Region.Environment.Scenes
3599 } 3632 }
3600 3633
3601 #endregion 3634 #endregion
3635
3636
3602 } 3637 }
3603} 3638}
3639
3640 \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 0f7a057..c6fd64c 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -736,6 +736,11 @@ namespace OpenSim.Region.Examples.SimpleModule
736 public void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID) 736 public void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID)
737 { 737 {
738 } 738 }
739
740 public void sendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID)
741 {
742 }
743
739 public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) 744 public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
740 { 745 {
741 } 746 }
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
index b7919e0..145d5eb 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
@@ -313,6 +313,23 @@ namespace OpenSim.DataStore.MSSQL
313 return new List<LandData>(); 313 return new List<LandData>();
314 } 314 }
315 315
316 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
317 {
318 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
319 return regionbanlist;
320 }
321
322 public void AddToRegionBanlist(RegionBanListItem item)
323 {
324
325 }
326
327 public void RemoveFromRegionBanlist(RegionBanListItem item)
328 {
329
330 }
331
332
316 public void Commit() 333 public void Commit()
317 { 334 {
318 lock (ds) 335 lock (ds)