aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDr Scofield2009-05-05 16:17:52 +0000
committerDr Scofield2009-05-05 16:17:52 +0000
commite0a06f641668cd5c25a7854af2faf8a61c4053ee (patch)
treec2a4620c4bdc0e479ca16528cd9e0524529a7998 /OpenSim/Region
parent* Fix http://opensimulator.org/mantis/view.php?id=3585 (diff)
downloadopensim-SC_OLD-e0a06f641668cd5c25a7854af2faf8a61c4053ee.zip
opensim-SC_OLD-e0a06f641668cd5c25a7854af2faf8a61c4053ee.tar.gz
opensim-SC_OLD-e0a06f641668cd5c25a7854af2faf8a61c4053ee.tar.bz2
opensim-SC_OLD-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/Region')
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Interregion/LocalInterregionComms.cs7
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs17
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInterregionComms.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs159
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs9
9 files changed, 122 insertions, 103 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
index f21ce0f..a5101d0 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
@@ -160,8 +160,9 @@ namespace OpenSim.Region.CoreModules.Hypergrid
160 } 160 }
161 } 161 }
162 162
163 public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent) 163 public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason)
164 { 164 {
165 reason = String.Empty;
165 return true; 166 return true;
166 } 167 }
167 168
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index ad91d63..5278b74 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -545,7 +545,15 @@ namespace OpenSim.Region.CoreModules.InterGrid
545 homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(userProfile); 545 homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(userProfile);
546 546
547 // Call 'new user' event handler 547 // Call 'new user' event handler
548 homeScene.NewUserConnection(agentData); 548 string reason;
549 if (!homeScene.NewUserConnection(agentData, out reason))
550 {
551 responseMap["connect"] = OSD.FromBoolean(false);
552 responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason));
553 m_log.ErrorFormat("[OGP]: rez_avatar/request failed: {0}", reason);
554 return responseMap;
555 }
556
549 557
550 //string raCap = string.Empty; 558 //string raCap = string.Empty;
551 559
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/LocalInterregionComms.cs
index b94efa7..bdf2280 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/LocalInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/LocalInterregionComms.cs
@@ -24,6 +24,7 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System;
27using System.Collections.Generic; 28using System.Collections.Generic;
28using System.Reflection; 29using System.Reflection;
29using log4net; 30using log4net;
@@ -112,19 +113,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
112 * Agent-related communications 113 * Agent-related communications
113 */ 114 */
114 115
115 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit) 116 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
116 { 117 {
117 foreach (Scene s in m_sceneList) 118 foreach (Scene s in m_sceneList)
118 { 119 {
119 if (s.RegionInfo.RegionHandle == regionHandle) 120 if (s.RegionInfo.RegionHandle == regionHandle)
120 { 121 {
121// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); 122// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle);
122 s.NewUserConnection(aCircuit); 123 return s.NewUserConnection(aCircuit, out reason);
123 return true;
124 } 124 }
125 } 125 }
126 126
127// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); 127// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle);
128 reason = "Did not find region.";
128 return false; 129 return false;
129 } 130 }
130 131
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
index 7fafb6e..80dced7 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
@@ -140,10 +140,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
140 * Agent-related communications 140 * Agent-related communications
141 */ 141 */
142 142
143 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit) 143 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
144 { 144 {
145 // Try local first 145 // Try local first
146 if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit)) 146 if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, out reason))
147 return true; 147 return true;
148 148
149 // else do the remote thing 149 // else do the remote thing
@@ -154,7 +154,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
154 { 154 {
155 m_regionClient.SendUserInformation(regInfo, aCircuit); 155 m_regionClient.SendUserInformation(regInfo, aCircuit);
156 156
157 return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None"); 157 return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", out reason);
158 } 158 }
159 //else 159 //else
160 // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); 160 // m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
@@ -431,12 +431,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
431 return; 431 return;
432 } 432 }
433 433
434 OSDMap resp = new OSDMap(2);
435 string reason = String.Empty;
436
434 // This is the meaning of POST agent 437 // This is the meaning of POST agent
435 m_regionClient.AdjustUserInformation(aCircuit); 438 m_regionClient.AdjustUserInformation(aCircuit);
436 bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit); 439 bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, out reason);
440
441 resp["reason"] = OSD.FromString(reason);
442 resp["success"] = OSD.FromBoolean(result);
437 443
444 // TODO: add reason if not String.Empty?
438 responsedata["int_response_code"] = 200; 445 responsedata["int_response_code"] = 200;
439 responsedata["str_response_string"] = result.ToString(); 446 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
440 } 447 }
441 448
442 protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata) 449 protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata)
diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
index b5a9395..95b1079 100644
--- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces
38 38
39 #region Agents 39 #region Agents
40 40
41 bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit); 41 bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason);
42 42
43 /// <summary> 43 /// <summary>
44 /// Full child agent update. 44 /// Full child agent update.
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
index dcebce5..542e7d0 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -180,10 +180,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
180 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 180 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
181 } 181 }
182 182
183 string reason = String.Empty;
184
183 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) 185 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
184 if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit)) 186 if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, out reason))
185 { 187 {
186 avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); 188 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
189 reason));
187 return; 190 return;
188 } 191 }
189 192
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a516a5a..77ca3bc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1859,87 +1859,46 @@ namespace OpenSim.Region.Framework.Scenes
1859 1859
1860 public override void AddNewClient(IClientAPI client) 1860 public override void AddNewClient(IClientAPI client)
1861 { 1861 {
1862 bool welcome = true; 1862 SubscribeToClientEvents(client);
1863 1863 ScenePresence presence;
1864 if (m_regInfo.EstateSettings.IsBanned(client.AgentId) && (!Permissions.IsGod(client.AgentId)))
1865 {
1866 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
1867 client.AgentId, client.FirstName, client.LastName, RegionInfo.RegionName);
1868 client.SendAlertMessage("Denied access to region " + RegionInfo.RegionName + ". You have been banned from that region.");
1869 welcome = false;
1870 }
1871 else if (!m_regInfo.EstateSettings.PublicAccess && !m_regInfo.EstateSettings.HasAccess(client.AgentId) && !Permissions.IsGod(client.AgentId))
1872 {
1873 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access",
1874 client.AgentId, client.FirstName, client.LastName, RegionInfo.RegionName);
1875 client.SendAlertMessage("Denied access to private region " + RegionInfo.RegionName + ". You do not have access to this region.");
1876 welcome = false;
1877 }
1878 1864
1879 if (!welcome) 1865 if (m_restorePresences.ContainsKey(client.AgentId))
1880 { 1866 {
1881 try 1867 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
1882 { 1868
1883 IEventQueue eq = RequestModuleInterface<IEventQueue>(); 1869 presence = m_restorePresences[client.AgentId];
1884 if (eq != null) 1870 m_restorePresences.Remove(client.AgentId);
1885 { 1871
1886 eq.DisableSimulator(RegionInfo.RegionHandle, client.AgentId); 1872 // This is one of two paths to create avatars that are
1887 } 1873 // used. This tends to get called more in standalone
1888 else 1874 // than grid, not really sure why, but as such needs
1889 client.SendShutdownConnectionNotice(); 1875 // an explicity appearance lookup here.
1890 1876 AvatarAppearance appearance = null;
1891 client.Close(false); 1877 GetAvatarAppearance(client, out appearance);
1892 CapsModule.RemoveCapsHandler(client.AgentId); 1878 presence.Appearance = appearance;
1893 m_authenticateHandler.RemoveCircuit(client.CircuitCode); 1879
1894 } 1880 presence.initializeScenePresence(client, RegionInfo, this);
1895 catch (Exception e) 1881
1882 m_sceneGraph.AddScenePresence(presence);
1883
1884 lock (m_restorePresences)
1896 { 1885 {
1897 m_log.DebugFormat("[SCENE]: Exception while closing unwelcome client {0} {1}: {2}", client.FirstName, client.LastName, e.Message); 1886 Monitor.PulseAll(m_restorePresences);
1898 } 1887 }
1899 } 1888 }
1900 else 1889 else
1901 { 1890 {
1902 SubscribeToClientEvents(client); 1891 m_log.DebugFormat(
1903 ScenePresence presence; 1892 "[SCENE]: Adding new child agent for {0} in {1}",
1904 1893 client.Name, RegionInfo.RegionName);
1905 if (m_restorePresences.ContainsKey(client.AgentId)) 1894
1906 { 1895 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
1907 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); 1896
1908 1897 CreateAndAddScenePresence(client);
1909 presence = m_restorePresences[client.AgentId];
1910 m_restorePresences.Remove(client.AgentId);
1911
1912 // This is one of two paths to create avatars that are
1913 // used. This tends to get called more in standalone
1914 // than grid, not really sure why, but as such needs
1915 // an explicity appearance lookup here.
1916 AvatarAppearance appearance = null;
1917 GetAvatarAppearance(client, out appearance);
1918 presence.Appearance = appearance;
1919
1920 presence.initializeScenePresence(client, RegionInfo, this);
1921
1922 m_sceneGraph.AddScenePresence(presence);
1923
1924 lock (m_restorePresences)
1925 {
1926 Monitor.PulseAll(m_restorePresences);
1927 }
1928 }
1929 else
1930 {
1931 m_log.DebugFormat(
1932 "[SCENE]: Adding new child agent for {0} in {1}",
1933 client.Name, RegionInfo.RegionName);
1934
1935 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
1936
1937 CreateAndAddScenePresence(client);
1938 }
1939
1940 m_LastLogin = Environment.TickCount;
1941 EventManager.TriggerOnNewClient(client);
1942 } 1898 }
1899
1900 m_LastLogin = Environment.TickCount;
1901 EventManager.TriggerOnNewClient(client);
1943 } 1902 }
1944 1903
1945 protected virtual void SubscribeToClientEvents(IClientAPI client) 1904 protected virtual void SubscribeToClientEvents(IClientAPI client)
@@ -2404,7 +2363,8 @@ namespace OpenSim.Region.Framework.Scenes
2404 /// <param name="agent"></param> 2363 /// <param name="agent"></param>
2405 public void HandleNewUserConnection(AgentCircuitData agent) 2364 public void HandleNewUserConnection(AgentCircuitData agent)
2406 { 2365 {
2407 NewUserConnection(agent); 2366 string reason;
2367 NewUserConnection(agent, out reason);
2408 } 2368 }
2409 2369
2410 /// <summary> 2370 /// <summary>
@@ -2415,10 +2375,36 @@ namespace OpenSim.Region.Framework.Scenes
2415 /// </summary> 2375 /// </summary>
2416 /// <param name="regionHandle"></param> 2376 /// <param name="regionHandle"></param>
2417 /// <param name="agent"></param> 2377 /// <param name="agent"></param>
2418 public bool NewUserConnection(AgentCircuitData agent) 2378 /// <param name="reason"></param>
2379 public bool NewUserConnection(AgentCircuitData agent, out string reason)
2419 { 2380 {
2420 bool goodUserConnection = AuthenticateUser(agent); 2381 bool goodUserConnection = AuthenticateUser(agent);
2421 2382
2383 reason = String.Empty;
2384
2385 if (goodUserConnection &&
2386 m_regInfo.EstateSettings.IsBanned(agent.AgentID) &&
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
2407
2422 if (goodUserConnection) 2408 if (goodUserConnection)
2423 { 2409 {
2424 CapsModule.NewUserConnection(agent); 2410 CapsModule.NewUserConnection(agent);
@@ -2431,7 +2417,7 @@ namespace OpenSim.Region.Framework.Scenes
2431 agent.AgentID, RegionInfo.RegionName); 2417 agent.AgentID, RegionInfo.RegionName);
2432 2418
2433 sp.AdjustKnownSeeds(); 2419 sp.AdjustKnownSeeds();
2434 2420
2435 return true; 2421 return true;
2436 } 2422 }
2437 2423
@@ -2440,13 +2426,13 @@ namespace OpenSim.Region.Framework.Scenes
2440 "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", 2426 "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})",
2441 RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); 2427 RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode);
2442 2428
2443 if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) 2429 // if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
2444 { 2430 // {
2445 m_log.WarnFormat( 2431 // m_log.WarnFormat(
2446 "[CONNECTION BEGIN]: Incoming user {0} at {1} is on the region banlist", 2432 // "[CONNECTION BEGIN]: Incoming user {0} at {1} is on the region banlist",
2447 agent.AgentID, RegionInfo.RegionName); 2433 // agent.AgentID, RegionInfo.RegionName);
2448 //return false; 2434 // //return false;
2449 } 2435 // }
2450 2436
2451 CapsModule.AddCapsHandler(agent.AgentID); 2437 CapsModule.AddCapsHandler(agent.AgentID);
2452 2438
@@ -2481,7 +2467,12 @@ namespace OpenSim.Region.Framework.Scenes
2481 } 2467 }
2482 else 2468 else
2483 { 2469 {
2484 m_log.WarnFormat("[CONNECTION BEGIN]: failed to authenticate user {0} {1}. Denying connection.", agent.firstname, agent.lastname); 2470 m_log.WarnFormat("[CONNECTION BEGIN]: failed to authenticate user {0} {1}: {2}. Denying connection.",
2471 agent.firstname, agent.lastname, reason);
2472 if (String.IsNullOrEmpty(reason))
2473 {
2474 reason = String.Format("Failed to authenticate user {0} {1}, access denied.", agent.firstname, agent.lastname);
2475 }
2485 return false; 2476 return false;
2486 } 2477 }
2487 } 2478 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 2fe005d..0699552 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -296,8 +296,10 @@ namespace OpenSim.Region.Framework.Scenes
296 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort 296 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
297 + "/CAPS/" + a.CapsPath + "0000/"; 297 + "/CAPS/" + a.CapsPath + "0000/";
298 298
299 string reason = String.Empty;
300
299 //bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); 301 //bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a);
300 bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a); 302 bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason);
301 303
302 if (regionAccepted && newAgent) 304 if (regionAccepted && newAgent)
303 { 305 {
@@ -785,11 +787,14 @@ namespace OpenSim.Region.Framework.Scenes
785 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 787 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
786 } 788 }
787 789
790 string reason = String.Empty;
791
788 // Let's create an agent there if one doesn't exist yet. 792 // Let's create an agent there if one doesn't exist yet.
789 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) 793 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
790 if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit)) 794 if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, out reason))
791 { 795 {
792 avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); 796 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
797 reason));
793 return; 798 return;
794 } 799 }
795 800
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index a26cb94..2903766 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -115,7 +115,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
115 agent.startpos = Vector3.Zero; 115 agent.startpos = Vector3.Zero;
116 agent.CapsPath = GetRandomCapsObjectPath(); 116 agent.CapsPath = GetRandomCapsObjectPath();
117 117
118 scene.NewUserConnection(agent); 118 string reason;
119 scene.NewUserConnection(agent, out reason);
119 testclient = new TestClient(agent, scene); 120 testclient = new TestClient(agent, scene);
120 scene.AddNewClient(testclient); 121 scene.AddNewClient(testclient);
121 122
@@ -146,7 +147,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
146 { 147 {
147 Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); 148 Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
148 149
149 scene.NewUserConnection(acd1); 150 string reason;
151 scene.NewUserConnection(acd1, out reason);
150 scene.AddNewClient(testclient); 152 scene.AddNewClient(testclient);
151 153
152 ScenePresence presence = scene.GetScenePresence(agent1); 154 ScenePresence presence = scene.GetScenePresence(agent1);
@@ -203,7 +205,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
203 Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); 205 Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
204 206
205 // Adding child agent to region 1001 207 // Adding child agent to region 1001
206 scene2.NewUserConnection(acd1); 208 string reason;
209 scene2.NewUserConnection(acd1, out reason);
207 scene2.AddNewClient(testclient); 210 scene2.AddNewClient(testclient);
208 211
209 ScenePresence presence = scene.GetScenePresence(agent1); 212 ScenePresence presence = scene.GetScenePresence(agent1);