Don't serve texture preview from other people's objects if you
havenever seen that texture before.0.6.1-post-fixes
parent
bb982ab57f
commit
fba9e3f513
|
@ -141,6 +141,14 @@ namespace OpenSim.Data.MySQL
|
|||
Migration m = new Migration(m_connection, assem, "RegionStore");
|
||||
m.Update();
|
||||
|
||||
PrepareConnection();
|
||||
}
|
||||
|
||||
public void Dispose() {}
|
||||
|
||||
private void PrepareConnection()
|
||||
{
|
||||
GetWaitTimeout();
|
||||
|
||||
MySqlCommand primSelectCmd = new MySqlCommand(m_primSelect, m_connection);
|
||||
m_primDataAdapter = new MySqlDataAdapter(primSelectCmd);
|
||||
|
@ -203,8 +211,6 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
}
|
||||
|
||||
public void Dispose() {}
|
||||
|
||||
/// <summary>
|
||||
/// Get the wait_timeout value for our connection
|
||||
/// </summary>
|
||||
|
@ -254,6 +260,8 @@ namespace OpenSim.Data.MySQL
|
|||
m_connection.Close();
|
||||
m_connection = new MySqlConnection(m_connectionString);
|
||||
m_connection.Open();
|
||||
|
||||
PrepareConnection();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,6 +315,13 @@ namespace OpenSim.Data.MySQL
|
|||
/// <param name="obj">The object</param>
|
||||
/// <param name="regionUUID">The region UUID</param>
|
||||
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
|
||||
{
|
||||
int tries = 3;
|
||||
while (tries > 0)
|
||||
{
|
||||
tries--;
|
||||
|
||||
try
|
||||
{
|
||||
lock (m_dataSet)
|
||||
{
|
||||
|
@ -324,6 +339,17 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
}
|
||||
Commit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch(MySqlException)
|
||||
{
|
||||
m_connection.Close();
|
||||
m_connection = new MySqlConnection(m_connectionString);
|
||||
m_connection.Open();
|
||||
|
||||
PrepareConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,33 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
return null;
|
||||
}
|
||||
|
||||
public InventoryItemBase FindAsset(UUID assetID)
|
||||
{
|
||||
lock (Items)
|
||||
{
|
||||
foreach (InventoryItemBase item in Items.Values)
|
||||
{
|
||||
if (item.AssetID == assetID)
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
lock (SubFolders)
|
||||
{
|
||||
foreach (InventoryFolderImpl folder in SubFolders.Values)
|
||||
{
|
||||
InventoryItemBase item = folder.FindAsset(assetID);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an item if it exists in this folder or any children
|
||||
/// </summary>
|
||||
|
|
|
@ -33,6 +33,7 @@ using Nini.Config;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Environment.Interfaces.ITextureSender>;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||
|
@ -161,6 +162,27 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
public void TextureRequest(Object sender, TextureRequestArgs e)
|
||||
{
|
||||
IClientAPI client = (IClientAPI) sender;
|
||||
|
||||
if (e.Priority == 1016001f) // Preview
|
||||
{
|
||||
if (client.Scene is Scene)
|
||||
{
|
||||
Scene scene = (Scene)client.Scene;
|
||||
|
||||
CachedUserInfo profile = scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId);
|
||||
if (profile == null) // Deny unknown user
|
||||
return;
|
||||
|
||||
if (profile.RootFolder == null) // Deny no inventory
|
||||
return;
|
||||
|
||||
if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned
|
||||
return;
|
||||
|
||||
m_log.Debug("Texture preview");
|
||||
}
|
||||
}
|
||||
|
||||
UserTextureDownloadService textureService;
|
||||
|
||||
if (TryGetUserTextureService(client, out textureService))
|
||||
|
|
Loading…
Reference in New Issue