aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2017-01-05 18:02:59 +0000
committerUbitUmarov2017-01-05 18:02:59 +0000
commitcbc3501246d5250788634f6d1b6fbd1f60661c85 (patch)
tree5983ff6f4c0ce5bce469c6b1257b9b60069cf79f
parent a few changes to estates port handling (diff)
downloadopensim-SC_OLD-cbc3501246d5250788634f6d1b6fbd1f60661c85.zip
opensim-SC_OLD-cbc3501246d5250788634f6d1b6fbd1f60661c85.tar.gz
opensim-SC_OLD-cbc3501246d5250788634f6d1b6fbd1f60661c85.tar.bz2
opensim-SC_OLD-cbc3501246d5250788634f6d1b6fbd1f60661c85.tar.xz
a few changes to Gods ( ie administrators) control
-rw-r--r--OpenSim/Framework/IClientAPI.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs48
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs125
-rw-r--r--OpenSim/Region/Framework/Interfaces/IGodsModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs36
5 files changed, 99 insertions, 119 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index c4de81e..1541b3a 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -227,10 +227,10 @@ namespace OpenSim.Framework
227 byte RayEndIsIntersection); 227 byte RayEndIsIntersection);
228 228
229 public delegate void RequestGodlikePowers( 229 public delegate void RequestGodlikePowers(
230 UUID AgentID, UUID SessionID, UUID token, bool GodLike, IClientAPI remote_client); 230 UUID AgentID, UUID SessionID, UUID token, bool GodLike);
231 231
232 public delegate void GodKickUser( 232 public delegate void GodKickUser(
233 UUID GodAgentID, UUID GodSessionID, UUID AgentID, uint kickflags, byte[] reason); 233 UUID GodAgentID, UUID AgentID, uint kickflags, byte[] reason);
234 234
235 public delegate void CreateInventoryFolder( 235 public delegate void CreateInventoryFolder(
236 IClientAPI remoteClient, UUID folderID, ushort folderType, string folderName, UUID parentID); 236 IClientAPI remoteClient, UUID folderID, ushort folderType, string folderName, UUID parentID);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 55050d9..27ca740 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -10455,6 +10455,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10455 private bool HandleRequestGodlikePowers(IClientAPI sender, Packet Pack) 10455 private bool HandleRequestGodlikePowers(IClientAPI sender, Packet Pack)
10456 { 10456 {
10457 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack; 10457 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
10458
10459 if (rglpPack.AgentData.SessionID != SessionId ||
10460 rglpPack.AgentData.AgentID != AgentId)
10461 return true;
10462
10458 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock; 10463 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock;
10459 UUID token = rblock.Token; 10464 UUID token = rblock.Token;
10460 10465
@@ -10464,7 +10469,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10464 10469
10465 if (handlerReqGodlikePowers != null) 10470 if (handlerReqGodlikePowers != null)
10466 { 10471 {
10467 handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike, this); 10472 handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike);
10468 } 10473 }
10469 10474
10470 return true; 10475 return true;
@@ -10475,6 +10480,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10475 GodUpdateRegionInfoPacket GodUpdateRegionInfo = 10480 GodUpdateRegionInfoPacket GodUpdateRegionInfo =
10476 (GodUpdateRegionInfoPacket)Packet; 10481 (GodUpdateRegionInfoPacket)Packet;
10477 10482
10483 if (GodUpdateRegionInfo.AgentData.SessionID != SessionId ||
10484 GodUpdateRegionInfo.AgentData.AgentID != AgentId)
10485 return true;
10486
10478 GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdate; 10487 GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdate;
10479 if (handlerGodUpdateRegionInfo != null) 10488 if (handlerGodUpdateRegionInfo != null)
10480 { 10489 {
@@ -10508,6 +10517,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10508 GodlikeMessagePacket GodlikeMessage = 10517 GodlikeMessagePacket GodlikeMessage =
10509 (GodlikeMessagePacket)Packet; 10518 (GodlikeMessagePacket)Packet;
10510 10519
10520 if (GodlikeMessage.AgentData.SessionID != SessionId ||
10521 GodlikeMessage.AgentData.AgentID != AgentId)
10522 return true;
10523
10511 GodlikeMessage handlerGodlikeMessage = onGodlikeMessage; 10524 GodlikeMessage handlerGodlikeMessage = onGodlikeMessage;
10512 if (handlerGodlikeMessage != null) 10525 if (handlerGodlikeMessage != null)
10513 { 10526 {
@@ -10524,6 +10537,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10524 { 10537 {
10525 StateSavePacket SaveStateMessage = 10538 StateSavePacket SaveStateMessage =
10526 (StateSavePacket)Packet; 10539 (StateSavePacket)Packet;
10540
10541 if (SaveStateMessage.AgentData.SessionID != SessionId ||
10542 SaveStateMessage.AgentData.AgentID != AgentId)
10543 return true;
10544
10527 SaveStateHandler handlerSaveStatePacket = OnSaveState; 10545 SaveStateHandler handlerSaveStatePacket = OnSaveState;
10528 if (handlerSaveStatePacket != null) 10546 if (handlerSaveStatePacket != null)
10529 { 10547 {
@@ -10537,30 +10555,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10537 { 10555 {
10538 GodKickUserPacket gkupack = (GodKickUserPacket)Pack; 10556 GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
10539 10557
10540 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID) 10558 if (gkupack.UserInfo.GodSessionID != SessionId ||
10541 { 10559 gkupack.UserInfo.GodID != AgentId)
10542 GodKickUser handlerGodKickUser = OnGodKickUser; 10560 return true;
10543 if (handlerGodKickUser != null) 10561
10544 { 10562 GodKickUser handlerGodKickUser = OnGodKickUser;
10545 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, 10563 if (handlerGodKickUser != null)
10546 gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason);
10547 }
10548 }
10549 else
10550 { 10564 {
10551 SendAgentAlertMessage("Kick request denied", false); 10565 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason);
10552 } 10566 }
10553 //KickUserPacket kupack = new KickUserPacket();
10554 //KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo;
10555
10556 //kupack.UserInfo.AgentID = gkupack.UserInfo.AgentID;
10557 //kupack.UserInfo.SessionID = gkupack.UserInfo.GodSessionID;
10558
10559 //kupack.TargetBlock.TargetIP = (uint)0;
10560 //kupack.TargetBlock.TargetPort = (ushort)0;
10561 //kupack.UserInfo.Reason = gkupack.UserInfo.Reason;
10562 10567
10563 //OutPacket(kupack, ThrottleOutPacketType.Task);
10564 return true; 10568 return true;
10565 } 10569 }
10566 #endregion GodPackets 10570 #endregion GodPackets
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index e0c4924..db02379 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
152 if (god == null || god.ControllingClient.SessionId != godSessionID) 152 if (god == null || god.ControllingClient.SessionId != godSessionID)
153 return String.Empty; 153 return String.Empty;
154 154
155 KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason)); 155 KickUser(godID, agentID, kickFlags, Util.StringToBytes1024(reason));
156 } 156 }
157 else 157 else
158 { 158 {
@@ -162,59 +162,53 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
162 } 162 }
163 163
164 public void RequestGodlikePowers( 164 public void RequestGodlikePowers(
165 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) 165 UUID agentID, UUID sessionID, UUID token, bool godLike)
166 { 166 {
167 ScenePresence sp = m_scene.GetScenePresence(agentID); 167 ScenePresence sp = m_scene.GetScenePresence(agentID);
168 if(sp == null || sp.IsDeleted || sp.isNPC)
169 return;
168 170
169 if (sp != null) 171 if (sessionID != sp.ControllingClient.SessionId)
170 { 172 return;
171 if (godLike == false)
172 {
173 sp.GrantGodlikePowers(agentID, sessionID, token, godLike);
174 return;
175 }
176 173
177 // First check that this is the sim owner 174 sp.GrantGodlikePowers(token, godLike);
178 if (m_scene.Permissions.IsGod(agentID)) 175
179 { 176 if (godLike && sp.GodLevel < 200 && DialogModule != null)
180 // Next we check for spoofing..... 177 DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
181 UUID testSessionID = sp.ControllingClient.SessionId;
182 if (sessionID == testSessionID)
183 {
184 if (sessionID == controllingClient.SessionId)
185 {
186 //m_log.Info("godlike: " + godLike.ToString());
187 sp.GrantGodlikePowers(agentID, testSessionID, token, godLike);
188 }
189 }
190 }
191 else
192 {
193 if (DialogModule != null)
194 DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
195 }
196 }
197 } 178 }
198 179
199 /// <summary> 180 /// <summary>
200 /// Kicks User specified from the simulator. This logs them off of the grid 181 /// Kicks or freezes User specified from the simulator. This logs them off of the grid
201 /// If the client gets the UUID: 44e87126e7944ded05b37c42da3d5cdb it assumes
202 /// that you're kicking it even if the avatar's UUID isn't the UUID that the
203 /// agent is assigned
204 /// </summary> 182 /// </summary>
205 /// <param name="godID">The person doing the kicking</param> 183 /// <param name="godID">The person doing the kicking</param>
206 /// <param name="sessionID">The session of the person doing the kicking</param>
207 /// <param name="agentID">the person that is being kicked</param> 184 /// <param name="agentID">the person that is being kicked</param>
208 /// <param name="kickflags">Tells what to do to the user</param> 185 /// <param name="kickflags">Tells what to do to the user</param>
209 /// <param name="reason">The message to send to the user after it's been turned into a field</param> 186 /// <param name="reason">The message to send to the user after it's been turned into a field</param>
210 public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) 187 public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason)
211 { 188 {
212 if (!m_scene.Permissions.IsGod(godID)) 189 // assuming automatic god rights on this for fast griefing reaction
190 // this is also needed for kick via message
191 if(!m_scene.Permissions.IsGod(godID))
213 return; 192 return;
214 193
215 ScenePresence sp = m_scene.GetScenePresence(agentID); 194 int godlevel = 200;
195 // update level so higher gods can kick lower ones
196 ScenePresence god = m_scene.GetScenePresence(godID);
197 if(god != null && god.GodLevel > godlevel)
198 godlevel = god.GodLevel;
216 199
217 if (sp == null && agentID != ALL_AGENTS) 200 if(agentID == ALL_AGENTS)
201 {
202 m_scene.ForEachRootScenePresence(delegate(ScenePresence p)
203 {
204 if (p.UUID != godID && godlevel > p.GodLevel)
205 doKickmodes(godID, p, kickflags, reason);
206 });
207 return;
208 }
209
210 ScenePresence sp = m_scene.GetScenePresence(agentID);
211 if (sp == null || sp.IsChildAgent)
218 { 212 {
219 IMessageTransferModule transferModule = 213 IMessageTransferModule transferModule =
220 m_scene.RequestModuleInterface<IMessageTransferModule>(); 214 m_scene.RequestModuleInterface<IMessageTransferModule>();
@@ -230,48 +224,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
230 return; 224 return;
231 } 225 }
232 226
227 if (godlevel <= sp.GodLevel) // no god wars
228 return;
229
230 if(sp.UUID == godID)
231 return;
232
233 doKickmodes(godID, sp, kickflags, reason);
234 }
235
236 private void doKickmodes(UUID godID, ScenePresence sp, uint kickflags, byte[] reason)
237 {
233 switch (kickflags) 238 switch (kickflags)
234 { 239 {
235 case 0: 240 case 0:
236 if (sp != null)
237 {
238 KickPresence(sp, Utils.BytesToString(reason)); 241 KickPresence(sp, Utils.BytesToString(reason));
239 } 242 break;
240 else if (agentID == ALL_AGENTS) 243 case 1:
241 {
242 m_scene.ForEachRootScenePresence(
243 delegate(ScenePresence p)
244 {
245 if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID)))
246 KickPresence(p, Utils.BytesToString(reason));
247 }
248 );
249 }
250 break;
251 case 1:
252 if (sp != null)
253 {
254 sp.AllowMovement = false; 244 sp.AllowMovement = false;
255 m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); 245 m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason));
256 m_dialogModule.SendAlertToUser(godID, "User Frozen"); 246 m_dialogModule.SendAlertToUser(godID, "User Frozen");
257 } 247 break;
258 break; 248 case 2:
259 case 2:
260 if (sp != null)
261 {
262 sp.AllowMovement = true; 249 sp.AllowMovement = true;
263 m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); 250 m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason));
264 m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); 251 m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
265 } 252 break;
266 break; 253 default:
267 default: 254 break;
268 break;
269 } 255 }
270 } 256 }
271 257
258
272 private void KickPresence(ScenePresence sp, string reason) 259 private void KickPresence(ScenePresence sp, string reason)
273 { 260 {
274 if (sp.IsChildAgent) 261 if(sp.IsDeleted || sp.IsChildAgent)
275 return; 262 return;
276 sp.ControllingClient.Kick(reason); 263 sp.ControllingClient.Kick(reason);
277 sp.Scene.CloseAgent(sp.UUID, true); 264 sp.Scene.CloseAgent(sp.UUID, true);
@@ -286,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
286 UUID godID = new UUID(msg.fromAgentID); 273 UUID godID = new UUID(msg.fromAgentID);
287 uint kickMode = (uint)msg.binaryBucket[0]; 274 uint kickMode = (uint)msg.binaryBucket[0];
288 275
289 KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason)); 276 KickUser(godID, agentID, kickMode, Util.StringToBytes1024(reason));
290 } 277 }
291 } 278 }
292 } 279 }
diff --git a/OpenSim/Region/Framework/Interfaces/IGodsModule.cs b/OpenSim/Region/Framework/Interfaces/IGodsModule.cs
index 552ce01..1cb9a30 100644
--- a/OpenSim/Region/Framework/Interfaces/IGodsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IGodsModule.cs
@@ -43,16 +43,15 @@ namespace OpenSim.Region.Framework.Interfaces
43 /// <param name="token"></param> 43 /// <param name="token"></param>
44 /// <param name="godLike"></param> 44 /// <param name="godLike"></param>
45 /// <param name="controllingClient"></param> 45 /// <param name="controllingClient"></param>
46 void RequestGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient); 46 void RequestGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godLike);
47 47
48 /// <summary> 48 /// <summary>
49 /// Kicks User specified from the simulator. This logs them off of the grid. 49 /// Kicks User specified from the simulator. This logs them off of the grid.
50 /// </summary> 50 /// </summary>
51 /// <param name="godID">The person doing the kicking</param> 51 /// <param name="godID">The person doing the kicking</param>
52 /// <param name="sessionID">The session of the person doing the kicking</param>
53 /// <param name="agentID">the person that is being kicked</param> 52 /// <param name="agentID">the person that is being kicked</param>
54 /// <param name="kickflags">This isn't used apparently</param> 53 /// <param name="kickflags">This isn't used apparently</param>
55 /// <param name="reason">The message to send to the user after it's been turned into a field</param> 54 /// <param name="reason">The message to send to the user after it's been turned into a field</param>
56 void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason); 55 void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason);
57 } 56 }
58} 57}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f906d9f..c1b1a63 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -4506,34 +4506,22 @@ namespace OpenSim.Region.Framework.Scenes
4506 #endregion 4506 #endregion
4507 4507
4508 /// <summary> 4508 /// <summary>
4509 /// This allows the Sim owner the abiility to kick users from their sim currently. 4509 /// handle god level requests.
4510 /// It tells the client that the agent has permission to do so.
4511 /// </summary> 4510 /// </summary>
4512 public void GrantGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godStatus) 4511 public void GrantGodlikePowers(UUID token, bool godStatus)
4513 { 4512 {
4514 int oldgodlevel = GodLevel; 4513 int oldgodlevel = GodLevel;
4515 4514
4516 if (godStatus) 4515 if (godStatus && !isNPC && m_scene.Permissions.IsGod(UUID))
4517 { 4516 {
4518 // For now, assign god level 200 to anyone 4517 GodLevel = 200;
4519 // who is granted god powers, but has no god level set. 4518 if(GodLevel < UserLevel)
4520 // 4519 GodLevel = UserLevel;
4521 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID);
4522 if (account != null)
4523 {
4524 if (account.UserLevel > 0)
4525 GodLevel = account.UserLevel;
4526 else
4527 GodLevel = 200;
4528 }
4529 } 4520 }
4530 else 4521 else
4531 { 4522 GodLevel = 0;
4532 GodLevel = 0;
4533 }
4534 4523
4535 ControllingClient.SendAdminResponse(token, (uint)GodLevel); 4524 ControllingClient.SendAdminResponse(token, (uint)GodLevel);
4536
4537 if(oldgodlevel != GodLevel) 4525 if(oldgodlevel != GodLevel)
4538 parcelGodCheck(m_currentParcelUUID, GodLevel >= 200); 4526 parcelGodCheck(m_currentParcelUUID, GodLevel >= 200);
4539 } 4527 }
@@ -4640,7 +4628,7 @@ namespace OpenSim.Region.Framework.Scenes
4640 cAgent.BodyRotation = Rotation; 4628 cAgent.BodyRotation = Rotation;
4641 cAgent.ControlFlags = (uint)m_AgentControlFlags; 4629 cAgent.ControlFlags = (uint)m_AgentControlFlags;
4642 4630
4643 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) 4631 if (GodLevel > 200 && m_scene.Permissions.IsGod(cAgent.AgentID))
4644 cAgent.GodLevel = (byte)GodLevel; 4632 cAgent.GodLevel = (byte)GodLevel;
4645 else 4633 else
4646 cAgent.GodLevel = (byte) 0; 4634 cAgent.GodLevel = (byte) 0;
@@ -4741,10 +4729,12 @@ namespace OpenSim.Region.Framework.Scenes
4741 Rotation = cAgent.BodyRotation; 4729 Rotation = cAgent.BodyRotation;
4742 m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; 4730 m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags;
4743 4731
4744 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) 4732 if (cAgent.GodLevel >200 && m_scene.Permissions.IsGod(cAgent.AgentID))
4745 GodLevel = cAgent.GodLevel; 4733 GodLevel = cAgent.GodLevel;
4746 SetAlwaysRun = cAgent.AlwaysRun; 4734 else
4735 GodLevel = 0;
4747 4736
4737 SetAlwaysRun = cAgent.AlwaysRun;
4748 4738
4749 Appearance = new AvatarAppearance(cAgent.Appearance); 4739 Appearance = new AvatarAppearance(cAgent.Appearance);
4750/* 4740/*