aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs54
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs134
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs1
5 files changed, 139 insertions, 57 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index e5f1e70..1a7da61 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -381,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
381 if ((nextPerms & (uint)PermissionMask.Modify) == 0) 381 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
382 perms &= ~(uint)PermissionMask.Modify; 382 perms &= ~(uint)PermissionMask.Modify;
383 383
384 // Make sure all bits but the ones we want are clear
385 // on take.
386 // This will be applied to the current perms, so
387 // it will do what we want.
388 objectGroup.RootPart.NextOwnerMask &=
389 ((uint)PermissionMask.Copy |
390 (uint)PermissionMask.Transfer |
391 (uint)PermissionMask.Modify);
392 objectGroup.RootPart.NextOwnerMask |=
393 (uint)PermissionMask.Move;
394
384 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; 395 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
385 item.CurrentPermissions = item.BasePermissions; 396 item.CurrentPermissions = item.BasePermissions;
386 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 397 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
387 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; 398 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
388 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; 399 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
389 item.CurrentPermissions |= 8; // Slam! 400
401 // Magic number badness. Maybe this deserves an enum.
402 // bit 4 (16) is the "Slam" bit, it means treat as passed
403 // and apply next owner perms on rez
404 item.CurrentPermissions |= 16; // Slam!
390 } 405 }
391 else 406 else
392 { 407 {
@@ -396,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
396 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 411 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
397 item.GroupPermissions = objectGroup.RootPart.GroupMask; 412 item.GroupPermissions = objectGroup.RootPart.GroupMask;
398 413
399 item.CurrentPermissions |= 8; // Slam! 414 item.CurrentPermissions &=
415 ((uint)PermissionMask.Copy |
416 (uint)PermissionMask.Transfer |
417 (uint)PermissionMask.Modify |
418 (uint)PermissionMask.Move |
419 7); // Preserve folded permissions
400 } 420 }
401 421
402 // TODO: add the new fields (Flags, Sale info, etc) 422 // TODO: add the new fields (Flags, Sale info, etc)
@@ -498,7 +518,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
498 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); 518 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
499 519
500 group.RootPart.FromFolderID = item.Folder; 520 group.RootPart.FromFolderID = item.Folder;
501 group.RootPart.CreateSelected = true 521
522 // If it's rezzed in world, select it. Much easier to
523 // find small items.
524 //
525 if (!attachment)
526 group.RootPart.CreateSelected = true;
502 527
503 if (!m_Scene.Permissions.CanRezObject( 528 if (!m_Scene.Permissions.CanRezObject(
504 group.Children.Count, remoteClient.AgentId, pos) 529 group.Children.Count, remoteClient.AgentId, pos)
@@ -572,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
572 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 597 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
573 598
574 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 599 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
575 if (rootPart.OwnerID != item.Owner) 600 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
576 { 601 {
577 //Need to kill the for sale here 602 //Need to kill the for sale here
578 rootPart.ObjectSaleType = 0; 603 rootPart.ObjectSaleType = 0;
@@ -580,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
580 605
581 if (m_Scene.Permissions.PropagatePermissions()) 606 if (m_Scene.Permissions.PropagatePermissions())
582 { 607 {
583 if ((item.CurrentPermissions & 8) != 0) 608 foreach (SceneObjectPart part in partList)
584 { 609 {
585 foreach (SceneObjectPart part in partList) 610 part.EveryoneMask = item.EveryOnePermissions;
586 { 611 part.NextOwnerMask = item.NextPermissions;
587 part.EveryoneMask = item.EveryOnePermissions; 612 part.GroupMask = 0; // DO NOT propagate here
588 part.NextOwnerMask = item.NextPermissions;
589 part.GroupMask = 0; // DO NOT propagate here
590 }
591 } 613 }
592 614
593 group.ApplyNextOwnerPermissions(); 615 group.ApplyNextOwnerPermissions();
@@ -596,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
596 618
597 foreach (SceneObjectPart part in partList) 619 foreach (SceneObjectPart part in partList)
598 { 620 {
599 if (part.OwnerID != item.Owner) 621 if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
600 { 622 {
601 part.LastOwnerID = part.OwnerID; 623 part.LastOwnerID = part.OwnerID;
602 part.OwnerID = item.Owner; 624 part.OwnerID = item.Owner;
603 part.Inventory.ChangeInventoryOwner(item.Owner); 625 part.Inventory.ChangeInventoryOwner(item.Owner);
604 }
605 else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
606 {
607 part.EveryoneMask = item.EveryOnePermissions;
608 part.NextOwnerMask = item.NextPermissions;
609
610 part.GroupMask = 0; // DO NOT propagate here 626 part.GroupMask = 0; // DO NOT propagate here
611 } 627 }
628 part.EveryoneMask = item.EveryOnePermissions;
629 part.NextOwnerMask = item.NextPermissions;
612 } 630 }
613 631
614 rootPart.TrimPermissions(); 632 rootPart.TrimPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9ba13ae..34461dc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes
265 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, 265 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
266 UUID itemID, InventoryItemBase itemUpd) 266 UUID itemID, InventoryItemBase itemUpd)
267 { 267 {
268 // This one will let people set next perms on items in agent
269 // inventory. Rut-Roh. Whatever. Make this secure. Yeah.
270 //
271 // Passing something to another avatar or a an object will already
268 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 272 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
269 item = InventoryService.GetItem(item); 273 item = InventoryService.GetItem(item);
270 274
@@ -274,11 +278,9 @@ namespace OpenSim.Region.Framework.Scenes
274 { 278 {
275 item.Name = itemUpd.Name; 279 item.Name = itemUpd.Name;
276 item.Description = itemUpd.Description; 280 item.Description = itemUpd.Description;
277 item.NextPermissions = itemUpd.NextPermissions; 281 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
278 item.CurrentPermissions |= 8; // Slam! 282 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
279 item.EveryOnePermissions = itemUpd.EveryOnePermissions; 283 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
280 item.GroupPermissions = itemUpd.GroupPermissions;
281
282 item.GroupID = itemUpd.GroupID; 284 item.GroupID = itemUpd.GroupID;
283 item.GroupOwned = itemUpd.GroupOwned; 285 item.GroupOwned = itemUpd.GroupOwned;
284 item.CreationDate = itemUpd.CreationDate; 286 item.CreationDate = itemUpd.CreationDate;
@@ -384,28 +386,96 @@ namespace OpenSim.Region.Framework.Scenes
384 386
385 if (Permissions.PropagatePermissions() && recipient != senderId) 387 if (Permissions.PropagatePermissions() && recipient != senderId)
386 { 388 {
387 // First, make sore base is limited to the next perms 389 // Trying to do this right this time. This is evil. If
388 itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move); 390 // you believe in Good, go elsewhere. Vampires and other
389 // By default, current equals base 391 // evil creatores only beyond this point. You have been
390 itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions; 392 // warned.
391 393
392 // If this is an object, replace current perms 394 // We're going to mask a lot of things by the next perms
393 // with folded perms 395 // Tweak the next perms to be nicer to our data
396 //
397 // In this mask, all the bits we do NOT want to mess
398 // with are set. These are:
399 //
400 // Transfer
401 // Copy
402 // Modufy
403 uint permsMask = ~ ((uint)PermissionMask.Copy |
404 (uint)PermissionMask.Transfer |
405 (uint)PermissionMask.Modify);
406
407 // Now, reduce the next perms to the mask bits
408 // relevant to the operation
409 uint nextPerms = permsMask | (item.NextPermissions &
410 ((uint)PermissionMask.Copy |
411 (uint)PermissionMask.Transfer |
412 (uint)PermissionMask.Modify));
413
414 // nextPerms now has all bits set, except for the actual
415 // next permission bits.
416
417 // This checks for no mod, no copy, no trans.
418 // This indicates an error or messed up item. Do it like
419 // SL and assume trans
420 if (nextPerms == permsMask)
421 nextPerms |= (uint)PermissionMask.Transfer;
422
423 // Inventory owner perms are the logical AND of the
424 // folded perms and the root prim perms, however, if
425 // the root prim is mod, the inventory perms will be
426 // mod. This happens on "take" and is of little concern
427 // here, save for preventing escalation
428
429 // This hack ensures that items previously permalocked
430 // get unlocked when they're passed or rezzed
431 uint basePerms = item.BasePermissions |
432 (uint)PermissionMask.Move;
433 uint ownerPerms = item.CurrentPermissions;
434
435 // Mask the base permissions. This is a conservative
436 // approach altering only the three main perms
437 basePerms &= nextPerms;
438
439 // If this is an object, root prim perms may be more
440 // permissive than folded perms. Use folded perms as
441 // a mask
394 if (item.InvType == (int)InventoryType.Object) 442 if (item.InvType == (int)InventoryType.Object)
395 { 443 {
396 itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); 444 // Create a safe mask for the current perms
397 itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13; 445 uint foldedPerms = (item.CurrentPermissions & 7) << 13;
446 foldedPerms |= permsMask;
447
448 bool isRootMod = (item.CurrentPermissions &
449 (uint)PermissionMask.Modify) != 0 ?
450 true : false;
451
452 // Mask the owner perms to the folded perms
453 ownerPerms &= foldedPerms;
454
455 // If the root was mod, let the mask reflect that
456 if (isRootMod)
457 ownerPerms |= (uint)PermissionMask.Modify;
398 } 458 }
399 459
400 // Ensure there is no escalation 460 // These will be applied to the root prim at next rez.
401 itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move); 461 // The slam bit (bit 3) and folded permission (bits 0-2)
462 // are preserved due to the above mangling
463 ownerPerms &= nextPerms;
402 464
403 // Need slam bit on xfer 465 // Assign to the actual item. Make sure the slam bit is
404 itemCopy.CurrentPermissions |= 8; 466 // set, if it wasn't set before.
467 itemCopy.BasePermissions = basePerms;
468 itemCopy.CurrentPermissions = ownerPerms | 16; // Slam
405 469
406 itemCopy.NextPermissions = item.NextPermissions; 470 itemCopy.NextPermissions = item.NextPermissions;
407 471
408 itemCopy.EveryOnePermissions = 0; 472 // This preserves "everyone can move"
473 itemCopy.EveryOnePermissions = item.EveryOnePermissions &
474 nextPerms;
475
476 // Intentionally killing "share with group" here, as
477 // the recipient will not have the group this is
478 // set to
409 itemCopy.GroupPermissions = 0; 479 itemCopy.GroupPermissions = 0;
410 } 480 }
411 else 481 else
@@ -903,7 +973,7 @@ namespace OpenSim.Region.Framework.Scenes
903 else 973 else
904 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 974 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
905 975
906 agentItem.CurrentPermissions |= 8; 976 agentItem.CurrentPermissions |= 16; // Slam
907 agentItem.NextPermissions = taskItem.NextPermissions; 977 agentItem.NextPermissions = taskItem.NextPermissions;
908 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 978 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
909 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 979 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
@@ -1094,7 +1164,7 @@ namespace OpenSim.Region.Framework.Scenes
1094 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1164 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1095 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1165 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1096 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1166 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1097 destTaskItem.CurrentPermissions |= 8; // Slam! 1167 destTaskItem.CurrentPermissions |= 16; // Slam!
1098 } 1168 }
1099 } 1169 }
1100 1170
@@ -1478,7 +1548,7 @@ namespace OpenSim.Region.Framework.Scenes
1478 srcTaskItem.NextPermissions; 1548 srcTaskItem.NextPermissions;
1479 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1549 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1480 srcTaskItem.NextPermissions; 1550 srcTaskItem.NextPermissions;
1481 destTaskItem.CurrentPermissions |= 8; // Slam! 1551 destTaskItem.CurrentPermissions |= 16; // Slam!
1482 } 1552 }
1483 } 1553 }
1484 1554
@@ -1864,17 +1934,14 @@ namespace OpenSim.Region.Framework.Scenes
1864 1934
1865 group.SetGroup(sourcePart.GroupID, null); 1935 group.SetGroup(sourcePart.GroupID, null);
1866 1936
1867 if (rootPart.OwnerID != item.OwnerID) 1937 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
1868 { 1938 {
1869 if (Permissions.PropagatePermissions()) 1939 if (Permissions.PropagatePermissions())
1870 { 1940 {
1871 if ((item.CurrentPermissions & 8) != 0) 1941 foreach (SceneObjectPart part in partList)
1872 { 1942 {
1873 foreach (SceneObjectPart part in partList) 1943 part.EveryoneMask = item.EveryonePermissions;
1874 { 1944 part.NextOwnerMask = item.NextPermissions;
1875 part.EveryoneMask = item.EveryonePermissions;
1876 part.NextOwnerMask = item.NextPermissions;
1877 }
1878 } 1945 }
1879 group.ApplyNextOwnerPermissions(); 1946 group.ApplyNextOwnerPermissions();
1880 } 1947 }
@@ -1882,17 +1949,14 @@ namespace OpenSim.Region.Framework.Scenes
1882 1949
1883 foreach (SceneObjectPart part in partList) 1950 foreach (SceneObjectPart part in partList)
1884 { 1951 {
1885 if (part.OwnerID != item.OwnerID) 1952 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
1886 { 1953 {
1887 part.LastOwnerID = part.OwnerID; 1954 part.LastOwnerID = part.OwnerID;
1888 part.OwnerID = item.OwnerID; 1955 part.OwnerID = item.OwnerID;
1889 part.Inventory.ChangeInventoryOwner(item.OwnerID); 1956 part.Inventory.ChangeInventoryOwner(item.OwnerID);
1890 } 1957 }
1891 else if ((item.CurrentPermissions & 8) != 0) // Slam! 1958 part.EveryoneMask = item.EveryonePermissions;
1892 { 1959 part.NextOwnerMask = item.NextPermissions;
1893 part.EveryoneMask = item.EveryonePermissions;
1894 part.NextOwnerMask = item.NextPermissions;
1895 }
1896 } 1960 }
1897 1961
1898 rootPart.TrimPermissions(); 1962 rootPart.TrimPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e2ab643..f7d2d37 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4731,7 +4731,7 @@ namespace OpenSim.Region.Framework.Scenes
4731 part.NextOwnerMask; 4731 part.NextOwnerMask;
4732 item.GroupPermissions = part.GroupMask & 4732 item.GroupPermissions = part.GroupMask &
4733 part.NextOwnerMask; 4733 part.NextOwnerMask;
4734 item.CurrentPermissions |= 8; // Slam! 4734 item.CurrentPermissions |= 16; // Slam!
4735 item.CreationDate = Util.UnixTimeSinceEpoch(); 4735 item.CreationDate = Util.UnixTimeSinceEpoch();
4736 4736
4737 if (InventoryService.AddItem(item)) 4737 if (InventoryService.AddItem(item))
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index f7e46af..55d2e32 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -172,13 +172,14 @@ namespace OpenSim.Region.Framework.Scenes
172 taskItem.GroupPermissions = item.GroupPermissions & 172 taskItem.GroupPermissions = item.GroupPermissions &
173 item.NextPermissions; 173 item.NextPermissions;
174 taskItem.NextPermissions = item.NextPermissions; 174 taskItem.NextPermissions = item.NextPermissions;
175 taskItem.CurrentPermissions |= 8; 175 // We're adding this to a prim we don't own. Force
176 // owner change
177 taskItem.CurrentPermissions |= 16; // Slam
176 } 178 }
177 else 179 else
178 { 180 {
179 taskItem.BasePermissions = item.BasePermissions; 181 taskItem.BasePermissions = item.BasePermissions;
180 taskItem.CurrentPermissions = item.CurrentPermissions; 182 taskItem.CurrentPermissions = item.CurrentPermissions;
181 taskItem.CurrentPermissions |= 8;
182 taskItem.EveryonePermissions = item.EveryOnePermissions; 183 taskItem.EveryonePermissions = item.EveryOnePermissions;
183 taskItem.GroupPermissions = item.GroupPermissions; 184 taskItem.GroupPermissions = item.GroupPermissions;
184 taskItem.NextPermissions = item.NextPermissions; 185 taskItem.NextPermissions = item.NextPermissions;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3a8f168..cabcf37 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -952,7 +952,6 @@ namespace OpenSim.Region.Framework.Scenes
952 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; 952 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
953 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) 953 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
954 item.CurrentPermissions &= ~(uint)PermissionMask.Modify; 954 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
955 item.CurrentPermissions |= 8;
956 } 955 }
957 item.CurrentPermissions &= item.NextPermissions; 956 item.CurrentPermissions &= item.NextPermissions;
958 item.BasePermissions &= item.NextPermissions; 957 item.BasePermissions &= item.NextPermissions;