aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-23 20:39:51 +0000
committerMelanie Thielker2008-11-23 20:39:51 +0000
commitfba9e3f513a0d9b4e0ccaf5a9fe24899d96e98c8 (patch)
treef5e20ebb72cb0e7cb1c9b2ae29f9db464eda726e
parentTry to keep autoreturn from IM spamming users if the prims take a bit (diff)
downloadopensim-SC_OLD-fba9e3f513a0d9b4e0ccaf5a9fe24899d96e98c8.zip
opensim-SC_OLD-fba9e3f513a0d9b4e0ccaf5a9fe24899d96e98c8.tar.gz
opensim-SC_OLD-fba9e3f513a0d9b4e0ccaf5a9fe24899d96e98c8.tar.bz2
opensim-SC_OLD-fba9e3f513a0d9b4e0ccaf5a9fe24899d96e98c8.tar.xz
Don't serve texture preview from other people's objects if you
havenever seen that texture before.
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs52
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs27
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs22
3 files changed, 88 insertions, 13 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 2e36123..f57d485 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -141,6 +141,14 @@ namespace OpenSim.Data.MySQL
141 Migration m = new Migration(m_connection, assem, "RegionStore"); 141 Migration m = new Migration(m_connection, assem, "RegionStore");
142 m.Update(); 142 m.Update();
143 143
144 PrepareConnection();
145 }
146
147 public void Dispose() {}
148
149 private void PrepareConnection()
150 {
151 GetWaitTimeout();
144 152
145 MySqlCommand primSelectCmd = new MySqlCommand(m_primSelect, m_connection); 153 MySqlCommand primSelectCmd = new MySqlCommand(m_primSelect, m_connection);
146 m_primDataAdapter = new MySqlDataAdapter(primSelectCmd); 154 m_primDataAdapter = new MySqlDataAdapter(primSelectCmd);
@@ -203,8 +211,6 @@ namespace OpenSim.Data.MySQL
203 } 211 }
204 } 212 }
205 213
206 public void Dispose() {}
207
208 /// <summary> 214 /// <summary>
209 /// Get the wait_timeout value for our connection 215 /// Get the wait_timeout value for our connection
210 /// </summary> 216 /// </summary>
@@ -254,6 +260,8 @@ namespace OpenSim.Data.MySQL
254 m_connection.Close(); 260 m_connection.Close();
255 m_connection = new MySqlConnection(m_connectionString); 261 m_connection = new MySqlConnection(m_connectionString);
256 m_connection.Open(); 262 m_connection.Open();
263
264 PrepareConnection();
257 } 265 }
258 } 266 }
259 267
@@ -308,22 +316,40 @@ namespace OpenSim.Data.MySQL
308 /// <param name="regionUUID">The region UUID</param> 316 /// <param name="regionUUID">The region UUID</param>
309 public void StoreObject(SceneObjectGroup obj, UUID regionUUID) 317 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
310 { 318 {
311 lock (m_dataSet) 319 int tries = 3;
320 while (tries > 0)
312 { 321 {
313 foreach (SceneObjectPart prim in obj.Children.Values) 322 tries--;
323
324 try
314 { 325 {
315 if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Temporary) == 0 326 lock (m_dataSet)
316 && (prim.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) == 0)
317 {
318 //m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
319 addPrim(prim, obj.UUID, regionUUID);
320 }
321 else
322 { 327 {
323 // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); 328 foreach (SceneObjectPart prim in obj.Children.Values)
329 {
330 if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Temporary) == 0
331 && (prim.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) == 0)
332 {
333 //m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
334 addPrim(prim, obj.UUID, regionUUID);
335 }
336 else
337 {
338 // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID);
339 }
340 }
341 Commit();
342 return;
324 } 343 }
325 } 344 }
326 Commit(); 345 catch(MySqlException)
346 {
347 m_connection.Close();
348 m_connection = new MySqlConnection(m_connectionString);
349 m_connection.Open();
350
351 PrepareConnection();
352 }
327 } 353 }
328 } 354 }
329 355
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
index f78cdee..8e624f9 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
@@ -138,6 +138,33 @@ namespace OpenSim.Framework.Communications.Cache
138 return null; 138 return null;
139 } 139 }
140 140
141 public InventoryItemBase FindAsset(UUID assetID)
142 {
143 lock (Items)
144 {
145 foreach (InventoryItemBase item in Items.Values)
146 {
147 if (item.AssetID == assetID)
148 return item;
149 }
150 }
151
152 lock (SubFolders)
153 {
154 foreach (InventoryFolderImpl folder in SubFolders.Values)
155 {
156 InventoryItemBase item = folder.FindAsset(assetID);
157
158 if (item != null)
159 {
160 return item;
161 }
162 }
163 }
164
165 return null;
166 }
167
141 /// <summary> 168 /// <summary>
142 /// Deletes an item if it exists in this folder or any children 169 /// Deletes an item if it exists in this folder or any children
143 /// </summary> 170 /// </summary>
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs
index af51df6..8e56afb 100644
--- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs
@@ -33,6 +33,7 @@ using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
36using OpenSim.Framework.Communications.Cache;
36using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Environment.Interfaces.ITextureSender>; 37using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Environment.Interfaces.ITextureSender>;
37 38
38namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload 39namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
@@ -161,6 +162,27 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
161 public void TextureRequest(Object sender, TextureRequestArgs e) 162 public void TextureRequest(Object sender, TextureRequestArgs e)
162 { 163 {
163 IClientAPI client = (IClientAPI) sender; 164 IClientAPI client = (IClientAPI) sender;
165
166 if (e.Priority == 1016001f) // Preview
167 {
168 if (client.Scene is Scene)
169 {
170 Scene scene = (Scene)client.Scene;
171
172 CachedUserInfo profile = scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId);
173 if (profile == null) // Deny unknown user
174 return;
175
176 if (profile.RootFolder == null) // Deny no inventory
177 return;
178
179 if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned
180 return;
181
182 m_log.Debug("Texture preview");
183 }
184 }
185
164 UserTextureDownloadService textureService; 186 UserTextureDownloadService textureService;
165 187
166 if (TryGetUserTextureService(client, out textureService)) 188 if (TryGetUserTextureService(client, out textureService))