* 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.0.6.0-stable
							parent
							
								
									17fd6cf661
								
							
						
					
					
						commit
						a5860ad438
					
				|  | @ -492,6 +492,22 @@ namespace OpenSim.Data.MSSQL | |||
|             return landDataForRegion; | ||||
|         } | ||||
| 
 | ||||
|         public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) | ||||
|         { | ||||
|             List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); | ||||
|             return regionbanlist; | ||||
|         } | ||||
| 
 | ||||
|         public void AddToRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public void RemoveFromRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public void Commit() | ||||
|         { | ||||
|             if (m_connection.State != ConnectionState.Open) | ||||
|  |  | |||
|  | @ -50,6 +50,7 @@ namespace OpenSim.Data.MySQL | |||
|         private const string m_terrainSelect = "select * from terrain limit 1"; | ||||
|         private const string m_landSelect = "select * from land"; | ||||
|         private const string m_landAccessListSelect = "select * from landaccesslist"; | ||||
|         private const string m_regionBanListSelect = "select * from regionban"; | ||||
| 
 | ||||
| 
 | ||||
|         /// <summary> | ||||
|  | @ -65,6 +66,7 @@ namespace OpenSim.Data.MySQL | |||
|         private MySqlDataAdapter m_terrainDataAdapter; | ||||
|         private MySqlDataAdapter m_landDataAdapter; | ||||
|         private MySqlDataAdapter m_landAccessListDataAdapter; | ||||
|         private MySqlDataAdapter m_regionBanListDataAdapter; | ||||
| 
 | ||||
|         private DataTable m_primTable; | ||||
|         private DataTable m_shapeTable; | ||||
|  | @ -72,6 +74,7 @@ namespace OpenSim.Data.MySQL | |||
|         private DataTable m_terrainTable; | ||||
|         private DataTable m_landTable; | ||||
|         private DataTable m_landAccessListTable; | ||||
|         private DataTable m_regionBanListTable; | ||||
| 
 | ||||
|         // Temporary attribute while this is experimental | ||||
|         private bool persistPrimInventories; | ||||
|  | @ -121,6 +124,9 @@ namespace OpenSim.Data.MySQL | |||
|             MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection); | ||||
|             m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd); | ||||
| 
 | ||||
|             MySqlCommand regionBanListSelectCmd = new MySqlCommand(m_regionBanListSelect, m_connection); | ||||
|             m_regionBanListDataAdapter = new MySqlDataAdapter(regionBanListSelectCmd); | ||||
| 
 | ||||
| 
 | ||||
|             lock (m_dataSet) | ||||
|             { | ||||
|  | @ -133,6 +139,7 @@ namespace OpenSim.Data.MySQL | |||
|                 m_dataSet.Tables.Add(m_shapeTable); | ||||
|                 SetupShapeCommands(m_shapeDataAdapter, m_connection); | ||||
|                 m_shapeDataAdapter.Fill(m_shapeTable); | ||||
|                  | ||||
| 
 | ||||
|                 if (persistPrimInventories) | ||||
|                 { | ||||
|  | @ -156,6 +163,11 @@ namespace OpenSim.Data.MySQL | |||
|                 m_dataSet.Tables.Add(m_landAccessListTable); | ||||
|                 setupLandAccessCommands(m_landAccessListDataAdapter, m_connection); | ||||
|                 m_landAccessListDataAdapter.Fill(m_landAccessListTable); | ||||
| 
 | ||||
|                 m_regionBanListTable = createRegionBanTable(); | ||||
|                 m_dataSet.Tables.Add(m_regionBanListTable); | ||||
|                 SetupRegionBanCommands(m_regionBanListDataAdapter, m_connection); | ||||
|                 m_regionBanListDataAdapter.Fill(m_regionBanListTable); | ||||
|             } | ||||
|         } | ||||
|         /// <summary> | ||||
|  | @ -577,6 +589,86 @@ namespace OpenSim.Data.MySQL | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) | ||||
|         { | ||||
|             List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); | ||||
|             lock (m_dataSet) | ||||
|             { | ||||
|                 DataTable regionban = m_regionBanListTable; | ||||
|                 string searchExp = "regionUUID = '" + regionUUID.ToString() + "'"; | ||||
|                 DataRow[] rawbanlist = regionban.Select(searchExp); | ||||
|                 foreach (DataRow rawbanrow in rawbanlist) | ||||
|                 { | ||||
|                     RegionBanListItem rbli = new RegionBanListItem(); | ||||
|                     LLUUID tmpvalue = LLUUID.Zero; | ||||
| 
 | ||||
|                     rbli.regionUUID = regionUUID; | ||||
| 
 | ||||
|                     if (Helpers.TryParse((string)rawbanrow["bannedUUID"], out tmpvalue)) | ||||
|                         rbli.bannedUUID = tmpvalue; | ||||
| 
 | ||||
|                     rbli.bannedIP = (string)rawbanrow["bannedIp"]; | ||||
|                     rbli.bannedIPHostMask = (string)rawbanrow["bannedIpHostMask"]; | ||||
|                     regionbanlist.Add(rbli); | ||||
|                 } | ||||
|                 return regionbanlist; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public void AddToRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
|             lock (m_dataSet) | ||||
|             { | ||||
|                 DataTable regionban = m_regionBanListTable; | ||||
|                 string searchExp = "regionUUID = '" + item.regionUUID.ToString() + "' AND bannedUUID = '" + item.bannedUUID.ToString() + "'"; | ||||
|                 DataRow[] rawbanlist = regionban.Select(searchExp); | ||||
|                 if (rawbanlist.Length == 0) | ||||
|                 { | ||||
|                     DataRow regionbanrow = regionban.NewRow(); | ||||
|                     regionbanrow["regionUUID"] = item.regionUUID.ToString(); | ||||
|                     regionbanrow["bannedUUID"] = item.bannedUUID.ToString(); | ||||
|                     regionbanrow["bannedIp"] = item.bannedIP.ToString(); | ||||
|                     regionbanrow["bannedIpHostMask"] = item.bannedIPHostMask.ToString(); | ||||
|                     regionban.Rows.Add(regionbanrow); | ||||
|                 } | ||||
|                 Commit(); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public void RemoveFromRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
|             lock (m_dataSet) | ||||
|             { | ||||
|                 DataTable regionban = m_regionBanListTable; | ||||
|                 string searchExp = "regionUUID = '" + item.regionUUID.ToString() + "' AND bannedUUID = '" + item.bannedUUID.ToString() + "'"; | ||||
|                 DataRow[] rawbanlist = regionban.Select(searchExp); | ||||
|                 if (rawbanlist.Length > 0) | ||||
|                 { | ||||
|                     foreach (DataRow rbli in rawbanlist) | ||||
|                     { | ||||
|                         regionban.Rows.Remove(rbli); | ||||
|                     } | ||||
|                 } | ||||
|                 Commit(); | ||||
|             } | ||||
|             if (m_connection.State != ConnectionState.Open) | ||||
|             { | ||||
|                 m_connection.Open(); | ||||
|             } | ||||
| 
 | ||||
|             using  | ||||
|             ( | ||||
|                 MySqlCommand cmd = | ||||
|                     new MySqlCommand("delete from regionban where regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID", m_connection) | ||||
|             ) | ||||
|             { | ||||
|                 cmd.Parameters.Add(new MySqlParameter("?regionUUID", item.regionUUID.ToString())); | ||||
|                 cmd.Parameters.Add(new MySqlParameter("?bannedUUID", item.bannedUUID.ToString())); | ||||
|                 cmd.ExecuteNonQuery(); | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public List<LandData> LoadLandObjects(LLUUID regionUUID) | ||||
|         { | ||||
|             List<LandData> landDataForRegion = new List<LandData>(); | ||||
|  | @ -624,6 +716,7 @@ namespace OpenSim.Data.MySQL | |||
|                 m_terrainDataAdapter.Update(m_terrainTable); | ||||
|                 m_landDataAdapter.Update(m_landTable); | ||||
|                 m_landAccessListDataAdapter.Update(m_landAccessListTable); | ||||
|                 m_regionBanListDataAdapter.Update(m_regionBanListTable); | ||||
| 
 | ||||
|                 m_dataSet.AcceptChanges(); | ||||
|             } | ||||
|  | @ -660,6 +753,17 @@ namespace OpenSim.Data.MySQL | |||
|             return terrain; | ||||
|         } | ||||
| 
 | ||||
|         private static DataTable createRegionBanTable() | ||||
|         { | ||||
|             DataTable regionban = new DataTable("regionban"); | ||||
|             createCol(regionban, "regionUUID", typeof(String)); | ||||
|             createCol(regionban, "bannedUUID", typeof(String)); | ||||
|             createCol(regionban, "bannedIp", typeof(String)); | ||||
|             createCol(regionban, "bannedIpHostMask", typeof(String)); | ||||
|             return regionban; | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         private static DataTable createPrimTable() | ||||
|         { | ||||
|             DataTable prims = new DataTable("prims"); | ||||
|  | @ -1553,7 +1657,20 @@ namespace OpenSim.Data.MySQL | |||
|             delete.Connection = conn; | ||||
|             da.DeleteCommand = delete; | ||||
|         } | ||||
|         private void SetupRegionBanCommands(MySqlDataAdapter da, MySqlConnection conn) | ||||
|         { | ||||
|             da.InsertCommand = createInsertCommand("regionban", m_regionBanListTable); | ||||
|             da.InsertCommand.Connection = conn; | ||||
| 
 | ||||
|             da.UpdateCommand = createUpdateCommand("regionban", "regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID", m_regionBanListTable); | ||||
|             da.UpdateCommand.Connection = conn; | ||||
| 
 | ||||
|             MySqlCommand delete = new MySqlCommand("delete from regionban where regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID"); | ||||
|             delete.Parameters.Add(createMySqlParameter("regionUUID", typeof(String))); | ||||
|             delete.Parameters.Add(createMySqlParameter("bannedUUID", typeof(String))); | ||||
|             delete.Connection = conn; | ||||
|             da.DeleteCommand = delete; | ||||
|         } | ||||
|         private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn) | ||||
|         { | ||||
|             da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]); | ||||
|  |  | |||
|  | @ -0,0 +1,5 @@ | |||
| BEGIN; | ||||
| 	 | ||||
| 	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'; | ||||
| 
 | ||||
| COMMIT; | ||||
|  | @ -80,6 +80,22 @@ namespace OpenSim.Data.Null | |||
|             return new List<LandData>(); | ||||
|         } | ||||
| 
 | ||||
|         public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) | ||||
|         { | ||||
|             List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); | ||||
|             return regionbanlist; | ||||
|         } | ||||
| 
 | ||||
|         public void AddToRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public void RemoveFromRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public void Shutdown() | ||||
|         { | ||||
|         } | ||||
|  |  | |||
|  | @ -1036,6 +1036,23 @@ namespace OpenSim.Data.SQLite | |||
|             return entry; | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) | ||||
|         { | ||||
|             List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); | ||||
|             return regionbanlist; | ||||
|         } | ||||
| 
 | ||||
|         public void AddToRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public void RemoveFromRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         private static Array serializeTerrain(double[,] val) | ||||
|         { | ||||
|             MemoryStream str = new MemoryStream(65536*sizeof (double)); | ||||
|  |  | |||
|  | @ -970,6 +970,9 @@ namespace OpenSim.Framework | |||
| 
 | ||||
| 
 | ||||
|         void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID); | ||||
| 
 | ||||
|         void sendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID); | ||||
| 
 | ||||
|         void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args); | ||||
|         void sendEstateCovenantInformation(); | ||||
|         void sendDetailedEstateData(LLUUID invoice,string estateName, uint estateID); | ||||
|  |  | |||
|  | @ -0,0 +1,20 @@ | |||
| using libsecondlife; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| 
 | ||||
| namespace OpenSim.Framework | ||||
| { | ||||
|     public class RegionBanListItem | ||||
|     { | ||||
|         public LLUUID regionUUID = LLUUID.Zero; | ||||
|         public LLUUID bannedUUID = LLUUID.Zero; | ||||
|         public string bannedIP = string.Empty; | ||||
|         public string bannedIPHostMask = string.Empty; | ||||
| 
 | ||||
|         public RegionBanListItem() | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -26,6 +26,7 @@ | |||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Net; | ||||
| using System.Net.Sockets; | ||||
| using System.Xml; | ||||
|  | @ -210,6 +211,7 @@ namespace OpenSim.Framework | |||
| 
 | ||||
|         public LLUUID lastMapUUID = LLUUID.Zero; | ||||
|         public string lastMapRefresh = "0"; | ||||
|         public List<RegionBanListItem> regionBanlist = new List<RegionBanListItem>(); | ||||
| 
 | ||||
|         // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | ||||
| 
 | ||||
|  | @ -346,6 +348,28 @@ namespace OpenSim.Framework | |||
|             configMember.performConfigurationRetrieve(); | ||||
|         } | ||||
| 
 | ||||
|         public bool CheckIfUserBanned(LLUUID user) | ||||
|         { | ||||
| 
 | ||||
|             RegionBanListItem[] bl = regionBanlist.ToArray(); | ||||
|              | ||||
|             bool banned = false; | ||||
| 
 | ||||
|             for (int i = 0; i < bl.Length; i++) | ||||
|             { | ||||
|                 if (bl[i] == null) | ||||
|                     continue; | ||||
|              | ||||
|                 if (bl[i].bannedUUID == user) | ||||
|                 { | ||||
|                     banned = true; | ||||
|                     break; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             return banned; | ||||
|         } | ||||
| 
 | ||||
|         public void loadConfigurationOptionsFromMe() | ||||
|         { | ||||
|             configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID_NULL_FREE, | ||||
|  |  | |||
|  | @ -260,13 +260,37 @@ namespace OpenSim.Grid.UserServer | |||
|                         "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}", | ||||
|                         SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); | ||||
|                 } | ||||
|                 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; | ||||
|                 if (handlerUserLoggedInAtLocation != null) | ||||
|                 if (!GridResp.IsFault) | ||||
|                 { | ||||
|                     //m_log.Info("[LOGIN]: Letting other objects know about login"); | ||||
|                     handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, | ||||
|                         theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,theUser.CurrentAgent.Position.Y,theUser.CurrentAgent.Position.Z, | ||||
|                         theUser.FirstName,theUser.SurName); | ||||
|                     bool responseSuccess = true; | ||||
| 
 | ||||
| 
 | ||||
|                     if (GridResp.Value != null) | ||||
|                     { | ||||
|                         Hashtable resp = (Hashtable)GridResp.Value; | ||||
|                         if (resp.ContainsKey("success")) | ||||
|                         { | ||||
|                             if ((string)resp["success"] == "FALSE") | ||||
|                             { | ||||
|                                 responseSuccess = false; | ||||
|                                 tryDefault = true; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
| 
 | ||||
|                     if (responseSuccess) | ||||
|                     { | ||||
|                         handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; | ||||
|                         if (handlerUserLoggedInAtLocation != null) | ||||
|                         { | ||||
|                             //m_log.Info("[LOGIN]: Letting other objects know about login"); | ||||
|                             handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, | ||||
|                                 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, | ||||
|                                 theUser.FirstName, theUser.SurName); | ||||
|                         } | ||||
|                     } | ||||
|                  | ||||
| 
 | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception) | ||||
|  | @ -340,14 +364,50 @@ namespace OpenSim.Grid.UserServer | |||
|                     // Send | ||||
|                     XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | ||||
|                     XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | ||||
|                     handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; | ||||
|                     if (handlerUserLoggedInAtLocation != null) | ||||
| 
 | ||||
|                     if (!GridResp.IsFault) | ||||
|                     { | ||||
|                         m_log.Info("[LOGIN]: Letting other objects know about login"); | ||||
|                         handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, | ||||
|                         theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, | ||||
|                         theUser.FirstName, theUser.SurName); | ||||
|                         bool responseSuccess = true; | ||||
| 
 | ||||
| 
 | ||||
|                         if (GridResp.Value != null) | ||||
|                         { | ||||
|                             Hashtable resp = (Hashtable) GridResp.Value; | ||||
|                             if (resp.ContainsKey("success")) | ||||
|                             { | ||||
|                                 if ((string)resp["success"] == "FALSE") | ||||
|                                 { | ||||
|                                     responseSuccess = false; | ||||
|                                     tryDefault = true; | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
| 
 | ||||
|                         if (responseSuccess) | ||||
|                         { | ||||
|                             handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; | ||||
|                             if (handlerUserLoggedInAtLocation != null) | ||||
|                             { | ||||
|                                 m_log.Info("[LOGIN]: Letting other objects know about login"); | ||||
|                                 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, | ||||
|                                 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, | ||||
|                                 theUser.FirstName, theUser.SurName); | ||||
|                             } | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             response.CreateDeadRegionResponse(); | ||||
| 
 | ||||
|                         } | ||||
| 
 | ||||
| 
 | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         response.CreateDeadRegionResponse(); | ||||
| 
 | ||||
|                     } | ||||
|                      | ||||
|                 } | ||||
| 
 | ||||
|                 catch (Exception e) | ||||
|  |  | |||
|  | @ -515,6 +515,7 @@ namespace OpenSim | |||
|             //moved these here as the terrain texture has to be created after the modules are initialized | ||||
|             // and has to happen before the region is registered with the grid. | ||||
|             scene.CreateTerrainTexture(false); | ||||
|             scene.LoadRegionBanlist(); | ||||
| 
 | ||||
|             try | ||||
|             { | ||||
|  |  | |||
|  | @ -2570,6 +2570,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
|             this.OutPacket(packet, ThrottleOutPacketType.Task); | ||||
|         } | ||||
| 
 | ||||
|         public void sendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID) | ||||
|         { | ||||
|             RegionBanListItem[] bl = banlist.ToArray(); | ||||
| 
 | ||||
|             LLUUID[] BannedUsers = new LLUUID[bl.Length]; | ||||
| 
 | ||||
| 
 | ||||
|             for (int i = 0; i < bl.Length; i++) | ||||
|             { | ||||
|                 if (bl[i] == null) | ||||
|                     continue; | ||||
|                 BannedUsers[i] = bl[i].bannedUUID; | ||||
|             } | ||||
|              | ||||
|             EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); | ||||
|             packet.AgentData.TransactionID = LLUUID.Random(); | ||||
|             packet.AgentData.AgentID = this.AgentId; | ||||
|             packet.AgentData.SessionID = this.SessionId; | ||||
|             packet.MethodData.Invoice = invoice; | ||||
|             packet.MethodData.Method = Helpers.StringToField("setaccess"); | ||||
| 
 | ||||
|             EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Length]; | ||||
| 
 | ||||
|             for (int i = 0; i < (6 + BannedUsers.Length); i++) | ||||
|             { | ||||
|                 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); | ||||
|             } | ||||
|             int j = 0; | ||||
| 
 | ||||
|             returnblock[j].Parameter = Helpers.StringToField(estateID.ToString()); j++; | ||||
|             returnblock[j].Parameter = Helpers.StringToField(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; | ||||
|             returnblock[j].Parameter = Helpers.StringToField("0"); j++; | ||||
|             returnblock[j].Parameter = Helpers.StringToField("0"); j++; | ||||
|             returnblock[j].Parameter = Helpers.StringToField(BannedUsers.Length.ToString()); j++; | ||||
|             returnblock[j].Parameter = Helpers.StringToField("0"); j++; | ||||
| 
 | ||||
|             for (int i = 0; i < BannedUsers.Length; i++) | ||||
|             { | ||||
|                 returnblock[j].Parameter = BannedUsers[i].GetBytes(); j++; | ||||
|             } | ||||
|             packet.ParamList = returnblock; | ||||
|             packet.Header.Reliable = false; | ||||
|             this.OutPacket(packet, ThrottleOutPacketType.Task); | ||||
|         } | ||||
| 
 | ||||
|         public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) | ||||
|         { | ||||
|             RegionInfoPacket rinfopack = new RegionInfoPacket(); | ||||
|  |  | |||
|  | @ -55,10 +55,14 @@ namespace OpenSim.Region.Communications.OGS1 | |||
|         private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>(); | ||||
|         private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>(); | ||||
|         private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); | ||||
|         private List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>(); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         public BaseHttpServer httpListener; | ||||
|         public NetworkServersInfo serversInfo; | ||||
|         public BaseHttpServer httpServer; | ||||
| 
 | ||||
|         public string _gdebugRegionName = String.Empty; | ||||
| 
 | ||||
|         public string gdebugRegionName | ||||
|  | @ -95,6 +99,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
|         // see IGridServices | ||||
|         public RegionCommsListener RegisterRegion(RegionInfo regionInfo) | ||||
|         { | ||||
|             m_regionsOnInstance.Add(regionInfo); | ||||
| 
 | ||||
|             m_log.InfoFormat( | ||||
|                 "[OGS1 GRID SERVICES]: Attempting to register region {0} with grid at {1}", | ||||
|                 regionInfo.RegionName, serversInfo.GridURL); | ||||
|  | @ -606,12 +612,47 @@ namespace OpenSim.Region.Communications.OGS1 | |||
| 
 | ||||
|             ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); | ||||
| 
 | ||||
|             m_log.Debug("[CONNECTION DEBUGGING]: Triggering welcome for " + agentData.AgentID.ToString() + " into " + regionHandle.ToString()); | ||||
|             m_localBackend.TriggerExpectUser(regionHandle, agentData); | ||||
| 
 | ||||
|             m_log.Info("[OGS1 GRID SERVICES]: Welcoming new user..."); | ||||
|             RegionInfo[] regions = m_regionsOnInstance.ToArray(); | ||||
|             bool banned = false; | ||||
| 
 | ||||
|             return new XmlRpcResponse(); | ||||
|             for (int i = 0; i < regions.Length; i++) | ||||
|             { | ||||
|                 if (regions[i] != null) | ||||
|                 { | ||||
|                     if (regions[i].RegionHandle == regionHandle) | ||||
|                     { | ||||
|                         if (regions[i].CheckIfUserBanned(agentData.AgentID)) | ||||
|                         { | ||||
|                             banned = true; | ||||
|                             break; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             XmlRpcResponse resp = new XmlRpcResponse(); | ||||
|              | ||||
|             if (banned) | ||||
|             { | ||||
|                 m_log.InfoFormat("[OGS1 GRID SERVICES]: Denying access for user {0} {1} because user is banned",agentData.firstname,agentData.lastname); | ||||
| 
 | ||||
|                 Hashtable respdata = new Hashtable(); | ||||
|                 respdata["success"] = "FALSE"; | ||||
|                 respdata["reason"] = "banned"; | ||||
|                 resp.Value = respdata; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 m_log.Debug("[CONNECTION DEBUGGING]: Triggering welcome for " + agentData.AgentID.ToString() + " into " + regionHandle.ToString()); | ||||
|                 m_localBackend.TriggerExpectUser(regionHandle, agentData); | ||||
|                 m_log.Info("[OGS1 GRID SERVICES]: Welcoming new user..."); | ||||
|                 Hashtable respdata = new Hashtable();   | ||||
|                 respdata["success"] = "TRUE"; | ||||
|                 resp.Value = respdata; | ||||
| 
 | ||||
|             } | ||||
|             return resp; | ||||
|         } | ||||
|         // Grid Request Processing | ||||
|         /// <summary> | ||||
|  | @ -1107,6 +1148,27 @@ namespace OpenSim.Region.Communications.OGS1 | |||
|         /// <returns></returns> | ||||
|         public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | ||||
|         { | ||||
|             RegionInfo[] regions = m_regionsOnInstance.ToArray(); | ||||
|             bool banned = false; | ||||
| 
 | ||||
|             for (int i = 0; i < regions.Length; i++) | ||||
|             { | ||||
|                 if (regions[i] != null) | ||||
|                 { | ||||
|                     if (regions[i].RegionHandle == regionHandle) | ||||
|                     { | ||||
|                         if (regions[i].CheckIfUserBanned(agentID)) | ||||
|                         { | ||||
|                             banned = true; | ||||
|                             break; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             if (banned) | ||||
|                 return false; | ||||
| 
 | ||||
|             RegionInfo regInfo = null; | ||||
|             try | ||||
|             { | ||||
|  |  | |||
|  | @ -72,6 +72,12 @@ namespace OpenSim.Region.Environment.Interfaces | |||
|         void RemoveLandObject(LLUUID globalID); | ||||
|         List<LandData> LoadLandObjects(LLUUID regionUUID); | ||||
| 
 | ||||
|         List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID); | ||||
|         void AddToRegionBanlist(RegionBanListItem item); | ||||
|         void RemoveFromRegionBanlist(RegionBanListItem item); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         void Shutdown(); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -51,6 +51,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
|         { | ||||
|             remote_client.sendDetailedEstateData(invoice,m_scene.RegionInfo.EstateSettings.estateName,m_scene.RegionInfo.EstateSettings.estateID); | ||||
|             remote_client.sendEstateManagersList(invoice,m_scene.RegionInfo.EstateSettings.estateManagers,m_scene.RegionInfo.EstateSettings.estateID); | ||||
|             remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); | ||||
|         } | ||||
| 
 | ||||
|         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 | |||
| 
 | ||||
|             switch (estateAccessType) | ||||
|             { | ||||
|                 case 64: | ||||
|                     if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) | ||||
|                     { | ||||
|                         RegionBanListItem[] banlistcheck = m_scene.RegionInfo.regionBanlist.ToArray(); | ||||
|                          | ||||
|                         bool alreadyInList = false; | ||||
| 
 | ||||
|                         for (int i = 0; i < banlistcheck.Length; i++) | ||||
|                         { | ||||
|                             if (user == banlistcheck[i].bannedUUID) | ||||
|                             { | ||||
|                                 alreadyInList = true; | ||||
|                                 break; | ||||
|                             } | ||||
| 
 | ||||
|                         } | ||||
|                         if (!alreadyInList) | ||||
|                         { | ||||
| 
 | ||||
|                             RegionBanListItem item = new RegionBanListItem(); | ||||
| 
 | ||||
|                             item.bannedUUID = user; | ||||
|                             item.regionUUID = m_scene.RegionInfo.RegionID; | ||||
|                             item.bannedIP = "0.0.0.0"; | ||||
|                             item.bannedIPHostMask = "0.0.0.0"; | ||||
| 
 | ||||
|                             m_scene.RegionInfo.regionBanlist.Add(item); | ||||
|                             m_scene.AddToRegionBanlist(item); | ||||
| 
 | ||||
|                             ScenePresence s = m_scene.GetScenePresence(user); | ||||
|                             if (s != null) | ||||
|                             { | ||||
|                                 m_scene.TeleportClientHome(user, s.ControllingClient); | ||||
|                             } | ||||
| 
 | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             remote_client.SendAlertMessage("User is already on the region ban list"); | ||||
|                         } | ||||
|                         //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | ||||
|                         remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||||
|                     } | ||||
|                     break; | ||||
|                 case 128: | ||||
|                     if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) | ||||
|                     { | ||||
|                         RegionBanListItem[] banlistcheck = m_scene.RegionInfo.regionBanlist.ToArray(); | ||||
| 
 | ||||
|                         bool alreadyInList = false; | ||||
|                         RegionBanListItem listitem = null; | ||||
| 
 | ||||
|                         for (int i = 0; i < banlistcheck.Length; i++) | ||||
|                         { | ||||
|                             if (user == banlistcheck[i].bannedUUID) | ||||
|                             { | ||||
|                                 alreadyInList = true; | ||||
|                                 listitem = banlistcheck[i]; | ||||
|                                 break; | ||||
|                             } | ||||
| 
 | ||||
|                         } | ||||
|                         if (alreadyInList && listitem != null) | ||||
|                         { | ||||
|                             m_scene.RegionInfo.regionBanlist.Remove(listitem); | ||||
|                             m_scene.RemoveFromRegionBanlist(listitem); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             remote_client.SendAlertMessage("User is not on the region ban list"); | ||||
|                         } | ||||
|                         //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | ||||
|                         remote_client.sendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||||
|                     } | ||||
|                     break; | ||||
|                 case 256: | ||||
| 
 | ||||
|                     // 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 | |||
| 
 | ||||
|                 default: | ||||
| 
 | ||||
|                     m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta"); | ||||
|                     m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString()); | ||||
|                     break; | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -743,6 +743,11 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
|         public void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public void sendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) | ||||
|         { | ||||
|         } | ||||
|  |  | |||
|  | @ -1437,6 +1437,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public void LoadRegionBanlist() | ||||
|         { | ||||
|             List<RegionBanListItem> regionbanlist = m_storageManager.DataStore.LoadRegionBanList(m_regInfo.RegionID); | ||||
|             m_regInfo.regionBanlist = regionbanlist;     | ||||
|         } | ||||
|         public void AddToRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
|             m_storageManager.DataStore.AddToRegionBanlist(item); | ||||
|         } | ||||
| 
 | ||||
|         public void RemoveFromRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
|             m_storageManager.DataStore.RemoveFromRegionBanlist(item); | ||||
|         } | ||||
|         #endregion | ||||
| 
 | ||||
|         #region Primitives Methods | ||||
|  | @ -1854,6 +1868,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
|                 SceneObjectPart RootPrim = GetSceneObjectPart(primID); | ||||
|                 if (RootPrim != null) | ||||
|                 { | ||||
|                     if (m_regInfo.CheckIfUserBanned(RootPrim.OwnerID)) | ||||
|                     { | ||||
|                         SceneObjectGroup grp = RootPrim.ParentGroup; | ||||
|                         if (grp != null) | ||||
|                         { | ||||
|                             DeleteSceneObject(grp); | ||||
|                         } | ||||
|                          | ||||
|                         m_log.Info("[INTERREGION]: Denied prim crossing for banned avatar"); | ||||
| 
 | ||||
|                         return false; | ||||
|                     } | ||||
|                     if (RootPrim.Shape.PCode == (byte)PCode.Prim) | ||||
|                     { | ||||
|                         SceneObjectGroup grp = RootPrim.ParentGroup; | ||||
|  | @ -2333,6 +2359,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
|         { | ||||
|             if (regionHandle == m_regInfo.RegionHandle) | ||||
|             { | ||||
|                 if (m_regInfo.CheckIfUserBanned(agent.AgentID)) | ||||
|                 { | ||||
|                     m_log.WarnFormat( | ||||
|                    "[CONNECTION DEBUGGING]: Denied access to: {0} [{1}] at {2} because the user is on the region banlist", | ||||
|                    agent.AgentID, regionHandle, RegionInfo.RegionName); | ||||
|                 } | ||||
| 
 | ||||
|                 capsPaths[agent.AgentID] = agent.CapsPath; | ||||
| 
 | ||||
|                 if (!agent.child) | ||||
|  | @ -3599,5 +3632,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
|         } | ||||
| 
 | ||||
|         #endregion | ||||
| 
 | ||||
|       | ||||
|     } | ||||
| } | ||||
|          | ||||
|          | ||||
|  | @ -736,6 +736,11 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
|         public void sendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public void sendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public void sendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) | ||||
|         { | ||||
|         } | ||||
|  |  | |||
|  | @ -313,6 +313,23 @@ namespace OpenSim.DataStore.MSSQL | |||
|             return new List<LandData>(); | ||||
|         } | ||||
| 
 | ||||
|         public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) | ||||
|         { | ||||
|             List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); | ||||
|              return regionbanlist; | ||||
|         } | ||||
| 
 | ||||
|         public void AddToRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public void RemoveFromRegionBanlist(RegionBanListItem item) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         public void Commit() | ||||
|         { | ||||
|             lock (ds) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Teravus Ovares
						Teravus Ovares