Merge branch 'master' into varregion

Conflicts:
	OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
	OpenSim/Region/Framework/Scenes/SceneBase.cs
	OpenSim/Services/Interfaces/IGridService.cs
	OpenSim/Services/LLLoginService/LLLoginResponse.cs
(conflicts were debug statements that are commented out in master branch)
varregion
Robert Adams 2014-01-11 08:52:23 -08:00
commit 1cf17a3cf7
19 changed files with 307 additions and 174 deletions

View File

@ -75,6 +75,7 @@ what it is today.
* Chris Yeoh (IBM) * Chris Yeoh (IBM)
* controlbreak * controlbreak
* coyled * coyled
* ctrlaltdavid
* Daedius * Daedius
* daTwitch * daTwitch
* devalnor-#708 * devalnor-#708

View File

@ -2763,15 +2763,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
/// </summary> /// </summary>
private void ApplyNextOwnerPermissions(InventoryItemBase item) private void ApplyNextOwnerPermissions(InventoryItemBase item)
{ {
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) if (item.InvType == (int)InventoryType.Object)
{ {
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) uint perms = item.CurrentPermissions;
item.CurrentPermissions &= ~(uint)PermissionMask.Copy; PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) item.CurrentPermissions = perms;
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
} }
item.CurrentPermissions &= item.NextPermissions; item.CurrentPermissions &= item.NextPermissions;
item.BasePermissions &= item.NextPermissions; item.BasePermissions &= item.NextPermissions;
item.EveryOnePermissions &= item.NextPermissions; item.EveryOnePermissions &= item.NextPermissions;

View File

@ -0,0 +1,87 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using log4net;
namespace OpenSim.Framework
{
public static class PermissionsUtil
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Logs permissions flags. Useful when debugging permission problems.
/// </summary>
/// <param name="message"></param>
public static void LogPermissions(String name, String message, uint basePerm, uint curPerm, uint nextPerm)
{
m_log.DebugFormat("Permissions of \"{0}\" at \"{1}\": Base {2} ({3:X4}), Current {4} ({5:X4}), NextOwner {6} ({7:X4})",
name, message,
PermissionsToString(basePerm), basePerm, PermissionsToString(curPerm), curPerm, PermissionsToString(nextPerm), nextPerm);
}
/// <summary>
/// Converts a permissions bit-mask to a string (e.g., "MCT").
/// </summary>
private static string PermissionsToString(uint perms)
{
string str = "";
if ((perms & (int)PermissionMask.Modify) != 0)
str += "M";
if ((perms & (int)PermissionMask.Copy) != 0)
str += "C";
if ((perms & (int)PermissionMask.Transfer) != 0)
str += "T";
if (str == "")
str = ".";
return str;
}
/// <summary>
/// Applies an object's folded permissions to its regular permissions.
/// </summary>
/// <param name="foldedPerms">The folded permissions. Only the lowest 7 bits are examined.</param>
/// <param name="mainPerms">The permissions variable to modify.</param>
public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms)
{
if ((foldedPerms & 7) == 0)
return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded
if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0)
mainPerms &= ~(uint)PermissionMask.Copy;
if ((foldedPerms & ((uint)PermissionMask.Transfer >> 13)) == 0)
mainPerms &= ~(uint)PermissionMask.Transfer;
if ((foldedPerms & ((uint)PermissionMask.Modify >> 13)) == 0)
mainPerms &= ~(uint)PermissionMask.Modify;
}
}
}

View File

@ -2072,8 +2072,10 @@ namespace OpenSim.Framework
#region Xml Serialization Utilities #region Xml Serialization Utilities
public static bool ReadBoolean(XmlTextReader reader) public static bool ReadBoolean(XmlTextReader reader)
{ {
// AuroraSim uses "int" for some fields that are boolean in OpenSim, e.g. "PassCollisions". Don't fail because of this.
reader.ReadStartElement(); reader.ReadStartElement();
bool result = Boolean.Parse(reader.ReadContentAsString().ToLower()); string val = reader.ReadContentAsString().ToLower();
bool result = val.Equals("true") || val.Equals("1");
reader.ReadEndElement(); reader.ReadEndElement();
return result; return result;

View File

@ -3606,7 +3606,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length];
avp.ObjectData.TextureEntry = textureEntry; avp.ObjectData.TextureEntry = textureEntry;
AvatarAppearancePacket.VisualParamBlock avblock = null; AvatarAppearancePacket.VisualParamBlock avblock = null;
@ -5070,11 +5070,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// excessive up and down movements of the camera when looking up and down. // excessive up and down movements of the camera when looking up and down.
// See http://opensimulator.org/mantis/view.php?id=3274 // See http://opensimulator.org/mantis/view.php?id=3274
// This does not affect head movement, since this is controlled entirely by camera movement rather than // This does not affect head movement, since this is controlled entirely by camera movement rather than
// body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
// effect, not the avatar rotation. // the rotation in this case.
rotation = presence.Rotation; rotation = presence.Rotation;
rotation.X = 0;
rotation.Y = 0; if (!presence.IsSatOnObject)
{
rotation.X = 0;
rotation.Y = 0;
}
if (sendTexture) if (sendTexture)
textureEntry = presence.Appearance.Texture.GetBytes(); textureEntry = presence.Appearance.Texture.GetBytes();
@ -5197,11 +5201,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// excessive up and down movements of the camera when looking up and down. // excessive up and down movements of the camera when looking up and down.
// See http://opensimulator.org/mantis/view.php?id=3274 // See http://opensimulator.org/mantis/view.php?id=3274
// This does not affect head movement, since this is controlled entirely by camera movement rather than // This does not affect head movement, since this is controlled entirely by camera movement rather than
// body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
// effect, not the avatar rotation. // the rotation in this case.
Quaternion rot = data.Rotation; Quaternion rot = data.Rotation;
rot.X = 0;
rot.Y = 0; if (!data.IsSatOnObject)
{
rot.X = 0;
rot.Y = 0;
}
rot.ToBytes(objectData, 52); rot.ToBytes(objectData, 52);
//data.AngularVelocity.ToBytes(objectData, 64); //data.AngularVelocity.ToBytes(objectData, 64);

View File

@ -413,16 +413,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (item == null) if (item == null)
return null; return null;
// Can't know creator is the same, so null it in inventory item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
item.CreatorData = objlist[0].RootPart.CreatorData;
if (objlist.Count > 1) if (objlist.Count > 1)
{ {
item.CreatorId = UUID.Zero.ToString();
item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
// If the objects have different creators then don't specify a creator at all
foreach (SceneObjectGroup objectGroup in objlist)
{
if ((objectGroup.RootPart.CreatorID.ToString() != item.CreatorId)
|| (objectGroup.RootPart.CreatorData.ToString() != item.CreatorData))
{
item.CreatorId = UUID.Zero.ToString();
item.CreatorData = string.Empty;
break;
}
}
} }
else else
{ {
item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
item.CreatorData = objlist[0].RootPart.CreatorData;
item.SaleType = objlist[0].RootPart.ObjectSaleType; item.SaleType = objlist[0].RootPart.ObjectSaleType;
item.SalePrice = objlist[0].RootPart.SalePrice; item.SalePrice = objlist[0].RootPart.SalePrice;
} }
@ -443,13 +454,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
} }
else else
{ {
AddPermissions(item, objlist[0], objlist, remoteClient);
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
item.Description = asset.Description; item.Description = asset.Description;
item.Name = asset.Name; item.Name = asset.Name;
item.AssetType = asset.Type; item.AssetType = asset.Type;
AddPermissions(item, objlist[0], objlist, remoteClient);
m_Scene.AddInventoryItem(item); m_Scene.AddInventoryItem(item);
if (remoteClient != null && item.Owner == remoteClient.AgentId) if (remoteClient != null && item.Owner == remoteClient.AgentId)
@ -491,39 +502,42 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
IClientAPI remoteClient) IClientAPI remoteClient)
{ {
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
uint allObjectsNextOwnerPerms = 0x7fffffff;
uint allObjectsEveryOnePerms = 0x7fffffff;
uint allObjectsGroupPerms = 0x7fffffff;
foreach (SceneObjectGroup grp in objsForEffectivePermissions) foreach (SceneObjectGroup grp in objsForEffectivePermissions)
{
effectivePerms &= grp.GetEffectivePermissions(); effectivePerms &= grp.GetEffectivePermissions();
allObjectsNextOwnerPerms &= grp.RootPart.NextOwnerMask;
allObjectsEveryOnePerms &= grp.RootPart.EveryoneMask;
allObjectsGroupPerms &= grp.RootPart.GroupMask;
}
effectivePerms |= (uint)PermissionMask.Move; effectivePerms |= (uint)PermissionMask.Move;
//PermissionsUtil.LogPermissions(item.Name, "Before AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions);
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
{ {
uint perms = effectivePerms; uint perms = effectivePerms;
uint nextPerms = (perms & 7) << 13; PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms);
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
perms &= ~(uint)PermissionMask.Copy;
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
perms &= ~(uint)PermissionMask.Transfer;
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
perms &= ~(uint)PermissionMask.Modify;
item.BasePermissions = perms & so.RootPart.NextOwnerMask; item.BasePermissions = perms & allObjectsNextOwnerPerms;
item.CurrentPermissions = item.BasePermissions; item.CurrentPermissions = item.BasePermissions;
item.NextPermissions = perms & so.RootPart.NextOwnerMask; item.NextPermissions = perms & allObjectsNextOwnerPerms;
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; item.EveryOnePermissions = allObjectsEveryOnePerms & allObjectsNextOwnerPerms;
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; item.GroupPermissions = allObjectsGroupPerms & allObjectsNextOwnerPerms;
// Magic number badness. Maybe this deserves an enum. // apply next owner perms on rez
// bit 4 (16) is the "Slam" bit, it means treat as passed item.CurrentPermissions |= SceneObjectGroup.SLAM;
// and apply next owner perms on rez
item.CurrentPermissions |= 16; // Slam!
} }
else else
{ {
item.BasePermissions = effectivePerms; item.BasePermissions = effectivePerms;
item.CurrentPermissions = effectivePerms; item.CurrentPermissions = effectivePerms;
item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms;
item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; item.EveryOnePermissions = allObjectsEveryOnePerms & effectivePerms;
item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; item.GroupPermissions = allObjectsGroupPerms & effectivePerms;
item.CurrentPermissions &= item.CurrentPermissions &=
((uint)PermissionMask.Copy | ((uint)PermissionMask.Copy |
@ -534,6 +548,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
7); // Preserve folded permissions 7); // Preserve folded permissions
} }
//PermissionsUtil.LogPermissions(item.Name, "After AddPermissions", item.BasePermissions, item.CurrentPermissions, item.NextPermissions);
return item; return item;
} }
@ -809,11 +825,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
} }
foreach (SceneObjectPart part in group.Parts) if (item == null)
{ {
// Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. // Change ownership. Normally this is done in DoPreRezWhenFromItem(), but in this case we must do it here.
part.LastOwnerID = part.OwnerID; foreach (SceneObjectPart part in group.Parts)
part.OwnerID = remoteClient.AgentId; {
// Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset.
part.LastOwnerID = part.OwnerID;
part.OwnerID = remoteClient.AgentId;
}
} }
if (!attachment) if (!attachment)
@ -969,42 +989,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", // "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
// rootPart.OwnerID, item.Owner, item.CurrentPermissions); // rootPart.OwnerID, item.Owner, item.CurrentPermissions);
if ((rootPart.OwnerID != item.Owner) || if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & SceneObjectGroup.SLAM) != 0)
(item.CurrentPermissions & 16) != 0)
{ {
//Need to kill the for sale here //Need to kill the for sale here
rootPart.ObjectSaleType = 0; rootPart.ObjectSaleType = 0;
rootPart.SalePrice = 10; rootPart.SalePrice = 10;
if (m_Scene.Permissions.PropagatePermissions())
{
foreach (SceneObjectPart part in so.Parts)
{
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
{
part.EveryoneMask = item.EveryOnePermissions;
part.NextOwnerMask = item.NextPermissions;
}
part.GroupMask = 0; // DO NOT propagate here
}
so.ApplyNextOwnerPermissions();
}
} }
foreach (SceneObjectPart part in so.Parts) foreach (SceneObjectPart part in so.Parts)
{ {
part.FromUserInventoryItemID = fromUserInventoryItemId; part.FromUserInventoryItemID = fromUserInventoryItemId;
part.ApplyPermissionsOnRez(item, true, m_Scene);
if ((part.OwnerID != item.Owner) ||
(item.CurrentPermissions & 16) != 0)
{
part.Inventory.ChangeInventoryOwner(item.Owner);
part.GroupMask = 0; // DO NOT propagate here
}
part.EveryoneMask = item.EveryOnePermissions;
part.NextOwnerMask = item.NextPermissions;
} }
rootPart.TrimPermissions(); rootPart.TrimPermissions();

View File

@ -193,13 +193,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = categoryID; item.Folder = categoryID;
uint nextPerms=(perms & 7) << 13; PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
perms &= ~(uint)PermissionMask.Copy;
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
perms &= ~(uint)PermissionMask.Transfer;
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
perms &= ~(uint)PermissionMask.Modify;
item.BasePermissions = perms & part.NextOwnerMask; item.BasePermissions = perms & part.NextOwnerMask;
item.CurrentPermissions = perms & part.NextOwnerMask; item.CurrentPermissions = perms & part.NextOwnerMask;

View File

@ -669,17 +669,13 @@ namespace OpenSim.Region.Framework.Scenes
// a mask // a mask
if (item.InvType == (int)InventoryType.Object) 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 & bool isRootMod = (item.CurrentPermissions &
(uint)PermissionMask.Modify) != 0 ? (uint)PermissionMask.Modify) != 0 ?
true : false; true : false;
// Mask the owner perms to the folded perms // Mask the owner perms to the folded perms
ownerPerms &= foldedPerms; PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms);
basePerms &= foldedPerms; PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms);
// If the root was mod, let the mask reflect that // If the root was mod, let the mask reflect that
// We also need to adjust the base here, because // We also need to adjust the base here, because
@ -1209,9 +1205,16 @@ namespace OpenSim.Region.Framework.Scenes
{ {
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
if (taskItem.InvType == (int)InventoryType.Object) if (taskItem.InvType == (int)InventoryType.Object)
agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); {
uint perms = taskItem.CurrentPermissions;
PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
agentItem.CurrentPermissions = agentItem.BasePermissions;
}
else else
{
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
}
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
agentItem.NextPermissions = taskItem.NextPermissions; agentItem.NextPermissions = taskItem.NextPermissions;

View File

@ -109,6 +109,9 @@ namespace OpenSim.Region.Framework.Scenes
STATUS_ROTATE_Z = 0x008, STATUS_ROTATE_Z = 0x008,
} }
// This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm
public static readonly uint SLAM = 16;
// private PrimCountTaintedDelegate handlerPrimCountTainted = null; // private PrimCountTaintedDelegate handlerPrimCountTainted = null;
/// <summary> /// <summary>
@ -3230,13 +3233,10 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 oldPos; Vector3 oldPos;
// FIXME: This improves the situation where editing just the root prim of an attached object would send
// all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim
// still ends up in the wrong position on reattach.
if (IsAttachment) if (IsAttachment)
oldPos = RootPart.OffsetPosition; oldPos = m_rootPart.AttachedPos + m_rootPart.OffsetPosition; // OffsetPosition should always be 0 in an attachments's root prim
else else
oldPos = AbsolutePosition + RootPart.OffsetPosition; oldPos = AbsolutePosition + m_rootPart.OffsetPosition;
Vector3 diff = oldPos - newPos; Vector3 diff = oldPos - newPos;
Quaternion partRotation = m_rootPart.RotationOffset; Quaternion partRotation = m_rootPart.RotationOffset;
@ -3252,6 +3252,9 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = newPos; AbsolutePosition = newPos;
if (IsAttachment)
m_rootPart.AttachedPos = newPos;
HasGroupChanged = true; HasGroupChanged = true;
ScheduleGroupForTerseUpdate(); ScheduleGroupForTerseUpdate();
} }

View File

@ -4801,6 +4801,64 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.AddScriptLPS(count); ParentGroup.AddScriptLPS(count);
} }
/// <summary>
/// Sets a prim's owner and permissions when it's rezzed.
/// </summary>
/// <param name="item">The inventory item from which the item was rezzed</param>
/// <param name="userInventory">True: the item is being rezzed from the user's inventory. False: from a prim's inventory.</param>
/// <param name="scene">The scene the prim is being rezzed into</param>
public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
{
if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
{
if (scene.Permissions.PropagatePermissions())
{
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
{
// Apply the item's permissions to the object
//LogPermissions("Before applying item permissions");
if (userInventory)
{
EveryoneMask = item.EveryOnePermissions;
NextOwnerMask = item.NextPermissions;
}
else
{
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
EveryoneMask = item.EveryOnePermissions;
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
NextOwnerMask = item.NextPermissions;
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
GroupMask = item.GroupPermissions;
}
//LogPermissions("After applying item permissions");
}
}
GroupMask = 0; // DO NOT propagate here
}
if (OwnerID != item.Owner)
{
//LogPermissions("Before ApplyNextOwnerPermissions");
ApplyNextOwnerPermissions();
//LogPermissions("After ApplyNextOwnerPermissions");
LastOwnerID = OwnerID;
OwnerID = item.Owner;
Inventory.ChangeInventoryOwner(item.Owner);
}
}
/// <summary>
/// Logs the prim's permissions. Useful when debugging permission problems.
/// </summary>
/// <param name="message"></param>
private void LogPermissions(String message)
{
PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask);
}
public void ApplyNextOwnerPermissions() public void ApplyNextOwnerPermissions()
{ {
// Export needs to be preserved in the base and everyone // Export needs to be preserved in the base and everyone

View File

@ -764,48 +764,27 @@ namespace OpenSim.Region.Framework.Scenes
// Since renaming the item in the inventory does not affect the name stored // Since renaming the item in the inventory does not affect the name stored
// in the serialization, transfer the correct name from the inventory to the // in the serialization, transfer the correct name from the inventory to the
// object itself before we rez. // object itself before we rez.
rootPart.Name = item.Name; // Only do these for the first object if we are rezzing a coalescence.
rootPart.Description = item.Description; if (i == 0)
{
SceneObjectPart[] partList = group.Parts; rootPart.Name = item.Name;
rootPart.Description = item.Description;
}
group.SetGroup(m_part.GroupID, null); group.SetGroup(m_part.GroupID, null);
// TODO: Remove magic number badness foreach (SceneObjectPart part in group.Parts)
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
{ {
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) // Convert between InventoryItem classes. You can never have too many similar but slightly different classes :)
{ InventoryItemBase dest = new InventoryItemBase(item.ItemID, item.OwnerID);
foreach (SceneObjectPart part in partList) dest.BasePermissions = item.BasePermissions;
{ dest.CurrentPermissions = item.CurrentPermissions;
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) dest.EveryOnePermissions = item.EveryonePermissions;
part.EveryoneMask = item.EveryonePermissions; dest.GroupPermissions = item.GroupPermissions;
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) dest.NextPermissions = item.NextPermissions;
part.NextOwnerMask = item.NextPermissions; dest.Flags = item.Flags;
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
part.GroupMask = item.GroupPermissions;
}
group.ApplyNextOwnerPermissions(); part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene);
}
}
foreach (SceneObjectPart part in partList)
{
// TODO: Remove magic number badness
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
{
part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID;
part.Inventory.ChangeInventoryOwner(item.OwnerID);
}
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
part.EveryoneMask = item.EveryonePermissions;
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
part.NextOwnerMask = item.NextPermissions;
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
part.GroupMask = item.GroupPermissions;
} }
rootPart.TrimPermissions(); rootPart.TrimPermissions();
@ -1131,25 +1110,6 @@ namespace OpenSim.Region.Framework.Scenes
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
mask &= ~((uint)PermissionMask.Modify >> 13); mask &= ~((uint)PermissionMask.Modify >> 13);
if (item.InvType != (int)InventoryType.Object)
{
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
mask &= ~((uint)PermissionMask.Copy >> 13);
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
mask &= ~((uint)PermissionMask.Transfer >> 13);
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
mask &= ~((uint)PermissionMask.Modify >> 13);
}
else
{
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
mask &= ~((uint)PermissionMask.Copy >> 13);
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
mask &= ~((uint)PermissionMask.Transfer >> 13);
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
mask &= ~((uint)PermissionMask.Modify >> 13);
}
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
mask &= ~(uint)PermissionMask.Copy; mask &= ~(uint)PermissionMask.Copy;
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
@ -1172,14 +1132,11 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", // "[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); // 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.InvType == (int)InventoryType.Object)
{ {
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) uint perms = item.CurrentPermissions;
item.CurrentPermissions &= ~(uint)PermissionMask.Copy; PermissionsUtil.ApplyFoldedPermissions(perms, ref perms);
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) item.CurrentPermissions = perms;
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
} }
item.CurrentPermissions &= item.NextPermissions; item.CurrentPermissions &= item.NextPermissions;

View File

@ -1900,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.SendAgentTerseUpdate(this); ControllingClient.SendAgentTerseUpdate(this);
PhysicsActor actor = PhysicsActor; PhysicsActor actor = PhysicsActor;
// This will be the case if the agent is sitting on the groudn or on an object.
if (actor == null) if (actor == null)
{ {
SendControlsToScripts(flagsForScripts); SendControlsToScripts(flagsForScripts);

View File

@ -71,7 +71,7 @@ public abstract class BSShape
lastReferenced = DateTime.Now; lastReferenced = DateTime.Now;
} }
// Called when this shape is being used again. // Called when this shape is done being used.
protected virtual void DecrementReference() protected virtual void DecrementReference()
{ {
referenceCount--; referenceCount--;
@ -866,6 +866,8 @@ public class BSShapeHull : BSShape
public class BSShapeCompound : BSShape public class BSShapeCompound : BSShape
{ {
private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]";
public static Dictionary<string, BSShapeCompound> CompoundShapes = new Dictionary<string, BSShapeCompound>();
public BSShapeCompound(BulletShape pShape) : base(pShape) public BSShapeCompound(BulletShape pShape) : base(pShape)
{ {
} }
@ -873,7 +875,9 @@ public class BSShapeCompound : BSShape
{ {
// Base compound shapes are not shared so this returns a raw shape. // Base compound shapes are not shared so this returns a raw shape.
// A built compound shape can be reused in linksets. // A built compound shape can be reused in linksets.
return new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); BSShapeCompound ret = new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene));
CompoundShapes.Add(ret.AddrString, ret);
return ret;
} }
public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim)
{ {
@ -911,10 +915,21 @@ public class BSShapeCompound : BSShape
BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii);
DereferenceAnonCollisionShape(physicsScene, childShape); DereferenceAnonCollisionShape(physicsScene, childShape);
} }
lock (CompoundShapes)
CompoundShapes.Remove(physShapeInfo.AddrString);
physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo);
} }
} }
} }
public static bool TryGetCompoundByPtr(BulletShape pShape, out BSShapeCompound outCompound)
{
lock (CompoundShapes)
{
string addr = pShape.AddrString;
return CompoundShapes.TryGetValue(addr, out outCompound);
}
}
private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene)
{ {
BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false);
@ -926,10 +941,13 @@ public class BSShapeCompound : BSShape
private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape)
{ {
// TODO: figure a better way to go through all the shape types and find a possible instance. // TODO: figure a better way to go through all the shape types and find a possible instance.
physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,shape={1}",
BSScene.DetailLogZero, pShape);
BSShapeMesh meshDesc; BSShapeMesh meshDesc;
if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc))
{ {
meshDesc.Dereference(physicsScene); meshDesc.Dereference(physicsScene);
// physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundMesh,shape={1}", BSScene.DetailLogZero, pShape);
} }
else else
{ {
@ -937,13 +955,15 @@ public class BSShapeCompound : BSShape
if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc))
{ {
hullDesc.Dereference(physicsScene); hullDesc.Dereference(physicsScene);
// physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundHull,shape={1}", BSScene.DetailLogZero, pShape);
} }
else else
{ {
BSShapeConvexHull chullDesc; BSShapeConvexHull chullDesc;
if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc)) if (BSShapeConvexHull.TryGetConvexHullByPtr(pShape, out chullDesc))
{ {
chullDesc.Dereference(physicsScene); chullDesc.Dereference(physicsScene);
// physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundConvexHull,shape={1}", BSScene.DetailLogZero, pShape);
} }
else else
{ {
@ -951,20 +971,23 @@ public class BSShapeCompound : BSShape
if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc))
{ {
gImpactDesc.Dereference(physicsScene); gImpactDesc.Dereference(physicsScene);
// physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundgImpact,shape={1}", BSScene.DetailLogZero, pShape);
} }
else else
{ {
// Didn't find it in the lists of specific types. It could be compound. // Didn't find it in the lists of specific types. It could be compound.
if (physicsScene.PE.IsCompound(pShape)) BSShapeCompound compoundDesc;
if (BSShapeCompound.TryGetCompoundByPtr(pShape, out compoundDesc))
{ {
BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); compoundDesc.Dereference(physicsScene);
recursiveCompound.Dereference(physicsScene); // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,recursiveCompoundShape,shape={1}", BSScene.DetailLogZero, pShape);
} }
else else
{ {
// If none of the above, maybe it is a simple native shape. // If none of the above, maybe it is a simple native shape.
if (physicsScene.PE.IsNativeShape(pShape)) if (physicsScene.PE.IsNativeShape(pShape))
{ {
// physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,assumingNative,shape={1}", BSScene.DetailLogZero, pShape);
BSShapeNative nativeShape = new BSShapeNative(pShape); BSShapeNative nativeShape = new BSShapeNative(pShape);
nativeShape.Dereference(physicsScene); nativeShape.Dereference(physicsScene);
} }
@ -1021,6 +1044,8 @@ public class BSShapeConvexHull : BSShape
convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo);
convexShape.shapeKey = newMeshKey; convexShape.shapeKey = newMeshKey;
ConvexHulls.Add(convexShape.shapeKey, retConvexHull); ConvexHulls.Add(convexShape.shapeKey, retConvexHull);
physicsScene.DetailLog("{0},BSShapeConvexHull.GetReference,addingNewlyCreatedShape,shape={1}",
BSScene.DetailLogZero, convexShape);
} }
// Done with the base mesh // Done with the base mesh
@ -1049,7 +1074,7 @@ public class BSShapeConvexHull : BSShape
} }
} }
// Loop through all the known hulls and return the description based on the physical address. // Loop through all the known hulls and return the description based on the physical address.
public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) public static bool TryGetConvexHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull)
{ {
bool ret = false; bool ret = false;
BSShapeConvexHull foundDesc = null; BSShapeConvexHull foundDesc = null;

View File

@ -4394,7 +4394,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID av = new UUID(); UUID av = new UUID();
if (!UUID.TryParse(agent,out av)) if (!UUID.TryParse(agent,out av))
{ {
LSLError("First parameter to llDialog needs to be a key"); LSLError("First parameter to llTextBox needs to be a key");
return; return;
} }

View File

@ -557,7 +557,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
catch catch
{ {
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs", m_ServerURL); m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs for user {1}", m_ServerURL, userID);
// reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
return serverURLs; return serverURLs;
} }

View File

@ -485,8 +485,8 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("Token")) if (kvp.ContainsKey("Token"))
Token = kvp["Token"].ToString(); Token = kvp["Token"].ToString();
m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>",
LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY);
} }
} }
} }

View File

@ -259,7 +259,6 @@ namespace OpenSim.Services.LLLoginService
FillOutRegionData(destination); FillOutRegionData(destination);
m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY);
Util.PrintCallStack();
FillOutSeedCap(aCircuit, destination, clientIP); FillOutSeedCap(aCircuit, destination, clientIP);

View File

@ -89,9 +89,9 @@
<Key Name="assetType" Value="10" /> <Key Name="assetType" Value="10" />
<Key Name="fileName" Value="llResetLandBanList.lsl" /> <Key Name="fileName" Value="llResetLandBanList.lsl" />
</Section> </Section>
<Section Name="llResetLandPassList"> <Section Name="llSay">
<Key Name="assetID" Value="366ac8e9-b391-11dc-8314-0800200c9a66" /> <Key Name="assetID" Value="366ac8e9-b391-11dc-8314-0800200c9a66" />
<Key Name="name" Value="llResetLandPassList" /> <Key Name="name" Value="llSay" />
<Key Name="assetType" Value="10" /> <Key Name="assetType" Value="10" />
<Key Name="fileName" Value="llSay.lsl" /> <Key Name="fileName" Value="llSay.lsl" />
</Section> </Section>

View File

@ -195,7 +195,7 @@
<!-- S == <Key Name="folderID" Value="30000112-000f-0000-0000-000100bba018"/> --> <!-- S == <Key Name="folderID" Value="30000112-000f-0000-0000-000100bba018"/> -->
<Section Name="llSay"> <Section Name="llSay">
<Key Name="inventoryID" Value="3af51d20-b38f-11dc-8314-0800200c9a66" /> <Key Name="inventoryID" Value="3af51d20-b38f-11dc-8314-0800200c9a66" />
<Key Name="assetID" Value="3af51d21-b38f-11dc-8314-0800200c9a66" /> <Key Name="assetID" Value="366ac8e9-b391-11dc-8314-0800200c9a66" />
<Key Name="folderID" Value="30000112-000f-0000-0000-000100bba018"/> <Key Name="folderID" Value="30000112-000f-0000-0000-000100bba018"/>
<Key Name="description" Value="llS" /> <Key Name="description" Value="llS" />
<Key Name="name" Value="llSay" /> <Key Name="name" Value="llSay" />