diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 29 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 34 |
2 files changed, 46 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 0104823..f8a2c2e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -1124,7 +1124,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1124 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); | 1124 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); |
1125 | 1125 | ||
1126 | if ((rootPart.OwnerID != item.Owner) || | 1126 | if ((rootPart.OwnerID != item.Owner) || |
1127 | (item.CurrentPermissions & 16) != 0 || | 1127 | (item.CurrentPermissions & 8) != 0 || |
1128 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | 1128 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) |
1129 | { | 1129 | { |
1130 | //Need to kill the for sale here | 1130 | //Need to kill the for sale here |
@@ -1142,22 +1142,37 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1142 | part.RezzerID = item.Owner; | 1142 | part.RezzerID = item.Owner; |
1143 | part.Inventory.ChangeInventoryOwner(item.Owner); | 1143 | part.Inventory.ChangeInventoryOwner(item.Owner); |
1144 | 1144 | ||
1145 | // This applies the base mask from the item as the next | 1145 | // Reconstruct the original item's base permissions. They |
1146 | // permissions for the object. This is correct because the | 1146 | // can be found in the lower (folded) bits. |
1147 | // giver's base mask was masked by the giver's next owner | 1147 | if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0) |
1148 | // mask, so the base mask equals the original next owner mask. | 1148 | { |
1149 | part.NextOwnerMask = item.BasePermissions; | 1149 | // We have permissions stored there so use them |
1150 | part.NextOwnerMask = ((item.BasePermissions & 7) << 13); | ||
1151 | if ((item.BasePermissions & (uint)PermissionMask.FoldedExport) != 0) | ||
1152 | part.NextOwnerMask |= (uint)PermissionMask.Export; | ||
1153 | part.NextOwnerMask |= (uint)PermissionMask.Move; | ||
1154 | } | ||
1155 | else | ||
1156 | { | ||
1157 | // This is a legacy object and we can't avoid the issues that | ||
1158 | // caused perms loss or escalation before, treat it the legacy | ||
1159 | // way. | ||
1160 | part.NextOwnerMask = item.NextPermissions; | ||
1161 | } | ||
1150 | } | 1162 | } |
1151 | 1163 | ||
1152 | so.ApplyNextOwnerPermissions(); | 1164 | so.ApplyNextOwnerPermissions(); |
1153 | 1165 | ||
1154 | // In case the user has changed flags on a received item | 1166 | // In case the user has changed flags on a received item |
1155 | // we have to apply those changes after the slam. Else we | 1167 | // we have to apply those changes after the slam. Else we |
1156 | // get a net loss of permissions | 1168 | // get a net loss of permissions. |
1169 | // On legacy objects, this opts for a loss of permissions rather | ||
1170 | // than the previous handling that allowed escalation. | ||
1157 | foreach (SceneObjectPart part in so.Parts) | 1171 | foreach (SceneObjectPart part in so.Parts) |
1158 | { | 1172 | { |
1159 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | 1173 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
1160 | { | 1174 | { |
1175 | part.GroupMask = item.GroupPermissions & part.BaseMask; | ||
1161 | part.EveryoneMask = item.EveryOnePermissions & part.BaseMask; | 1176 | part.EveryoneMask = item.EveryOnePermissions & part.BaseMask; |
1162 | part.NextOwnerMask = item.NextPermissions & part.BaseMask; | 1177 | part.NextOwnerMask = item.NextPermissions & part.BaseMask; |
1163 | } | 1178 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index cb06540..0d09cef 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -647,7 +647,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | // Modify | 647 | // Modify |
648 | uint permsMask = ~ ((uint)PermissionMask.Copy | | 648 | uint permsMask = ~ ((uint)PermissionMask.Copy | |
649 | (uint)PermissionMask.Transfer | | 649 | (uint)PermissionMask.Transfer | |
650 | (uint)PermissionMask.Modify); | 650 | (uint)PermissionMask.Modify | |
651 | (uint)PermissionMask.Export); | ||
651 | 652 | ||
652 | // Now, reduce the next perms to the mask bits | 653 | // Now, reduce the next perms to the mask bits |
653 | // relevant to the operation | 654 | // relevant to the operation |
@@ -677,6 +678,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
677 | (uint)PermissionMask.Move; | 678 | (uint)PermissionMask.Move; |
678 | uint ownerPerms = item.CurrentPermissions; | 679 | uint ownerPerms = item.CurrentPermissions; |
679 | 680 | ||
681 | // These will be applied to the root prim at next rez. | ||
682 | // The legacy slam bit (bit 3) and folded permission (bits 0-2) | ||
683 | // are preserved due to the above mangling | ||
684 | ownerPerms &= nextPerms; | ||
685 | |||
686 | // Mask the base permissions. This is a conservative | ||
687 | // approach altering only the three main perms | ||
688 | basePerms &= nextPerms; | ||
689 | |||
690 | // Mask out the folded portion of the base mask. | ||
691 | // While the owner mask carries the actual folded | ||
692 | // permissions, the base mask carries the original | ||
693 | // base mask, before masking with the folded perms. | ||
694 | // We need this later for rezzing. | ||
695 | basePerms &= ~(uint)PermissionMask.FoldedMask; | ||
696 | basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); | ||
697 | |||
680 | // If this is an object, root prim perms may be more | 698 | // If this is an object, root prim perms may be more |
681 | // permissive than folded perms. Use folded perms as | 699 | // permissive than folded perms. Use folded perms as |
682 | // a mask | 700 | // a mask |
@@ -684,6 +702,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
684 | { | 702 | { |
685 | // Create a safe mask for the current perms | 703 | // Create a safe mask for the current perms |
686 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; | 704 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; |
705 | if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) != 0) | ||
706 | foldedPerms |= (uint)PermissionMask.Export; | ||
707 | |||
687 | foldedPerms |= permsMask; | 708 | foldedPerms |= permsMask; |
688 | 709 | ||
689 | bool isRootMod = (item.CurrentPermissions & | 710 | bool isRootMod = (item.CurrentPermissions & |
@@ -691,6 +712,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
691 | true : false; | 712 | true : false; |
692 | 713 | ||
693 | // Mask the owner perms to the folded perms | 714 | // Mask the owner perms to the folded perms |
715 | // Note that this is only to satisfy the viewer. | ||
716 | // The effect of this will be reversed on rez. | ||
694 | ownerPerms &= foldedPerms; | 717 | ownerPerms &= foldedPerms; |
695 | basePerms &= foldedPerms; | 718 | basePerms &= foldedPerms; |
696 | 719 | ||
@@ -705,15 +728,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
705 | } | 728 | } |
706 | } | 729 | } |
707 | 730 | ||
708 | // These will be applied to the root prim at next rez. | ||
709 | // The slam bit (bit 3) and folded permission (bits 0-2) | ||
710 | // are preserved due to the above mangling | ||
711 | ownerPerms &= nextPerms; | ||
712 | |||
713 | // Mask the base permissions. This is a conservative | ||
714 | // approach altering only the three main perms | ||
715 | basePerms &= nextPerms; | ||
716 | |||
717 | // Assign to the actual item. Make sure the slam bit is | 731 | // Assign to the actual item. Make sure the slam bit is |
718 | // set, if it wasn't set before. | 732 | // set, if it wasn't set before. |
719 | itemCopy.BasePermissions = basePerms; | 733 | itemCopy.BasePermissions = basePerms; |