From 52714c339e49e8f1f839b315cd6b4da1bb53e82a Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 24 Nov 2007 01:38:36 +0000 Subject: * Hanling RequestGodlikePowers. On Request.. sends the sim owner's client the appropriate messages to make it think it's got god status. Will be used for finding more unimplemented packets.... --- OpenSim/Framework/IClientAPI.cs | 5 ++++ OpenSim/Region/ClientStack/ClientView.API.cs | 3 +- .../ClientStack/ClientView.ProcessPackets.cs | 22 ++++----------- OpenSim/Region/Environment/Scenes/Scene.cs | 32 ++++++++++++++++++++++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 19 +++++++++++++ .../Region/Examples/SimpleApp/MyNpcCharacter.cs | 1 + 6 files changed, 64 insertions(+), 18 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 2c82d97..f7e3521 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -267,6 +267,8 @@ namespace OpenSim.Framework public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape); + public delegate void RequestGodlikePowers(LLUUID AgentID, LLUUID SessionID, LLUUID token, IClientAPI remote_client); + public delegate void CreateInventoryFolder( IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); @@ -329,6 +331,9 @@ namespace OpenSim.Framework event AvatarPickerRequest OnAvatarPickerRequest; event Action OnRequestAvatarsData; event AddNewPrim OnAddPrim; + + event RequestGodlikePowers OnRequestGodlikePowers; + event ObjectDuplicate OnObjectDuplicate; event UpdateVector OnGrabObject; event ObjectSelect OnDeGrabObject; diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 9182b5c..b046f0a 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -65,6 +65,7 @@ namespace OpenSim.Region.ClientStack public event ObjectDuplicate OnObjectDuplicate; public event MoveObject OnGrabUpdate; public event AddNewPrim OnAddPrim; + public event RequestGodlikePowers OnRequestGodlikePowers; public event ObjectExtraParams OnUpdateExtraParams; public event UpdateShape OnUpdatePrimShape; public event ObjectSelect OnObjectSelect; @@ -246,7 +247,7 @@ namespace OpenSim.Region.ClientStack OutPacket(reply, ThrottleOutPacketType.Task); } - + /// /// /// diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 64f5b6d..ca7ba7f 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -1066,25 +1066,13 @@ namespace OpenSim.Region.ClientStack #region unimplemented handlers case PacketType.RequestGodlikePowers: - //RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket) Pack; - //RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock; - //LLUUID token = rblock.Token; - //RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData; + RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket) Pack; + RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock; + LLUUID token = rblock.Token; + RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData; + OnRequestGodlikePowers(ablock.AgentID, ablock.SessionID, token, this); - //GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket(); - //GrantGodlikePowersPacket.GrantDataBlock gdb = new GrantGodlikePowersPacket.GrantDataBlock(); - //GrantGodlikePowersPacket.AgentDataBlock adb = new GrantGodlikePowersPacket.AgentDataBlock(); - - //adb.AgentID = ablock.AgentID; - //adb.SessionID = ablock.SessionID; - - //gdb.GodLevel = (byte)100; - //gdb.Token = token; - //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; - //respondPacket.GrantData = gdb; - //respondPacket.AgentData = adb; - //OutPacket(respondPacket, ThrottleOutPacketType.Task); break; case PacketType.GodKickUser: //GodKickUserPacket gkupack = (GodKickUserPacket) Pack; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7bcd7bd..234b12a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -830,6 +830,7 @@ namespace OpenSim.Region.Environment.Scenes new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); + client.OnRequestGodlikePowers += handleRequestGodlikePowers; client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryFolder += CommsManager.UserProfileCache.HandleCreateInventoryFolder; @@ -1177,6 +1178,37 @@ namespace OpenSim.Region.Environment.Scenes } } + public void handleRequestGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, IClientAPI controllingclient) + { + // First check that this is the sim owner + + if (agentID == RegionInfo.MasterAvatarAssignedUUID) + { + + // User needs to be logged into this sim + if (m_scenePresences.ContainsKey(agentID)) + { + // Next we check for spoofing..... + LLUUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; + if (sessionID == testSessionID) + { + if (sessionID == controllingclient.SessionId) + { + m_scenePresences[agentID].GrantGodlikePowers(agentID, testSessionID, token); + + } + + } + + } + } + else + { + m_scenePresences[agentID].ControllingClient.SendAgentAlertMessage("Request for god powers denied", false); + } + + } + public void SendAlertToUser(string firstName, string lastName, string message, bool modal) { foreach (ScenePresence presence in m_scenePresences.Values) diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 0cc3a7e..f91913d 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1233,6 +1233,25 @@ namespace OpenSim.Region.Environment.Scenes ControllingClient.OutPacket(kupack, ThrottleOutPacketType.Task); } + public void GrantGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token) + { + GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket(); + GrantGodlikePowersPacket.GrantDataBlock gdb = new GrantGodlikePowersPacket.GrantDataBlock(); + GrantGodlikePowersPacket.AgentDataBlock adb = new GrantGodlikePowersPacket.AgentDataBlock(); + + adb.AgentID = agentID; + adb.SessionID = sessionID; // More security + + gdb.GodLevel = (byte)100; + gdb.Token = token; + //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; + respondPacket.GrantData = gdb; + respondPacket.AgentData = adb; + ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task); + + + + } /// /// /// diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 65c8ee7..b8800a8 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -75,6 +75,7 @@ namespace SimpleApp public event AvatarPickerRequest OnAvatarPickerRequest; public event Action OnRequestAvatarsData; public event AddNewPrim OnAddPrim; + public event RequestGodlikePowers OnRequestGodlikePowers; public event ObjectDuplicate OnObjectDuplicate; public event UpdateVector OnGrabObject; public event ObjectSelect OnDeGrabObject; -- cgit v1.1