diff options
author | Melanie | 2010-04-30 11:46:50 +0100 |
---|---|---|
committer | Melanie | 2010-04-30 11:46:50 +0100 |
commit | 22b32171130b557dd83df218a38629589c7cc570 (patch) | |
tree | 6aca2861ae3657ba0ca7a960cd5f8af025a2d889 /OpenSim/Region/Framework | |
parent | Started redoing HGInventoryBroker for XInventory and with multi-protocol in m... (diff) | |
download | opensim-SC_OLD-22b32171130b557dd83df218a38629589c7cc570.zip opensim-SC_OLD-22b32171130b557dd83df218a38629589c7cc570.tar.gz opensim-SC_OLD-22b32171130b557dd83df218a38629589c7cc570.tar.bz2 opensim-SC_OLD-22b32171130b557dd83df218a38629589c7cc570.tar.xz |
Fix link security issue
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 50 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 41 |
3 files changed, 63 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 15b5230..6ebfd31 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1941,5 +1941,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
1941 | part.GetProperties(remoteClient); | 1941 | part.GetProperties(remoteClient); |
1942 | } | 1942 | } |
1943 | } | 1943 | } |
1944 | |||
1945 | public void DelinkObjects(List<uint> primIds, IClientAPI client) | ||
1946 | { | ||
1947 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | ||
1948 | |||
1949 | foreach (uint localID in primIds) | ||
1950 | { | ||
1951 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1952 | |||
1953 | if (part == null) | ||
1954 | continue; | ||
1955 | |||
1956 | if (Permissions.CanDelinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | ||
1957 | parts.Add(part); | ||
1958 | } | ||
1959 | |||
1960 | m_sceneGraph.DelinkObjects(parts); | ||
1961 | } | ||
1962 | |||
1963 | public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | ||
1964 | { | ||
1965 | List<UUID> owners = new List<UUID>(); | ||
1966 | |||
1967 | List<SceneObjectPart> children = new List<SceneObjectPart>(); | ||
1968 | SceneObjectPart root = GetSceneObjectPart(parentPrimId); | ||
1969 | |||
1970 | if (Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) | ||
1971 | return; | ||
1972 | |||
1973 | foreach (uint localID in childPrimIds) | ||
1974 | { | ||
1975 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1976 | |||
1977 | if (part == null) | ||
1978 | continue; | ||
1979 | |||
1980 | if (!owners.Contains(part.OwnerID)) | ||
1981 | owners.Add(part.OwnerID); | ||
1982 | |||
1983 | if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | ||
1984 | children.Add(part); | ||
1985 | } | ||
1986 | |||
1987 | // Must be all one owner | ||
1988 | // | ||
1989 | if (owners.Count > 1) | ||
1990 | return; | ||
1991 | |||
1992 | m_sceneGraph.LinkObjects(root, children); | ||
1993 | } | ||
1944 | } | 1994 | } |
1945 | } | 1995 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 57587be..61a2956 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2721,8 +2721,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2721 | client.OnObjectName += m_sceneGraph.PrimName; | 2721 | client.OnObjectName += m_sceneGraph.PrimName; |
2722 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; | 2722 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; |
2723 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 2723 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
2724 | client.OnLinkObjects += m_sceneGraph.LinkObjects; | 2724 | client.OnLinkObjects += LinkObjects; |
2725 | client.OnDelinkObjects += m_sceneGraph.DelinkObjects; | 2725 | client.OnDelinkObjects += DelinkObjects; |
2726 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; | 2726 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; |
2727 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; | 2727 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; |
2728 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; | 2728 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; |
@@ -2878,8 +2878,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2878 | client.OnObjectName -= m_sceneGraph.PrimName; | 2878 | client.OnObjectName -= m_sceneGraph.PrimName; |
2879 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; | 2879 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; |
2880 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; | 2880 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; |
2881 | client.OnLinkObjects -= m_sceneGraph.LinkObjects; | 2881 | client.OnLinkObjects -= LinkObjects; |
2882 | client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; | 2882 | client.OnDelinkObjects -= DelinkObjects; |
2883 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; | 2883 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; |
2884 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; | 2884 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; |
2885 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; | 2885 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1421d0e..ce11267 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1463,20 +1463,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1463 | /// <param name="client"></param> | 1463 | /// <param name="client"></param> |
1464 | /// <param name="parentPrim"></param> | 1464 | /// <param name="parentPrim"></param> |
1465 | /// <param name="childPrims"></param> | 1465 | /// <param name="childPrims"></param> |
1466 | protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | 1466 | protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) |
1467 | { | 1467 | { |
1468 | Monitor.Enter(m_updateLock); | 1468 | Monitor.Enter(m_updateLock); |
1469 | try | 1469 | try |
1470 | { | 1470 | { |
1471 | SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId); | 1471 | SceneObjectGroup parentGroup = root.ParentGroup; |
1472 | 1472 | ||
1473 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); | 1473 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); |
1474 | if (parentGroup != null) | 1474 | if (parentGroup != null) |
1475 | { | 1475 | { |
1476 | // We do this in reverse to get the link order of the prims correct | 1476 | // We do this in reverse to get the link order of the prims correct |
1477 | for (int i = childPrimIds.Count - 1; i >= 0; i--) | 1477 | for (int i = children.Count - 1; i >= 0; i--) |
1478 | { | 1478 | { |
1479 | SceneObjectGroup child = GetGroupByPrim(childPrimIds[i]); | 1479 | SceneObjectGroup child = children[i].ParentGroup; |
1480 | |||
1480 | if (child != null) | 1481 | if (child != null) |
1481 | { | 1482 | { |
1482 | // Make sure no child prim is set for sale | 1483 | // Make sure no child prim is set for sale |
@@ -1509,17 +1510,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1509 | parentGroup.HasGroupChanged = true; | 1510 | parentGroup.HasGroupChanged = true; |
1510 | parentGroup.ScheduleGroupForFullUpdate(); | 1511 | parentGroup.ScheduleGroupForFullUpdate(); |
1511 | 1512 | ||
1512 | // if (client != null) | ||
1513 | // { | ||
1514 | // parentGroup.GetProperties(client); | ||
1515 | // } | ||
1516 | // else | ||
1517 | // { | ||
1518 | // foreach (ScenePresence p in GetScenePresences()) | ||
1519 | // { | ||
1520 | // parentGroup.GetProperties(p.ControllingClient); | ||
1521 | // } | ||
1522 | // } | ||
1523 | } | 1513 | } |
1524 | finally | 1514 | finally |
1525 | { | 1515 | { |
@@ -1531,12 +1521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1531 | /// Delink a linkset | 1521 | /// Delink a linkset |
1532 | /// </summary> | 1522 | /// </summary> |
1533 | /// <param name="prims"></param> | 1523 | /// <param name="prims"></param> |
1534 | protected internal void DelinkObjects(List<uint> primIds) | 1524 | protected internal void DelinkObjects(List<SceneObjectPart> prims) |
1535 | { | ||
1536 | DelinkObjects(primIds, true); | ||
1537 | } | ||
1538 | |||
1539 | protected internal void DelinkObjects(List<uint> primIds, bool sendEvents) | ||
1540 | { | 1525 | { |
1541 | Monitor.Enter(m_updateLock); | 1526 | Monitor.Enter(m_updateLock); |
1542 | try | 1527 | try |
@@ -1546,9 +1531,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1546 | List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); | 1531 | List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); |
1547 | // Look them all up in one go, since that is comparatively expensive | 1532 | // Look them all up in one go, since that is comparatively expensive |
1548 | // | 1533 | // |
1549 | foreach (uint primID in primIds) | 1534 | foreach (SceneObjectPart part in prims) |
1550 | { | 1535 | { |
1551 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primID); | ||
1552 | if (part != null) | 1536 | if (part != null) |
1553 | { | 1537 | { |
1554 | if (part.ParentGroup.Children.Count != 1) // Skip single | 1538 | if (part.ParentGroup.Children.Count != 1) // Skip single |
@@ -1563,17 +1547,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1563 | affectedGroups.Add(group); | 1547 | affectedGroups.Add(group); |
1564 | } | 1548 | } |
1565 | } | 1549 | } |
1566 | else | ||
1567 | { | ||
1568 | m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID); | ||
1569 | } | ||
1570 | } | 1550 | } |
1571 | 1551 | ||
1572 | foreach (SceneObjectPart child in childParts) | 1552 | foreach (SceneObjectPart child in childParts) |
1573 | { | 1553 | { |
1574 | // Unlink all child parts from their groups | 1554 | // Unlink all child parts from their groups |
1575 | // | 1555 | // |
1576 | child.ParentGroup.DelinkFromGroup(child, sendEvents); | 1556 | child.ParentGroup.DelinkFromGroup(child, true); |
1577 | } | 1557 | } |
1578 | 1558 | ||
1579 | foreach (SceneObjectPart root in rootParts) | 1559 | foreach (SceneObjectPart root in rootParts) |
@@ -1628,12 +1608,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1628 | List<uint> linkIDs = new List<uint>(); | 1608 | List<uint> linkIDs = new List<uint>(); |
1629 | 1609 | ||
1630 | foreach (SceneObjectPart newChild in newSet) | 1610 | foreach (SceneObjectPart newChild in newSet) |
1631 | { | ||
1632 | newChild.UpdateFlag = 0; | 1611 | newChild.UpdateFlag = 0; |
1633 | linkIDs.Add(newChild.LocalId); | ||
1634 | } | ||
1635 | 1612 | ||
1636 | LinkObjects(null, newRoot.LocalId, linkIDs); | 1613 | LinkObjects(newRoot, newSet); |
1637 | if (!affectedGroups.Contains(newRoot.ParentGroup)) | 1614 | if (!affectedGroups.Contains(newRoot.ParentGroup)) |
1638 | affectedGroups.Add(newRoot.ParentGroup); | 1615 | affectedGroups.Add(newRoot.ParentGroup); |
1639 | } | 1616 | } |