diff options
author | Dr Scofield | 2009-05-05 16:17:52 +0000 |
---|---|---|
committer | Dr Scofield | 2009-05-05 16:17:52 +0000 |
commit | e0a06f641668cd5c25a7854af2faf8a61c4053ee (patch) | |
tree | c2a4620c4bdc0e479ca16528cd9e0524529a7998 /OpenSim/Framework/Communications | |
parent | * Fix http://opensimulator.org/mantis/view.php?id=3585 (diff) | |
download | opensim-SC-e0a06f641668cd5c25a7854af2faf8a61c4053ee.zip opensim-SC-e0a06f641668cd5c25a7854af2faf8a61c4053ee.tar.gz opensim-SC-e0a06f641668cd5c25a7854af2faf8a61c4053ee.tar.bz2 opensim-SC-e0a06f641668cd5c25a7854af2faf8a61c4053ee.tar.xz |
- moving banned check and public/private check to
Scene.NewUserConnection()
- adding reason reporting
this enforces estate bans very early on and prevents us from
circulating client objects that we'd then have to retract once we
realize that the client is not allowed into the region
Diffstat (limited to 'OpenSim/Framework/Communications')
4 files changed, 29 insertions, 12 deletions
diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index da3f620..6fdacb1 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey) | 46 | public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey, out string reason) |
47 | { | 47 | { |
48 | // Eventually, we want to use a caps url instead of the agentID | 48 | // Eventually, we want to use a caps url instead of the agentID |
49 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; | 49 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; |
@@ -56,6 +56,8 @@ namespace OpenSim.Framework.Communications.Clients | |||
56 | //AgentCreateRequest.KeepAlive = false; | 56 | //AgentCreateRequest.KeepAlive = false; |
57 | AgentCreateRequest.Headers.Add("Authorization", authKey); | 57 | AgentCreateRequest.Headers.Add("Authorization", authKey); |
58 | 58 | ||
59 | reason = String.Empty; | ||
60 | |||
59 | // Fill it in | 61 | // Fill it in |
60 | OSDMap args = null; | 62 | OSDMap args = null; |
61 | try | 63 | try |
@@ -98,7 +100,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
98 | catch | 100 | catch |
99 | { | 101 | { |
100 | //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); | 102 | //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); |
101 | 103 | reason = "cannot contact remote region"; | |
102 | return false; | 104 | return false; |
103 | } | 105 | } |
104 | 106 | ||
@@ -112,13 +114,24 @@ namespace OpenSim.Framework.Communications.Clients | |||
112 | { | 114 | { |
113 | m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post"); | 115 | m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post"); |
114 | } | 116 | } |
117 | else | ||
118 | { | ||
115 | 119 | ||
116 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 120 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
117 | //reply = sr.ReadToEnd().Trim(); | 121 | string response = sr.ReadToEnd().Trim(); |
118 | sr.ReadToEnd().Trim(); | 122 | sr.Close(); |
119 | sr.Close(); | 123 | m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", response); |
120 | //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); | 124 | |
121 | 125 | if (!String.IsNullOrEmpty(response)) | |
126 | { | ||
127 | // we assume we got an OSDMap back | ||
128 | OSDMap r = GetOSDMap(response); | ||
129 | bool success = r["success"].AsBoolean(); | ||
130 | reason = r["reason"].AsString(); | ||
131 | |||
132 | return success; | ||
133 | } | ||
134 | } | ||
122 | } | 135 | } |
123 | catch (WebException ex) | 136 | catch (WebException ex) |
124 | { | 137 | { |
diff --git a/OpenSim/Framework/Communications/Services/LoginResponse.cs b/OpenSim/Framework/Communications/Services/LoginResponse.cs index d91bf84..4b5c99d 100644 --- a/OpenSim/Framework/Communications/Services/LoginResponse.cs +++ b/OpenSim/Framework/Communications/Services/LoginResponse.cs | |||
@@ -320,7 +320,7 @@ namespace OpenSim.Framework.Communications.Services | |||
320 | { | 320 | { |
321 | return GenerateFailureResponseLLSD( | 321 | return GenerateFailureResponseLLSD( |
322 | "key", | 322 | "key", |
323 | "Error connecting to grid. Could not percieve credentials from login XML.", | 323 | "Error connecting to grid. Could not perceive credentials from login XML.", |
324 | "false"); | 324 | "false"); |
325 | } | 325 | } |
326 | 326 | ||
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 168f7a6..f55c030 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs | |||
@@ -946,13 +946,15 @@ namespace OpenSim.Framework.Communications.Services | |||
946 | { | 946 | { |
947 | regionInfo = homeInfo; | 947 | regionInfo = homeInfo; |
948 | theUser.CurrentAgent.Position = theUser.HomeLocation; | 948 | theUser.CurrentAgent.Position = theUser.HomeLocation; |
949 | response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]"; | 949 | response.LookAt = String.Format("[r{0},r{1},r{2}]", theUser.HomeLookAt.X.ToString(), |
950 | theUser.HomeLookAt.Y.ToString(), theUser.HomeLookAt.Z.ToString()); | ||
950 | } | 951 | } |
951 | else if (startLocationRequest == "last") | 952 | else if (startLocationRequest == "last") |
952 | { | 953 | { |
953 | UUID lastRegion = theUser.CurrentAgent.Region; | 954 | UUID lastRegion = theUser.CurrentAgent.Region; |
954 | regionInfo = GetRegionInfo(lastRegion); | 955 | regionInfo = GetRegionInfo(lastRegion); |
955 | response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; | 956 | response.LookAt = String.Format("[r{0},r{1},r{2}]", theUser.CurrentAgent.LookAt.X.ToString(), |
957 | theUser.CurrentAgent.LookAt.Y.ToString(), theUser.CurrentAgent.LookAt.Z.ToString()); | ||
956 | } | 958 | } |
957 | else | 959 | else |
958 | { | 960 | { |
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index d0c1b3b..965e6b4 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -345,8 +345,9 @@ namespace OpenSim.Framework.Communications.Tests | |||
345 | { | 345 | { |
346 | } | 346 | } |
347 | 347 | ||
348 | public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent) | 348 | public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason) |
349 | { | 349 | { |
350 | reason = String.Empty; | ||
350 | lock (m_regionsList) | 351 | lock (m_regionsList) |
351 | { | 352 | { |
352 | foreach (RegionInfo regInfo in m_regionsList) | 353 | foreach (RegionInfo regInfo in m_regionsList) |
@@ -355,6 +356,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
355 | return true; | 356 | return true; |
356 | } | 357 | } |
357 | } | 358 | } |
359 | reason = "Region not found"; | ||
358 | return false; | 360 | return false; |
359 | } | 361 | } |
360 | 362 | ||