Browse Source

Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

Justin Clark-Casey (justincc) 14 years ago
parent
commit
0080c3b1f4

+ 1 - 1
OpenSim/Data/Tests/RegionTests.cs

@@ -781,7 +781,7 @@ namespace OpenSim.Data.Tests
             // Ownership changes when you drop an object into an object
             // Ownership changes when you drop an object into an object
             // owned by someone else
             // owned by someone else
             Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))");
             Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))");
-            Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
+            Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 16), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
             Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))");
             Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))");
             Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))");
             Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))");
         }
         }

+ 36 - 17
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs

@@ -381,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
                     if ((nextPerms & (uint)PermissionMask.Modify) == 0)
                     if ((nextPerms & (uint)PermissionMask.Modify) == 0)
                         perms &= ~(uint)PermissionMask.Modify;
                         perms &= ~(uint)PermissionMask.Modify;
 
 
+                    // Make sure all bits but the ones we want are clear
+                    // on take.
+                    // This will be applied to the current perms, so
+                    // it will do what we want.
+                    objectGroup.RootPart.NextOwnerMask &=
+                            ((uint)PermissionMask.Copy | 
+                             (uint)PermissionMask.Transfer |
+                             (uint)PermissionMask.Modify);
+                    objectGroup.RootPart.NextOwnerMask |=
+                            (uint)PermissionMask.Move;
+
                     item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
                     item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
                     item.CurrentPermissions = item.BasePermissions;
                     item.CurrentPermissions = item.BasePermissions;
                     item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
                     item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
                     item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
                     item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
                     item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
                     item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
-                    item.CurrentPermissions |= 8; // Slam!
+                    
+                    // Magic number badness. Maybe this deserves an enum.
+                    // bit 4 (16) is the "Slam" bit, it means treat as passed
+                    // and apply next owner perms on rez
+                    item.CurrentPermissions |= 16; // Slam!
                 }
                 }
                 else
                 else
                 {
                 {
@@ -396,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
                     item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
                     item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
                     item.GroupPermissions = objectGroup.RootPart.GroupMask;
                     item.GroupPermissions = objectGroup.RootPart.GroupMask;
 
 
-                    item.CurrentPermissions |= 8; // Slam!
+                    item.CurrentPermissions &=
+                            ((uint)PermissionMask.Copy |
+                             (uint)PermissionMask.Transfer |
+                             (uint)PermissionMask.Modify |
+                             (uint)PermissionMask.Move |
+                             7); // Preserve folded permissions
                 }
                 }
 
 
                 // TODO: add the new fields (Flags, Sale info, etc)
                 // TODO: add the new fields (Flags, Sale info, etc)
@@ -499,6 +519,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
 
 
                     group.RootPart.FromFolderID = item.Folder;
                     group.RootPart.FromFolderID = item.Folder;
 
 
+                    // If it's rezzed in world, select it. Much easier to 
+                    // find small items.
+                    //
+                    if (!attachment)
+                        group.RootPart.CreateSelected = true;
+
                     if (!m_Scene.Permissions.CanRezObject(
                     if (!m_Scene.Permissions.CanRezObject(
                         group.Children.Count, remoteClient.AgentId, pos)
                         group.Children.Count, remoteClient.AgentId, pos)
                         && !attachment)
                         && !attachment)
@@ -571,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
                     List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
                     List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
 
 
                     group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
                     group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
-                    if (rootPart.OwnerID != item.Owner)
+                    if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
                     {
                     {
                         //Need to kill the for sale here
                         //Need to kill the for sale here
                         rootPart.ObjectSaleType = 0;
                         rootPart.ObjectSaleType = 0;
@@ -579,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
 
 
                         if (m_Scene.Permissions.PropagatePermissions())
                         if (m_Scene.Permissions.PropagatePermissions())
                         {
                         {
-                            if ((item.CurrentPermissions & 8) != 0)
+                            foreach (SceneObjectPart part in partList)
                             {
                             {
-                                foreach (SceneObjectPart part in partList)
-                                {
-                                    part.EveryoneMask = item.EveryOnePermissions;
-                                    part.NextOwnerMask = item.NextPermissions;
-                                    part.GroupMask = 0; // DO NOT propagate here
-                                }
+                                part.EveryoneMask = item.EveryOnePermissions;
+                                part.NextOwnerMask = item.NextPermissions;
+                                part.GroupMask = 0; // DO NOT propagate here
                             }
                             }
                             
                             
                             group.ApplyNextOwnerPermissions();
                             group.ApplyNextOwnerPermissions();
@@ -595,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
 
 
                     foreach (SceneObjectPart part in partList)
                     foreach (SceneObjectPart part in partList)
                     {
                     {
-                        if (part.OwnerID != item.Owner)
+                        if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
                         {
                         {
                             part.LastOwnerID = part.OwnerID;
                             part.LastOwnerID = part.OwnerID;
                             part.OwnerID = item.Owner;
                             part.OwnerID = item.Owner;
                             part.Inventory.ChangeInventoryOwner(item.Owner);
                             part.Inventory.ChangeInventoryOwner(item.Owner);
-                        }
-                        else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
-                        {
-                            part.EveryoneMask = item.EveryOnePermissions;
-                            part.NextOwnerMask = item.NextPermissions;
-
                             part.GroupMask = 0; // DO NOT propagate here
                             part.GroupMask = 0; // DO NOT propagate here
                         }
                         }
+                        part.EveryoneMask = item.EveryOnePermissions;
+                        part.NextOwnerMask = item.NextPermissions;
                     }
                     }
 
 
                     rootPart.TrimPermissions();
                     rootPart.TrimPermissions();

+ 16 - 18
OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs

@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
 
 
         public InventoryFolderBase GetRootFolder(UUID userID)
         public InventoryFolderBase GetRootFolder(UUID userID)
         {
         {
-            m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
+            //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
 
 
             string invURL = GetInventoryServiceURL(userID);
             string invURL = GetInventoryServiceURL(userID);
 
 
@@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
 
 
         public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
         public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
         {
         {
-            m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
+            //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
 
 
             string invURL = GetInventoryServiceURL(userID);
             string invURL = GetInventoryServiceURL(userID);
 
 
@@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
 
 
         public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
         public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
         {
         {
-            m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
 
 
             string invURL = GetInventoryServiceURL(userID);
             string invURL = GetInventoryServiceURL(userID);
 
 
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
 
 
         public  List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
         public  List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
         {
         {
-            m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
 
 
             string invURL = GetInventoryServiceURL(userID);
             string invURL = GetInventoryServiceURL(userID);
 
 
@@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (folder == null)
             if (folder == null)
                 return false;
                 return false;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
 
 
             string invURL = GetInventoryServiceURL(folder.Owner);
             string invURL = GetInventoryServiceURL(folder.Owner);
 
 
@@ -331,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (folder == null)
             if (folder == null)
                 return false;
                 return false;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
 
 
             string invURL = GetInventoryServiceURL(folder.Owner);
             string invURL = GetInventoryServiceURL(folder.Owner);
 
 
@@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (folderIDs.Count == 0)
             if (folderIDs.Count == 0)
                 return false;
                 return false;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
 
 
             string invURL = GetInventoryServiceURL(ownerID);
             string invURL = GetInventoryServiceURL(ownerID);
 
 
@@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (folder == null)
             if (folder == null)
                 return false;
                 return false;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
 
 
             string invURL = GetInventoryServiceURL(folder.Owner);
             string invURL = GetInventoryServiceURL(folder.Owner);
 
 
@@ -384,7 +384,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (folder == null)
             if (folder == null)
                 return false;
                 return false;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
 
 
             string invURL = GetInventoryServiceURL(folder.Owner);
             string invURL = GetInventoryServiceURL(folder.Owner);
 
 
@@ -401,7 +401,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (item == null)
             if (item == null)
                 return false;
                 return false;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
 
 
             string invURL = GetInventoryServiceURL(item.Owner);
             string invURL = GetInventoryServiceURL(item.Owner);
 
 
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (item == null)
             if (item == null)
                 return false;
                 return false;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
 
 
             string invURL = GetInventoryServiceURL(item.Owner);
             string invURL = GetInventoryServiceURL(item.Owner);
 
 
@@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (items.Count == 0)
             if (items.Count == 0)
                 return true;
                 return true;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
 
 
             string invURL = GetInventoryServiceURL(ownerID);
             string invURL = GetInventoryServiceURL(ownerID);
 
 
@@ -451,15 +451,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
 
 
         public  bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
         public  bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
         {
         {
-            m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
+            //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
 
 
             if (itemIDs == null)
             if (itemIDs == null)
                 return false;
                 return false;
             if (itemIDs.Count == 0)
             if (itemIDs.Count == 0)
                 return true;
                 return true;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID);
-
             string invURL = GetInventoryServiceURL(ownerID);
             string invURL = GetInventoryServiceURL(ownerID);
 
 
             if (invURL == null) // not there, forward to local inventory connector to resolve
             if (invURL == null) // not there, forward to local inventory connector to resolve
@@ -474,7 +472,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
         {
         {
             if (item == null)
             if (item == null)
                 return null;
                 return null;
-            m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
 
 
             string invURL = GetInventoryServiceURL(item.Owner);
             string invURL = GetInventoryServiceURL(item.Owner);
 
 
@@ -491,7 +489,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
             if (folder == null)
             if (folder == null)
                 return null;
                 return null;
 
 
-            m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
 
 
             string invURL = GetInventoryServiceURL(folder.Owner);
             string invURL = GetInventoryServiceURL(folder.Owner);
 
 
@@ -515,7 +513,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
 
 
         public  int GetAssetPermissions(UUID userID, UUID assetID)
         public  int GetAssetPermissions(UUID userID, UUID assetID)
         {
         {
-            m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
+            //m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
 
 
             string invURL = GetInventoryServiceURL(userID);
             string invURL = GetInventoryServiceURL(userID);
 
 

+ 2 - 2
OpenSim/Region/CoreModules/World/Land/LandObject.cs

@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
             else
             else
             {
             {
                 // Normal Calculations
                 // Normal Calculations
-                return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.objectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
+                return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
             }
             }
         }
         }
         public int GetSimulatorMaxPrimCount(ILandObject thisObject)
         public int GetSimulatorMaxPrimCount(ILandObject thisObject)
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Land
             else
             else
             {
             {
                 //Normal Calculations
                 //Normal Calculations
-                return m_scene.objectCapacity;
+                return m_scene.RegionInfo.ObjectCapacity;
             }
             }
         }
         }
         #endregion
         #endregion

+ 106 - 35
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs

@@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes
         public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
         public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
                                              UUID itemID, InventoryItemBase itemUpd)
                                              UUID itemID, InventoryItemBase itemUpd)
         {
         {
+            // This one will let people set next perms on items in agent
+            // inventory. Rut-Roh. Whatever. Make this secure. Yeah.
+            //
+            // Passing something to another avatar or a an object will already
             InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
             InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
             item = InventoryService.GetItem(item);
             item = InventoryService.GetItem(item);
 
 
@@ -274,11 +278,9 @@ namespace OpenSim.Region.Framework.Scenes
                 {
                 {
                     item.Name = itemUpd.Name;
                     item.Name = itemUpd.Name;
                     item.Description = itemUpd.Description;
                     item.Description = itemUpd.Description;
-                    item.NextPermissions = itemUpd.NextPermissions;
-                    item.CurrentPermissions |= 8; // Slam!
-                    item.EveryOnePermissions = itemUpd.EveryOnePermissions;
-                    item.GroupPermissions = itemUpd.GroupPermissions;
-
+                    item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
+                    item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
+                    item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
                     item.GroupID = itemUpd.GroupID;
                     item.GroupID = itemUpd.GroupID;
                     item.GroupOwned = itemUpd.GroupOwned;
                     item.GroupOwned = itemUpd.GroupOwned;
                     item.CreationDate = itemUpd.CreationDate;
                     item.CreationDate = itemUpd.CreationDate;
@@ -384,28 +386,103 @@ namespace OpenSim.Region.Framework.Scenes
 
 
                 if (Permissions.PropagatePermissions() && recipient != senderId)
                 if (Permissions.PropagatePermissions() && recipient != senderId)
                 {
                 {
-                    // First, make sore base is limited to the next perms
-                    itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move);
-                    // By default, current equals base
-                    itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions;
-
-                    // If this is an object, replace current perms
-                    // with folded perms
+                    // Trying to do this right this time. This is evil. If
+                    // you believe in Good, go elsewhere. Vampires and other
+                    // evil creatores only beyond this point. You have been
+                    // warned.
+
+                    // We're going to mask a lot of things by the next perms
+                    // Tweak the next perms to be nicer to our data
+                    //
+                    // In this mask, all the bits we do NOT want to mess
+                    // with are set. These are:
+                    //
+                    // Transfer
+                    // Copy
+                    // Modufy
+                    uint permsMask = ~ ((uint)PermissionMask.Copy |
+                                        (uint)PermissionMask.Transfer |
+                                        (uint)PermissionMask.Modify);
+
+                    // Now, reduce the next perms to the mask bits
+                    // relevant to the operation
+                    uint nextPerms = permsMask | (item.NextPermissions &
+                                      ((uint)PermissionMask.Copy |
+                                       (uint)PermissionMask.Transfer |
+                                       (uint)PermissionMask.Modify));
+
+                    // nextPerms now has all bits set, except for the actual
+                    // next permission bits.
+
+                    // This checks for no mod, no copy, no trans.
+                    // This indicates an error or messed up item. Do it like
+                    // SL and assume trans
+                    if (nextPerms == permsMask)
+                        nextPerms |= (uint)PermissionMask.Transfer;
+
+                    // Inventory owner perms are the logical AND of the
+                    // folded perms and the root prim perms, however, if
+                    // the root prim is mod, the inventory perms will be
+                    // mod. This happens on "take" and is of little concern
+                    // here, save for preventing escalation
+
+                    // This hack ensures that items previously permalocked
+                    // get unlocked when they're passed or rezzed
+                    uint basePerms = item.BasePermissions |
+                                    (uint)PermissionMask.Move;
+                    uint ownerPerms = item.CurrentPermissions;
+
+                    // If this is an object, root prim perms may be more
+                    // permissive than folded perms. Use folded perms as
+                    // a mask
                     if (item.InvType == (int)InventoryType.Object)
                     if (item.InvType == (int)InventoryType.Object)
                     {
                     {
-                        itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
-                        itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13;
+                        // 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
+                        ownerPerms &= foldedPerms;
+                        basePerms &= foldedPerms;
+
+                        // If the root was mod, let the mask reflect that
+                        // We also need to adjust the base here, because
+                        // we should be able to edit in-inventory perms
+                        // for the root prim, if it's mod.
+                        if (isRootMod)
+                        {
+                            ownerPerms |= (uint)PermissionMask.Modify;
+                            basePerms |= (uint)PermissionMask.Modify;
+                        }
                     }
                     }
 
 
-                    // Ensure there is no escalation
-                    itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move);
+                    // These will be applied to the root prim at next rez.
+                    // The slam bit (bit 3) and folded permission (bits 0-2)
+                    // are preserved due to the above mangling
+                    ownerPerms &= nextPerms;
+
+                    // Mask the base permissions. This is a conservative
+                    // approach altering only the three main perms
+                    basePerms &= nextPerms;
 
 
-                    // Need slam bit on xfer
-                    itemCopy.CurrentPermissions |= 8;
+                    // Assign to the actual item. Make sure the slam bit is
+                    // set, if it wasn't set before.
+                    itemCopy.BasePermissions = basePerms;
+                    itemCopy.CurrentPermissions = ownerPerms | 16; // Slam
 
 
                     itemCopy.NextPermissions = item.NextPermissions;
                     itemCopy.NextPermissions = item.NextPermissions;
 
 
-                    itemCopy.EveryOnePermissions = 0;
+                    // This preserves "everyone can move"
+                    itemCopy.EveryOnePermissions = item.EveryOnePermissions &
+                                                   nextPerms;
+
+                    // Intentionally killing "share with group" here, as
+                    // the recipient will not have the group this is
+                    // set to
                     itemCopy.GroupPermissions = 0;
                     itemCopy.GroupPermissions = 0;
                 }
                 }
                 else
                 else
@@ -903,7 +980,7 @@ namespace OpenSim.Region.Framework.Scenes
                 else
                 else
                     agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
                     agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
 
 
-                agentItem.CurrentPermissions |= 8;
+                agentItem.CurrentPermissions |= 16; // Slam
                 agentItem.NextPermissions = taskItem.NextPermissions;
                 agentItem.NextPermissions = taskItem.NextPermissions;
                 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
                 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
                 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
                 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
@@ -1094,7 +1171,7 @@ namespace OpenSim.Region.Framework.Scenes
                             (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
                             (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
                     destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
                     destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
                             (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
                             (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
-                    destTaskItem.CurrentPermissions |= 8; // Slam!
+                    destTaskItem.CurrentPermissions |= 16; // Slam!
                 }
                 }
             }
             }
 
 
@@ -1478,7 +1555,7 @@ namespace OpenSim.Region.Framework.Scenes
                             srcTaskItem.NextPermissions;
                             srcTaskItem.NextPermissions;
                     destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
                     destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
                             srcTaskItem.NextPermissions;
                             srcTaskItem.NextPermissions;
-                    destTaskItem.CurrentPermissions |= 8; // Slam!
+                    destTaskItem.CurrentPermissions |= 16; // Slam!
                 }
                 }
             }
             }
 
 
@@ -1864,17 +1941,14 @@ namespace OpenSim.Region.Framework.Scenes
 
 
                     group.SetGroup(sourcePart.GroupID, null);
                     group.SetGroup(sourcePart.GroupID, null);
 
 
-                    if (rootPart.OwnerID != item.OwnerID)
+                    if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
                     {
                     {
                         if (Permissions.PropagatePermissions())
                         if (Permissions.PropagatePermissions())
                         {
                         {
-                            if ((item.CurrentPermissions & 8) != 0)
+                            foreach (SceneObjectPart part in partList)
                             {
                             {
-                                foreach (SceneObjectPart part in partList)
-                                {
-                                    part.EveryoneMask = item.EveryonePermissions;
-                                    part.NextOwnerMask = item.NextPermissions;
-                                }
+                                part.EveryoneMask = item.EveryonePermissions;
+                                part.NextOwnerMask = item.NextPermissions;
                             }
                             }
                             group.ApplyNextOwnerPermissions();
                             group.ApplyNextOwnerPermissions();
                         }
                         }
@@ -1882,17 +1956,14 @@ namespace OpenSim.Region.Framework.Scenes
 
 
                     foreach (SceneObjectPart part in partList)
                     foreach (SceneObjectPart part in partList)
                     {
                     {
-                        if (part.OwnerID != item.OwnerID)
+                        if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
                         {
                         {
                             part.LastOwnerID = part.OwnerID;
                             part.LastOwnerID = part.OwnerID;
                             part.OwnerID = item.OwnerID;
                             part.OwnerID = item.OwnerID;
                             part.Inventory.ChangeInventoryOwner(item.OwnerID);
                             part.Inventory.ChangeInventoryOwner(item.OwnerID);
                         }
                         }
-                        else if ((item.CurrentPermissions & 8) != 0) // Slam!
-                        {
-                            part.EveryoneMask = item.EveryonePermissions;
-                            part.NextOwnerMask = item.NextPermissions;
-                        }
+                        part.EveryoneMask = item.EveryonePermissions;
+                        part.NextOwnerMask = item.NextPermissions;
                     }
                     }
                     
                     
                     rootPart.TrimPermissions();
                     rootPart.TrimPermissions();

+ 2 - 18
OpenSim/Region/Framework/Scenes/Scene.cs

@@ -478,8 +478,6 @@ namespace OpenSim.Region.Framework.Scenes
             set { m_sceneGraph.RestorePresences = value; }
             set { m_sceneGraph.RestorePresences = value; }
         }
         }
 
 
-        public int objectCapacity = 45000;
-
         #endregion
         #endregion
 
 
         #region BinaryStats
         #region BinaryStats
@@ -687,7 +685,7 @@ namespace OpenSim.Region.Framework.Scenes
             StatsReporter.OnSendStatsResult += SendSimStatsPackets;
             StatsReporter.OnSendStatsResult += SendSimStatsPackets;
             StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
             StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
 
 
-            StatsReporter.SetObjectCapacity(objectCapacity);
+            StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity);
 
 
             // Old
             // Old
             /*
             /*
@@ -4119,20 +4117,6 @@ namespace OpenSim.Region.Framework.Scenes
 
 
         #region Other Methods
         #region Other Methods
 
 
-        public void SetObjectCapacity(int objects)
-        {
-            // Region specific config overrides global
-            //
-            if (RegionInfo.ObjectCapacity != 0)
-                objects = RegionInfo.ObjectCapacity;
-
-            if (StatsReporter != null)
-            {
-                StatsReporter.SetObjectCapacity(objects);
-            }
-            objectCapacity = objects;
-        }
-
         #endregion
         #endregion
 
 
         public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
         public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
@@ -4731,7 +4715,7 @@ namespace OpenSim.Region.Framework.Scenes
                                            part.NextOwnerMask;
                                            part.NextOwnerMask;
                 item.GroupPermissions = part.GroupMask &
                 item.GroupPermissions = part.GroupMask &
                                            part.NextOwnerMask;
                                            part.NextOwnerMask;
-                item.CurrentPermissions |= 8; // Slam!
+                item.CurrentPermissions |= 16; // Slam!
                 item.CreationDate = Util.UnixTimeSinceEpoch();
                 item.CreationDate = Util.UnixTimeSinceEpoch();
 
 
                 if (InventoryService.AddItem(item))
                 if (InventoryService.AddItem(item))

+ 14 - 9
OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs

@@ -172,13 +172,14 @@ namespace OpenSim.Region.Framework.Scenes
                     taskItem.GroupPermissions = item.GroupPermissions &
                     taskItem.GroupPermissions = item.GroupPermissions &
                             item.NextPermissions;
                             item.NextPermissions;
                     taskItem.NextPermissions = item.NextPermissions;
                     taskItem.NextPermissions = item.NextPermissions;
-                    taskItem.CurrentPermissions |= 8;
+                    // We're adding this to a prim we don't own. Force
+                    // owner change
+                    taskItem.CurrentPermissions |= 16; // Slam
                 } 
                 } 
                 else 
                 else 
                 {
                 {
                     taskItem.BasePermissions = item.BasePermissions;
                     taskItem.BasePermissions = item.BasePermissions;
                     taskItem.CurrentPermissions = item.CurrentPermissions;
                     taskItem.CurrentPermissions = item.CurrentPermissions;
-                    taskItem.CurrentPermissions |= 8;
                     taskItem.EveryonePermissions = item.EveryOnePermissions;
                     taskItem.EveryonePermissions = item.EveryOnePermissions;
                     taskItem.GroupPermissions = item.GroupPermissions;
                     taskItem.GroupPermissions = item.GroupPermissions;
                     taskItem.NextPermissions = item.NextPermissions;
                     taskItem.NextPermissions = item.NextPermissions;
@@ -281,7 +282,7 @@ namespace OpenSim.Region.Framework.Scenes
                               PermissionMask.Move |
                               PermissionMask.Move |
                               PermissionMask.Transfer) | 7;
                               PermissionMask.Transfer) | 7;
 
 
-            uint ownerMask = 0x7ffffff;
+            uint ownerMask = 0x7fffffff;
             foreach (SceneObjectPart part in m_parts.Values)
             foreach (SceneObjectPart part in m_parts.Values)
             {
             {
                 ownerMask &= part.OwnerMask;
                 ownerMask &= part.OwnerMask;
@@ -295,12 +296,16 @@ namespace OpenSim.Region.Framework.Scenes
             if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
             if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
                 perms &= ~(uint)PermissionMask.Transfer;
                 perms &= ~(uint)PermissionMask.Transfer;
 
 
-            if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
-                perms &= ~((uint)PermissionMask.Modify >> 13);
-            if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
-                perms &= ~((uint)PermissionMask.Copy >> 13);
-            if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
-                perms &= ~((uint)PermissionMask.Transfer >> 13);
+            // If root prim permissions are applied here, this would screw
+            // with in-inventory manipulation of the next owner perms
+            // in a major way. So, let's move this to the give itself.
+            // Yes. I know. Evil.
+//            if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
+//                perms &= ~((uint)PermissionMask.Modify >> 13);
+//            if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
+//                perms &= ~((uint)PermissionMask.Copy >> 13);
+//            if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
+//                perms &= ~((uint)PermissionMask.Transfer >> 13);
 
 
             return perms;
             return perms;
         }
         }

+ 0 - 1
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs

@@ -952,7 +952,6 @@ namespace OpenSim.Region.Framework.Scenes
                             item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
                             item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
                         if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
                         if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
                             item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
                             item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
-                        item.CurrentPermissions |= 8;
                     }
                     }
                     item.CurrentPermissions &= item.NextPermissions;
                     item.CurrentPermissions &= item.NextPermissions;
                     item.BasePermissions &= item.NextPermissions;
                     item.BasePermissions &= item.NextPermissions;

+ 3 - 4
OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs

@@ -138,8 +138,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
         public void AddRegion(Scene scene)
         public void AddRegion(Scene scene)
         {
         {
             // Send ObjectCapacity to Scene..  Which sends it to the SimStatsReporter.
             // Send ObjectCapacity to Scene..  Which sends it to the SimStatsReporter.
-            scene.SetObjectCapacity(ObjectCapacity);
-
             if (m_enabled)
             if (m_enabled)
             {
             {
                 scene.RegisterModuleInterface<IMoneyModule>(this);
                 scene.RegisterModuleInterface<IMoneyModule>(this);
@@ -252,7 +250,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
 
 
             if (config == "Economy" && startupConfig != null)
             if (config == "Economy" && startupConfig != null)
             {
             {
-                ObjectCapacity = startupConfig.GetInt("ObjectCapacity", 45000);
                 PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100);
                 PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100);
                 PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10);
                 PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10);
                 PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4);
                 PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4);
@@ -701,7 +698,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
 
 
             if (user != null)
             if (user != null)
             {
             {
-                user.SendEconomyData(EnergyEfficiency, ObjectCapacity, ObjectCount, PriceEnergyUnit, PriceGroupCreate,
+                Scene s = LocateSceneClientIn(user.AgentId);
+
+                user.SendEconomyData(EnergyEfficiency, s.RegionInfo.ObjectCapacity, ObjectCount, PriceEnergyUnit, PriceGroupCreate,
                                      PriceObjectClaim, PriceObjectRent, PriceObjectScaleFactor, PriceParcelClaim, PriceParcelClaimFactor,
                                      PriceObjectClaim, PriceObjectRent, PriceObjectScaleFactor, PriceParcelClaim, PriceParcelClaimFactor,
                                      PriceParcelRent, PricePublicObjectDecay, PricePublicObjectDelete, PriceRentLight, PriceUpload,
                                      PriceParcelRent, PricePublicObjectDecay, PricePublicObjectDelete, PriceRentLight, PriceUpload,
                                      TeleportMinPrice, TeleportPriceExponent);
                                      TeleportMinPrice, TeleportPriceExponent);

+ 0 - 12
bin/OpenSim.ini.example

@@ -288,9 +288,6 @@
     ; if not defined - default machine name is being used
     ; if not defined - default machine name is being used
     ; (on Windows this mean NETBIOS name - useably only inside local network)
     ; (on Windows this mean NETBIOS name - useably only inside local network)
     ; ExternalHostNameForLSL=127.0.0.1
     ; ExternalHostNameForLSL=127.0.0.1
-    ; Uncomment below to enable llRemoteData/remote channels
-    ; remoteDataPort = 20800
-
 
 
     ; What is reported as the "X-Secondlife-Shard"
     ; What is reported as the "X-Secondlife-Shard"
     ; Defaults to the user server url if not set
     ; Defaults to the user server url if not set
@@ -1303,12 +1300,3 @@
     ;XmlRpcRouterModule = "XmlRpcRouterModule"
     ;XmlRpcRouterModule = "XmlRpcRouterModule"
     ;XmlRpcPort = 20800
     ;XmlRpcPort = 20800
 
 
-[Friends]
-    ; The port the friendslist interregion comms will listen on
-    ; Defaults to the simulator's TCP port
-    ;Port = 0
-
-    ; Uncomment one of the lines below. Use FriendsService for local
-    ; operation, Connectors for remote operation
-    ;Connector = "OpenSim.Services.FriendsService.dll"
-    Connector = "OpenSim.Services.Connectors.dll"