diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 161 |
1 files changed, 77 insertions, 84 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 77ca3bc..a81bd12 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2378,112 +2378,105 @@ namespace OpenSim.Region.Framework.Scenes | |||
2378 | /// <param name="reason"></param> | 2378 | /// <param name="reason"></param> |
2379 | public bool NewUserConnection(AgentCircuitData agent, out string reason) | 2379 | public bool NewUserConnection(AgentCircuitData agent, out string reason) |
2380 | { | 2380 | { |
2381 | bool goodUserConnection = AuthenticateUser(agent); | 2381 | // Don't disable this log message - it's too helpful |
2382 | m_log.InfoFormat( | ||
2383 | "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5})", | ||
2384 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | ||
2385 | agent.AgentID, agent.circuitcode); | ||
2382 | 2386 | ||
2383 | reason = String.Empty; | 2387 | reason = String.Empty; |
2388 | if (!AuthenticateUser(agent, out reason)) | ||
2389 | return false; | ||
2384 | 2390 | ||
2385 | if (goodUserConnection && | 2391 | if (!AuthorizeUser(agent, out reason)) |
2386 | m_regInfo.EstateSettings.IsBanned(agent.AgentID) && | 2392 | return false; |
2387 | (!Permissions.IsGod(agent.AgentID))) | ||
2388 | { | ||
2389 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | ||
2390 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
2391 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", | ||
2392 | RegionInfo.RegionName); | ||
2393 | goodUserConnection = false; | ||
2394 | } | ||
2395 | else if (goodUserConnection && | ||
2396 | !m_regInfo.EstateSettings.PublicAccess && | ||
2397 | !m_regInfo.EstateSettings.HasAccess(agent.AgentID) && | ||
2398 | !Permissions.IsGod(agent.AgentID)) | ||
2399 | { | ||
2400 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access", | ||
2401 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
2402 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | ||
2403 | RegionInfo.RegionName); | ||
2404 | goodUserConnection = false; | ||
2405 | } | ||
2406 | 2393 | ||
2394 | CapsModule.NewUserConnection(agent); | ||
2407 | 2395 | ||
2408 | if (goodUserConnection) | 2396 | ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); |
2397 | if (sp != null) | ||
2409 | { | 2398 | { |
2410 | CapsModule.NewUserConnection(agent); | 2399 | m_log.DebugFormat( |
2411 | 2400 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | |
2412 | ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); | 2401 | agent.AgentID, RegionInfo.RegionName); |
2413 | if (sp != null) | 2402 | |
2414 | { | 2403 | sp.AdjustKnownSeeds(); |
2415 | m_log.DebugFormat( | 2404 | |
2416 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 2405 | return true; |
2417 | agent.AgentID, RegionInfo.RegionName); | 2406 | } |
2418 | 2407 | ||
2419 | sp.AdjustKnownSeeds(); | 2408 | CapsModule.AddCapsHandler(agent.AgentID); |
2420 | 2409 | ||
2421 | return true; | 2410 | if (!agent.child) |
2422 | } | 2411 | { |
2423 | 2412 | // Honor parcel landing type and position. | |
2424 | // Don't disable this log message - it's too helpful | 2413 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
2425 | m_log.InfoFormat( | 2414 | if (land != null) |
2426 | "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", | ||
2427 | RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); | ||
2428 | |||
2429 | // if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) | ||
2430 | // { | ||
2431 | // m_log.WarnFormat( | ||
2432 | // "[CONNECTION BEGIN]: Incoming user {0} at {1} is on the region banlist", | ||
2433 | // agent.AgentID, RegionInfo.RegionName); | ||
2434 | // //return false; | ||
2435 | // } | ||
2436 | |||
2437 | CapsModule.AddCapsHandler(agent.AgentID); | ||
2438 | |||
2439 | if (!agent.child) | ||
2440 | { | 2415 | { |
2441 | // Honor parcel landing type and position. | 2416 | if (land.landData.LandingType == (byte)1 && land.landData.UserLocation != Vector3.Zero) |
2442 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
2443 | if (land != null) | ||
2444 | { | 2417 | { |
2445 | if (land.landData.LandingType == (byte)1 && land.landData.UserLocation != Vector3.Zero) | 2418 | agent.startpos = land.landData.UserLocation; |
2446 | { | ||
2447 | agent.startpos = land.landData.UserLocation; | ||
2448 | } | ||
2449 | } | 2419 | } |
2450 | } | 2420 | } |
2451 | 2421 | } | |
2452 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 2422 | |
2453 | 2423 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | |
2454 | // rewrite session_id | 2424 | |
2455 | CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); | 2425 | // rewrite session_id |
2456 | if (userinfo != null) | 2426 | CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); |
2457 | { | 2427 | if (userinfo != null) |
2458 | userinfo.SessionID = agent.SessionID; | 2428 | { |
2459 | } | 2429 | userinfo.SessionID = agent.SessionID; |
2460 | else | ||
2461 | { | ||
2462 | m_log.WarnFormat( | ||
2463 | "[CONNECTION BEGIN]: We couldn't find a User Info record for {0}. This is usually an indication that the UUID we're looking up is invalid", agent.AgentID); | ||
2464 | } | ||
2465 | |||
2466 | return true; | ||
2467 | } | 2430 | } |
2468 | else | 2431 | else |
2469 | { | 2432 | { |
2470 | m_log.WarnFormat("[CONNECTION BEGIN]: failed to authenticate user {0} {1}: {2}. Denying connection.", | 2433 | m_log.WarnFormat( |
2471 | agent.firstname, agent.lastname, reason); | 2434 | "[CONNECTION BEGIN]: We couldn't find a User Info record for {0}. This is usually an indication that the UUID we're looking up is invalid", agent.AgentID); |
2472 | if (String.IsNullOrEmpty(reason)) | ||
2473 | { | ||
2474 | reason = String.Format("Failed to authenticate user {0} {1}, access denied.", agent.firstname, agent.lastname); | ||
2475 | } | ||
2476 | return false; | ||
2477 | } | 2435 | } |
2436 | |||
2437 | return true; | ||
2478 | } | 2438 | } |
2479 | 2439 | ||
2480 | public virtual bool AuthenticateUser(AgentCircuitData agent) | 2440 | public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) |
2481 | { | 2441 | { |
2442 | reason = String.Empty; | ||
2443 | |||
2482 | bool result = CommsManager.UserService.VerifySession(agent.AgentID, agent.SessionID); | 2444 | bool result = CommsManager.UserService.VerifySession(agent.AgentID, agent.SessionID); |
2483 | m_log.Debug("[CONNECTION BEGIN]: User authentication returned " + result); | 2445 | m_log.Debug("[CONNECTION BEGIN]: User authentication returned " + result); |
2446 | if (!result) | ||
2447 | reason = String.Format("Failed to authenticate user {0} {1}, access denied.", agent.firstname, agent.lastname); | ||
2448 | |||
2484 | return result; | 2449 | return result; |
2485 | } | 2450 | } |
2486 | 2451 | ||
2452 | protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) | ||
2453 | { | ||
2454 | reason = String.Empty; | ||
2455 | |||
2456 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID) && | ||
2457 | (!Permissions.IsGod(agent.AgentID))) | ||
2458 | { | ||
2459 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | ||
2460 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
2461 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", | ||
2462 | RegionInfo.RegionName); | ||
2463 | return false; | ||
2464 | } | ||
2465 | |||
2466 | if (!m_regInfo.EstateSettings.PublicAccess && | ||
2467 | !m_regInfo.EstateSettings.HasAccess(agent.AgentID) && | ||
2468 | !Permissions.IsGod(agent.AgentID)) | ||
2469 | { | ||
2470 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access", | ||
2471 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
2472 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | ||
2473 | RegionInfo.RegionName); | ||
2474 | return false; | ||
2475 | } | ||
2476 | |||
2477 | return true; | ||
2478 | } | ||
2479 | |||
2487 | public void UpdateCircuitData(AgentCircuitData data) | 2480 | public void UpdateCircuitData(AgentCircuitData data) |
2488 | { | 2481 | { |
2489 | m_authenticateHandler.UpdateAgentData(data); | 2482 | m_authenticateHandler.UpdateAgentData(data); |