Skip to content

Commit

Permalink
Must filter objects by owner, replace prims by creator. Fixed null ref.
Browse files Browse the repository at this point in the history
  • Loading branch information
appurist authored and kf6kjg committed Mar 25, 2019
1 parent 7379ea7 commit fa2e864
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -512,24 +512,38 @@ private AssetBase ReserializeCoalescedToAsset(IList<SceneObjectGroup> items, Lis
return asset;
}

private bool MustReplaceByCreatorOwner(UUID creatorID, UUID ownerID)
private bool MustFilterByOwner(UUID ownerID)
{
if (!m_allowedUUIDs.Contains(ownerID))
return true;
if (!m_allowedUUIDs.Contains(creatorID))
return true;
return false;
if (m_allowedUUIDs == null)
return false; // filter disabled

return !m_allowedUUIDs.Contains(ownerID);
}

private bool MustReplaceByCreator(UUID creatorID)
{
if (m_allowedUUIDs == null)
return false; // filter disabled

// Also include the LIBRARY_USER in the creator whitelist.
if (creatorID == LIBRARY_USER)
return false;

return !m_allowedUUIDs.Contains(creatorID);
}

private bool MustReplaceByAsset(UUID assetID, UUID ownerID, UUID creatorID)
{
if (assetID == UUID.Zero) return false;

if (m_allowedUUIDs == null)
return false; // filter disabled

if (m_libAssets.ContainsKey(assetID))
return false; // it's in the Library

// Filter out owners who aren't in the allowed list.
if (!m_allowedUUIDs.Contains(ownerID))
if (MustFilterByOwner(ownerID))
return true; // filter out this user

if (creatorID == UUID.Zero) {
Expand All @@ -546,7 +560,7 @@ private bool MustReplaceByAsset(UUID assetID, UUID ownerID, UUID creatorID)
return false;

// Filter out creators who aren't in the allowed list.
return !m_allowedUUIDs.Contains(creatorID);
return MustReplaceByCreator(creatorID);
}

private void ReplaceDescription(SceneObjectPart part, UUID prevCreatorID)
Expand Down Expand Up @@ -709,7 +723,7 @@ private bool FilterPart(SceneObjectPart part, UUID ownerID)
}

// Check if object creator has opted in
if (MustReplaceByCreatorOwner(part.CreatorID, ownerID))
if (MustReplaceByCreator(part.CreatorID))
{
// Creator of prim has not opted-in for this instance.
// First, replace the prim with a default prim.
Expand Down Expand Up @@ -966,8 +980,6 @@ public void DearchiveRegion(HashSet<UUID> allowedUUIDs)
{
// Adopt this whitelist for filtering a load.
m_allowedUUIDs = allowedUUIDs;
// Also include the LIBRARY_USER in the whitelist.
m_allowedUUIDs.Add(LIBRARY_USER);
// Now a normal filtered load.
m_assetCreators = GetAssetCreators();
}
Expand Down Expand Up @@ -999,7 +1011,7 @@ public void DearchiveRegion(HashSet<UUID> allowedUUIDs)
failedAssetRestores++;

if (((successfulAssetRestores + failedAssetRestores) % 1000) == 0)
m_log.InfoFormat("[ARCHIVER]: Assets {0} of {1} restored.", successfulAssetRestores, successfulAssetRestores + failedAssetRestores);
m_log.InfoFormat("[ARCHIVER]: Assets {0} of {1} restored (so far)...", successfulAssetRestores, successfulAssetRestores + failedAssetRestores);
}
else if (!m_merge && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
{
Expand Down Expand Up @@ -1061,6 +1073,9 @@ public void DearchiveRegion(HashSet<UUID> allowedUUIDs)
else throw new Exception("Error while deserializing group");
}

if (MustFilterByOwner(sceneObject.OwnerID))
continue;

DearchiveSceneObject(sceneObject, sceneObject.OwnerID, true, OriginalBackupIDs);

backupObjects.Add(sceneObject);
Expand Down

0 comments on commit fa2e864

Please sign in to comment.