aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
diff options
context:
space:
mode:
authordiva2009-03-30 19:26:25 +0000
committerdiva2009-03-30 19:26:25 +0000
commit4cbf963354128f6d30e28ea68fe06a85ba5790c5 (patch)
treebfe313ab6fc9e2c5fac9d583a71e94993d2cb1a2 /OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
parent* Fix test breakage by always inserting a gods module when testing (diff)
downloadopensim-SC_OLD-4cbf963354128f6d30e28ea68fe06a85ba5790c5.zip
opensim-SC_OLD-4cbf963354128f6d30e28ea68fe06a85ba5790c5.tar.gz
opensim-SC_OLD-4cbf963354128f6d30e28ea68fe06a85ba5790c5.tar.bz2
opensim-SC_OLD-4cbf963354128f6d30e28ea68fe06a85ba5790c5.tar.xz
HGInventoryService now uses the actual authority portion of the user's key to verify the key.
Diffstat (limited to 'OpenSim/Framework/Communications/Services/HGLoginAuthService.cs')
-rw-r--r--OpenSim/Framework/Communications/Services/HGLoginAuthService.cs656
1 files changed, 328 insertions, 328 deletions
diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
index 72e2dfb..99fbb2b 100644
--- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
+++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
@@ -1,328 +1,328 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Framework.Communications.Capabilities; 36using OpenSim.Framework.Communications.Capabilities;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38 38
39using OpenMetaverse; 39using OpenMetaverse;
40 40
41using log4net; 41using log4net;
42using Nini.Config; 42using Nini.Config;
43using Nwc.XmlRpc; 43using Nwc.XmlRpc;
44 44
45namespace OpenSim.Framework.Communications.Services 45namespace OpenSim.Framework.Communications.Services
46{ 46{
47 public class HGLoginAuthService : LoginService 47 public class HGLoginAuthService : LoginService
48 { 48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 protected NetworkServersInfo m_serversInfo; 51 protected NetworkServersInfo m_serversInfo;
52 protected bool m_authUsers = false; 52 protected bool m_authUsers = false;
53 53
54 /// <summary> 54 /// <summary>
55 /// Used by the login service to make requests to the inventory service. 55 /// Used by the login service to make requests to the inventory service.
56 /// </summary> 56 /// </summary>
57 protected IInterServiceInventoryServices m_interServiceInventoryService; 57 protected IInterServiceInventoryServices m_interServiceInventoryService;
58 58
59 /// <summary> 59 /// <summary>
60 /// Used to make requests to the local regions. 60 /// Used to make requests to the local regions.
61 /// </summary> 61 /// </summary>
62 protected ILoginServiceToRegionsConnector m_regionsConnector; 62 protected ILoginServiceToRegionsConnector m_regionsConnector;
63 63
64 64
65 public HGLoginAuthService( 65 public HGLoginAuthService(
66 UserManagerBase userManager, string welcomeMess, 66 UserManagerBase userManager, string welcomeMess,
67 IInterServiceInventoryServices interServiceInventoryService, 67 IInterServiceInventoryServices interServiceInventoryService,
68 NetworkServersInfo serversInfo, 68 NetworkServersInfo serversInfo,
69 bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector) 69 bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
70 : base(userManager, libraryRootFolder, welcomeMess) 70 : base(userManager, libraryRootFolder, welcomeMess)
71 { 71 {
72 this.m_serversInfo = serversInfo; 72 this.m_serversInfo = serversInfo;
73 if (m_serversInfo != null) 73 if (m_serversInfo != null)
74 { 74 {
75 m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX; 75 m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX;
76 m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY; 76 m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY;
77 } 77 }
78 m_authUsers = authenticate; 78 m_authUsers = authenticate;
79 79
80 m_interServiceInventoryService = interServiceInventoryService; 80 m_interServiceInventoryService = interServiceInventoryService;
81 m_regionsConnector = regionsConnector; 81 m_regionsConnector = regionsConnector;
82 m_inventoryService = interServiceInventoryService; 82 m_inventoryService = interServiceInventoryService;
83 } 83 }
84 84
85 public void SetServersInfo(NetworkServersInfo sinfo) 85 public void SetServersInfo(NetworkServersInfo sinfo)
86 { 86 {
87 m_serversInfo = sinfo; 87 m_serversInfo = sinfo;
88 } 88 }
89 89
90 public override XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 90 public override XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
91 { 91 {
92 m_log.Info("[HGLOGIN] HGLogin called " + request.MethodName); 92 m_log.Info("[HGLOGIN] HGLogin called " + request.MethodName);
93 XmlRpcResponse response = base.XmlRpcLoginMethod(request); 93 XmlRpcResponse response = base.XmlRpcLoginMethod(request);
94 Hashtable responseData = (Hashtable)response.Value; 94 Hashtable responseData = (Hashtable)response.Value;
95 95
96 responseData["grid_service"] = m_serversInfo.GridURL; 96 responseData["grid_service"] = m_serversInfo.GridURL;
97 responseData["grid_service_send_key"] = m_serversInfo.GridSendKey; 97 responseData["grid_service_send_key"] = m_serversInfo.GridSendKey;
98 responseData["inventory_service"] = m_serversInfo.InventoryURL; 98 responseData["inventory_service"] = m_serversInfo.InventoryURL;
99 responseData["asset_service"] = m_serversInfo.AssetURL; 99 responseData["asset_service"] = m_serversInfo.AssetURL;
100 responseData["asset_service_send_key"] = m_serversInfo.AssetSendKey; 100 responseData["asset_service_send_key"] = m_serversInfo.AssetSendKey;
101 int x = (Int32)responseData["region_x"]; 101 int x = (Int32)responseData["region_x"];
102 int y = (Int32)responseData["region_y"]; 102 int y = (Int32)responseData["region_y"];
103 uint ux = (uint)(x / Constants.RegionSize); 103 uint ux = (uint)(x / Constants.RegionSize);
104 uint uy = (uint)(y / Constants.RegionSize); 104 uint uy = (uint)(y / Constants.RegionSize);
105 ulong regionHandle = Util.UIntsToLong(ux, uy); 105 ulong regionHandle = Util.UIntsToLong(ux, uy);
106 responseData["region_handle"] = regionHandle.ToString(); 106 responseData["region_handle"] = regionHandle.ToString();
107 107
108 // Let's remove the seed cap from the login 108 // Let's remove the seed cap from the login
109 //responseData.Remove("seed_capability"); 109 //responseData.Remove("seed_capability");
110 110
111 // Let's add the appearance 111 // Let's add the appearance
112 UUID userID = UUID.Zero; 112 UUID userID = UUID.Zero;
113 UUID.TryParse((string)responseData["agent_id"], out userID); 113 UUID.TryParse((string)responseData["agent_id"], out userID);
114 AvatarAppearance appearance = m_userManager.GetUserAppearance(userID); 114 AvatarAppearance appearance = m_userManager.GetUserAppearance(userID);
115 if (appearance == null) 115 if (appearance == null)
116 { 116 {
117 m_log.WarnFormat("[INTER]: Appearance not found for {0}. Creating default.", userID); 117 m_log.WarnFormat("[INTER]: Appearance not found for {0}. Creating default.", userID);
118 appearance = new AvatarAppearance(); 118 appearance = new AvatarAppearance();
119 } 119 }
120 120
121 responseData["appearance"] = appearance.ToHashTable(); 121 responseData["appearance"] = appearance.ToHashTable();
122 122
123 // Let's also send the auth token 123 // Let's also send the auth token
124 UUID token = UUID.Random(); 124 UUID token = UUID.Random();
125 responseData["auth_token"] = token.ToString(); 125 responseData["auth_token"] = token.ToString();
126 UserProfileData userProfile = m_userManager.GetUserProfile(userID); 126 UserProfileData userProfile = m_userManager.GetUserProfile(userID);
127 if (userProfile != null) 127 if (userProfile != null)
128 { 128 {
129 userProfile.WebLoginKey = token; 129 userProfile.WebLoginKey = token;
130 m_userManager.CommitAgent(ref userProfile); 130 m_userManager.CommitAgent(ref userProfile);
131 } 131 }
132 132
133 return response; 133 return response;
134 } 134 }
135 135
136 public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request) 136 public XmlRpcResponse XmlRpcGenerateKeyMethod(XmlRpcRequest request)
137 { 137 {
138 138
139 // Verify the key of who's calling 139 // Verify the key of who's calling
140 UUID userID = UUID.Zero; 140 UUID userID = UUID.Zero;
141 UUID authKey = UUID.Zero; 141 UUID authKey = UUID.Zero;
142 UUID.TryParse((string)request.Params[0], out userID); 142 UUID.TryParse((string)request.Params[0], out userID);
143 UUID.TryParse((string)request.Params[1], out authKey); 143 UUID.TryParse((string)request.Params[1], out authKey);
144 144
145 m_log.InfoFormat("[HGLOGIN] HGGenerateKey called with authToken ", authKey); 145 m_log.InfoFormat("[HGLOGIN] HGGenerateKey called with authToken ", authKey);
146 string newKey = string.Empty; 146 string newKey = string.Empty;
147 147
148 if (!(m_userManager is IAuthentication)) 148 if (!(m_userManager is IAuthentication))
149 { 149 {
150 m_log.Debug("[HGLOGIN]: UserManager is not IAuthentication service. Returning empty key."); 150 m_log.Debug("[HGLOGIN]: UserManager is not IAuthentication service. Returning empty key.");
151 } 151 }
152 else 152 else
153 { 153 {
154 newKey = ((IAuthentication)m_userManager).GetNewKey(m_serversInfo.UserURL, userID, authKey); 154 newKey = ((IAuthentication)m_userManager).GetNewKey(m_serversInfo.UserURL, userID, authKey);
155 } 155 }
156 156
157 XmlRpcResponse response = new XmlRpcResponse(); 157 XmlRpcResponse response = new XmlRpcResponse();
158 response.Value = (string) newKey; 158 response.Value = (string) newKey;
159 return response; 159 return response;
160 } 160 }
161 161
162 public XmlRpcResponse XmlRpcVerifyKeyMethod(XmlRpcRequest request) 162 public XmlRpcResponse XmlRpcVerifyKeyMethod(XmlRpcRequest request)
163 { 163 {
164 bool success = false; 164 bool success = false;
165 165
166 if (request.Params.Count >= 2) 166 if (request.Params.Count >= 2)
167 { 167 {
168 // Verify the key of who's calling 168 // Verify the key of who's calling
169 UUID userID = UUID.Zero; 169 UUID userID = UUID.Zero;
170 string authKey = string.Empty; 170 string authKey = string.Empty;
171 if (UUID.TryParse((string)request.Params[0], out userID)) 171 if (UUID.TryParse((string)request.Params[0], out userID))
172 { 172 {
173 authKey = (string)request.Params[1]; 173 authKey = (string)request.Params[1];
174 174
175 m_log.InfoFormat("[HGLOGIN] HGVerifyKey called with key {0}", authKey); 175 m_log.InfoFormat("[HGLOGIN] HGVerifyKey called with key {0}", authKey);
176 176
177 if (!(m_userManager is IAuthentication)) 177 if (!(m_userManager is IAuthentication))
178 { 178 {
179 m_log.Debug("[HGLOGIN]: UserManager is not IAuthentication service. Denying."); 179 m_log.Debug("[HGLOGIN]: UserManager is not IAuthentication service. Denying.");
180 } 180 }
181 else 181 else
182 { 182 {
183 success = ((IAuthentication)m_userManager).VerifyKey(userID, authKey); 183 success = ((IAuthentication)m_userManager).VerifyKey(userID, authKey);
184 } 184 }
185 } 185 }
186 } 186 }
187 187
188 m_log.DebugFormat("[HGLOGIN]: Response to VerifyKey is {0}", success); 188 m_log.DebugFormat("[HGLOGIN]: Response to VerifyKey is {0}", success);
189 XmlRpcResponse response = new XmlRpcResponse(); 189 XmlRpcResponse response = new XmlRpcResponse();
190 response.Value = success; 190 response.Value = success;
191 return response; 191 return response;
192 } 192 }
193 193
194 public override UserProfileData GetTheUser(string firstname, string lastname) 194 public override UserProfileData GetTheUser(string firstname, string lastname)
195 { 195 {
196 UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname); 196 UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname);
197 if (profile != null) 197 if (profile != null)
198 { 198 {
199 return profile; 199 return profile;
200 } 200 }
201 201
202 if (!m_authUsers) 202 if (!m_authUsers)
203 { 203 {
204 //no current user account so make one 204 //no current user account so make one
205 m_log.Info("[LOGIN]: No user account found so creating a new one."); 205 m_log.Info("[LOGIN]: No user account found so creating a new one.");
206 206
207 m_userManager.AddUser(firstname, lastname, "test", "", m_defaultHomeX, m_defaultHomeY); 207 m_userManager.AddUser(firstname, lastname, "test", "", m_defaultHomeX, m_defaultHomeY);
208 208
209 return m_userManager.GetUserProfile(firstname, lastname); 209 return m_userManager.GetUserProfile(firstname, lastname);
210 } 210 }
211 211
212 return null; 212 return null;
213 } 213 }
214 214
215 public override bool AuthenticateUser(UserProfileData profile, string password) 215 public override bool AuthenticateUser(UserProfileData profile, string password)
216 { 216 {
217 if (!m_authUsers) 217 if (!m_authUsers)
218 { 218 {
219 //for now we will accept any password in sandbox mode 219 //for now we will accept any password in sandbox mode
220 m_log.Info("[LOGIN]: Authorising user (no actual password check)"); 220 m_log.Info("[LOGIN]: Authorising user (no actual password check)");
221 221
222 return true; 222 return true;
223 } 223 }
224 else 224 else
225 { 225 {
226 m_log.Info( 226 m_log.Info(
227 "[LOGIN]: Authenticating " + profile.FirstName + " " + profile.SurName); 227 "[LOGIN]: Authenticating " + profile.FirstName + " " + profile.SurName);
228 228
229 if (!password.StartsWith("$1$")) 229 if (!password.StartsWith("$1$"))
230 password = "$1$" + Util.Md5Hash(password); 230 password = "$1$" + Util.Md5Hash(password);
231 231
232 password = password.Remove(0, 3); //remove $1$ 232 password = password.Remove(0, 3); //remove $1$
233 233
234 string s = Util.Md5Hash(password + ":" + profile.PasswordSalt); 234 string s = Util.Md5Hash(password + ":" + profile.PasswordSalt);
235 235
236 bool loginresult = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) 236 bool loginresult = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
237 || profile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); 237 || profile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase));
238 return loginresult; 238 return loginresult;
239 } 239 }
240 } 240 }
241 241
242 protected override RegionInfo RequestClosestRegion(string region) 242 protected override RegionInfo RequestClosestRegion(string region)
243 { 243 {
244 return m_regionsConnector.RequestClosestRegion(region); 244 return m_regionsConnector.RequestClosestRegion(region);
245 } 245 }
246 246
247 protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) 247 protected override RegionInfo GetRegionInfo(ulong homeRegionHandle)
248 { 248 {
249 return m_regionsConnector.RequestNeighbourInfo(homeRegionHandle); 249 return m_regionsConnector.RequestNeighbourInfo(homeRegionHandle);
250 } 250 }
251 251
252 protected override RegionInfo GetRegionInfo(UUID homeRegionId) 252 protected override RegionInfo GetRegionInfo(UUID homeRegionId)
253 { 253 {
254 return m_regionsConnector.RequestNeighbourInfo(homeRegionId); 254 return m_regionsConnector.RequestNeighbourInfo(homeRegionId);
255 } 255 }
256 256
257 257
258 /// <summary> 258 /// <summary>
259 /// Not really informing the region. Just filling out the response fields related to the region. 259 /// Not really informing the region. Just filling out the response fields related to the region.
260 /// </summary> 260 /// </summary>
261 /// <param name="sim"></param> 261 /// <param name="sim"></param>
262 /// <param name="user"></param> 262 /// <param name="user"></param>
263 /// <param name="response"></param> 263 /// <param name="response"></param>
264 /// <returns>true if the region was successfully contacted, false otherwise</returns> 264 /// <returns>true if the region was successfully contacted, false otherwise</returns>
265 protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response) 265 protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response)
266 { 266 {
267 IPEndPoint endPoint = regionInfo.ExternalEndPoint; 267 IPEndPoint endPoint = regionInfo.ExternalEndPoint;
268 response.SimAddress = endPoint.Address.ToString(); 268 response.SimAddress = endPoint.Address.ToString();
269 response.SimPort = (uint)endPoint.Port; 269 response.SimPort = (uint)endPoint.Port;
270 response.RegionX = regionInfo.RegionLocX; 270 response.RegionX = regionInfo.RegionLocX;
271 response.RegionY = regionInfo.RegionLocY; 271 response.RegionY = regionInfo.RegionLocY;
272 response.SimHttpPort = regionInfo.HttpPort; 272 response.SimHttpPort = regionInfo.HttpPort;
273 273
274 string capsPath = CapsUtil.GetRandomCapsObjectPath(); 274 string capsPath = CapsUtil.GetRandomCapsObjectPath();
275 string capsSeedPath = CapsUtil.GetCapsSeedPath(capsPath); 275 string capsSeedPath = CapsUtil.GetCapsSeedPath(capsPath);
276 276
277 // Don't use the following! It Fails for logging into any region not on the same port as the http server! 277 // Don't use the following! It Fails for logging into any region not on the same port as the http server!
278 // Kept here so it doesn't happen again! 278 // Kept here so it doesn't happen again!
279 // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; 279 // response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
280 280
281 string seedcap = "http://"; 281 string seedcap = "http://";
282 282
283 if (m_serversInfo.HttpUsesSSL) 283 if (m_serversInfo.HttpUsesSSL)
284 { 284 {
285 seedcap = "https://" + m_serversInfo.HttpSSLCN + ":" + regionInfo.HttpPort + capsSeedPath; 285 seedcap = "https://" + m_serversInfo.HttpSSLCN + ":" + regionInfo.HttpPort + capsSeedPath;
286 } 286 }
287 else 287 else
288 { 288 {
289 seedcap = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + capsSeedPath; 289 seedcap = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + capsSeedPath;
290 } 290 }
291 291
292 response.SeedCapability = seedcap; 292 response.SeedCapability = seedcap;
293 293
294 // Notify the target of an incoming user 294 // Notify the target of an incoming user
295 m_log.InfoFormat( 295 m_log.InfoFormat(
296 "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection", 296 "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
297 regionInfo.RegionName, response.RegionX, response.RegionY, regionInfo.ServerURI); 297 regionInfo.RegionName, response.RegionX, response.RegionY, regionInfo.ServerURI);
298 298
299 // Update agent with target sim 299 // Update agent with target sim
300 user.CurrentAgent.Region = regionInfo.RegionID; 300 user.CurrentAgent.Region = regionInfo.RegionID;
301 user.CurrentAgent.Handle = regionInfo.RegionHandle; 301 user.CurrentAgent.Handle = regionInfo.RegionHandle;
302 302
303 return true; 303 return true;
304 } 304 }
305 305
306 public override void LogOffUser(UserProfileData theUser, string message) 306 public override void LogOffUser(UserProfileData theUser, string message)
307 { 307 {
308 RegionInfo SimInfo; 308 RegionInfo SimInfo;
309 try 309 try
310 { 310 {
311 SimInfo = this.m_regionsConnector.RequestNeighbourInfo(theUser.CurrentAgent.Handle); 311 SimInfo = this.m_regionsConnector.RequestNeighbourInfo(theUser.CurrentAgent.Handle);
312 312
313 if (SimInfo == null) 313 if (SimInfo == null)
314 { 314 {
315 m_log.Error("[LOCAL LOGIN]: Region user was in isn't currently logged in"); 315 m_log.Error("[LOCAL LOGIN]: Region user was in isn't currently logged in");
316 return; 316 return;
317 } 317 }
318 } 318 }
319 catch (Exception) 319 catch (Exception)
320 { 320 {
321 m_log.Error("[LOCAL LOGIN]: Unable to look up region to log user off"); 321 m_log.Error("[LOCAL LOGIN]: Unable to look up region to log user off");
322 return; 322 return;
323 } 323 }
324 324
325 m_regionsConnector.LogOffUserFromGrid(SimInfo.RegionHandle, theUser.ID, theUser.CurrentAgent.SecureSessionID, "Logging you off"); 325 m_regionsConnector.LogOffUserFromGrid(SimInfo.RegionHandle, theUser.ID, theUser.CurrentAgent.SecureSessionID, "Logging you off");
326 } 326 }
327 } 327 }
328} 328}