diff options
author | Charles Krinke | 2008-07-29 03:43:31 +0000 |
---|---|---|
committer | Charles Krinke | 2008-07-29 03:43:31 +0000 |
commit | bfa1fd768b2c6bbd49542c2873a8fbf31747fcea (patch) | |
tree | 1c94e44c5036c5f8f901ec13ce3febc41a51c6ed /OpenSim/Framework/Communications/LoginService.cs | |
parent | Trying to guestimate sensible default values for GridInfoService if no (diff) | |
download | opensim-SC-bfa1fd768b2c6bbd49542c2873a8fbf31747fcea.zip opensim-SC-bfa1fd768b2c6bbd49542c2873a8fbf31747fcea.tar.gz opensim-SC-bfa1fd768b2c6bbd49542c2873a8fbf31747fcea.tar.bz2 opensim-SC-bfa1fd768b2c6bbd49542c2873a8fbf31747fcea.tar.xz |
Mantis#1849. Thank you kindly, Kinoc for a patch that:
- LLSDLoginMethod should error out in similar way to XMLRPC login for already logged in condition
- Have LLSDLoginMethod mirror the sequence of the XMLRPC for easier side by side compare
- Log messages report which process XML or LLSD generated them for easier debugging
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 93 |
1 files changed, 64 insertions, 29 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index e95dd21..d603052 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -130,7 +130,7 @@ namespace OpenSim.Framework.Communications | |||
130 | lastname = (string) requestData["last"]; | 130 | lastname = (string) requestData["last"]; |
131 | 131 | ||
132 | m_log.InfoFormat( | 132 | m_log.InfoFormat( |
133 | "[LOGIN BEGIN]: Received login request message from user {0} {1}", | 133 | "[LOGIN BEGIN]: XMLRPC Received login request message from user '{0}' '{1}'", |
134 | firstname, lastname); | 134 | firstname, lastname); |
135 | 135 | ||
136 | string clientVersion = "Unknown"; | 136 | string clientVersion = "Unknown"; |
@@ -146,12 +146,12 @@ namespace OpenSim.Framework.Communications | |||
146 | } | 146 | } |
147 | 147 | ||
148 | m_log.DebugFormat( | 148 | m_log.DebugFormat( |
149 | "[LOGIN]: Client is {0}, start location is {1}", clientVersion, startLocationRequest); | 149 | "[LOGIN]: XMLRPC Client is {0}, start location is {1}", clientVersion, startLocationRequest); |
150 | 150 | ||
151 | userProfile = GetTheUser(firstname, lastname); | 151 | userProfile = GetTheUser(firstname, lastname); |
152 | if (userProfile == null) | 152 | if (userProfile == null) |
153 | { | 153 | { |
154 | m_log.Info("[LOGIN END]: Could not find a profile for " + firstname + " " + lastname); | 154 | m_log.Info("[LOGIN END]: XMLRPC Could not find a profile for " + firstname + " " + lastname); |
155 | 155 | ||
156 | return logResponse.CreateLoginFailedResponse(); | 156 | return logResponse.CreateLoginFailedResponse(); |
157 | } | 157 | } |
@@ -171,7 +171,7 @@ namespace OpenSim.Framework.Communications | |||
171 | catch (Exception e) | 171 | catch (Exception e) |
172 | { | 172 | { |
173 | m_log.InfoFormat( | 173 | m_log.InfoFormat( |
174 | "[LOGIN END]: Bad web_login_key: {0} for user {1} {2}, exception {3}", | 174 | "[LOGIN END]: XMLRPC Bad web_login_key: {0} for user {1} {2}, exception {3}", |
175 | requestData["web_login_key"], firstname, lastname, e); | 175 | requestData["web_login_key"], firstname, lastname, e); |
176 | 176 | ||
177 | return logResponse.CreateFailedResponse(); | 177 | return logResponse.CreateFailedResponse(); |
@@ -183,14 +183,14 @@ namespace OpenSim.Framework.Communications | |||
183 | else | 183 | else |
184 | { | 184 | { |
185 | m_log.Info( | 185 | m_log.Info( |
186 | "[LOGIN END]: login_to_simulator login message did not contain all the required data"); | 186 | "[LOGIN END]: XMLRPC login_to_simulator login message did not contain all the required data"); |
187 | 187 | ||
188 | return logResponse.CreateGridErrorResponse(); | 188 | return logResponse.CreateGridErrorResponse(); |
189 | } | 189 | } |
190 | 190 | ||
191 | if (!GoodLogin) | 191 | if (!GoodLogin) |
192 | { | 192 | { |
193 | m_log.InfoFormat("[LOGIN END]: User {0} {1} failed authentication", firstname, lastname); | 193 | m_log.InfoFormat("[LOGIN END]: XMLRPC User {0} {1} failed authentication", firstname, lastname); |
194 | 194 | ||
195 | return logResponse.CreateLoginFailedResponse(); | 195 | return logResponse.CreateLoginFailedResponse(); |
196 | } | 196 | } |
@@ -208,13 +208,13 @@ namespace OpenSim.Framework.Communications | |||
208 | m_userManager.CommitAgent(ref userProfile); | 208 | m_userManager.CommitAgent(ref userProfile); |
209 | 209 | ||
210 | // try to tell the region that their user is dead. | 210 | // try to tell the region that their user is dead. |
211 | LogOffUser(userProfile, "You were logged off because you logged in from another location"); | 211 | LogOffUser(userProfile, " XMLRPC You were logged off because you logged in from another location"); |
212 | 212 | ||
213 | // Reject the login | 213 | // Reject the login |
214 | 214 | ||
215 | 215 | ||
216 | m_log.InfoFormat( | 216 | m_log.InfoFormat( |
217 | "[LOGIN END]: Notifying user {0} {1} that they are already logged in", | 217 | "[LOGIN END]: XMLRPC Notifying user {0} {1} that they are already logged in", |
218 | firstname, lastname); | 218 | firstname, lastname); |
219 | 219 | ||
220 | return logResponse.CreateAlreadyLoggedInResponse(); | 220 | return logResponse.CreateAlreadyLoggedInResponse(); |
@@ -235,7 +235,7 @@ namespace OpenSim.Framework.Communications | |||
235 | catch (Exception e) | 235 | catch (Exception e) |
236 | { | 236 | { |
237 | m_log.ErrorFormat( | 237 | m_log.ErrorFormat( |
238 | "[LOGIN END]: Error retrieving inventory skeleton of agent {0}, {1} - {2}", | 238 | "[LOGIN END]: XMLRPC Error retrieving inventory skeleton of agent {0}, {1} - {2}", |
239 | agentID, e.GetType(), e.Message); | 239 | agentID, e.GetType(), e.Message); |
240 | 240 | ||
241 | return logResponse.CreateLoginInventoryFailedResponse(); | 241 | return logResponse.CreateLoginInventoryFailedResponse(); |
@@ -288,7 +288,7 @@ namespace OpenSim.Framework.Communications | |||
288 | } | 288 | } |
289 | catch (Exception e) | 289 | catch (Exception e) |
290 | { | 290 | { |
291 | m_log.Info("[LOGIN END]: " + e.ToString()); | 291 | m_log.Info("[LOGIN END]: XMLRPC " + e.ToString()); |
292 | return logResponse.CreateDeadRegionResponse(); | 292 | return logResponse.CreateDeadRegionResponse(); |
293 | //return logResponse.ToXmlRpcResponse(); | 293 | //return logResponse.ToXmlRpcResponse(); |
294 | } | 294 | } |
@@ -299,18 +299,18 @@ namespace OpenSim.Framework.Communications | |||
299 | StatsManager.UserStats.AddSuccessfulLogin(); | 299 | StatsManager.UserStats.AddSuccessfulLogin(); |
300 | 300 | ||
301 | m_log.DebugFormat( | 301 | m_log.DebugFormat( |
302 | "[LOGIN END]: Authentication of user {0} {1} successful. Sending response to client.", | 302 | "[LOGIN END]: XMLRPC Authentication of user {0} {1} successful. Sending response to client.", |
303 | firstname, lastname); | 303 | firstname, lastname); |
304 | 304 | ||
305 | return logResponse.ToXmlRpcResponse(); | 305 | return logResponse.ToXmlRpcResponse(); |
306 | } | 306 | } |
307 | catch (Exception e) | 307 | catch (Exception e) |
308 | { | 308 | { |
309 | m_log.Info("[LOGIN END]: Login failed, " + e.ToString()); | 309 | m_log.Info("[LOGIN END]: XMLRPC Login failed, " + e.ToString()); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
313 | m_log.Info("[LOGIN END]: Login failed. Sending back blank XMLRPC response"); | 313 | m_log.Info("[LOGIN END]: XMLRPC Login failed. Sending back blank XMLRPC response"); |
314 | return response; | 314 | return response; |
315 | } | 315 | } |
316 | finally | 316 | finally |
@@ -345,14 +345,15 @@ namespace OpenSim.Framework.Communications | |||
345 | 345 | ||
346 | if (map.ContainsKey("start")) | 346 | if (map.ContainsKey("start")) |
347 | { | 347 | { |
348 | m_log.Info("[LOGIN]: StartLocation Requested: " + map["start"].AsString()); | 348 | m_log.Info("[LOGIN]: LLSD StartLocation Requested: " + map["start"].AsString()); |
349 | startLocationRequest = map["start"].AsString(); | 349 | startLocationRequest = map["start"].AsString(); |
350 | } | 350 | } |
351 | m_log.Info("[LOGIN]: LLSD Login Requested for: '" + firstname+"' '"+lastname+"' / "+passwd); | ||
351 | 352 | ||
352 | userProfile = GetTheUser(firstname, lastname); | 353 | userProfile = GetTheUser(firstname, lastname); |
353 | if (userProfile == null) | 354 | if (userProfile == null) |
354 | { | 355 | { |
355 | m_log.Info("[LOGIN]: Could not find a profile for " + firstname + " " + lastname); | 356 | m_log.Info("[LOGIN]: LLSD Could not find a profile for " + firstname + " " + lastname); |
356 | 357 | ||
357 | return logResponse.CreateLoginFailedResponseLLSD(); | 358 | return logResponse.CreateLoginFailedResponseLLSD(); |
358 | } | 359 | } |
@@ -370,10 +371,19 @@ namespace OpenSim.Framework.Communications | |||
370 | // If we already have a session... | 371 | // If we already have a session... |
371 | if (userProfile.CurrentAgent != null && userProfile.CurrentAgent.AgentOnline) | 372 | if (userProfile.CurrentAgent != null && userProfile.CurrentAgent.AgentOnline) |
372 | { | 373 | { |
373 | userProfile.CurrentAgent = null; | 374 | userProfile.CurrentAgent.AgentOnline = false; |
375 | |||
374 | m_userManager.CommitAgent(ref userProfile); | 376 | m_userManager.CommitAgent(ref userProfile); |
377 | // try to tell the region that their user is dead. | ||
378 | LogOffUser(userProfile, " LLSD You were logged off because you logged in from another location"); | ||
375 | 379 | ||
376 | // Reject the login | 380 | // Reject the login |
381 | |||
382 | m_log.InfoFormat( | ||
383 | "[LOGIN END]: LLSD Notifying user {0} {1} that they are already logged in", | ||
384 | userProfile.FirstName, userProfile.SurName); | ||
385 | |||
386 | userProfile.CurrentAgent = null; | ||
377 | return logResponse.CreateAlreadyLoggedInResponseLLSD(); | 387 | return logResponse.CreateAlreadyLoggedInResponseLLSD(); |
378 | } | 388 | } |
379 | 389 | ||
@@ -385,7 +395,23 @@ namespace OpenSim.Framework.Communications | |||
385 | { | 395 | { |
386 | LLUUID agentID = userProfile.ID; | 396 | LLUUID agentID = userProfile.ID; |
387 | 397 | ||
388 | InventoryData inventData = GetInventorySkeleton(agentID); | 398 | //InventoryData inventData = GetInventorySkeleton(agentID); |
399 | InventoryData inventData = null; | ||
400 | |||
401 | try | ||
402 | { | ||
403 | inventData = GetInventorySkeleton(agentID); | ||
404 | } | ||
405 | catch (Exception e) | ||
406 | { | ||
407 | m_log.ErrorFormat( | ||
408 | "[LOGIN END]: LLSD Error retrieving inventory skeleton of agent {0}, {1} - {2}", | ||
409 | agentID, e.GetType(), e.Message); | ||
410 | |||
411 | return logResponse.CreateLoginFailedResponseLLSD();// .CreateLoginInventoryFailedResponseLLSD (); | ||
412 | } | ||
413 | |||
414 | |||
389 | ArrayList AgentInventoryArray = inventData.InventoryArray; | 415 | ArrayList AgentInventoryArray = inventData.InventoryArray; |
390 | 416 | ||
391 | Hashtable InventoryRootHash = new Hashtable(); | 417 | Hashtable InventoryRootHash = new Hashtable(); |
@@ -394,6 +420,20 @@ namespace OpenSim.Framework.Communications | |||
394 | InventoryRoot.Add(InventoryRootHash); | 420 | InventoryRoot.Add(InventoryRootHash); |
395 | userProfile.RootInventoryFolderID = inventData.RootFolderID; | 421 | userProfile.RootInventoryFolderID = inventData.RootFolderID; |
396 | 422 | ||
423 | |||
424 | // Inventory Library Section | ||
425 | Hashtable InventoryLibRootHash = new Hashtable(); | ||
426 | InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; | ||
427 | ArrayList InventoryLibRoot = new ArrayList(); | ||
428 | InventoryLibRoot.Add(InventoryLibRootHash); | ||
429 | logResponse.InventoryLibRoot = InventoryLibRoot; | ||
430 | |||
431 | logResponse.InventoryLibraryOwner = GetLibraryOwner(); | ||
432 | |||
433 | logResponse.InventoryRoot = InventoryRoot; | ||
434 | logResponse.InventorySkeleton = AgentInventoryArray; | ||
435 | logResponse.InventoryLibrary = GetInventoryLibrary(); | ||
436 | |||
397 | // Circuit Code | 437 | // Circuit Code |
398 | uint circode = (uint)(Util.RandomClass.Next()); | 438 | uint circode = (uint)(Util.RandomClass.Next()); |
399 | 439 | ||
@@ -402,17 +442,7 @@ namespace OpenSim.Framework.Communications | |||
402 | logResponse.AgentID = agentID.ToString(); | 442 | logResponse.AgentID = agentID.ToString(); |
403 | logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString(); | 443 | logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString(); |
404 | logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); | 444 | logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); |
405 | logResponse.InventoryRoot = InventoryRoot; | ||
406 | logResponse.InventorySkeleton = AgentInventoryArray; | ||
407 | logResponse.InventoryLibrary = GetInventoryLibrary(); | ||
408 | |||
409 | Hashtable InventoryLibRootHash = new Hashtable(); | ||
410 | InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; | ||
411 | ArrayList InventoryLibRoot = new ArrayList(); | ||
412 | InventoryLibRoot.Add(InventoryLibRootHash); | ||
413 | logResponse.InventoryLibRoot = InventoryLibRoot; | ||
414 | 445 | ||
415 | logResponse.InventoryLibraryOwner = GetLibraryOwner(); | ||
416 | logResponse.CircuitCode = (Int32)circode; | 446 | logResponse.CircuitCode = (Int32)circode; |
417 | //logResponse.RegionX = 0; //overwritten | 447 | //logResponse.RegionX = 0; //overwritten |
418 | //logResponse.RegionY = 0; //overwritten | 448 | //logResponse.RegionY = 0; //overwritten |
@@ -422,6 +452,7 @@ namespace OpenSim.Framework.Communications | |||
422 | //logResponse.SimPort = 0; //overwritten | 452 | //logResponse.SimPort = 0; //overwritten |
423 | logResponse.Message = GetMessage(); | 453 | logResponse.Message = GetMessage(); |
424 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); | 454 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); |
455 | logResponse.StartLocation = startLocationRequest; | ||
425 | 456 | ||
426 | try | 457 | try |
427 | { | 458 | { |
@@ -429,7 +460,7 @@ namespace OpenSim.Framework.Communications | |||
429 | } | 460 | } |
430 | catch (Exception ex) | 461 | catch (Exception ex) |
431 | { | 462 | { |
432 | m_log.Info("[LOGIN]: " + ex.ToString()); | 463 | m_log.Info("[LOGIN]: LLSD " + ex.ToString()); |
433 | return logResponse.CreateDeadRegionResponseLLSD(); | 464 | return logResponse.CreateDeadRegionResponseLLSD(); |
434 | } | 465 | } |
435 | 466 | ||
@@ -439,11 +470,15 @@ namespace OpenSim.Framework.Communications | |||
439 | if (StatsManager.UserStats != null) | 470 | if (StatsManager.UserStats != null) |
440 | StatsManager.UserStats.AddSuccessfulLogin(); | 471 | StatsManager.UserStats.AddSuccessfulLogin(); |
441 | 472 | ||
473 | m_log.DebugFormat( | ||
474 | "[LOGIN END]: LLSD Authentication of user {0} {1} successful. Sending response to client.", | ||
475 | userProfile.FirstName, userProfile.SurName); | ||
476 | |||
442 | return logResponse.ToLLSDResponse(); | 477 | return logResponse.ToLLSDResponse(); |
443 | } | 478 | } |
444 | catch (Exception ex) | 479 | catch (Exception ex) |
445 | { | 480 | { |
446 | m_log.Info("[LOGIN]: " + ex.ToString()); | 481 | m_log.Info("[LOGIN]: LLSD " + ex.ToString()); |
447 | return logResponse.CreateFailedResponseLLSD(); | 482 | return logResponse.CreateFailedResponseLLSD(); |
448 | } | 483 | } |
449 | } | 484 | } |