aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/UserManager/UserManagerBase.cs
diff options
context:
space:
mode:
authorlbsa712007-07-01 13:17:27 +0000
committerlbsa712007-07-01 13:17:27 +0000
commit5e805656db1215518a344d6d5364629a4997fd47 (patch)
tree2d8b50bac8e77f983e3016e969df3535c52fb0d3 /OpenSim/Framework/UserManager/UserManagerBase.cs
parent* Project files fixed for OGS. (diff)
downloadopensim-SC_OLD-5e805656db1215518a344d6d5364629a4997fd47.zip
opensim-SC_OLD-5e805656db1215518a344d6d5364629a4997fd47.tar.gz
opensim-SC_OLD-5e805656db1215518a344d6d5364629a4997fd47.tar.bz2
opensim-SC_OLD-5e805656db1215518a344d6d5364629a4997fd47.tar.xz
Fixed SimpleApp - aka thankgoditssundaycommit
* Updated SimpleApp with various introduced dependencies * Extracted ScenePrescence creation in Scene * removed try-catchall from UserManagerBase (that actually hid a bug) * Refactored RegionInfo * handle is calculated * it will explode upon accessing x,y,ip,port,externalip if not explicitly initialized * Removed superfluous 'ref' keywords * Removed a shitload of 'catch Exception e' that causes build warnings * Lots of small refactorings, renames et c * Ignored some bins
Diffstat (limited to 'OpenSim/Framework/UserManager/UserManagerBase.cs')
-rw-r--r--OpenSim/Framework/UserManager/UserManagerBase.cs60
1 files changed, 25 insertions, 35 deletions
diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs
index d06059e..560752e 100644
--- a/OpenSim/Framework/UserManager/UserManagerBase.cs
+++ b/OpenSim/Framework/UserManager/UserManagerBase.cs
@@ -43,7 +43,7 @@ using System.Security.Cryptography;
43 43
44namespace OpenSim.Framework.UserManagement 44namespace OpenSim.Framework.UserManagement
45{ 45{
46 public class UserManagerBase 46 public abstract class UserManagerBase
47 { 47 {
48 public OpenSim.Framework.Interfaces.UserConfig _config; 48 public OpenSim.Framework.Interfaces.UserConfig _config;
49 Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); 49 Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
@@ -142,14 +142,9 @@ namespace OpenSim.Framework.UserManagement
142 try 142 try
143 { 143 {
144 UserProfileData profile = plugin.Value.getUserByName(fname,lname); 144 UserProfileData profile = plugin.Value.getUserByName(fname,lname);
145 try 145
146 { 146 profile.currentAgent = getUserAgent(profile.UUID);
147 profile.currentAgent = getUserAgent(profile.UUID); 147
148 }
149 catch (Exception e)
150 {
151 // Ignore
152 }
153 return profile; 148 return profile;
154 } 149 }
155 catch (Exception e) 150 catch (Exception e)
@@ -238,16 +233,14 @@ namespace OpenSim.Framework.UserManagement
238 /// </summary> 233 /// </summary>
239 /// <param name="profile">The users profile</param> 234 /// <param name="profile">The users profile</param>
240 /// <param name="request">The users loginrequest</param> 235 /// <param name="request">The users loginrequest</param>
241 public void CreateAgent(ref UserProfileData profile, XmlRpcRequest request) 236 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
242 { 237 {
243 Hashtable requestData = (Hashtable)request.Params[0]; 238 Hashtable requestData = (Hashtable)request.Params[0];
244 239
245 UserAgentData agent = new UserAgentData(); 240 UserAgentData agent = new UserAgentData();
246 241
247 // User connection 242 // User connection
248 agent.agentIP = "";
249 agent.agentOnline = true; 243 agent.agentOnline = true;
250 agent.agentPort = 0;
251 244
252 // Generate sessions 245 // Generate sessions
253 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); 246 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
@@ -282,7 +275,7 @@ namespace OpenSim.Framework.UserManagement
282 //SimProfile SimInfo = new SimProfile(); 275 //SimProfile SimInfo = new SimProfile();
283 //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); 276 //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
284 } 277 }
285 catch (Exception e) 278 catch (Exception)
286 { 279 {
287 280
288 } 281 }
@@ -319,7 +312,7 @@ namespace OpenSim.Framework.UserManagement
319 /// <param name="profile">The users profile</param> 312 /// <param name="profile">The users profile</param>
320 /// <param name="password">The supplied password</param> 313 /// <param name="password">The supplied password</param>
321 /// <returns>Authenticated?</returns> 314 /// <returns>Authenticated?</returns>
322 public virtual bool AuthenticateUser(ref UserProfileData profile, string password) 315 public virtual bool AuthenticateUser(UserProfileData profile, string password)
323 { 316 {
324 OpenSim.Framework.Console.MainLog.Instance.Verbose( 317 OpenSim.Framework.Console.MainLog.Instance.Verbose(
325 "Authenticating " + profile.username + " " + profile.surname); 318 "Authenticating " + profile.username + " " + profile.surname);
@@ -358,10 +351,7 @@ namespace OpenSim.Framework.UserManagement
358 /// </summary> 351 /// </summary>
359 /// <param name="response">The existing response</param> 352 /// <param name="response">The existing response</param>
360 /// <param name="theUser">The user profile</param> 353 /// <param name="theUser">The user profile</param>
361 public virtual void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) 354 public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser);
362 {
363
364 }
365 355
366 /// <summary> 356 /// <summary>
367 /// Main user login function 357 /// Main user login function
@@ -379,7 +369,7 @@ namespace OpenSim.Framework.UserManagement
379 string lastname = ""; 369 string lastname = "";
380 string passwd = ""; 370 string passwd = "";
381 371
382 UserProfileData TheUser; 372 UserProfileData userProfile;
383 LoginResponse logResponse = new LoginResponse(); 373 LoginResponse logResponse = new LoginResponse();
384 374
385 if (GoodXML) 375 if (GoodXML)
@@ -388,11 +378,11 @@ namespace OpenSim.Framework.UserManagement
388 lastname = (string)requestData["last"]; 378 lastname = (string)requestData["last"];
389 passwd = (string)requestData["passwd"]; 379 passwd = (string)requestData["passwd"];
390 380
391 TheUser = GetTheUser(firstname, lastname); 381 userProfile = GetTheUser(firstname, lastname);
392 if (TheUser == null) 382 if (userProfile == null)
393 return logResponse.CreateLoginFailedResponse(); 383 return logResponse.CreateLoginFailedResponse();
394 384
395 GoodLogin = AuthenticateUser(ref TheUser, passwd); 385 GoodLogin = AuthenticateUser(userProfile, passwd);
396 } 386 }
397 else 387 else
398 { 388 {
@@ -406,19 +396,19 @@ namespace OpenSim.Framework.UserManagement
406 else 396 else
407 { 397 {
408 // If we already have a session... 398 // If we already have a session...
409 if (TheUser.currentAgent != null && TheUser.currentAgent.agentOnline) 399 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
410 { 400 {
411 // Reject the login 401 // Reject the login
412 return logResponse.CreateAlreadyLoggedInResponse(); 402 return logResponse.CreateAlreadyLoggedInResponse();
413 } 403 }
414 // Otherwise... 404 // Otherwise...
415 // Create a new agent session 405 // Create a new agent session
416 CreateAgent(ref TheUser, request); 406 CreateAgent( userProfile, request);
417 407
418 try 408 try
419 { 409 {
420 410
421 LLUUID AgentID = TheUser.UUID; 411 LLUUID AgentID = userProfile.UUID;
422 412
423 // Inventory Library Section 413 // Inventory Library Section
424 ArrayList AgentInventoryArray = new ArrayList(); 414 ArrayList AgentInventoryArray = new ArrayList();
@@ -446,32 +436,32 @@ namespace OpenSim.Framework.UserManagement
446 // Circuit Code 436 // Circuit Code
447 uint circode = (uint)(Util.RandomClass.Next()); 437 uint circode = (uint)(Util.RandomClass.Next());
448 438
449 logResponse.Lastname = TheUser.surname; 439 logResponse.Lastname = userProfile.surname;
450 logResponse.Firstname = TheUser.username; 440 logResponse.Firstname = userProfile.username;
451 logResponse.AgentID = AgentID.ToStringHyphenated(); 441 logResponse.AgentID = AgentID.ToStringHyphenated();
452 logResponse.SessionID = TheUser.currentAgent.sessionID.ToStringHyphenated(); 442 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
453 logResponse.SecureSessionID = TheUser.currentAgent.secureSessionID.ToStringHyphenated(); 443 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
454 logResponse.InventoryRoot = InventoryRoot; 444 logResponse.InventoryRoot = InventoryRoot;
455 logResponse.InventorySkeleton = AgentInventoryArray; 445 logResponse.InventorySkeleton = AgentInventoryArray;
456 logResponse.CircuitCode = (Int32)circode; 446 logResponse.CircuitCode = (Int32)circode;
457 logResponse.RegionX = 0; //overwritten 447 //logResponse.RegionX = 0; //overwritten
458 logResponse.RegionY = 0; //overwritten 448 //logResponse.RegionY = 0; //overwritten
459 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten 449 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
460 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; 450 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
461 logResponse.SimAddress = "127.0.0.1"; //overwritten 451 //logResponse.SimAddress = "127.0.0.1"; //overwritten
462 logResponse.SimPort = 0; //overwritten 452 //logResponse.SimPort = 0; //overwritten
463 logResponse.Message = this.GetMessage(); 453 logResponse.Message = this.GetMessage();
464 454
465 try 455 try
466 { 456 {
467 this.CustomiseResponse(ref logResponse, ref TheUser); 457 this.CustomiseResponse( logResponse, userProfile);
468 } 458 }
469 catch (Exception e) 459 catch (Exception e)
470 { 460 {
471 System.Console.WriteLine(e.ToString()); 461 System.Console.WriteLine(e.ToString());
472 return logResponse.CreateDeadRegionResponse(); 462 return logResponse.CreateDeadRegionResponse();
473 } 463 }
474 CommitAgent(ref TheUser); 464 CommitAgent(ref userProfile);
475 return logResponse.ToXmlRpcResponse(); 465 return logResponse.ToXmlRpcResponse();
476 466
477 } 467 }