From 4385d7d6934443530c1e14976e40f01dc90175bf Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 6 Jan 2017 13:17:43 +0000 Subject: Fix errors introduced by incomplete understanding of what folded perms are --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 24 ++++++++-------------- .../Framework/Scenes/SceneObjectPartInventory.cs | 19 +++++++++++------ 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e3ccf96..9c8dbb6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -681,13 +681,17 @@ namespace OpenSim.Region.Framework.Scenes // a mask if (item.InvType == (int)InventoryType.Object) { + // Create a safe mask for the current perms + uint foldedPerms = (item.CurrentPermissions & 7) << 13; + foldedPerms |= permsMask; + bool isRootMod = (item.CurrentPermissions & (uint)PermissionMask.Modify) != 0 ? true : false; // Mask the owner perms to the folded perms - PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms); - PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms); + ownerPerms &= foldedPerms; + basePerms &= foldedPerms; // If the root was mod, let the mask reflect that // We also need to adjust the base here, because @@ -1240,19 +1244,9 @@ namespace OpenSim.Region.Framework.Scenes { agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); if (taskItem.InvType == (int)InventoryType.Object) - { - // Bake the new base permissions from folded permissions - // The folded perms are in the lowest 3 bits of the current perms - // We use base permissions here to avoid baking the "Locked" status - // into the item as it is passed. - uint perms = taskItem.BasePermissions & taskItem.NextPermissions; - PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); - // Avoid the "lock trap" - move must always be enabled but the above may remove it - // Add it back here. - agentItem.BasePermissions = perms | (uint)PermissionMask.Move; - // Newly given items cannot be "locked" on rez. Make sure by - // setting current equal to base. - } + agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); + else + agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; agentItem.CurrentPermissions = agentItem.BasePermissions; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index a50f162..45c3ebd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -1358,12 +1358,19 @@ namespace OpenSim.Region.Framework.Scenes { if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Modify; +// m_log.DebugFormat ( +// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", +// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); + + if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + { + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Modify; + } } item.CurrentPermissions &= item.NextPermissions; item.BasePermissions &= item.NextPermissions; -- cgit v1.1