aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/InventoryService/XInventoryService.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-11-17 01:01:14 +0000
committerJustin Clark-Casey (justincc)2012-11-17 01:01:14 +0000
commit2aa58c58435e0071da185d32a3f3cb622f699de0 (patch)
tree3c787f543101b44ca45adb43d0a6a9b49133b5a2 /OpenSim/Services/InventoryService/XInventoryService.cs
parentAdd basic XInventoryServicesTests.TestAddItem() regression test. (diff)
downloadopensim-SC_OLD-2aa58c58435e0071da185d32a3f3cb622f699de0.zip
opensim-SC_OLD-2aa58c58435e0071da185d32a3f3cb622f699de0.tar.gz
opensim-SC_OLD-2aa58c58435e0071da185d32a3f3cb622f699de0.tar.bz2
opensim-SC_OLD-2aa58c58435e0071da185d32a3f3cb622f699de0.tar.xz
Do not allow invariants to change on calls to XInventoryService.UpdateItem()
This is to help track down http://opensimulator.org/mantis/view.php?id=6359 where creator IDs on items and rezzed objects have been reported to sometimes change. This should never happen - a particular item should never change creators (if an item is given then a new item (with new id) is created). Invariants are inventory type, asset type, folder (changed only on MoveItems()), CreatorIdentification and Owner. If caller attempts to change an invariant, warning is logged but other properties are still changed. If you see this warning, reporting on Mantis 6359 would be very welcome with the exact operation being done at the time.
Diffstat (limited to 'OpenSim/Services/InventoryService/XInventoryService.cs')
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 9abc5e4..00faa44 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -476,6 +476,46 @@ namespace OpenSim.Services.InventoryService
476// m_log.InfoFormat( 476// m_log.InfoFormat(
477// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); 477// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
478 478
479 InventoryItemBase retrievedItem = GetItem(item);
480
481 if (retrievedItem == null)
482 {
483 m_log.WarnFormat(
484 "[XINVENTORY SERVICE]: Tried to update item {0} {1}, owner {2} but no existing item found.",
485 item.Name, item.ID, item.Owner);
486
487 return false;
488 }
489
490 // Do not allow invariants to change. Changes to folder ID occur in MoveItems()
491 if (retrievedItem.InvType != item.InvType
492 || retrievedItem.AssetType != item.AssetType
493 || retrievedItem.Folder != item.Folder
494 || retrievedItem.CreatorIdentification != item.CreatorIdentification
495 || retrievedItem.Owner != item.Owner)
496 {
497 m_log.WarnFormat(
498 "[XINVENTORY SERVICE]: Caller to UpdateItem() for {0} {1} tried to alter property(s) that should be invariant, (InvType, AssetType, Folder, CreatorIdentification, Owner), existing ({2}, {3}, {4}, {5}, {6}), update ({7}, {8}, {9}, {10}, {11})",
499 retrievedItem.Name,
500 retrievedItem.ID,
501 retrievedItem.InvType,
502 retrievedItem.AssetType,
503 retrievedItem.Folder,
504 retrievedItem.CreatorIdentification,
505 retrievedItem.Owner,
506 item.InvType,
507 item.AssetType,
508 item.Folder,
509 item.CreatorIdentification,
510 item.Owner);
511
512 item.InvType = retrievedItem.InvType;
513 item.AssetType = retrievedItem.AssetType;
514 item.Folder = retrievedItem.Folder;
515 item.CreatorIdentification = retrievedItem.CreatorIdentification;
516 item.Owner = retrievedItem.Owner;
517 }
518
479 return m_Database.StoreItem(ConvertFromOpenSim(item)); 519 return m_Database.StoreItem(ConvertFromOpenSim(item));
480 } 520 }
481 521