diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 238 |
1 files changed, 135 insertions, 103 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 45c901e..dfad485 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -710,12 +710,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
710 | //there is a local handler for this packet type | 710 | //there is a local handler for this packet type |
711 | if (pprocessor.Async) | 711 | if (pprocessor.Async) |
712 | { | 712 | { |
713 | ClientInfo cinfo = UDPClient.GetClientInfo(); | ||
714 | if (!cinfo.AsyncRequests.ContainsKey(packet.Type.ToString())) | ||
715 | cinfo.AsyncRequests[packet.Type.ToString()] = 0; | ||
716 | cinfo.AsyncRequests[packet.Type.ToString()]++; | ||
717 | |||
713 | object obj = new AsyncPacketProcess(this, pprocessor.method, packet); | 718 | object obj = new AsyncPacketProcess(this, pprocessor.method, packet); |
714 | Util.FireAndForget(ProcessSpecificPacketAsync, obj); | 719 | Util.FireAndForget(ProcessSpecificPacketAsync, obj); |
715 | result = true; | 720 | result = true; |
716 | } | 721 | } |
717 | else | 722 | else |
718 | { | 723 | { |
724 | ClientInfo cinfo = UDPClient.GetClientInfo(); | ||
725 | if (!cinfo.SyncRequests.ContainsKey(packet.Type.ToString())) | ||
726 | cinfo.SyncRequests[packet.Type.ToString()] = 0; | ||
727 | cinfo.SyncRequests[packet.Type.ToString()]++; | ||
728 | |||
719 | result = pprocessor.method(this, packet); | 729 | result = pprocessor.method(this, packet); |
720 | } | 730 | } |
721 | } | 731 | } |
@@ -730,6 +740,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
730 | } | 740 | } |
731 | if (found) | 741 | if (found) |
732 | { | 742 | { |
743 | ClientInfo cinfo = UDPClient.GetClientInfo(); | ||
744 | if (!cinfo.GenericRequests.ContainsKey(packet.Type.ToString())) | ||
745 | cinfo.GenericRequests[packet.Type.ToString()] = 0; | ||
746 | cinfo.GenericRequests[packet.Type.ToString()]++; | ||
747 | |||
733 | result = method(this, packet); | 748 | result = method(this, packet); |
734 | } | 749 | } |
735 | } | 750 | } |
@@ -5376,7 +5391,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5376 | AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); | 5391 | AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); |
5377 | AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); | 5392 | AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); |
5378 | AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); | 5393 | AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); |
5379 | AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply); | 5394 | AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); |
5380 | AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); | 5395 | AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); |
5381 | AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); | 5396 | AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); |
5382 | AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing); | 5397 | AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing); |
@@ -5437,8 +5452,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5437 | AddLocalPacketHandler(PacketType.ScriptAnswerYes, HandleScriptAnswerYes, false); | 5452 | AddLocalPacketHandler(PacketType.ScriptAnswerYes, HandleScriptAnswerYes, false); |
5438 | AddLocalPacketHandler(PacketType.ObjectClickAction, HandleObjectClickAction, false); | 5453 | AddLocalPacketHandler(PacketType.ObjectClickAction, HandleObjectClickAction, false); |
5439 | AddLocalPacketHandler(PacketType.ObjectMaterial, HandleObjectMaterial, false); | 5454 | AddLocalPacketHandler(PacketType.ObjectMaterial, HandleObjectMaterial, false); |
5440 | AddLocalPacketHandler(PacketType.RequestImage, HandleRequestImage); | 5455 | AddLocalPacketHandler(PacketType.RequestImage, HandleRequestImage, false); |
5441 | AddLocalPacketHandler(PacketType.TransferRequest, HandleTransferRequest); | 5456 | AddLocalPacketHandler(PacketType.TransferRequest, HandleTransferRequest, false); |
5442 | AddLocalPacketHandler(PacketType.AssetUploadRequest, HandleAssetUploadRequest); | 5457 | AddLocalPacketHandler(PacketType.AssetUploadRequest, HandleAssetUploadRequest); |
5443 | AddLocalPacketHandler(PacketType.RequestXfer, HandleRequestXfer); | 5458 | AddLocalPacketHandler(PacketType.RequestXfer, HandleRequestXfer); |
5444 | AddLocalPacketHandler(PacketType.SendXferPacket, HandleSendXferPacket); | 5459 | AddLocalPacketHandler(PacketType.SendXferPacket, HandleSendXferPacket); |
@@ -5470,7 +5485,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5470 | AddLocalPacketHandler(PacketType.TeleportCancel, HandleTeleportCancel); | 5485 | AddLocalPacketHandler(PacketType.TeleportCancel, HandleTeleportCancel); |
5471 | AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest); | 5486 | AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest); |
5472 | AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false); | 5487 | AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false); |
5473 | AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest); | 5488 | AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest, false); |
5474 | AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest); | 5489 | AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest); |
5475 | AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false); | 5490 | AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false); |
5476 | AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false); | 5491 | AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false); |
@@ -7868,129 +7883,145 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7868 | //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); | 7883 | //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); |
7869 | 7884 | ||
7870 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | 7885 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; |
7871 | //m_log.Debug("Transfer Request: " + transfer.ToString()); | ||
7872 | // Validate inventory transfers | ||
7873 | // Has to be done here, because AssetCache can't do it | ||
7874 | // | ||
7875 | UUID taskID = UUID.Zero; | 7886 | UUID taskID = UUID.Zero; |
7876 | if (transfer.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) | 7887 | if (transfer.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) |
7877 | { | 7888 | { |
7878 | taskID = new UUID(transfer.TransferInfo.Params, 48); | ||
7879 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); | ||
7880 | UUID requestID = new UUID(transfer.TransferInfo.Params, 80); | ||
7881 | |||
7882 | // m_log.DebugFormat( | ||
7883 | // "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", | ||
7884 | // requestID, itemID, taskID, Name); | ||
7885 | |||
7886 | if (!(((Scene)m_scene).Permissions.BypassPermissions())) | 7889 | if (!(((Scene)m_scene).Permissions.BypassPermissions())) |
7887 | { | 7890 | { |
7888 | if (taskID != UUID.Zero) // Prim | 7891 | // We're spawning a thread because the permissions check can block this thread |
7892 | Util.FireAndForget(delegate | ||
7889 | { | 7893 | { |
7890 | SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); | 7894 | // This requests the asset if needed |
7895 | HandleSimInventoryTransferRequestWithPermsCheck(sender, transfer); | ||
7896 | }); | ||
7897 | return true; | ||
7898 | } | ||
7899 | } | ||
7900 | else if (transfer.TransferInfo.SourceType == (int)SourceType.SimEstate) | ||
7901 | { | ||
7902 | //TransferRequestPacket does not include covenant uuid? | ||
7903 | //get scene covenant uuid | ||
7904 | taskID = m_scene.RegionInfo.RegionSettings.Covenant; | ||
7905 | } | ||
7891 | 7906 | ||
7892 | if (part == null) | 7907 | // This is non-blocking |
7893 | { | 7908 | MakeAssetRequest(transfer, taskID); |
7894 | m_log.WarnFormat( | ||
7895 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", | ||
7896 | Name, requestID, itemID, taskID); | ||
7897 | return true; | ||
7898 | } | ||
7899 | 7909 | ||
7900 | TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID); | 7910 | return true; |
7901 | if (tii == null) | 7911 | } |
7902 | { | ||
7903 | m_log.WarnFormat( | ||
7904 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", | ||
7905 | Name, requestID, itemID, taskID); | ||
7906 | return true; | ||
7907 | } | ||
7908 | 7912 | ||
7909 | if (tii.Type == (int)AssetType.LSLText) | 7913 | private void HandleSimInventoryTransferRequestWithPermsCheck(IClientAPI sender, TransferRequestPacket transfer) |
7910 | { | 7914 | { |
7911 | if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId)) | 7915 | UUID taskID = new UUID(transfer.TransferInfo.Params, 48); |
7912 | return true; | 7916 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); |
7913 | } | 7917 | UUID requestID = new UUID(transfer.TransferInfo.Params, 80); |
7914 | else if (tii.Type == (int)AssetType.Notecard) | ||
7915 | { | ||
7916 | if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId)) | ||
7917 | return true; | ||
7918 | } | ||
7919 | else | ||
7920 | { | ||
7921 | // TODO: Change this code to allow items other than notecards and scripts to be successfully | ||
7922 | // shared with group. In fact, this whole block of permissions checking should move to an IPermissionsModule | ||
7923 | if (part.OwnerID != AgentId) | ||
7924 | { | ||
7925 | m_log.WarnFormat( | ||
7926 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}", | ||
7927 | Name, requestID, itemID, taskID, part.OwnerID); | ||
7928 | return true; | ||
7929 | } | ||
7930 | 7918 | ||
7931 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | 7919 | //m_log.DebugFormat( |
7932 | { | 7920 | // "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", |
7933 | m_log.WarnFormat( | 7921 | // requestID, itemID, taskID, Name); |
7934 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", | ||
7935 | Name, requestID, itemID, taskID); | ||
7936 | return true; | ||
7937 | } | ||
7938 | 7922 | ||
7939 | if (tii.OwnerID != AgentId) | 7923 | //m_log.Debug("Transfer Request: " + transfer.ToString()); |
7940 | { | 7924 | // Validate inventory transfers |
7941 | m_log.WarnFormat( | 7925 | // Has to be done here, because AssetCache can't do it |
7942 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", | 7926 | // |
7943 | Name, requestID, itemID, taskID, tii.OwnerID); | 7927 | if (taskID != UUID.Zero) // Prim |
7944 | return true; | 7928 | { |
7945 | } | 7929 | SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); |
7946 | 7930 | ||
7947 | if (( | 7931 | if (part == null) |
7948 | tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | 7932 | { |
7949 | != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | 7933 | m_log.WarnFormat( |
7950 | { | 7934 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", |
7951 | m_log.WarnFormat( | 7935 | Name, requestID, itemID, taskID); |
7952 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", | 7936 | return; |
7953 | Name, requestID, itemID, taskID); | 7937 | } |
7954 | return true; | ||
7955 | } | ||
7956 | 7938 | ||
7957 | if (tii.AssetID != requestID) | 7939 | TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID); |
7958 | { | 7940 | if (tii == null) |
7959 | m_log.WarnFormat( | 7941 | { |
7960 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", | 7942 | m_log.WarnFormat( |
7961 | Name, requestID, itemID, taskID, tii.AssetID); | 7943 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", |
7962 | return true; | 7944 | Name, requestID, itemID, taskID); |
7963 | } | 7945 | return; |
7964 | } | 7946 | } |
7947 | |||
7948 | if (tii.Type == (int)AssetType.LSLText) | ||
7949 | { | ||
7950 | if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId)) | ||
7951 | return; | ||
7952 | } | ||
7953 | else if (tii.Type == (int)AssetType.Notecard) | ||
7954 | { | ||
7955 | if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId)) | ||
7956 | return; | ||
7957 | } | ||
7958 | else | ||
7959 | { | ||
7960 | // TODO: Change this code to allow items other than notecards and scripts to be successfully | ||
7961 | // shared with group. In fact, this whole block of permissions checking should move to an IPermissionsModule | ||
7962 | if (part.OwnerID != AgentId) | ||
7963 | { | ||
7964 | m_log.WarnFormat( | ||
7965 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}", | ||
7966 | Name, requestID, itemID, taskID, part.OwnerID); | ||
7967 | return; | ||
7965 | } | 7968 | } |
7966 | else // Agent | 7969 | |
7970 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | ||
7967 | { | 7971 | { |
7968 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 7972 | m_log.WarnFormat( |
7969 | if (invAccess != null) | 7973 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", |
7970 | { | 7974 | Name, requestID, itemID, taskID); |
7971 | if (!invAccess.CanGetAgentInventoryItem(this, itemID, requestID)) | 7975 | return; |
7972 | return false; | 7976 | } |
7973 | } | 7977 | |
7974 | else | 7978 | if (tii.OwnerID != AgentId) |
7975 | { | 7979 | { |
7976 | return false; | 7980 | m_log.WarnFormat( |
7977 | } | 7981 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", |
7982 | Name, requestID, itemID, taskID, tii.OwnerID); | ||
7983 | return; | ||
7984 | } | ||
7985 | |||
7986 | if (( | ||
7987 | tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | ||
7988 | != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | ||
7989 | { | ||
7990 | m_log.WarnFormat( | ||
7991 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", | ||
7992 | Name, requestID, itemID, taskID); | ||
7993 | return; | ||
7994 | } | ||
7995 | |||
7996 | if (tii.AssetID != requestID) | ||
7997 | { | ||
7998 | m_log.WarnFormat( | ||
7999 | "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", | ||
8000 | Name, requestID, itemID, taskID, tii.AssetID); | ||
8001 | return; | ||
7978 | } | 8002 | } |
7979 | } | 8003 | } |
7980 | } | 8004 | } |
7981 | else | 8005 | else // Agent |
7982 | if (transfer.TransferInfo.SourceType == (int)SourceType.SimEstate) | 8006 | { |
8007 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
8008 | if (invAccess != null) | ||
8009 | { | ||
8010 | if (!invAccess.CanGetAgentInventoryItem(this, itemID, requestID)) | ||
8011 | return; | ||
8012 | } | ||
8013 | else | ||
7983 | { | 8014 | { |
7984 | //TransferRequestPacket does not include covenant uuid? | 8015 | return; |
7985 | //get scene covenant uuid | ||
7986 | taskID = m_scene.RegionInfo.RegionSettings.Covenant; | ||
7987 | } | 8016 | } |
8017 | } | ||
7988 | 8018 | ||
8019 | // Permissions out of the way, let's request the asset | ||
7989 | MakeAssetRequest(transfer, taskID); | 8020 | MakeAssetRequest(transfer, taskID); |
7990 | 8021 | ||
7991 | return true; | ||
7992 | } | 8022 | } |
7993 | 8023 | ||
8024 | |||
7994 | private bool HandleAssetUploadRequest(IClientAPI sender, Packet Pack) | 8025 | private bool HandleAssetUploadRequest(IClientAPI sender, Packet Pack) |
7995 | { | 8026 | { |
7996 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | 8027 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; |
@@ -12378,7 +12409,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12378 | ClientInfo info = m_udpClient.GetClientInfo(); | 12409 | ClientInfo info = m_udpClient.GetClientInfo(); |
12379 | 12410 | ||
12380 | info.proxyEP = null; | 12411 | info.proxyEP = null; |
12381 | info.agentcircuit = RequestClientInfo(); | 12412 | if (info.agentcircuit == null) |
12413 | info.agentcircuit = RequestClientInfo(); | ||
12382 | 12414 | ||
12383 | return info; | 12415 | return info; |
12384 | } | 12416 | } |