diff options
Diffstat (limited to 'OpenSim/Region/Framework')
4 files changed, 103 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 38a5456..5796194 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -280,6 +280,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
280 | public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, | 280 | public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, |
281 | UUID itemID, InventoryItemBase itemUpd) | 281 | UUID itemID, InventoryItemBase itemUpd) |
282 | { | 282 | { |
283 | // This one will let people set next perms on items in agent | ||
284 | // inventory. Rut-Roh. Whatever. Make this secure. Yeah. | ||
285 | // | ||
286 | // Passing something to another avatar or a an object will already | ||
283 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 287 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
284 | item = InventoryService.GetItem(item); | 288 | item = InventoryService.GetItem(item); |
285 | 289 | ||
@@ -289,11 +293,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
289 | { | 293 | { |
290 | item.Name = itemUpd.Name; | 294 | item.Name = itemUpd.Name; |
291 | item.Description = itemUpd.Description; | 295 | item.Description = itemUpd.Description; |
292 | item.NextPermissions = itemUpd.NextPermissions; | 296 | item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; |
293 | item.CurrentPermissions |= 8; // Slam! | 297 | item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; |
294 | item.EveryOnePermissions = itemUpd.EveryOnePermissions; | 298 | item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; |
295 | item.GroupPermissions = itemUpd.GroupPermissions; | ||
296 | |||
297 | item.GroupID = itemUpd.GroupID; | 299 | item.GroupID = itemUpd.GroupID; |
298 | item.GroupOwned = itemUpd.GroupOwned; | 300 | item.GroupOwned = itemUpd.GroupOwned; |
299 | item.CreationDate = itemUpd.CreationDate; | 301 | item.CreationDate = itemUpd.CreationDate; |
@@ -399,28 +401,96 @@ namespace OpenSim.Region.Framework.Scenes | |||
399 | 401 | ||
400 | if (Permissions.PropagatePermissions() && recipient != senderId) | 402 | if (Permissions.PropagatePermissions() && recipient != senderId) |
401 | { | 403 | { |
402 | // First, make sore base is limited to the next perms | 404 | // Trying to do this right this time. This is evil. If |
403 | itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move); | 405 | // you believe in Good, go elsewhere. Vampires and other |
404 | // By default, current equals base | 406 | // evil creatores only beyond this point. You have been |
405 | itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions; | 407 | // warned. |
406 | 408 | ||
407 | // If this is an object, replace current perms | 409 | // We're going to mask a lot of things by the next perms |
408 | // with folded perms | 410 | // Tweak the next perms to be nicer to our data |
411 | // | ||
412 | // In this mask, all the bits we do NOT want to mess | ||
413 | // with are set. These are: | ||
414 | // | ||
415 | // Transfer | ||
416 | // Copy | ||
417 | // Modufy | ||
418 | uint permsMask = ~ ((uint)PermissionMask.Copy | | ||
419 | (uint)PermissionMask.Transfer | | ||
420 | (uint)PermissionMask.Modify); | ||
421 | |||
422 | // Now, reduce the next perms to the mask bits | ||
423 | // relevant to the operation | ||
424 | uint nextPerms = permsMask | (item.NextPermissions & | ||
425 | ((uint)PermissionMask.Copy | | ||
426 | (uint)PermissionMask.Transfer | | ||
427 | (uint)PermissionMask.Modify)); | ||
428 | |||
429 | // nextPerms now has all bits set, except for the actual | ||
430 | // next permission bits. | ||
431 | |||
432 | // This checks for no mod, no copy, no trans. | ||
433 | // This indicates an error or messed up item. Do it like | ||
434 | // SL and assume trans | ||
435 | if (nextPerms == permsMask) | ||
436 | nextPerms |= (uint)PermissionMask.Transfer; | ||
437 | |||
438 | // Inventory owner perms are the logical AND of the | ||
439 | // folded perms and the root prim perms, however, if | ||
440 | // the root prim is mod, the inventory perms will be | ||
441 | // mod. This happens on "take" and is of little concern | ||
442 | // here, save for preventing escalation | ||
443 | |||
444 | // This hack ensures that items previously permalocked | ||
445 | // get unlocked when they're passed or rezzed | ||
446 | uint basePerms = item.BasePermissions | | ||
447 | (uint)PermissionMask.Move; | ||
448 | uint ownerPerms = item.CurrentPermissions; | ||
449 | |||
450 | // Mask the base permissions. This is a conservative | ||
451 | // approach altering only the three main perms | ||
452 | basePerms &= nextPerms; | ||
453 | |||
454 | // If this is an object, root prim perms may be more | ||
455 | // permissive than folded perms. Use folded perms as | ||
456 | // a mask | ||
409 | if (item.InvType == (int)InventoryType.Object) | 457 | if (item.InvType == (int)InventoryType.Object) |
410 | { | 458 | { |
411 | itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | 459 | // Create a safe mask for the current perms |
412 | itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13; | 460 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; |
461 | foldedPerms |= permsMask; | ||
462 | |||
463 | bool isRootMod = (item.CurrentPermissions & | ||
464 | (uint)PermissionMask.Modify) != 0 ? | ||
465 | true : false; | ||
466 | |||
467 | // Mask the owner perms to the folded perms | ||
468 | ownerPerms &= foldedPerms; | ||
469 | |||
470 | // If the root was mod, let the mask reflect that | ||
471 | if (isRootMod) | ||
472 | ownerPerms |= (uint)PermissionMask.Modify; | ||
413 | } | 473 | } |
414 | 474 | ||
415 | // Ensure there is no escalation | 475 | // These will be applied to the root prim at next rez. |
416 | itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move); | 476 | // The slam bit (bit 3) and folded permission (bits 0-2) |
477 | // are preserved due to the above mangling | ||
478 | ownerPerms &= nextPerms; | ||
417 | 479 | ||
418 | // Need slam bit on xfer | 480 | // Assign to the actual item. Make sure the slam bit is |
419 | itemCopy.CurrentPermissions |= 8; | 481 | // set, if it wasn't set before. |
482 | itemCopy.BasePermissions = basePerms; | ||
483 | itemCopy.CurrentPermissions = ownerPerms | 16; // Slam | ||
420 | 484 | ||
421 | itemCopy.NextPermissions = item.NextPermissions; | 485 | itemCopy.NextPermissions = item.NextPermissions; |
422 | 486 | ||
423 | itemCopy.EveryOnePermissions = 0; | 487 | // This preserves "everyone can move" |
488 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & | ||
489 | nextPerms; | ||
490 | |||
491 | // Intentionally killing "share with group" here, as | ||
492 | // the recipient will not have the group this is | ||
493 | // set to | ||
424 | itemCopy.GroupPermissions = 0; | 494 | itemCopy.GroupPermissions = 0; |
425 | } | 495 | } |
426 | else | 496 | else |
@@ -922,7 +992,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
922 | else | 992 | else |
923 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; | 993 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; |
924 | 994 | ||
925 | agentItem.CurrentPermissions |= 8; | 995 | agentItem.CurrentPermissions |= 16; // Slam |
926 | agentItem.NextPermissions = taskItem.NextPermissions; | 996 | agentItem.NextPermissions = taskItem.NextPermissions; |
927 | agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 997 | agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
928 | agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; | 998 | agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; |
@@ -1113,7 +1183,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1113 | (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); | 1183 | (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); |
1114 | destTaskItem.BasePermissions = srcTaskItem.BasePermissions & | 1184 | destTaskItem.BasePermissions = srcTaskItem.BasePermissions & |
1115 | (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); | 1185 | (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); |
1116 | destTaskItem.CurrentPermissions |= 8; // Slam! | 1186 | destTaskItem.CurrentPermissions |= 16; // Slam! |
1117 | } | 1187 | } |
1118 | } | 1188 | } |
1119 | 1189 | ||
@@ -1497,7 +1567,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1497 | srcTaskItem.NextPermissions; | 1567 | srcTaskItem.NextPermissions; |
1498 | destTaskItem.BasePermissions = srcTaskItem.BasePermissions & | 1568 | destTaskItem.BasePermissions = srcTaskItem.BasePermissions & |
1499 | srcTaskItem.NextPermissions; | 1569 | srcTaskItem.NextPermissions; |
1500 | destTaskItem.CurrentPermissions |= 8; // Slam! | 1570 | destTaskItem.CurrentPermissions |= 16; // Slam! |
1501 | } | 1571 | } |
1502 | } | 1572 | } |
1503 | 1573 | ||
@@ -1889,17 +1959,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1889 | 1959 | ||
1890 | group.SetGroup(sourcePart.GroupID, null); | 1960 | group.SetGroup(sourcePart.GroupID, null); |
1891 | 1961 | ||
1892 | if (rootPart.OwnerID != item.OwnerID) | 1962 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) |
1893 | { | 1963 | { |
1894 | if (Permissions.PropagatePermissions()) | 1964 | if (Permissions.PropagatePermissions()) |
1895 | { | 1965 | { |
1896 | if ((item.CurrentPermissions & 8) != 0) | 1966 | foreach (SceneObjectPart part in partList) |
1897 | { | 1967 | { |
1898 | foreach (SceneObjectPart part in partList) | 1968 | part.EveryoneMask = item.EveryonePermissions; |
1899 | { | 1969 | part.NextOwnerMask = item.NextPermissions; |
1900 | part.EveryoneMask = item.EveryonePermissions; | ||
1901 | part.NextOwnerMask = item.NextPermissions; | ||
1902 | } | ||
1903 | } | 1970 | } |
1904 | group.ApplyNextOwnerPermissions(); | 1971 | group.ApplyNextOwnerPermissions(); |
1905 | } | 1972 | } |
@@ -1907,17 +1974,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1907 | 1974 | ||
1908 | foreach (SceneObjectPart part in partList) | 1975 | foreach (SceneObjectPart part in partList) |
1909 | { | 1976 | { |
1910 | if (part.OwnerID != item.OwnerID) | 1977 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) |
1911 | { | 1978 | { |
1912 | part.LastOwnerID = part.OwnerID; | 1979 | part.LastOwnerID = part.OwnerID; |
1913 | part.OwnerID = item.OwnerID; | 1980 | part.OwnerID = item.OwnerID; |
1914 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | 1981 | part.Inventory.ChangeInventoryOwner(item.OwnerID); |
1915 | } | 1982 | } |
1916 | else if ((item.CurrentPermissions & 8) != 0) // Slam! | 1983 | part.EveryoneMask = item.EveryonePermissions; |
1917 | { | 1984 | part.NextOwnerMask = item.NextPermissions; |
1918 | part.EveryoneMask = item.EveryonePermissions; | ||
1919 | part.NextOwnerMask = item.NextPermissions; | ||
1920 | } | ||
1921 | } | 1985 | } |
1922 | 1986 | ||
1923 | rootPart.TrimPermissions(); | 1987 | rootPart.TrimPermissions(); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c5fb198..d323e19 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4818,7 +4818,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4818 | part.NextOwnerMask; | 4818 | part.NextOwnerMask; |
4819 | item.GroupPermissions = part.GroupMask & | 4819 | item.GroupPermissions = part.GroupMask & |
4820 | part.NextOwnerMask; | 4820 | part.NextOwnerMask; |
4821 | item.CurrentPermissions |= 8; // Slam! | 4821 | item.CurrentPermissions |= 16; // Slam! |
4822 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 4822 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
4823 | 4823 | ||
4824 | if (InventoryService.AddItem(item)) | 4824 | if (InventoryService.AddItem(item)) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 1149a20..70b37fb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -170,13 +170,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
170 | taskItem.GroupPermissions = item.GroupPermissions & | 170 | taskItem.GroupPermissions = item.GroupPermissions & |
171 | item.NextPermissions; | 171 | item.NextPermissions; |
172 | taskItem.NextPermissions = item.NextPermissions; | 172 | taskItem.NextPermissions = item.NextPermissions; |
173 | taskItem.CurrentPermissions |= 8; | 173 | // We're adding this to a prim we don't own. Force |
174 | // owner change | ||
175 | taskItem.CurrentPermissions |= 16; // Slam | ||
174 | } | 176 | } |
175 | else | 177 | else |
176 | { | 178 | { |
177 | taskItem.BasePermissions = item.BasePermissions; | 179 | taskItem.BasePermissions = item.BasePermissions; |
178 | taskItem.CurrentPermissions = item.CurrentPermissions; | 180 | taskItem.CurrentPermissions = item.CurrentPermissions; |
179 | taskItem.CurrentPermissions |= 8; | ||
180 | taskItem.EveryonePermissions = item.EveryOnePermissions; | 181 | taskItem.EveryonePermissions = item.EveryOnePermissions; |
181 | taskItem.GroupPermissions = item.GroupPermissions; | 182 | taskItem.GroupPermissions = item.GroupPermissions; |
182 | taskItem.NextPermissions = item.NextPermissions; | 183 | taskItem.NextPermissions = item.NextPermissions; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 2cde8f3..0066158 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1082,7 +1082,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1082 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | 1082 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; |
1083 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 1083 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) |
1084 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 1084 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; |
1085 | item.CurrentPermissions |= 8; | ||
1086 | } | 1085 | } |
1087 | item.OwnerChanged = true; | 1086 | item.OwnerChanged = true; |
1088 | item.CurrentPermissions &= item.NextPermissions; | 1087 | item.CurrentPermissions &= item.NextPermissions; |