aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs214
1 files changed, 115 insertions, 99 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index c5b6ac6..ef4f190 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5374,7 +5374,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5374 AddLocalPacketHandler(PacketType.ObjectClickAction, HandleObjectClickAction, false); 5374 AddLocalPacketHandler(PacketType.ObjectClickAction, HandleObjectClickAction, false);
5375 AddLocalPacketHandler(PacketType.ObjectMaterial, HandleObjectMaterial, false); 5375 AddLocalPacketHandler(PacketType.ObjectMaterial, HandleObjectMaterial, false);
5376 AddLocalPacketHandler(PacketType.RequestImage, HandleRequestImage, false); 5376 AddLocalPacketHandler(PacketType.RequestImage, HandleRequestImage, false);
5377 AddLocalPacketHandler(PacketType.TransferRequest, HandleTransferRequest); 5377 AddLocalPacketHandler(PacketType.TransferRequest, HandleTransferRequest, false);
5378 AddLocalPacketHandler(PacketType.AssetUploadRequest, HandleAssetUploadRequest); 5378 AddLocalPacketHandler(PacketType.AssetUploadRequest, HandleAssetUploadRequest);
5379 AddLocalPacketHandler(PacketType.RequestXfer, HandleRequestXfer); 5379 AddLocalPacketHandler(PacketType.RequestXfer, HandleRequestXfer);
5380 AddLocalPacketHandler(PacketType.SendXferPacket, HandleSendXferPacket); 5380 AddLocalPacketHandler(PacketType.SendXferPacket, HandleSendXferPacket);
@@ -7751,129 +7751,145 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7751 //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); 7751 //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request");
7752 7752
7753 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 7753 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
7754 //m_log.Debug("Transfer Request: " + transfer.ToString());
7755 // Validate inventory transfers
7756 // Has to be done here, because AssetCache can't do it
7757 //
7758 UUID taskID = UUID.Zero; 7754 UUID taskID = UUID.Zero;
7759 if (transfer.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) 7755 if (transfer.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
7760 { 7756 {
7761 taskID = new UUID(transfer.TransferInfo.Params, 48);
7762 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
7763 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
7764
7765// m_log.DebugFormat(
7766// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
7767// requestID, itemID, taskID, Name);
7768
7769 if (!(((Scene)m_scene).Permissions.BypassPermissions())) 7757 if (!(((Scene)m_scene).Permissions.BypassPermissions()))
7770 { 7758 {
7771 if (taskID != UUID.Zero) // Prim 7759 // We're spawning a thread because the permissions check can block this thread
7760 Util.FireAndForget(delegate
7772 { 7761 {
7773 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); 7762 // This requests the asset if needed
7763 HandleSimInventoryTransferRequestWithPermsCheck(sender, transfer);
7764 });
7765 return true;
7766 }
7767 }
7768 else if (transfer.TransferInfo.SourceType == (int)SourceType.SimEstate)
7769 {
7770 //TransferRequestPacket does not include covenant uuid?
7771 //get scene covenant uuid
7772 taskID = m_scene.RegionInfo.RegionSettings.Covenant;
7773 }
7774 7774
7775 if (part == null) 7775 // This is non-blocking
7776 { 7776 MakeAssetRequest(transfer, taskID);
7777 m_log.WarnFormat(
7778 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
7779 Name, requestID, itemID, taskID);
7780 return true;
7781 }
7782 7777
7783 TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID); 7778 return true;
7784 if (tii == null) 7779 }
7785 {
7786 m_log.WarnFormat(
7787 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
7788 Name, requestID, itemID, taskID);
7789 return true;
7790 }
7791 7780
7792 if (tii.Type == (int)AssetType.LSLText) 7781 private void HandleSimInventoryTransferRequestWithPermsCheck(IClientAPI sender, TransferRequestPacket transfer)
7793 { 7782 {
7794 if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId)) 7783 UUID taskID = new UUID(transfer.TransferInfo.Params, 48);
7795 return true; 7784 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
7796 } 7785 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
7797 else if (tii.Type == (int)AssetType.Notecard)
7798 {
7799 if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId))
7800 return true;
7801 }
7802 else
7803 {
7804 // TODO: Change this code to allow items other than notecards and scripts to be successfully
7805 // shared with group. In fact, this whole block of permissions checking should move to an IPermissionsModule
7806 if (part.OwnerID != AgentId)
7807 {
7808 m_log.WarnFormat(
7809 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
7810 Name, requestID, itemID, taskID, part.OwnerID);
7811 return true;
7812 }
7813 7786
7814 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 7787 //m_log.DebugFormat(
7815 { 7788 // "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
7816 m_log.WarnFormat( 7789 // requestID, itemID, taskID, Name);
7817 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
7818 Name, requestID, itemID, taskID);
7819 return true;
7820 }
7821 7790
7822 if (tii.OwnerID != AgentId) 7791 //m_log.Debug("Transfer Request: " + transfer.ToString());
7823 { 7792 // Validate inventory transfers
7824 m_log.WarnFormat( 7793 // Has to be done here, because AssetCache can't do it
7825 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", 7794 //
7826 Name, requestID, itemID, taskID, tii.OwnerID); 7795 if (taskID != UUID.Zero) // Prim
7827 return true; 7796 {
7828 } 7797 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
7829 7798
7830 if (( 7799 if (part == null)
7831 tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) 7800 {
7832 != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) 7801 m_log.WarnFormat(
7833 { 7802 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
7834 m_log.WarnFormat( 7803 Name, requestID, itemID, taskID);
7835 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", 7804 return;
7836 Name, requestID, itemID, taskID); 7805 }
7837 return true;
7838 }
7839 7806
7840 if (tii.AssetID != requestID) 7807 TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID);
7841 { 7808 if (tii == null)
7842 m_log.WarnFormat( 7809 {
7843 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", 7810 m_log.WarnFormat(
7844 Name, requestID, itemID, taskID, tii.AssetID); 7811 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
7845 return true; 7812 Name, requestID, itemID, taskID);
7846 } 7813 return;
7847 } 7814 }
7815
7816 if (tii.Type == (int)AssetType.LSLText)
7817 {
7818 if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
7819 return;
7820 }
7821 else if (tii.Type == (int)AssetType.Notecard)
7822 {
7823 if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId))
7824 return;
7825 }
7826 else
7827 {
7828 // TODO: Change this code to allow items other than notecards and scripts to be successfully
7829 // shared with group. In fact, this whole block of permissions checking should move to an IPermissionsModule
7830 if (part.OwnerID != AgentId)
7831 {
7832 m_log.WarnFormat(
7833 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
7834 Name, requestID, itemID, taskID, part.OwnerID);
7835 return;
7848 } 7836 }
7849 else // Agent 7837
7838 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
7850 { 7839 {
7851 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); 7840 m_log.WarnFormat(
7852 if (invAccess != null) 7841 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
7853 { 7842 Name, requestID, itemID, taskID);
7854 if (!invAccess.CanGetAgentInventoryItem(this, itemID, requestID)) 7843 return;
7855 return false; 7844 }
7856 } 7845
7857 else 7846 if (tii.OwnerID != AgentId)
7858 { 7847 {
7859 return false; 7848 m_log.WarnFormat(
7860 } 7849 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
7850 Name, requestID, itemID, taskID, tii.OwnerID);
7851 return;
7852 }
7853
7854 if ((
7855 tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
7856 != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
7857 {
7858 m_log.WarnFormat(
7859 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
7860 Name, requestID, itemID, taskID);
7861 return;
7862 }
7863
7864 if (tii.AssetID != requestID)
7865 {
7866 m_log.WarnFormat(
7867 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
7868 Name, requestID, itemID, taskID, tii.AssetID);
7869 return;
7861 } 7870 }
7862 } 7871 }
7863 } 7872 }
7864 else 7873 else // Agent
7865 if (transfer.TransferInfo.SourceType == (int)SourceType.SimEstate) 7874 {
7875 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
7876 if (invAccess != null)
7877 {
7878 if (!invAccess.CanGetAgentInventoryItem(this, itemID, requestID))
7879 return;
7880 }
7881 else
7866 { 7882 {
7867 //TransferRequestPacket does not include covenant uuid? 7883 return;
7868 //get scene covenant uuid
7869 taskID = m_scene.RegionInfo.RegionSettings.Covenant;
7870 } 7884 }
7885 }
7871 7886
7887 // Permissions out of the way, let's request the asset
7872 MakeAssetRequest(transfer, taskID); 7888 MakeAssetRequest(transfer, taskID);
7873 7889
7874 return true;
7875 } 7890 }
7876 7891
7892
7877 private bool HandleAssetUploadRequest(IClientAPI sender, Packet Pack) 7893 private bool HandleAssetUploadRequest(IClientAPI sender, Packet Pack)
7878 { 7894 {
7879 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 7895 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;