aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs139
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs59
4 files changed, 140 insertions, 113 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 2f016fa..afdd99e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -682,30 +682,26 @@ namespace OpenSim.Region.Framework.Scenes
682 // These will be applied to the root prim at next rez. 682 // These will be applied to the root prim at next rez.
683 // The legacy slam bit (bit 3) and folded permission (bits 0-2) 683 // The legacy slam bit (bit 3) and folded permission (bits 0-2)
684 // are preserved due to the above mangling 684 // are preserved due to the above mangling
685 ownerPerms &= nextPerms; 685// ownerPerms &= nextPerms;
686 686
687 // Mask the base permissions. This is a conservative 687 // Mask the base permissions. This is a conservative
688 // approach altering only the three main perms 688 // approach altering only the three main perms
689 basePerms &= nextPerms; 689// basePerms &= nextPerms;
690 690
691 // Mask out the folded portion of the base mask. 691 // Mask out the folded portion of the base mask.
692 // While the owner mask carries the actual folded 692 // While the owner mask carries the actual folded
693 // permissions, the base mask carries the original 693 // permissions, the base mask carries the original
694 // base mask, before masking with the folded perms. 694 // base mask, before masking with the folded perms.
695 // We need this later for rezzing. 695 // We need this later for rezzing.
696 basePerms &= ~(uint)PermissionMask.FoldedMask; 696// basePerms &= ~(uint)PermissionMask.FoldedMask;
697 basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); 697// basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
698 698
699 // If this is an object, root prim perms may be more 699 // If this is an object, root prim perms may be more
700 // permissive than folded perms. Use folded perms as 700 // permissive than folded perms. Use folded perms as
701 // a mask 701 // a mask
702 if (item.InvType == (int)InventoryType.Object) 702 uint foldedPerms = (item.CurrentPermissions & (uint)PermissionMask.FoldedMask) << (int)PermissionMask.FoldingShift;
703 if (foldedPerms != 0 && item.InvType == (int)InventoryType.Object)
703 { 704 {
704 // Create a safe mask for the current perms
705 uint foldedPerms = (item.CurrentPermissions & 7) << 13;
706 if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) != 0)
707 foldedPerms |= (uint)PermissionMask.Export;
708
709 foldedPerms |= permsMask; 705 foldedPerms |= permsMask;
710 706
711 bool isRootMod = (item.CurrentPermissions & 707 bool isRootMod = (item.CurrentPermissions &
@@ -729,6 +725,11 @@ namespace OpenSim.Region.Framework.Scenes
729 } 725 }
730 } 726 }
731 727
728 // move here so nextperms are mandatory
729 ownerPerms &= nextPerms;
730 basePerms &= nextPerms;
731 basePerms &= ~(uint)PermissionMask.FoldedMask;
732 basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
732 // Assign to the actual item. Make sure the slam bit is 733 // Assign to the actual item. Make sure the slam bit is
733 // set, if it wasn't set before. 734 // set, if it wasn't set before.
734 itemCopy.BasePermissions = basePerms; 735 itemCopy.BasePermissions = basePerms;
@@ -1266,20 +1267,26 @@ namespace OpenSim.Region.Framework.Scenes
1266 // TODO: Fix this after the inventory fixer exists and has beenr run 1267 // TODO: Fix this after the inventory fixer exists and has beenr run
1267 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) 1268 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
1268 { 1269 {
1269 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 1270 uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
1270 if (taskItem.InvType == (int)InventoryType.Object) 1271 if (taskItem.InvType == (int)InventoryType.Object)
1271 agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); 1272 {
1273 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms );
1274 perms = PermissionsUtil.FixAndFoldPermissions(perms);
1275 }
1272 else 1276 else
1273 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 1277 perms &= taskItem.CurrentPermissions;
1274 1278
1275 agentItem.BasePermissions = agentItem.CurrentPermissions; 1279 // always unlock
1276 1280 perms |= (uint)PermissionMask.Move;
1281
1282 agentItem.BasePermissions = perms;
1283 agentItem.CurrentPermissions = perms;
1284 agentItem.NextPermissions = perms & taskItem.NextPermissions;
1285 agentItem.EveryOnePermissions = perms & taskItem.EveryonePermissions;
1286 agentItem.GroupPermissions = perms & taskItem.GroupPermissions;
1287
1277 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; 1288 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1278 agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); 1289 agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
1279 agentItem.NextPermissions = taskItem.NextPermissions;
1280 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
1281 // Group permissions make no sense here
1282 agentItem.GroupPermissions = 0;
1283 } 1290 }
1284 else 1291 else
1285 { 1292 {
@@ -1287,7 +1294,7 @@ namespace OpenSim.Region.Framework.Scenes
1287 agentItem.CurrentPermissions = taskItem.CurrentPermissions; 1294 agentItem.CurrentPermissions = taskItem.CurrentPermissions;
1288 agentItem.NextPermissions = taskItem.NextPermissions; 1295 agentItem.NextPermissions = taskItem.NextPermissions;
1289 agentItem.EveryOnePermissions = taskItem.EveryonePermissions; 1296 agentItem.EveryOnePermissions = taskItem.EveryonePermissions;
1290 agentItem.GroupPermissions = 0; 1297 agentItem.GroupPermissions = taskItem.GroupPermissions;
1291 } 1298 }
1292 1299
1293 message = null; 1300 message = null;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 12e53a8..36844a9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -252,18 +252,26 @@ namespace OpenSim.Region.Framework.Scenes
252 } 252 }
253 253
254 // new test code, to place in better place later 254 // new test code, to place in better place later
255 private object PermissionsLock = new object(); 255 private object m_PermissionsLock = new object();
256 private bool m_EffectivePermsInvalid = true;
257
258 public void InvalidateEffectivePerms()
259 {
260 lock(m_PermissionsLock)
261 m_EffectivePermsInvalid = true;
262 }
256 263
257 private uint m_EffectiveEveryOnePerms; 264 private uint m_EffectiveEveryOnePerms;
258 public uint EffectiveEveryOnePerms 265 public uint EffectiveEveryOnePerms
259 { 266 {
260 get 267 get
261 { 268 {
262 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) 269 lock(m_PermissionsLock)
263 // bc this is on heavy duty code paths 270 {
264 // but for now we need to test the concept 271 if(m_EffectivePermsInvalid)
265// AggregateDeepPerms(); 272 AggregatePerms();
266 return m_EffectiveEveryOnePerms; 273 return m_EffectiveEveryOnePerms;
274 }
267 } 275 }
268 } 276 }
269 277
@@ -272,11 +280,12 @@ namespace OpenSim.Region.Framework.Scenes
272 { 280 {
273 get 281 get
274 { 282 {
275 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) 283 lock(m_PermissionsLock)
276 // bc this is on heavy duty code paths 284 {
277 // but for now we need to test the concept 285 if(m_EffectivePermsInvalid)
278// AggregateDeepPerms(); 286 AggregatePerms();
279 return m_EffectiveGroupPerms; 287 return m_EffectiveGroupPerms;
288 }
280 } 289 }
281 } 290 }
282 291
@@ -285,11 +294,12 @@ namespace OpenSim.Region.Framework.Scenes
285 { 294 {
286 get 295 get
287 { 296 {
288 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) 297 lock(m_PermissionsLock)
289 // bc this is on heavy duty code paths 298 {
290 // but for now we need to test the concept 299 if(m_EffectivePermsInvalid)
291// AggregateDeepPerms(); 300 AggregatePerms();
292 return m_EffectiveGroupOrEveryOnePerms; 301 return m_EffectiveGroupOrEveryOnePerms;
302 }
293 } 303 }
294 } 304 }
295 305
@@ -298,11 +308,12 @@ namespace OpenSim.Region.Framework.Scenes
298 { 308 {
299 get 309 get
300 { 310 {
301 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) 311 lock(m_PermissionsLock)
302 // bc this is on heavy duty code paths 312 {
303 // but for now we need to test the concept 313 if(m_EffectivePermsInvalid)
304 // AggregateDeepPerms(); 314 AggregatePerms();
305 return m_EffectiveOwnerPerms; 315 return m_EffectiveOwnerPerms;
316 }
306 } 317 }
307 } 318 }
308 319
@@ -310,12 +321,12 @@ namespace OpenSim.Region.Framework.Scenes
310 // AggregatePerms does same using cached parts content perms 321 // AggregatePerms does same using cached parts content perms
311 public void AggregateDeepPerms() 322 public void AggregateDeepPerms()
312 { 323 {
313 lock(PermissionsLock) 324 lock(m_PermissionsLock)
314 { 325 {
315 // aux 326 // aux
316 const uint allmask = (uint)PermissionMask.AllEffective; 327 const uint allmask = (uint)PermissionMask.AllEffective;
317 const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify); 328 const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
318 const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer); 329 const uint copytransfermask = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
319 330
320 uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; 331 uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
321 bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0; 332 bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
@@ -327,6 +338,8 @@ namespace OpenSim.Region.Framework.Scenes
327 uint rootEveryonePerms = RootPart.EveryoneMask; 338 uint rootEveryonePerms = RootPart.EveryoneMask;
328 uint everyone = rootEveryonePerms; 339 uint everyone = rootEveryonePerms;
329 340
341 // date is time of writing april 30th 2017
342 bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
330 SceneObjectPart[] parts = m_parts.GetArray(); 343 SceneObjectPart[] parts = m_parts.GetArray();
331 for (int i = 0; i < parts.Length; i++) 344 for (int i = 0; i < parts.Length; i++)
332 { 345 {
@@ -334,12 +347,13 @@ namespace OpenSim.Region.Framework.Scenes
334 part.AggregateInnerPerms(); 347 part.AggregateInnerPerms();
335 owner &= part.AggregatedInnerOwnerPerms; 348 owner &= part.AggregatedInnerOwnerPerms;
336 group &= part.AggregatedInnerGroupPerms; 349 group &= part.AggregatedInnerGroupPerms;
337 everyone &= part.AggregatedInnerEveryonePerms; 350 if(newObject)
351 everyone &= part.AggregatedInnerEveryonePerms;
338 } 352 }
339 // recover modify and move 353 // recover modify and move
340 rootOwnerPerms &= movemodmask; 354 rootOwnerPerms &= movemodmask;
341 owner |= rootOwnerPerms; 355 owner |= rootOwnerPerms;
342 if((owner & copytransfermast) == 0) 356 if((owner & copytransfermask) == 0)
343 owner |= (uint)PermissionMask.Transfer; 357 owner |= (uint)PermissionMask.Transfer;
344 358
345 owner &= basePerms; 359 owner &= basePerms;
@@ -370,6 +384,7 @@ namespace OpenSim.Region.Framework.Scenes
370 384
371 m_EffectiveEveryOnePerms = everyone & owner; 385 m_EffectiveEveryOnePerms = everyone & owner;
372 m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; 386 m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
387 m_EffectivePermsInvalid = false;
373 } 388 }
374 } 389 }
375 390
@@ -377,7 +392,7 @@ namespace OpenSim.Region.Framework.Scenes
377 // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop 392 // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop
378 public void AggregatePerms() 393 public void AggregatePerms()
379 { 394 {
380 lock(PermissionsLock) 395 lock(m_PermissionsLock)
381 { 396 {
382 // aux 397 // aux
383 const uint allmask = (uint)PermissionMask.AllEffective; 398 const uint allmask = (uint)PermissionMask.AllEffective;
@@ -394,13 +409,17 @@ namespace OpenSim.Region.Framework.Scenes
394 uint rootEveryonePerms = RootPart.EveryoneMask; 409 uint rootEveryonePerms = RootPart.EveryoneMask;
395 uint everyone = rootEveryonePerms; 410 uint everyone = rootEveryonePerms;
396 411
412 bool needUpdate = false;
413 // date is time of writing april 30th 2017
414 bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
397 SceneObjectPart[] parts = m_parts.GetArray(); 415 SceneObjectPart[] parts = m_parts.GetArray();
398 for (int i = 0; i < parts.Length; i++) 416 for (int i = 0; i < parts.Length; i++)
399 { 417 {
400 SceneObjectPart part = parts[i]; 418 SceneObjectPart part = parts[i];
401 owner &= part.AggregatedInnerOwnerPerms; 419 owner &= part.AggregatedInnerOwnerPerms;
402 group &= part.AggregatedInnerGroupPerms; 420 group &= part.AggregatedInnerGroupPerms;
403 everyone &= part.AggregatedInnerEveryonePerms; 421 if(newObject)
422 everyone &= part.AggregatedInnerEveryonePerms;
404 } 423 }
405 // recover modify and move 424 // recover modify and move
406 rootOwnerPerms &= movemodmask; 425 rootOwnerPerms &= movemodmask;
@@ -409,7 +428,12 @@ namespace OpenSim.Region.Framework.Scenes
409 owner |= (uint)PermissionMask.Transfer; 428 owner |= (uint)PermissionMask.Transfer;
410 429
411 owner &= basePerms; 430 owner &= basePerms;
412 m_EffectiveOwnerPerms = owner; 431 if(owner != m_EffectiveOwnerPerms)
432 {
433 needUpdate = true;
434 m_EffectiveOwnerPerms = owner;
435 }
436
413 uint ownertransfermask = owner & (uint)PermissionMask.Transfer; 437 uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
414 438
415 // recover modify and move 439 // recover modify and move
@@ -421,7 +445,12 @@ namespace OpenSim.Region.Framework.Scenes
421 group |= ownertransfermask; 445 group |= ownertransfermask;
422 446
423 uint groupOrEveryone = group; 447 uint groupOrEveryone = group;
424 m_EffectiveGroupPerms = group & owner; 448 uint tmpPerms = group & owner;
449 if(tmpPerms != m_EffectiveGroupPerms)
450 {
451 needUpdate = true;
452 m_EffectiveGroupPerms = tmpPerms;
453 }
425 454
426 // recover move 455 // recover move
427 rootEveryonePerms &= (uint)PermissionMask.Move; 456 rootEveryonePerms &= (uint)PermissionMask.Move;
@@ -434,35 +463,42 @@ namespace OpenSim.Region.Framework.Scenes
434 463
435 groupOrEveryone |= everyone; 464 groupOrEveryone |= everyone;
436 465
437 m_EffectiveEveryOnePerms = everyone & owner; 466 tmpPerms = everyone & owner;
438 m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; 467 if(tmpPerms != m_EffectiveEveryOnePerms)
439 } 468 {
440 } 469 needUpdate = true;
470 m_EffectiveEveryOnePerms = tmpPerms;
471 }
441 472
442 public uint GetEffectivePermissions() 473 tmpPerms = groupOrEveryone & owner;
443 { 474 if(tmpPerms != m_EffectiveGroupOrEveryOnePerms)
444 return GetEffectivePermissions(false); 475 {
476 needUpdate = true;
477 m_EffectiveGroupOrEveryOnePerms = tmpPerms;
478 }
479
480 m_EffectivePermsInvalid = false;
481
482 if(needUpdate)
483 RootPart.ScheduleFullUpdate();
484 }
445 } 485 }
446 486
447 public uint GetEffectivePermissions(bool useBase) 487 public uint CurrentAndFoldedNextPermissions()
448 { 488 {
449 uint perms=(uint)(PermissionMask.Modify | 489 uint perms=(uint)(PermissionMask.Modify |
450 PermissionMask.Copy | 490 PermissionMask.Copy |
451 PermissionMask.Move | 491 PermissionMask.Move |
452 PermissionMask.Transfer) | 7; 492 PermissionMask.Transfer |
493 PermissionMask.FoldedMask);
453 494
454 uint ownerMask = 0x7fffffff; 495 uint ownerMask = RootPart.OwnerMask;
455 496
456 SceneObjectPart[] parts = m_parts.GetArray(); 497 SceneObjectPart[] parts = m_parts.GetArray();
457 for (int i = 0; i < parts.Length; i++) 498 for (int i = 0; i < parts.Length; i++)
458 { 499 {
459 SceneObjectPart part = parts[i]; 500 SceneObjectPart part = parts[i];
460 501 ownerMask &= part.BaseMask;
461 if (useBase)
462 ownerMask &= part.BaseMask;
463 else
464 ownerMask &= part.OwnerMask;
465
466 perms &= part.Inventory.MaskEffectivePermissions(); 502 perms &= part.Inventory.MaskEffectivePermissions();
467 } 503 }
468 504
@@ -472,17 +508,8 @@ namespace OpenSim.Region.Framework.Scenes
472 perms &= ~(uint)PermissionMask.Copy; 508 perms &= ~(uint)PermissionMask.Copy;
473 if ((ownerMask & (uint)PermissionMask.Transfer) == 0) 509 if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
474 perms &= ~(uint)PermissionMask.Transfer; 510 perms &= ~(uint)PermissionMask.Transfer;
475 511 if ((ownerMask & (uint)PermissionMask.Export) == 0)
476 // If root prim permissions are applied here, this would screw 512 perms &= ~(uint)PermissionMask.Export;
477 // with in-inventory manipulation of the next owner perms
478 // in a major way. So, let's move this to the give itself.
479 // Yes. I know. Evil.
480// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
481// perms &= ~((uint)PermissionMask.Modify >> 13);
482// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
483// perms &= ~((uint)PermissionMask.Copy >> 13);
484// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
485// perms &= ~((uint)PermissionMask.Transfer >> 13);
486 513
487 return perms; 514 return perms;
488 } 515 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 19bf53f..f948336 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2579,6 +2579,8 @@ namespace OpenSim.Region.Framework.Scenes
2579 AggregatedInnerOwnerPerms = owner & mask; 2579 AggregatedInnerOwnerPerms = owner & mask;
2580 AggregatedInnerGroupPerms = group & mask; 2580 AggregatedInnerGroupPerms = group & mask;
2581 AggregatedInnerEveryonePerms = everyone & mask; 2581 AggregatedInnerEveryonePerms = everyone & mask;
2582 if(ParentGroup != null)
2583 ParentGroup.InvalidateEffectivePerms();
2582 } 2584 }
2583 } 2585 }
2584 2586
@@ -5286,9 +5288,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5286 // Export needs to be preserved in the base and everyone 5288 // Export needs to be preserved in the base and everyone
5287 // mask, but removed in the owner mask as a next owner 5289 // mask, but removed in the owner mask as a next owner
5288 // can never change the export status 5290 // can never change the export status
5289 BaseMask &= NextOwnerMask | (uint)PermissionMask.Export; 5291 BaseMask &= (NextOwnerMask | (uint)PermissionMask.Export);
5290 OwnerMask &= NextOwnerMask; 5292 OwnerMask &= NextOwnerMask;
5291 EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export; 5293 EveryoneMask &= (NextOwnerMask | (uint)PermissionMask.Export);
5292 GroupMask = 0; // Giving an object zaps group permissions 5294 GroupMask = 0; // Giving an object zaps group permissions
5293 5295
5294 Inventory.ApplyNextOwnerPermissions(); 5296 Inventory.ApplyNextOwnerPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index b53c355..8c9d0bb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1332,6 +1332,8 @@ namespace OpenSim.Region.Framework.Scenes
1332 { 1332 {
1333 foreach (TaskInventoryItem item in m_items.Values) 1333 foreach (TaskInventoryItem item in m_items.Values)
1334 { 1334 {
1335 if(item.InvType == (sbyte)InventoryType.Landmark)
1336 continue;
1335 owner &= item.CurrentPermissions; 1337 owner &= item.CurrentPermissions;
1336 group &= item.GroupPermissions; 1338 group &= item.GroupPermissions;
1337 everyone &= item.EveryonePermissions; 1339 everyone &= item.EveryonePermissions;
@@ -1340,33 +1342,35 @@ namespace OpenSim.Region.Framework.Scenes
1340 1342
1341 public uint MaskEffectivePermissions() 1343 public uint MaskEffectivePermissions()
1342 { 1344 {
1345 // used to propagate permissions restrictions outwards
1346 // Modify does not propagate outwards.
1343 uint mask=0x7fffffff; 1347 uint mask=0x7fffffff;
1344 1348
1345 foreach (TaskInventoryItem item in m_items.Values) 1349 foreach (TaskInventoryItem item in m_items.Values)
1346 { 1350 {
1347 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) 1351 if(item.InvType == (sbyte)InventoryType.Landmark)
1348 mask &= ~((uint)PermissionMask.Copy >> 13); 1352 continue;
1349 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) 1353
1350 mask &= ~((uint)PermissionMask.Transfer >> 13); 1354 // apply current to normal permission bits
1351 if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) 1355 uint newperms = item.CurrentPermissions;
1352 mask &= ~((uint)PermissionMask.Modify >> 13);
1353
1354 if (item.InvType == (int)InventoryType.Object)
1355 {
1356 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
1357 mask &= ~((uint)PermissionMask.Copy >> 13);
1358 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
1359 mask &= ~((uint)PermissionMask.Transfer >> 13);
1360 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1361 mask &= ~((uint)PermissionMask.Modify >> 13);
1362 }
1363 1356
1364 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1357 if ((newperms & (uint)PermissionMask.Copy) == 0)
1365 mask &= ~(uint)PermissionMask.Copy; 1358 mask &= ~(uint)PermissionMask.Copy;
1366 if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) 1359 if ((newperms & (uint)PermissionMask.Transfer) == 0)
1367 mask &= ~(uint)PermissionMask.Transfer; 1360 mask &= ~(uint)PermissionMask.Transfer;
1368 if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) 1361 if ((newperms & (uint)PermissionMask.Export) == 0)
1369 mask &= ~(uint)PermissionMask.Modify; 1362 mask &= ~((uint)PermissionMask.Export);
1363
1364 // apply next owner restricted by current to folded bits
1365 newperms &= item.NextPermissions;
1366
1367 if ((newperms & (uint)PermissionMask.Copy) == 0)
1368 mask &= ~((uint)PermissionMask.FoldedCopy);
1369 if ((newperms & (uint)PermissionMask.Transfer) == 0)
1370 mask &= ~((uint)PermissionMask.FoldedTransfer);
1371 if ((newperms & (uint)PermissionMask.Export) == 0)
1372 mask &= ~((uint)PermissionMask.FoldedExport);
1373
1370 } 1374 }
1371 return mask; 1375 return mask;
1372 } 1376 }
@@ -1375,19 +1379,6 @@ namespace OpenSim.Region.Framework.Scenes
1375 { 1379 {
1376 foreach (TaskInventoryItem item in m_items.Values) 1380 foreach (TaskInventoryItem item in m_items.Values)
1377 { 1381 {
1378 if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
1379 {
1380// m_log.DebugFormat (
1381// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}",
1382// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions);
1383
1384 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
1385 item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
1386 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
1387 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
1388 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1389 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
1390 }
1391 item.CurrentPermissions &= item.NextPermissions; 1382 item.CurrentPermissions &= item.NextPermissions;
1392 item.BasePermissions &= item.NextPermissions; 1383 item.BasePermissions &= item.NextPermissions;
1393 item.EveryonePermissions &= item.NextPermissions; 1384 item.EveryonePermissions &= item.NextPermissions;