diff options
6 files changed, 69 insertions, 59 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0ec24e6..4d025a9 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -79,7 +79,9 @@ namespace OpenSim.Framework | |||
79 | 79 | ||
80 | FoldedMask = 0x0f, | 80 | FoldedMask = 0x0f, |
81 | 81 | ||
82 | // | 82 | FoldingShift = 13 , // number of bit shifts from normal perm to folded or back (same as Transfer shift below) |
83 | // when doing as a block | ||
84 | |||
83 | Transfer = 1 << 13, // 0x02000 | 85 | Transfer = 1 << 13, // 0x02000 |
84 | Modify = 1 << 14, // 0x04000 | 86 | Modify = 1 << 14, // 0x04000 |
85 | Copy = 1 << 15, // 0x08000 | 87 | Copy = 1 << 15, // 0x08000 |
@@ -91,6 +93,7 @@ namespace OpenSim.Framework | |||
91 | All = 0x8e000, | 93 | All = 0x8e000, |
92 | AllAndExport = 0x9e000, | 94 | AllAndExport = 0x9e000, |
93 | AllEffective = 0x9e000 | 95 | AllEffective = 0x9e000 |
96 | |||
94 | } | 97 | } |
95 | 98 | ||
96 | /// <summary> | 99 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 67c847b..eb7211c 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -574,8 +574,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
574 | IClientAPI remoteClient) | 574 | IClientAPI remoteClient) |
575 | { | 575 | { |
576 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; | 576 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; |
577 | uint allObjectsNextOwnerPerms = 0x7fffffff; | 577 | |
578 | |||
579 | // For the porposes of inventory, an object is modify if the prims | 578 | // For the porposes of inventory, an object is modify if the prims |
580 | // are modify. This allows renaming an object that contains no | 579 | // are modify. This allows renaming an object that contains no |
581 | // mod items. | 580 | // mod items. |
@@ -591,21 +590,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
591 | 590 | ||
592 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 591 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
593 | { | 592 | { |
594 | uint perms = effectivePerms; | 593 | if ((effectivePerms & (uint)PermissionMask.FoldedCopy) == 0) |
595 | uint nextPerms = (perms & 7) << 13; | 594 | effectivePerms &= ~(uint)PermissionMask.Copy; |
596 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | 595 | if ((effectivePerms & (uint)PermissionMask.FoldedTransfer) == 0) |
597 | perms &= ~(uint)PermissionMask.Copy; | 596 | effectivePerms &= ~(uint)PermissionMask.Transfer; |
598 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | 597 | if ((effectivePerms & (uint)PermissionMask.FoldedExport) == 0) |
599 | perms &= ~(uint)PermissionMask.Transfer; | 598 | effectivePerms &= ~(uint)PermissionMask.Export; |
600 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
601 | perms &= ~(uint)PermissionMask.Modify; | ||
602 | 599 | ||
603 | // item.BasePermissions = perms & so.RootPart.NextOwnerMask; | 600 | uint basePerms = effectivePerms & so.RootPart.NextOwnerMask; |
604 | 601 | ||
605 | uint nextp = so.RootPart.NextOwnerMask | (uint)PermissionMask.FoldedMask; | 602 | if((basePerms & (uint)PermissionMask.Copy) == 0) |
606 | item.BasePermissions = perms & nextp; | 603 | basePerms |= (uint)PermissionMask.Transfer; |
604 | |||
605 | // unlock | ||
606 | basePerms |= (uint)PermissionMask.Move; | ||
607 | |||
608 | basePerms &= ~(uint)PermissionMask.FoldedMask; | ||
609 | basePerms |= ((basePerms >> (int)PermissionMask.FoldingShift) & (uint)PermissionMask.FoldedMask); | ||
610 | |||
611 | item.BasePermissions = basePerms; | ||
607 | item.CurrentPermissions = item.BasePermissions; | 612 | item.CurrentPermissions = item.BasePermissions; |
608 | item.NextPermissions = perms & so.RootPart.NextOwnerMask; | 613 | item.NextPermissions = effectivePerms & so.RootPart.NextOwnerMask; |
609 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | 614 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; |
610 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | 615 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; |
611 | 616 | ||
@@ -626,7 +631,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
626 | (uint)PermissionMask.Modify | | 631 | (uint)PermissionMask.Modify | |
627 | (uint)PermissionMask.Move | | 632 | (uint)PermissionMask.Move | |
628 | (uint)PermissionMask.Export | | 633 | (uint)PermissionMask.Export | |
629 | 7); // Preserve folded permissions | 634 | (uint)PermissionMask.FoldedMask); // Preserve folded permissions ?? |
630 | } | 635 | } |
631 | 636 | ||
632 | return item; | 637 | return item; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2f016fa..edf8cb6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -682,19 +682,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
682 | // These will be applied to the root prim at next rez. | 682 | // These will be applied to the root prim at next rez. |
683 | // The legacy slam bit (bit 3) and folded permission (bits 0-2) | 683 | // The legacy slam bit (bit 3) and folded permission (bits 0-2) |
684 | // are preserved due to the above mangling | 684 | // are preserved due to the above mangling |
685 | ownerPerms &= nextPerms; | 685 | // ownerPerms &= nextPerms; |
686 | 686 | ||
687 | // Mask the base permissions. This is a conservative | 687 | // Mask the base permissions. This is a conservative |
688 | // approach altering only the three main perms | 688 | // approach altering only the three main perms |
689 | basePerms &= nextPerms; | 689 | // basePerms &= nextPerms; |
690 | 690 | ||
691 | // Mask out the folded portion of the base mask. | 691 | // Mask out the folded portion of the base mask. |
692 | // While the owner mask carries the actual folded | 692 | // While the owner mask carries the actual folded |
693 | // permissions, the base mask carries the original | 693 | // permissions, the base mask carries the original |
694 | // base mask, before masking with the folded perms. | 694 | // base mask, before masking with the folded perms. |
695 | // We need this later for rezzing. | 695 | // We need this later for rezzing. |
696 | basePerms &= ~(uint)PermissionMask.FoldedMask; | 696 | // basePerms &= ~(uint)PermissionMask.FoldedMask; |
697 | basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); | 697 | // basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); |
698 | 698 | ||
699 | // If this is an object, root prim perms may be more | 699 | // If this is an object, root prim perms may be more |
700 | // permissive than folded perms. Use folded perms as | 700 | // permissive than folded perms. Use folded perms as |
@@ -729,6 +729,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
729 | } | 729 | } |
730 | } | 730 | } |
731 | 731 | ||
732 | // move here so nextperms are mandatory | ||
733 | ownerPerms &= nextPerms; | ||
734 | basePerms &= nextPerms; | ||
735 | basePerms &= ~(uint)PermissionMask.FoldedMask; | ||
736 | basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); | ||
732 | // Assign to the actual item. Make sure the slam bit is | 737 | // Assign to the actual item. Make sure the slam bit is |
733 | // set, if it wasn't set before. | 738 | // set, if it wasn't set before. |
734 | itemCopy.BasePermissions = basePerms; | 739 | itemCopy.BasePermissions = basePerms; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 081281e..42f47b5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -326,7 +326,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
326 | // aux | 326 | // aux |
327 | const uint allmask = (uint)PermissionMask.AllEffective; | 327 | const uint allmask = (uint)PermissionMask.AllEffective; |
328 | const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify); | 328 | const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify); |
329 | const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer); | 329 | const uint copytransfermask = (uint)(PermissionMask.Copy | PermissionMask.Transfer); |
330 | 330 | ||
331 | uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; | 331 | uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; |
332 | bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0; | 332 | bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0; |
@@ -350,7 +350,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
350 | // recover modify and move | 350 | // recover modify and move |
351 | rootOwnerPerms &= movemodmask; | 351 | rootOwnerPerms &= movemodmask; |
352 | owner |= rootOwnerPerms; | 352 | owner |= rootOwnerPerms; |
353 | if((owner & copytransfermast) == 0) | 353 | if((owner & copytransfermask) == 0) |
354 | owner |= (uint)PermissionMask.Transfer; | 354 | owner |= (uint)PermissionMask.Transfer; |
355 | 355 | ||
356 | owner &= basePerms; | 356 | owner &= basePerms; |
@@ -479,17 +479,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | public uint GetEffectivePermissions() | ||
483 | { | ||
484 | return GetEffectivePermissions(false); | ||
485 | } | ||
486 | |||
487 | public uint GetEffectivePermissions(bool useBase) | 482 | public uint GetEffectivePermissions(bool useBase) |
488 | { | 483 | { |
489 | uint perms=(uint)(PermissionMask.Modify | | 484 | uint perms=(uint)(PermissionMask.Modify | |
490 | PermissionMask.Copy | | 485 | PermissionMask.Copy | |
491 | PermissionMask.Move | | 486 | PermissionMask.Move | |
492 | PermissionMask.Transfer) | 7; | 487 | PermissionMask.Transfer | |
488 | PermissionMask.FoldedMask); | ||
493 | 489 | ||
494 | uint ownerMask = 0x7fffffff; | 490 | uint ownerMask = 0x7fffffff; |
495 | 491 | ||
@@ -512,17 +508,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
512 | perms &= ~(uint)PermissionMask.Copy; | 508 | perms &= ~(uint)PermissionMask.Copy; |
513 | if ((ownerMask & (uint)PermissionMask.Transfer) == 0) | 509 | if ((ownerMask & (uint)PermissionMask.Transfer) == 0) |
514 | perms &= ~(uint)PermissionMask.Transfer; | 510 | perms &= ~(uint)PermissionMask.Transfer; |
515 | 511 | if ((ownerMask & (uint)PermissionMask.Export) == 0) | |
516 | // If root prim permissions are applied here, this would screw | 512 | perms &= ~(uint)PermissionMask.Export; |
517 | // with in-inventory manipulation of the next owner perms | ||
518 | // in a major way. So, let's move this to the give itself. | ||
519 | // Yes. I know. Evil. | ||
520 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0) | ||
521 | // perms &= ~((uint)PermissionMask.Modify >> 13); | ||
522 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0) | ||
523 | // perms &= ~((uint)PermissionMask.Copy >> 13); | ||
524 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) | ||
525 | // perms &= ~((uint)PermissionMask.Transfer >> 13); | ||
526 | 513 | ||
527 | return perms; | 514 | return perms; |
528 | } | 515 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e4f18d9..f948336 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -5288,9 +5288,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5288 | // Export needs to be preserved in the base and everyone | 5288 | // Export needs to be preserved in the base and everyone |
5289 | // mask, but removed in the owner mask as a next owner | 5289 | // mask, but removed in the owner mask as a next owner |
5290 | // can never change the export status | 5290 | // can never change the export status |
5291 | BaseMask &= NextOwnerMask | (uint)PermissionMask.Export; | 5291 | BaseMask &= (NextOwnerMask | (uint)PermissionMask.Export); |
5292 | OwnerMask &= NextOwnerMask; | 5292 | OwnerMask &= NextOwnerMask; |
5293 | EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export; | 5293 | EveryoneMask &= (NextOwnerMask | (uint)PermissionMask.Export); |
5294 | GroupMask = 0; // Giving an object zaps group permissions | 5294 | GroupMask = 0; // Giving an object zaps group permissions |
5295 | 5295 | ||
5296 | Inventory.ApplyNextOwnerPermissions(); | 5296 | Inventory.ApplyNextOwnerPermissions(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b53c355..894078d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1340,33 +1340,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
1340 | 1340 | ||
1341 | public uint MaskEffectivePermissions() | 1341 | public uint MaskEffectivePermissions() |
1342 | { | 1342 | { |
1343 | // used to propagate permissions restrictions outwards | ||
1344 | // Modify does not propagate outwards. | ||
1343 | uint mask=0x7fffffff; | 1345 | uint mask=0x7fffffff; |
1344 | 1346 | ||
1345 | foreach (TaskInventoryItem item in m_items.Values) | 1347 | foreach (TaskInventoryItem item in m_items.Values) |
1346 | { | 1348 | { |
1347 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) | 1349 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) |
1348 | mask &= ~((uint)PermissionMask.Copy >> 13); | 1350 | mask &= ~((uint)PermissionMask.FoldedCopy); |
1349 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) | 1351 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) |
1350 | mask &= ~((uint)PermissionMask.Transfer >> 13); | 1352 | mask &= ~((uint)PermissionMask.FoldedTransfer); |
1351 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) | 1353 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Export) == 0) |
1352 | mask &= ~((uint)PermissionMask.Modify >> 13); | 1354 | mask &= ~((uint)PermissionMask.FoldedExport); |
1353 | 1355 | ||
1356 | // this breaks some SL legal use cases | ||
1357 | // there should be no folding from task inventory | ||
1358 | /* | ||
1354 | if (item.InvType == (int)InventoryType.Object) | 1359 | if (item.InvType == (int)InventoryType.Object) |
1355 | { | 1360 | { |
1356 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 1361 | if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedCopy)) == 0) |
1357 | mask &= ~((uint)PermissionMask.Copy >> 13); | 1362 | mask &= ~((uint)PermissionMask.FoldedCopy); |
1358 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 1363 | if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedTransfer)) == 0) |
1359 | mask &= ~((uint)PermissionMask.Transfer >> 13); | 1364 | mask &= ~((uint)PermissionMask.FoldedTransfer); |
1360 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 1365 | if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) == 0) |
1361 | mask &= ~((uint)PermissionMask.Modify >> 13); | 1366 | mask &= ~((uint)PermissionMask.FoldedExport); |
1362 | } | 1367 | } |
1363 | 1368 | */ | |
1364 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1369 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1365 | mask &= ~(uint)PermissionMask.Copy; | 1370 | mask &= ~(uint)PermissionMask.Copy; |
1366 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1371 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) |
1367 | mask &= ~(uint)PermissionMask.Transfer; | 1372 | mask &= ~(uint)PermissionMask.Transfer; |
1368 | if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) | 1373 | if ((item.CurrentPermissions & (uint)PermissionMask.Export) == 0) |
1369 | mask &= ~(uint)PermissionMask.Modify; | 1374 | mask &= ~((uint)PermissionMask.Export); |
1370 | } | 1375 | } |
1371 | return mask; | 1376 | return mask; |
1372 | } | 1377 | } |
@@ -1375,19 +1380,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1375 | { | 1380 | { |
1376 | foreach (TaskInventoryItem item in m_items.Values) | 1381 | foreach (TaskInventoryItem item in m_items.Values) |
1377 | { | 1382 | { |
1378 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 1383 | |
1384 | // this breaks legal SL use cases | ||
1385 | // there should be no unfold into task inventory | ||
1386 | /* | ||
1387 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & (uint)PermissionMask.FoldedMask) != 0) | ||
1379 | { | 1388 | { |
1380 | // m_log.DebugFormat ( | 1389 | // m_log.DebugFormat ( |
1381 | // "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", | 1390 | // "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", |
1382 | // item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); | 1391 | // item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); |
1383 | 1392 | ||
1384 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 1393 | if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedCopy)) == 0) |
1385 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | 1394 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; |
1386 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 1395 | if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedTransfer)) == 0) |
1387 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | 1396 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; |
1388 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 1397 | if ((item.CurrentPermissions & ((uint)PermissionMask.FoldedModify)) == 0) |
1389 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 1398 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; |
1390 | } | 1399 | } |
1400 | */ | ||
1391 | item.CurrentPermissions &= item.NextPermissions; | 1401 | item.CurrentPermissions &= item.NextPermissions; |
1392 | item.BasePermissions &= item.NextPermissions; | 1402 | item.BasePermissions &= item.NextPermissions; |
1393 | item.EveryonePermissions &= item.NextPermissions; | 1403 | item.EveryonePermissions &= item.NextPermissions; |