diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 390 |
1 files changed, 192 insertions, 198 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9061244..97b11c7 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4060,7 +4060,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4060 | return false; | 4060 | return false; |
4061 | } | 4061 | } |
4062 | 4062 | ||
4063 | ILandObject land; | ||
4064 | ScenePresence sp; | 4063 | ScenePresence sp; |
4065 | 4064 | ||
4066 | lock (m_removeClientLock) | 4065 | lock (m_removeClientLock) |
@@ -4166,28 +4165,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4166 | // If the checks fail, we remove the circuit. | 4165 | // If the checks fail, we remove the circuit. |
4167 | acd.teleportFlags = teleportFlags; | 4166 | acd.teleportFlags = teleportFlags; |
4168 | 4167 | ||
4169 | // Remove any preexisting circuit - we don't want duplicates | ||
4170 | // This is a stab at preventing avatar "ghosting" | ||
4171 | if (vialogin) | ||
4172 | m_authenticateHandler.RemoveCircuit(acd.AgentID); | ||
4173 | |||
4174 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); | ||
4175 | |||
4176 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); | ||
4177 | |||
4178 | // On login test land permisions | ||
4179 | if (vialogin) | 4168 | if (vialogin) |
4180 | { | 4169 | { |
4181 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); | 4170 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
4182 | if (cache != null) | 4171 | if (cache != null) |
4183 | cache.Remove(acd.firstname + " " + acd.lastname); | 4172 | cache.Remove(acd.firstname + " " + acd.lastname); |
4184 | if (land != null && !TestLandRestrictions(acd.AgentID, out reason, ref acd.startpos.X, ref acd.startpos.Y)) | 4173 | |
4185 | { | 4174 | // Remove any preexisting circuit - we don't want duplicates |
4186 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 4175 | // This is a stab at preventing avatar "ghosting" |
4187 | return false; | 4176 | m_authenticateHandler.RemoveCircuit(acd.AgentID); |
4188 | } | ||
4189 | } | 4177 | } |
4190 | 4178 | ||
4179 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); | ||
4180 | |||
4191 | if (sp == null) // We don't have an [child] agent here already | 4181 | if (sp == null) // We don't have an [child] agent here already |
4192 | { | 4182 | { |
4193 | if (requirePresenceLookup) | 4183 | if (requirePresenceLookup) |
@@ -4271,92 +4261,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
4271 | CapsModule.ActivateCaps(acd.circuitcode); | 4261 | CapsModule.ActivateCaps(acd.circuitcode); |
4272 | } | 4262 | } |
4273 | 4263 | ||
4274 | if (vialogin) | 4264 | // if (vialogin) |
4275 | { | 4265 | // { |
4276 | // CleanDroppedAttachments(); | 4266 | // CleanDroppedAttachments(); |
4267 | // } | ||
4277 | 4268 | ||
4278 | // Make sure avatar position is in the region (why it wouldn't be is a mystery but do sanity checking) | 4269 | // Make sure avatar position is in the region (why it wouldn't be is a mystery but do sanity checking) |
4279 | if (acd.startpos.X < 0) acd.startpos.X = 1f; | 4270 | if (acd.startpos.X < 0) |
4280 | if (acd.startpos.X >= RegionInfo.RegionSizeX) acd.startpos.X = RegionInfo.RegionSizeX - 1f; | 4271 | acd.startpos.X = 1f; |
4281 | if (acd.startpos.Y < 0) acd.startpos.Y = 1f; | 4272 | else if (acd.startpos.X >= RegionInfo.RegionSizeX) |
4282 | if (acd.startpos.Y >= RegionInfo.RegionSizeY) acd.startpos.Y = RegionInfo.RegionSizeY - 1f; | 4273 | acd.startpos.X = RegionInfo.RegionSizeX - 1f; |
4283 | 4274 | if (acd.startpos.Y < 0) | |
4284 | // m_log.DebugFormat( | 4275 | acd.startpos.Y = 1f; |
4285 | // "[SCENE]: Found telehub object {0} for new user connection {1} to {2}", | 4276 | else if (acd.startpos.Y >= RegionInfo.RegionSizeY) |
4286 | // RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4277 | acd.startpos.Y = RegionInfo.RegionSizeY - 1f; |
4287 | 4278 | ||
4288 | // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags | 4279 | // only check access, actual relocations will happen later on ScenePresence MakeRoot |
4289 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && | 4280 | // allow child agents creation |
4290 | RegionInfo.EstateSettings.AllowDirectTeleport == false && | 4281 | if(!godlike || teleportFlags != (uint) TPFlags.Default) |
4291 | !viahome && !godlike) | 4282 | { |
4292 | { | 4283 | bool checkTeleHub; |
4293 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); | 4284 | |
4294 | 4285 | // don't check hubs if via home or via lure | |
4295 | if (telehub != null) | 4286 | if((teleportFlags & (uint) TPFlags.ViaHome) != 0 |
4296 | { | 4287 | || (teleportFlags & (uint) TPFlags.ViaLure) != 0) |
4297 | // Can have multiple SpawnPoints | 4288 | checkTeleHub = false; |
4298 | List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); | 4289 | else |
4299 | if (spawnpoints.Count > 1) | 4290 | checkTeleHub = vialogin |
4300 | { | 4291 | || (TelehubAllowLandmarks == true ? false : ((teleportFlags & (uint)TPFlags.ViaLandmark) != 0 )) |
4301 | // We have multiple SpawnPoints, Route the agent to a random or sequential one | 4292 | || (teleportFlags & (uint) TPFlags.ViaLocation) != 0; |
4302 | if (SpawnPointRouting == "random") | 4293 | |
4303 | acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( | 4294 | if(!CheckLandPositionAccess(acd.AgentID, true, checkTeleHub, acd.startpos, out reason)) |
4304 | telehub.AbsolutePosition, | ||
4305 | telehub.GroupRotation | ||
4306 | ); | ||
4307 | else | ||
4308 | acd.startpos = spawnpoints[SpawnPoint()].GetLocation( | ||
4309 | telehub.AbsolutePosition, | ||
4310 | telehub.GroupRotation | ||
4311 | ); | ||
4312 | } | ||
4313 | else if (spawnpoints.Count == 1) | ||
4314 | { | ||
4315 | // We have a single SpawnPoint and will route the agent to it | ||
4316 | acd.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4317 | } | ||
4318 | else | ||
4319 | { | ||
4320 | m_log.DebugFormat( | ||
4321 | "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.", | ||
4322 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | ||
4323 | } | ||
4324 | } | ||
4325 | else | ||
4326 | { | ||
4327 | m_log.DebugFormat( | ||
4328 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", | ||
4329 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | ||
4330 | } | ||
4331 | |||
4332 | // Final permissions check; this time we don't allow changing the position | ||
4333 | if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason)) | ||
4334 | { | ||
4335 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | ||
4336 | return false; | ||
4337 | } | ||
4338 | |||
4339 | return true; | ||
4340 | } | ||
4341 | |||
4342 | // Honor parcel landing type and position. | ||
4343 | /* | ||
4344 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
4345 | if (land != null) | ||
4346 | { | 4295 | { |
4347 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4296 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
4348 | { | 4297 | return false; |
4349 | acd.startpos = land.LandData.UserLocation; | ||
4350 | |||
4351 | // Final permissions check; this time we don't allow changing the position | ||
4352 | if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason)) | ||
4353 | { | ||
4354 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | ||
4355 | return false; | ||
4356 | } | ||
4357 | } | ||
4358 | } | 4298 | } |
4359 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
4360 | } | 4299 | } |
4361 | 4300 | ||
4362 | return true; | 4301 | return true; |
@@ -4406,7 +4345,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4406 | if (nearestParcel != null) | 4345 | if (nearestParcel != null) |
4407 | { | 4346 | { |
4408 | //Move agent to nearest allowed | 4347 | //Move agent to nearest allowed |
4409 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4348 | Vector2 newPosition = GetParcelSafeCorner(nearestParcel); |
4410 | posX = newPosition.X; | 4349 | posX = newPosition.X; |
4411 | posY = newPosition.Y; | 4350 | posY = newPosition.Y; |
4412 | } | 4351 | } |
@@ -4468,8 +4407,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4468 | { | 4407 | { |
4469 | reason = String.Empty; | 4408 | reason = String.Empty; |
4470 | 4409 | ||
4471 | if (!m_strictAccessControl) return true; | 4410 | if (!m_strictAccessControl) |
4472 | if (Permissions.IsGod(agent.AgentID)) return true; | 4411 | return true; |
4412 | if (Permissions.IsGod(agent.AgentID)) | ||
4413 | return true; | ||
4473 | 4414 | ||
4474 | if (AuthorizationService != null) | 4415 | if (AuthorizationService != null) |
4475 | { | 4416 | { |
@@ -4489,99 +4430,85 @@ namespace OpenSim.Region.Framework.Scenes | |||
4489 | // the root is done elsewhere (QueryAccess) | 4430 | // the root is done elsewhere (QueryAccess) |
4490 | if (!bypassAccessControl) | 4431 | if (!bypassAccessControl) |
4491 | { | 4432 | { |
4492 | if (RegionInfo.EstateSettings != null) | 4433 | if(RegionInfo.EstateSettings == null) |
4493 | { | 4434 | { |
4494 | int flags = GetUserFlags(agent.AgentID); | 4435 | // something is broken? let it get in |
4495 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, flags)) | 4436 | m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!"); |
4496 | { | 4437 | return true; |
4497 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | ||
4498 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
4499 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", | ||
4500 | RegionInfo.RegionName); | ||
4501 | return false; | ||
4502 | } | ||
4503 | } | 4438 | } |
4504 | else | 4439 | |
4440 | // check estate ban | ||
4441 | int flags = GetUserFlags(agent.AgentID); | ||
4442 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, flags)) | ||
4505 | { | 4443 | { |
4506 | m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!"); | 4444 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
4445 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
4446 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", | ||
4447 | RegionInfo.RegionName); | ||
4448 | return false; | ||
4507 | } | 4449 | } |
4508 | 4450 | ||
4509 | List<UUID> agentGroups = new List<UUID>(); | 4451 | // public access |
4452 | if (RegionInfo.EstateSettings.PublicAccess) | ||
4453 | return true; | ||
4510 | 4454 | ||
4511 | if (m_groupsModule != null) | 4455 | // in access list / owner / manager |
4456 | if (RegionInfo.EstateSettings.HasAccess(agent.AgentID)) | ||
4457 | return true; | ||
4458 | |||
4459 | // finally test groups | ||
4460 | |||
4461 | if (m_groupsModule == null) // if no groups allow | ||
4462 | return true; | ||
4463 | |||
4464 | UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups; | ||
4465 | |||
4466 | if (estateGroups == null) | ||
4512 | { | 4467 | { |
4513 | GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID); | 4468 | m_log.ErrorFormat("[CONNECTION BEGIN]: Estate GroupMembership is null!"); |
4469 | return false; | ||
4470 | } | ||
4514 | 4471 | ||
4515 | if (GroupMembership != null) | 4472 | if(estateGroups.Length == 0) |
4516 | { | 4473 | { |
4517 | for (int i = 0; i < GroupMembership.Length; i++) | 4474 | return false; |
4518 | agentGroups.Add(GroupMembership[i].GroupID); | ||
4519 | } | ||
4520 | else | ||
4521 | { | ||
4522 | m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!"); | ||
4523 | } | ||
4524 | } | 4475 | } |
4525 | 4476 | ||
4526 | bool groupAccess = false; | 4477 | List<UUID> agentGroups = new List<UUID>(); |
4527 | UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups; | 4478 | GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID); |
4528 | 4479 | ||
4529 | if (estateGroups != null) | 4480 | if (GroupMembership == null) |
4530 | { | 4481 | { |
4531 | foreach (UUID group in estateGroups) | 4482 | m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!"); |
4532 | { | 4483 | return false; |
4533 | if (agentGroups.Contains(group)) | ||
4534 | { | ||
4535 | groupAccess = true; | ||
4536 | break; | ||
4537 | } | ||
4538 | } | ||
4539 | } | 4484 | } |
4540 | else | 4485 | |
4486 | if(GroupMembership.Length == 0) | ||
4487 | return false; | ||
4488 | |||
4489 | for (int i = 0; i < GroupMembership.Length; i++) | ||
4490 | agentGroups.Add(GroupMembership[i].GroupID); | ||
4491 | |||
4492 | bool groupAccess = false; | ||
4493 | foreach (UUID group in estateGroups) | ||
4541 | { | 4494 | { |
4542 | m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); | 4495 | if (agentGroups.Contains(group)) |
4496 | { | ||
4497 | groupAccess = true; | ||
4498 | break; | ||
4499 | } | ||
4543 | } | 4500 | } |
4544 | 4501 | ||
4545 | if (!RegionInfo.EstateSettings.PublicAccess && | 4502 | if (!groupAccess) |
4546 | !RegionInfo.EstateSettings.HasAccess(agent.AgentID) && | ||
4547 | !groupAccess) | ||
4548 | { | 4503 | { |
4549 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", | 4504 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", |
4550 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4505 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
4551 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | 4506 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", |
4552 | RegionInfo.RegionName); | 4507 | RegionInfo.RegionName); |
4553 | return false; | 4508 | return false; |
4554 | } | 4509 | } |
4555 | } | 4510 | } |
4556 | 4511 | ||
4557 | // TODO: estate/region settings are not properly hooked up | ||
4558 | // to ILandObject.isRestrictedFromLand() | ||
4559 | // if (null != LandChannel) | ||
4560 | // { | ||
4561 | // // region seems to have local Id of 1 | ||
4562 | // ILandObject land = LandChannel.GetLandObject(1); | ||
4563 | // if (null != land) | ||
4564 | // { | ||
4565 | // if (land.isBannedFromLand(agent.AgentID)) | ||
4566 | // { | ||
4567 | // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user has been banned from land", | ||
4568 | // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
4569 | // reason = String.Format("Denied access to private region {0}: You are banned from that region.", | ||
4570 | // RegionInfo.RegionName); | ||
4571 | // return false; | ||
4572 | // } | ||
4573 | |||
4574 | // if (land.isRestrictedFromLand(agent.AgentID)) | ||
4575 | // { | ||
4576 | // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", | ||
4577 | // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
4578 | // reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | ||
4579 | // RegionInfo.RegionName); | ||
4580 | // return false; | ||
4581 | // } | ||
4582 | // } | ||
4583 | // } | ||
4584 | |||
4585 | return true; | 4512 | return true; |
4586 | } | 4513 | } |
4587 | 4514 | ||
@@ -5951,6 +5878,14 @@ Environment.Exit(1); | |||
5951 | return LandChannel.AllParcels(); | 5878 | return LandChannel.AllParcels(); |
5952 | } | 5879 | } |
5953 | 5880 | ||
5881 | private Vector2 GetParcelSafeCorner(ILandObject parcel) | ||
5882 | { | ||
5883 | Vector3 start = parcel.StartPoint; | ||
5884 | float x = start.X + 2.0f; | ||
5885 | float y = start.Y + 2.0f; | ||
5886 | return new Vector2(x, y); | ||
5887 | } | ||
5888 | |||
5954 | private float GetParcelDistancefromPoint(ILandObject parcel, float x, float y) | 5889 | private float GetParcelDistancefromPoint(ILandObject parcel, float x, float y) |
5955 | { | 5890 | { |
5956 | return Vector2.Distance(new Vector2(x, y), GetParcelCenter(parcel)); | 5891 | return Vector2.Distance(new Vector2(x, y), GetParcelCenter(parcel)); |
@@ -5962,9 +5897,16 @@ Environment.Exit(1); | |||
5962 | int count = 0; | 5897 | int count = 0; |
5963 | int avgx = 0; | 5898 | int avgx = 0; |
5964 | int avgy = 0; | 5899 | int avgy = 0; |
5965 | for (int x = 0; x < RegionInfo.RegionSizeX; x++) | 5900 | Vector3 start = parcel.StartPoint; |
5901 | Vector3 end = parcel.EndPoint; | ||
5902 | int startX = (int) start.X; | ||
5903 | int startY = (int) start.Y; | ||
5904 | int endX = (int) end.X; | ||
5905 | int endY = (int) end.Y; | ||
5906 | |||
5907 | for (int x = startX; x < endX; x += 4) | ||
5966 | { | 5908 | { |
5967 | for (int y = 0; y < RegionInfo.RegionSizeY; y++) | 5909 | for (int y = startY; y < endY; y += 4) |
5968 | { | 5910 | { |
5969 | //Just keep a running average as we check if all the points are inside or not | 5911 | //Just keep a running average as we check if all the points are inside or not |
5970 | if (parcel.ContainsPoint(x, y)) | 5912 | if (parcel.ContainsPoint(x, y)) |
@@ -5983,6 +5925,7 @@ Environment.Exit(1); | |||
5983 | } | 5925 | } |
5984 | } | 5926 | } |
5985 | } | 5927 | } |
5928 | |||
5986 | return new Vector2(avgx, avgy); | 5929 | return new Vector2(avgx, avgy); |
5987 | } | 5930 | } |
5988 | 5931 | ||
@@ -6230,13 +6173,16 @@ Environment.Exit(1); | |||
6230 | reason = string.Empty; | 6173 | reason = string.Empty; |
6231 | 6174 | ||
6232 | if (Permissions.IsGod(agentID)) | 6175 | if (Permissions.IsGod(agentID)) |
6233 | { | ||
6234 | reason = String.Empty; | ||
6235 | return true; | 6176 | return true; |
6236 | } | ||
6237 | 6177 | ||
6238 | if (!AllowAvatarCrossing && !viaTeleport) | 6178 | if (!AllowAvatarCrossing && !viaTeleport) |
6179 | { | ||
6180 | reason = "Region Crossing not allowed"; | ||
6239 | return false; | 6181 | return false; |
6182 | } | ||
6183 | |||
6184 | bool isAdmin = Permissions.IsAdministrator(agentID); | ||
6185 | bool isManager = Permissions.IsEstateManager(agentID); | ||
6240 | 6186 | ||
6241 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 6187 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
6242 | // However, the long term fix is to make sure root agent count is always accurate. | 6188 | // However, the long term fix is to make sure root agent count is always accurate. |
@@ -6246,7 +6192,7 @@ Environment.Exit(1); | |||
6246 | 6192 | ||
6247 | if (num >= RegionInfo.RegionSettings.AgentLimit) | 6193 | if (num >= RegionInfo.RegionSettings.AgentLimit) |
6248 | { | 6194 | { |
6249 | if (!Permissions.IsAdministrator(agentID)) | 6195 | if (!(isAdmin || isManager)) |
6250 | { | 6196 | { |
6251 | reason = "The region is full"; | 6197 | reason = "The region is full"; |
6252 | 6198 | ||
@@ -6284,6 +6230,7 @@ Environment.Exit(1); | |||
6284 | if (!AuthorizeUser(aCircuit, false, out reason)) | 6230 | if (!AuthorizeUser(aCircuit, false, out reason)) |
6285 | { | 6231 | { |
6286 | //m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | 6232 | //m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); |
6233 | // reason = "Region authorization fail"; | ||
6287 | return false; | 6234 | return false; |
6288 | } | 6235 | } |
6289 | } | 6236 | } |
@@ -6293,53 +6240,101 @@ Environment.Exit(1); | |||
6293 | reason = "Error authorizing agent: " + e.Message; | 6240 | reason = "Error authorizing agent: " + e.Message; |
6294 | return false; | 6241 | return false; |
6295 | } | 6242 | } |
6243 | |||
6244 | // last check aditional land access restrictions and relocations | ||
6245 | // if crossing (viaTeleport false) check only the specified parcel | ||
6246 | return CheckLandPositionAccess(agentID, viaTeleport, true, position, out reason); | ||
6247 | } | ||
6248 | |||
6249 | // check access to land. | ||
6250 | public bool CheckLandPositionAccess(UUID agentID, bool agentRootCrossing, bool checkTeleHub, Vector3 position, out string reason) | ||
6251 | { | ||
6252 | reason = string.Empty; | ||
6296 | 6253 | ||
6297 | if (viaTeleport) | 6254 | if (Permissions.IsGod(agentID)) |
6255 | return true; | ||
6256 | |||
6257 | bool isAdmin = Permissions.IsAdministrator(agentID); | ||
6258 | if(isAdmin) | ||
6259 | return true; | ||
6260 | |||
6261 | // also honor estate managers access rights | ||
6262 | bool isManager = Permissions.IsEstateManager(agentID); | ||
6263 | if(isManager) | ||
6264 | return true; | ||
6265 | |||
6266 | if (!agentRootCrossing) | ||
6298 | { | 6267 | { |
6299 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 6268 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
6300 | { | 6269 | { |
6301 | SceneObjectGroup telehub; | 6270 | SceneObjectGroup telehub; |
6302 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject)) != null) | 6271 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = GetSceneObjectGroup (RegionInfo.RegionSettings.TelehubObject)) != null && checkTeleHub) |
6303 | { | 6272 | { |
6304 | List<SpawnPoint> spawnPoints = RegionInfo.RegionSettings.SpawnPoints(); | ||
6305 | bool banned = true; | 6273 | bool banned = true; |
6306 | foreach (SpawnPoint sp in spawnPoints) | 6274 | bool validTelehub = false; |
6275 | List<SpawnPoint> spawnPoints = RegionInfo.RegionSettings.SpawnPoints(); | ||
6276 | Vector3 spawnPoint; | ||
6277 | ILandObject land = null; | ||
6278 | Vector3 telehubPosition = telehub.AbsolutePosition; | ||
6279 | |||
6280 | if(spawnPoints.Count == 0) | ||
6307 | { | 6281 | { |
6308 | Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 6282 | // will this ever happen? |
6309 | ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); | 6283 | // if so use the telehub object position |
6310 | if (land == null) | 6284 | spawnPoint = telehubPosition; |
6311 | continue; | 6285 | land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); |
6312 | if (land.IsEitherBannedOrRestricted(agentID)) | 6286 | if(land != null && !land.IsEitherBannedOrRestricted(agentID)) |
6313 | continue; | 6287 | { |
6314 | banned = false; | 6288 | banned = false; |
6315 | break; | 6289 | validTelehub = true; |
6290 | } | ||
6291 | } | ||
6292 | else | ||
6293 | { | ||
6294 | Quaternion telehubRotation = telehub.GroupRotation; | ||
6295 | foreach (SpawnPoint spawn in spawnPoints) | ||
6296 | { | ||
6297 | spawnPoint = spawn.GetLocation(telehubPosition, telehubRotation); | ||
6298 | land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); | ||
6299 | if (land == null) | ||
6300 | continue; | ||
6301 | validTelehub = true; | ||
6302 | if (!land.IsEitherBannedOrRestricted(agentID)) | ||
6303 | { | ||
6304 | banned = false; | ||
6305 | break; | ||
6306 | } | ||
6307 | } | ||
6316 | } | 6308 | } |
6317 | 6309 | ||
6318 | if (banned) | 6310 | if(validTelehub) |
6319 | { | 6311 | { |
6320 | if (Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) | 6312 | if (banned) |
6321 | { | 6313 | { |
6322 | reason = "No suitable landing point found"; | 6314 | reason = "No suitable landing point found"; |
6323 | return false; | 6315 | return false; |
6324 | } | 6316 | } |
6325 | reason = "Administrative access only"; | 6317 | else |
6326 | return true; | 6318 | return true; |
6327 | } | 6319 | } |
6320 | // possible broken telehub, fall into normal check | ||
6328 | } | 6321 | } |
6329 | } | 6322 | } |
6330 | 6323 | ||
6331 | float posX = 128.0f; | 6324 | float posX = position.X; |
6332 | float posY = 128.0f; | 6325 | float posY = position.Y; |
6333 | 6326 | ||
6327 | // allow position relocation | ||
6334 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | 6328 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) |
6335 | { | 6329 | { |
6336 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | 6330 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); |
6337 | reason = "You are banned from the region on all parcels"; | 6331 | reason = "You dont have access to the region parcels"; |
6338 | return false; | 6332 | return false; |
6339 | } | 6333 | } |
6340 | } | 6334 | } |
6341 | else // Walking | 6335 | else // check for query region crossing only |
6342 | { | 6336 | { |
6337 | // no relocation allowed on crossings | ||
6343 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | 6338 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); |
6344 | if (land == null) | 6339 | if (land == null) |
6345 | { | 6340 | { |
@@ -6360,7 +6355,6 @@ Environment.Exit(1); | |||
6360 | } | 6355 | } |
6361 | } | 6356 | } |
6362 | 6357 | ||
6363 | reason = String.Empty; | ||
6364 | return true; | 6358 | return true; |
6365 | } | 6359 | } |
6366 | 6360 | ||