aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorsacha2010-07-13 21:12:01 +0000
committersacha2010-07-13 21:12:01 +0000
commit8c2e1c6c29a9b3de6dd32c5cfd4eec72029a027d (patch)
tree3c8112b646ab91348502292fdf017b732492e83a /OpenSim
parentadding the 'wearble' case for llGetLocalPos. (diff)
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
downloadopensim-SC_OLD-8c2e1c6c29a9b3de6dd32c5cfd4eec72029a027d.zip
opensim-SC_OLD-8c2e1c6c29a9b3de6dd32c5cfd4eec72029a027d.tar.gz
opensim-SC_OLD-8c2e1c6c29a9b3de6dd32c5cfd4eec72029a027d.tar.bz2
opensim-SC_OLD-8c2e1c6c29a9b3de6dd32c5cfd4eec72029a027d.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs53
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs134
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs1
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs90
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs67
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs6
10 files changed, 252 insertions, 126 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 1f654d3..2506678 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -781,7 +781,7 @@ namespace OpenSim.Data.Tests
781 // Ownership changes when you drop an object into an object 781 // Ownership changes when you drop an object into an object
782 // owned by someone else 782 // owned by someone else
783 Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))"); 783 Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))");
784 Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))"); 784 Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 16), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
785 Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))"); 785 Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))");
786 Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))"); 786 Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))");
787 } 787 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 9996074..c8697fe 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -212,9 +212,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
212 212
213 InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders); 213 InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders);
214 214
215 m_log.DebugFormat( 215// m_log.DebugFormat(
216 "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]", 216// "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
217 iarPath, iarPathExisting); 217// iarPath, iarPathExisting);
218 218
219 string iarPathToCreate = iarPath.Substring(iarPathExisting.Length); 219 string iarPathToCreate = iarPath.Substring(iarPathExisting.Length);
220 CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes); 220 CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes);
@@ -255,12 +255,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
255 { 255 {
256 while (null == destFolder && archivePath.Length > 0) 256 while (null == destFolder && archivePath.Length > 0)
257 { 257 {
258 m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); 258// m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
259 259
260 if (resolvedFolders.ContainsKey(archivePath)) 260 if (resolvedFolders.ContainsKey(archivePath))
261 { 261 {
262 m_log.DebugFormat( 262// m_log.DebugFormat(
263 "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath); 263// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
264 destFolder = resolvedFolders[archivePath]; 264 destFolder = resolvedFolders[archivePath];
265 } 265 }
266 else 266 else
@@ -275,9 +275,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
275 } 275 }
276 else 276 else
277 { 277 {
278 m_log.DebugFormat( 278// m_log.DebugFormat(
279 "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}", 279// "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
280 originalArchivePath); 280// originalArchivePath);
281 archivePath = string.Empty; 281 archivePath = string.Empty;
282 destFolder = rootDestFolder; 282 destFolder = rootDestFolder;
283 } 283 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 2057c65..1a7da61 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -381,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
381 if ((nextPerms & (uint)PermissionMask.Modify) == 0) 381 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
382 perms &= ~(uint)PermissionMask.Modify; 382 perms &= ~(uint)PermissionMask.Modify;
383 383
384 // Make sure all bits but the ones we want are clear
385 // on take.
386 // This will be applied to the current perms, so
387 // it will do what we want.
388 objectGroup.RootPart.NextOwnerMask &=
389 ((uint)PermissionMask.Copy |
390 (uint)PermissionMask.Transfer |
391 (uint)PermissionMask.Modify);
392 objectGroup.RootPart.NextOwnerMask |=
393 (uint)PermissionMask.Move;
394
384 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; 395 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
385 item.CurrentPermissions = item.BasePermissions; 396 item.CurrentPermissions = item.BasePermissions;
386 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 397 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
387 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; 398 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
388 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; 399 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
389 item.CurrentPermissions |= 8; // Slam! 400
401 // Magic number badness. Maybe this deserves an enum.
402 // bit 4 (16) is the "Slam" bit, it means treat as passed
403 // and apply next owner perms on rez
404 item.CurrentPermissions |= 16; // Slam!
390 } 405 }
391 else 406 else
392 { 407 {
@@ -396,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
396 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 411 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
397 item.GroupPermissions = objectGroup.RootPart.GroupMask; 412 item.GroupPermissions = objectGroup.RootPart.GroupMask;
398 413
399 item.CurrentPermissions |= 8; // Slam! 414 item.CurrentPermissions &=
415 ((uint)PermissionMask.Copy |
416 (uint)PermissionMask.Transfer |
417 (uint)PermissionMask.Modify |
418 (uint)PermissionMask.Move |
419 7); // Preserve folded permissions
400 } 420 }
401 421
402 // TODO: add the new fields (Flags, Sale info, etc) 422 // TODO: add the new fields (Flags, Sale info, etc)
@@ -499,6 +519,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
499 519
500 group.RootPart.FromFolderID = item.Folder; 520 group.RootPart.FromFolderID = item.Folder;
501 521
522 // If it's rezzed in world, select it. Much easier to
523 // find small items.
524 //
525 if (!attachment)
526 group.RootPart.CreateSelected = true;
527
502 if (!m_Scene.Permissions.CanRezObject( 528 if (!m_Scene.Permissions.CanRezObject(
503 group.Children.Count, remoteClient.AgentId, pos) 529 group.Children.Count, remoteClient.AgentId, pos)
504 && !attachment) 530 && !attachment)
@@ -571,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
571 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 597 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
572 598
573 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 599 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
574 if (rootPart.OwnerID != item.Owner) 600 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
575 { 601 {
576 //Need to kill the for sale here 602 //Need to kill the for sale here
577 rootPart.ObjectSaleType = 0; 603 rootPart.ObjectSaleType = 0;
@@ -579,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
579 605
580 if (m_Scene.Permissions.PropagatePermissions()) 606 if (m_Scene.Permissions.PropagatePermissions())
581 { 607 {
582 if ((item.CurrentPermissions & 8) != 0) 608 foreach (SceneObjectPart part in partList)
583 { 609 {
584 foreach (SceneObjectPart part in partList) 610 part.EveryoneMask = item.EveryOnePermissions;
585 { 611 part.NextOwnerMask = item.NextPermissions;
586 part.EveryoneMask = item.EveryOnePermissions; 612 part.GroupMask = 0; // DO NOT propagate here
587 part.NextOwnerMask = item.NextPermissions;
588 part.GroupMask = 0; // DO NOT propagate here
589 }
590 } 613 }
591 614
592 group.ApplyNextOwnerPermissions(); 615 group.ApplyNextOwnerPermissions();
@@ -595,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
595 618
596 foreach (SceneObjectPart part in partList) 619 foreach (SceneObjectPart part in partList)
597 { 620 {
598 if (part.OwnerID != item.Owner) 621 if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
599 { 622 {
600 part.LastOwnerID = part.OwnerID; 623 part.LastOwnerID = part.OwnerID;
601 part.OwnerID = item.Owner; 624 part.OwnerID = item.Owner;
602 part.Inventory.ChangeInventoryOwner(item.Owner); 625 part.Inventory.ChangeInventoryOwner(item.Owner);
603 }
604 else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
605 {
606 part.EveryoneMask = item.EveryOnePermissions;
607 part.NextOwnerMask = item.NextPermissions;
608
609 part.GroupMask = 0; // DO NOT propagate here 626 part.GroupMask = 0; // DO NOT propagate here
610 } 627 }
628 part.EveryoneMask = item.EveryOnePermissions;
629 part.NextOwnerMask = item.NextPermissions;
611 } 630 }
612 631
613 rootPart.TrimPermissions(); 632 rootPart.TrimPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 38a5456..5796194 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -280,6 +280,10 @@ namespace OpenSim.Region.Framework.Scenes
280 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, 280 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
281 UUID itemID, InventoryItemBase itemUpd) 281 UUID itemID, InventoryItemBase itemUpd)
282 { 282 {
283 // This one will let people set next perms on items in agent
284 // inventory. Rut-Roh. Whatever. Make this secure. Yeah.
285 //
286 // Passing something to another avatar or a an object will already
283 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 287 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
284 item = InventoryService.GetItem(item); 288 item = InventoryService.GetItem(item);
285 289
@@ -289,11 +293,9 @@ namespace OpenSim.Region.Framework.Scenes
289 { 293 {
290 item.Name = itemUpd.Name; 294 item.Name = itemUpd.Name;
291 item.Description = itemUpd.Description; 295 item.Description = itemUpd.Description;
292 item.NextPermissions = itemUpd.NextPermissions; 296 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
293 item.CurrentPermissions |= 8; // Slam! 297 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
294 item.EveryOnePermissions = itemUpd.EveryOnePermissions; 298 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
295 item.GroupPermissions = itemUpd.GroupPermissions;
296
297 item.GroupID = itemUpd.GroupID; 299 item.GroupID = itemUpd.GroupID;
298 item.GroupOwned = itemUpd.GroupOwned; 300 item.GroupOwned = itemUpd.GroupOwned;
299 item.CreationDate = itemUpd.CreationDate; 301 item.CreationDate = itemUpd.CreationDate;
@@ -399,28 +401,96 @@ namespace OpenSim.Region.Framework.Scenes
399 401
400 if (Permissions.PropagatePermissions() && recipient != senderId) 402 if (Permissions.PropagatePermissions() && recipient != senderId)
401 { 403 {
402 // First, make sore base is limited to the next perms 404 // Trying to do this right this time. This is evil. If
403 itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move); 405 // you believe in Good, go elsewhere. Vampires and other
404 // By default, current equals base 406 // evil creatores only beyond this point. You have been
405 itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions; 407 // warned.
406 408
407 // If this is an object, replace current perms 409 // We're going to mask a lot of things by the next perms
408 // with folded perms 410 // Tweak the next perms to be nicer to our data
411 //
412 // In this mask, all the bits we do NOT want to mess
413 // with are set. These are:
414 //
415 // Transfer
416 // Copy
417 // Modufy
418 uint permsMask = ~ ((uint)PermissionMask.Copy |
419 (uint)PermissionMask.Transfer |
420 (uint)PermissionMask.Modify);
421
422 // Now, reduce the next perms to the mask bits
423 // relevant to the operation
424 uint nextPerms = permsMask | (item.NextPermissions &
425 ((uint)PermissionMask.Copy |
426 (uint)PermissionMask.Transfer |
427 (uint)PermissionMask.Modify));
428
429 // nextPerms now has all bits set, except for the actual
430 // next permission bits.
431
432 // This checks for no mod, no copy, no trans.
433 // This indicates an error or messed up item. Do it like
434 // SL and assume trans
435 if (nextPerms == permsMask)
436 nextPerms |= (uint)PermissionMask.Transfer;
437
438 // Inventory owner perms are the logical AND of the
439 // folded perms and the root prim perms, however, if
440 // the root prim is mod, the inventory perms will be
441 // mod. This happens on "take" and is of little concern
442 // here, save for preventing escalation
443
444 // This hack ensures that items previously permalocked
445 // get unlocked when they're passed or rezzed
446 uint basePerms = item.BasePermissions |
447 (uint)PermissionMask.Move;
448 uint ownerPerms = item.CurrentPermissions;
449
450 // Mask the base permissions. This is a conservative
451 // approach altering only the three main perms
452 basePerms &= nextPerms;
453
454 // If this is an object, root prim perms may be more
455 // permissive than folded perms. Use folded perms as
456 // a mask
409 if (item.InvType == (int)InventoryType.Object) 457 if (item.InvType == (int)InventoryType.Object)
410 { 458 {
411 itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); 459 // Create a safe mask for the current perms
412 itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13; 460 uint foldedPerms = (item.CurrentPermissions & 7) << 13;
461 foldedPerms |= permsMask;
462
463 bool isRootMod = (item.CurrentPermissions &
464 (uint)PermissionMask.Modify) != 0 ?
465 true : false;
466
467 // Mask the owner perms to the folded perms
468 ownerPerms &= foldedPerms;
469
470 // If the root was mod, let the mask reflect that
471 if (isRootMod)
472 ownerPerms |= (uint)PermissionMask.Modify;
413 } 473 }
414 474
415 // Ensure there is no escalation 475 // These will be applied to the root prim at next rez.
416 itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move); 476 // The slam bit (bit 3) and folded permission (bits 0-2)
477 // are preserved due to the above mangling
478 ownerPerms &= nextPerms;
417 479
418 // Need slam bit on xfer 480 // Assign to the actual item. Make sure the slam bit is
419 itemCopy.CurrentPermissions |= 8; 481 // set, if it wasn't set before.
482 itemCopy.BasePermissions = basePerms;
483 itemCopy.CurrentPermissions = ownerPerms | 16; // Slam
420 484
421 itemCopy.NextPermissions = item.NextPermissions; 485 itemCopy.NextPermissions = item.NextPermissions;
422 486
423 itemCopy.EveryOnePermissions = 0; 487 // This preserves "everyone can move"
488 itemCopy.EveryOnePermissions = item.EveryOnePermissions &
489 nextPerms;
490
491 // Intentionally killing "share with group" here, as
492 // the recipient will not have the group this is
493 // set to
424 itemCopy.GroupPermissions = 0; 494 itemCopy.GroupPermissions = 0;
425 } 495 }
426 else 496 else
@@ -922,7 +992,7 @@ namespace OpenSim.Region.Framework.Scenes
922 else 992 else
923 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 993 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
924 994
925 agentItem.CurrentPermissions |= 8; 995 agentItem.CurrentPermissions |= 16; // Slam
926 agentItem.NextPermissions = taskItem.NextPermissions; 996 agentItem.NextPermissions = taskItem.NextPermissions;
927 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 997 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
928 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 998 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
@@ -1113,7 +1183,7 @@ namespace OpenSim.Region.Framework.Scenes
1113 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1183 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1114 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1184 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1115 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1185 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1116 destTaskItem.CurrentPermissions |= 8; // Slam! 1186 destTaskItem.CurrentPermissions |= 16; // Slam!
1117 } 1187 }
1118 } 1188 }
1119 1189
@@ -1497,7 +1567,7 @@ namespace OpenSim.Region.Framework.Scenes
1497 srcTaskItem.NextPermissions; 1567 srcTaskItem.NextPermissions;
1498 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1568 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1499 srcTaskItem.NextPermissions; 1569 srcTaskItem.NextPermissions;
1500 destTaskItem.CurrentPermissions |= 8; // Slam! 1570 destTaskItem.CurrentPermissions |= 16; // Slam!
1501 } 1571 }
1502 } 1572 }
1503 1573
@@ -1889,17 +1959,14 @@ namespace OpenSim.Region.Framework.Scenes
1889 1959
1890 group.SetGroup(sourcePart.GroupID, null); 1960 group.SetGroup(sourcePart.GroupID, null);
1891 1961
1892 if (rootPart.OwnerID != item.OwnerID) 1962 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
1893 { 1963 {
1894 if (Permissions.PropagatePermissions()) 1964 if (Permissions.PropagatePermissions())
1895 { 1965 {
1896 if ((item.CurrentPermissions & 8) != 0) 1966 foreach (SceneObjectPart part in partList)
1897 { 1967 {
1898 foreach (SceneObjectPart part in partList) 1968 part.EveryoneMask = item.EveryonePermissions;
1899 { 1969 part.NextOwnerMask = item.NextPermissions;
1900 part.EveryoneMask = item.EveryonePermissions;
1901 part.NextOwnerMask = item.NextPermissions;
1902 }
1903 } 1970 }
1904 group.ApplyNextOwnerPermissions(); 1971 group.ApplyNextOwnerPermissions();
1905 } 1972 }
@@ -1907,17 +1974,14 @@ namespace OpenSim.Region.Framework.Scenes
1907 1974
1908 foreach (SceneObjectPart part in partList) 1975 foreach (SceneObjectPart part in partList)
1909 { 1976 {
1910 if (part.OwnerID != item.OwnerID) 1977 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
1911 { 1978 {
1912 part.LastOwnerID = part.OwnerID; 1979 part.LastOwnerID = part.OwnerID;
1913 part.OwnerID = item.OwnerID; 1980 part.OwnerID = item.OwnerID;
1914 part.Inventory.ChangeInventoryOwner(item.OwnerID); 1981 part.Inventory.ChangeInventoryOwner(item.OwnerID);
1915 } 1982 }
1916 else if ((item.CurrentPermissions & 8) != 0) // Slam! 1983 part.EveryoneMask = item.EveryonePermissions;
1917 { 1984 part.NextOwnerMask = item.NextPermissions;
1918 part.EveryoneMask = item.EveryonePermissions;
1919 part.NextOwnerMask = item.NextPermissions;
1920 }
1921 } 1985 }
1922 1986
1923 rootPart.TrimPermissions(); 1987 rootPart.TrimPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c5fb198..d323e19 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4818,7 +4818,7 @@ namespace OpenSim.Region.Framework.Scenes
4818 part.NextOwnerMask; 4818 part.NextOwnerMask;
4819 item.GroupPermissions = part.GroupMask & 4819 item.GroupPermissions = part.GroupMask &
4820 part.NextOwnerMask; 4820 part.NextOwnerMask;
4821 item.CurrentPermissions |= 8; // Slam! 4821 item.CurrentPermissions |= 16; // Slam!
4822 item.CreationDate = Util.UnixTimeSinceEpoch(); 4822 item.CreationDate = Util.UnixTimeSinceEpoch();
4823 4823
4824 if (InventoryService.AddItem(item)) 4824 if (InventoryService.AddItem(item))
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 1149a20..70b37fb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -170,13 +170,14 @@ namespace OpenSim.Region.Framework.Scenes
170 taskItem.GroupPermissions = item.GroupPermissions & 170 taskItem.GroupPermissions = item.GroupPermissions &
171 item.NextPermissions; 171 item.NextPermissions;
172 taskItem.NextPermissions = item.NextPermissions; 172 taskItem.NextPermissions = item.NextPermissions;
173 taskItem.CurrentPermissions |= 8; 173 // We're adding this to a prim we don't own. Force
174 // owner change
175 taskItem.CurrentPermissions |= 16; // Slam
174 } 176 }
175 else 177 else
176 { 178 {
177 taskItem.BasePermissions = item.BasePermissions; 179 taskItem.BasePermissions = item.BasePermissions;
178 taskItem.CurrentPermissions = item.CurrentPermissions; 180 taskItem.CurrentPermissions = item.CurrentPermissions;
179 taskItem.CurrentPermissions |= 8;
180 taskItem.EveryonePermissions = item.EveryOnePermissions; 181 taskItem.EveryonePermissions = item.EveryOnePermissions;
181 taskItem.GroupPermissions = item.GroupPermissions; 182 taskItem.GroupPermissions = item.GroupPermissions;
182 taskItem.NextPermissions = item.NextPermissions; 183 taskItem.NextPermissions = item.NextPermissions;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 2cde8f3..0066158 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1082,7 +1082,6 @@ namespace OpenSim.Region.Framework.Scenes
1082 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; 1082 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
1083 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) 1083 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1084 item.CurrentPermissions &= ~(uint)PermissionMask.Modify; 1084 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
1085 item.CurrentPermissions |= 8;
1086 } 1085 }
1087 item.OwnerChanged = true; 1086 item.OwnerChanged = true;
1088 item.CurrentPermissions &= item.NextPermissions; 1087 item.CurrentPermissions &= item.NextPermissions;
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
index 38c38b6..61c16b8 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
@@ -565,7 +565,29 @@ namespace OpenSim.Region.Physics.OdePlugin
565 CAPSULE_RADIUS = 0.01f; 565 CAPSULE_RADIUS = 0.01f;
566 566
567 } 567 }
568
569 if(Shell != IntPtr.Zero)
570 {
571 try
572 {
573 d.GeomDestroy(Shell);
574 }
575 catch (System.AccessViolationException)
576 {
577 m_log.Error("[PHYSICS]: PrimGeom dead");
578 }
579 // Remove any old entries
580//string tShell;
581//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell);
582//Console.WriteLine("**** Remove {0}", tShell);
583 if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell);
584 if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell);
585 }
586
568 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); 587 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
588 _parent_scene.geom_name_map[Shell] = m_name;
589 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
590//Console.WriteLine("**** Create {2} Dicts: actor={0} name={1}", _parent_scene.actor_name_map.Count, _parent_scene.geom_name_map.Count, m_name);
569 591
570 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); 592 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
571 d.GeomSetCollideBits(Shell, (int)m_collisionFlags); 593 d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
@@ -931,10 +953,23 @@ namespace OpenSim.Region.Physics.OdePlugin
931 Body = IntPtr.Zero; 953 Body = IntPtr.Zero;
932 } 954 }
933 955
934 if (Shell != IntPtr.Zero) 956 if(Shell != IntPtr.Zero)
935 { 957 {
936 d.GeomDestroy(Shell); 958 try
937 _parent_scene.geom_name_map.Remove(Shell); 959 {
960 d.GeomDestroy(Shell);
961 }
962 catch (System.AccessViolationException)
963 {
964 m_log.Error("[PHYSICS]: PrimGeom dead");
965 }
966 // Remove any old entries
967//string tShell;
968//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell);
969//Console.WriteLine("**** Remove {0}", tShell);
970
971 if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell);
972 if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell);
938 Shell = IntPtr.Zero; 973 Shell = IntPtr.Zero;
939 } 974 }
940 975
@@ -1097,11 +1132,24 @@ namespace OpenSim.Region.Physics.OdePlugin
1097 1132
1098 Body = IntPtr.Zero; 1133 Body = IntPtr.Zero;
1099 } 1134 }
1100 1135
1101 if (Shell != IntPtr.Zero) 1136 if(Shell != IntPtr.Zero)
1102 { 1137 {
1103 d.GeomDestroy(Shell); 1138 try
1104 _parent_scene.geom_name_map.Remove(Shell); 1139 {
1140 d.GeomDestroy(Shell);
1141 }
1142 catch (System.AccessViolationException)
1143 {
1144 m_log.Error("[PHYSICS]: PrimGeom dead");
1145 }
1146 // Remove any old entries
1147//string tShell;
1148//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell);
1149//Console.WriteLine("**** Remove {0}", tShell);
1150
1151 if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell);
1152 if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell);
1105 Shell = IntPtr.Zero; 1153 Shell = IntPtr.Zero;
1106 } 1154 }
1107 } 1155 }
@@ -1277,9 +1325,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1277 + (Amotor!=IntPtr.Zero ? "Amotor ":"")); 1325 + (Amotor!=IntPtr.Zero ? "Amotor ":""));
1278 } 1326 }
1279 AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor); 1327 AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor);
1280
1281 _parent_scene.geom_name_map[Shell] = m_name;
1282 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
1283 _parent_scene.AddCharacter(this); 1328 _parent_scene.AddCharacter(this);
1284 } 1329 }
1285 else 1330 else
@@ -1299,17 +1344,28 @@ namespace OpenSim.Region.Physics.OdePlugin
1299 { 1344 {
1300 //kill the body 1345 //kill the body
1301 d.BodyDestroy(Body); 1346 d.BodyDestroy(Body);
1302
1303 Body = IntPtr.Zero; 1347 Body = IntPtr.Zero;
1304 } 1348 }
1305 1349
1306 if (Shell != IntPtr.Zero) 1350 if(Shell != IntPtr.Zero)
1307 { 1351 {
1308 d.GeomDestroy(Shell); 1352 try
1309 _parent_scene.geom_name_map.Remove(Shell); 1353 {
1354 d.GeomDestroy(Shell);
1355 }
1356 catch (System.AccessViolationException)
1357 {
1358 m_log.Error("[PHYSICS]: PrimGeom dead");
1359 }
1360 // Remove any old entries
1361//string tShell;
1362//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell);
1363//Console.WriteLine("**** Remove {0}", tShell);
1364
1365 if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell);
1366 if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell);
1310 Shell = IntPtr.Zero; 1367 Shell = IntPtr.Zero;
1311 } 1368 }
1312
1313 } 1369 }
1314 1370
1315 m_isPhysical = m_tainted_isPhysical; 1371 m_isPhysical = m_tainted_isPhysical;
@@ -1327,13 +1383,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1327 CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH; 1383 CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH;
1328 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); 1384 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
1329 d.BodyDestroy(Body); 1385 d.BodyDestroy(Body);
1330 d.GeomDestroy(Shell);
1331 AvatarGeomAndBodyCreation(_position.X, _position.Y, 1386 AvatarGeomAndBodyCreation(_position.X, _position.Y,
1332 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); 1387 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
1333 Velocity = Vector3.Zero; 1388 Velocity = Vector3.Zero;
1334
1335 _parent_scene.geom_name_map[Shell] = m_name;
1336 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
1337 } 1389 }
1338 else 1390 else
1339 { 1391 {
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index 7ce01dc..6b17ce7 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Physics.OdePlugin
142 private OdeScene _parent_scene; 142 private OdeScene _parent_scene;
143 public IntPtr m_targetSpace = IntPtr.Zero; 143 public IntPtr m_targetSpace = IntPtr.Zero;
144 public IntPtr prim_geom; 144 public IntPtr prim_geom;
145 public IntPtr prev_geom; 145// public IntPtr prev_geom;
146 public IntPtr _triMeshData; 146 public IntPtr _triMeshData;
147 147
148 private IntPtr _linkJointGroup = IntPtr.Zero; 148 private IntPtr _linkJointGroup = IntPtr.Zero;
@@ -274,7 +274,7 @@ namespace OpenSim.Region.Physics.OdePlugin
274 274
275 275
276 prim_geom = IntPtr.Zero; 276 prim_geom = IntPtr.Zero;
277 prev_geom = IntPtr.Zero; 277// prev_geom = IntPtr.Zero;
278 278
279 if (!pos.IsFinite()) 279 if (!pos.IsFinite())
280 { 280 {
@@ -776,13 +776,26 @@ namespace OpenSim.Region.Physics.OdePlugin
776 776
777 public void SetGeom(IntPtr geom) 777 public void SetGeom(IntPtr geom)
778 { 778 {
779 prev_geom = prim_geom; 779 if(prim_geom != IntPtr.Zero)
780 {
781 // Remove any old entries
782//string tPA;
783//_parent_scene.geom_name_map.TryGetValue(prim_geom, out tPA);
784//Console.WriteLine("**** Remove {0}", tPA);
785 if(_parent_scene.geom_name_map.ContainsKey(prim_geom)) _parent_scene.geom_name_map.Remove(prim_geom);
786 if(_parent_scene.actor_name_map.ContainsKey(prim_geom)) _parent_scene.actor_name_map.Remove(prim_geom);
787 d.GeomDestroy(prim_geom);
788 }
789
780 prim_geom = geom; 790 prim_geom = geom;
781//Console.WriteLine("SetGeom to " + prim_geom + " for " + m_primName); 791//Console.WriteLine("SetGeom to " + prim_geom + " for " + m_primName);
782 if (prim_geom != IntPtr.Zero) 792 if (prim_geom != IntPtr.Zero)
783 { 793 {
794 _parent_scene.geom_name_map[prim_geom] = this.m_primName;
795 _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this;
784 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); 796 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
785 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 797 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
798//Console.WriteLine("**** Create {2} Dicts: actor={0} name={1}", _parent_scene.actor_name_map.Count, _parent_scene.geom_name_map.Count, this.m_primName);
786 } 799 }
787 800
788 if (childPrim) 801 if (childPrim)
@@ -1774,17 +1787,17 @@ namespace OpenSim.Region.Physics.OdePlugin
1774 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) 1787 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
1775 { 1788 {
1776//Console.WriteLine("CreateGeom:"); 1789//Console.WriteLine("CreateGeom:");
1777 if (_mesh != null) 1790 if (_mesh != null) // Special - make mesh
1778 { 1791 {
1779 setMesh(_parent_scene, _mesh); 1792 setMesh(_parent_scene, _mesh);
1780 } 1793 }
1781 else 1794 else // not a mesh
1782 { 1795 {
1783 if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) 1796 if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) // special profile??
1784 { 1797 {
1785 if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) 1798 if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) // Equi-size
1786 { 1799 {
1787 if (((_size.X / 2f) > 0f)) 1800 if (((_size.X / 2f) > 0f)) // Has size
1788 { 1801 {
1789 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1802 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1790 try 1803 try
@@ -1815,7 +1828,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1815 } 1828 }
1816 } 1829 }
1817 } 1830 }
1818 else 1831 else // not equi-size
1819 { 1832 {
1820 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1833 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1821 try 1834 try
@@ -1832,7 +1845,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1832 } 1845 }
1833 } 1846 }
1834 1847
1835 else 1848 else // not special profile
1836 { 1849 {
1837 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1850 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1838 try 1851 try
@@ -1894,9 +1907,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1894 } 1907 }
1895 } 1908 }
1896 1909
1897 _parent_scene.geom_name_map[prim_geom] = this.m_primName;
1898 _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this;
1899
1900 changeSelectedStatus(timestep); 1910 changeSelectedStatus(timestep);
1901 1911
1902 m_taintadd = false; 1912 m_taintadd = false;
@@ -2045,22 +2055,7 @@ Console.WriteLine(" JointCreateFixed");
2045 { 2055 {
2046 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) 2056 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
2047 { 2057 {
2048 2058 _mesh = null;
2049
2050 if (prim_geom != IntPtr.Zero)
2051 {
2052 try
2053 {
2054 d.GeomDestroy(prim_geom);
2055 prim_geom = IntPtr.Zero;
2056 _mesh = null;
2057 }
2058 catch (System.AccessViolationException)
2059 {
2060 prim_geom = IntPtr.Zero;
2061 m_log.Error("[PHYSICS]: PrimGeom dead");
2062 }
2063 }
2064//Console.WriteLine("changePhysicsStatus for " + m_primName ); 2059//Console.WriteLine("changePhysicsStatus for " + m_primName );
2065 changeadd(2f); 2060 changeadd(2f);
2066 } 2061 }
@@ -2120,8 +2115,6 @@ Console.WriteLine(" JointCreateFixed");
2120 _parent_scene.waitForSpaceUnlock(m_targetSpace); 2115 _parent_scene.waitForSpaceUnlock(m_targetSpace);
2121 d.SpaceRemove(m_targetSpace, prim_geom); 2116 d.SpaceRemove(m_targetSpace, prim_geom);
2122 } 2117 }
2123 d.GeomDestroy(prim_geom);
2124 prim_geom = IntPtr.Zero;
2125 // we don't need to do space calculation because the client sends a position update also. 2118 // we don't need to do space calculation because the client sends a position update also.
2126 2119
2127 // Construction of new prim 2120 // Construction of new prim
@@ -2223,16 +2216,8 @@ Console.WriteLine(" JointCreateFixed");
2223 disableBody(); 2216 disableBody();
2224 } 2217 }
2225 } 2218 }
2226 try 2219
2227 { 2220
2228 d.GeomDestroy(prim_geom);
2229 }
2230 catch (System.AccessViolationException)
2231 {
2232 prim_geom = IntPtr.Zero;
2233 m_log.Error("[PHYSICS]: PrimGeom dead");
2234 }
2235 prim_geom = IntPtr.Zero;
2236 // we don't need to do space calculation because the client sends a position update also. 2221 // we don't need to do space calculation because the client sends a position update also.
2237 if (_size.X <= 0) _size.X = 0.01f; 2222 if (_size.X <= 0) _size.X = 0.01f;
2238 if (_size.Y <= 0) _size.Y = 0.01f; 2223 if (_size.Y <= 0) _size.Y = 0.01f;
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
index 79e2986..ab084fd 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
@@ -2206,6 +2206,12 @@ namespace OpenSim.Region.Physics.OdePlugin
2206 { 2206 {
2207 if (prim.prim_geom != IntPtr.Zero) 2207 if (prim.prim_geom != IntPtr.Zero)
2208 { 2208 {
2209
2210//string tPA;
2211//geom_name_map.TryGetValue(prim.prim_geom, out tPA);
2212//Console.WriteLine("**** Remove {0}", tPA);
2213 if(geom_name_map.ContainsKey(prim.prim_geom)) geom_name_map.Remove(prim.prim_geom);
2214 if(actor_name_map.ContainsKey(prim.prim_geom)) actor_name_map.Remove(prim.prim_geom);
2209 d.GeomDestroy(prim.prim_geom); 2215 d.GeomDestroy(prim.prim_geom);
2210 prim.prim_geom = IntPtr.Zero; 2216 prim.prim_geom = IntPtr.Zero;
2211 } 2217 }