diff options
author | Jeff Ames | 2008-02-05 19:44:27 +0000 |
---|---|---|
committer | Jeff Ames | 2008-02-05 19:44:27 +0000 |
commit | 6ed5283bc06a62f38eb517e67b975832b603bf61 (patch) | |
tree | e5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Framework/Communications/LoginService.cs | |
parent | Cut down on the number of packets sent during terraforming. Terraforming shou... (diff) | |
download | opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.zip opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2 opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz |
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O.
This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to 'OpenSim/Framework/Communications/LoginService.cs')
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 865349f..db86a97 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -44,6 +44,8 @@ namespace OpenSim.Framework.UserManagement | |||
44 | { | 44 | { |
45 | public class LoginService | 45 | public class LoginService |
46 | { | 46 | { |
47 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
47 | protected string m_welcomeMessage = "Welcome to OpenSim"; | 49 | protected string m_welcomeMessage = "Welcome to OpenSim"; |
48 | protected UserManagerBase m_userManager = null; | 50 | protected UserManagerBase m_userManager = null; |
49 | protected Mutex m_loginMutex = new Mutex(false); | 51 | protected Mutex m_loginMutex = new Mutex(false); |
@@ -83,7 +85,7 @@ namespace OpenSim.Framework.UserManagement | |||
83 | try | 85 | try |
84 | { | 86 | { |
85 | //CFK: CustomizeResponse contains sufficient strings to alleviate the need for this. | 87 | //CFK: CustomizeResponse contains sufficient strings to alleviate the need for this. |
86 | //CKF: MainLog.Instance.Verbose("LOGIN", "Attempting login now..."); | 88 | //CKF: m_log.Info("[LOGIN]: Attempting login now..."); |
87 | XmlRpcResponse response = new XmlRpcResponse(); | 89 | XmlRpcResponse response = new XmlRpcResponse(); |
88 | Hashtable requestData = (Hashtable) request.Params[0]; | 90 | Hashtable requestData = (Hashtable) request.Params[0]; |
89 | 91 | ||
@@ -102,16 +104,14 @@ namespace OpenSim.Framework.UserManagement | |||
102 | if( requestData.Contains("version")) | 104 | if( requestData.Contains("version")) |
103 | { | 105 | { |
104 | string clientversion = (string)requestData["version"]; | 106 | string clientversion = (string)requestData["version"]; |
105 | MainLog.Instance.Verbose("LOGIN","Client Version " + clientversion + " for " + firstname + " " + lastname); | 107 | m_log.Info("[LOGIN]: Client Version " + clientversion + " for " + firstname + " " + lastname); |
106 | } | 108 | } |
107 | 109 | ||
108 | 110 | ||
109 | userProfile = GetTheUser(firstname, lastname); | 111 | userProfile = GetTheUser(firstname, lastname); |
110 | if (userProfile == null) | 112 | if (userProfile == null) |
111 | { | 113 | { |
112 | MainLog.Instance.Verbose( | 114 | m_log.Info("[LOGIN]: Could not find a profile for " + firstname + " " + lastname); |
113 | "LOGIN", | ||
114 | "Could not find a profile for " + firstname + " " + lastname); | ||
115 | 115 | ||
116 | return logResponse.CreateLoginFailedResponse(); | 116 | return logResponse.CreateLoginFailedResponse(); |
117 | } | 117 | } |
@@ -213,7 +213,7 @@ namespace OpenSim.Framework.UserManagement | |||
213 | } | 213 | } |
214 | catch (Exception e) | 214 | catch (Exception e) |
215 | { | 215 | { |
216 | MainLog.Instance.Verbose("LOGIN", e.ToString()); | 216 | m_log.Info("[LOGIN]: " + e.ToString()); |
217 | return logResponse.CreateDeadRegionResponse(); | 217 | return logResponse.CreateDeadRegionResponse(); |
218 | //return logResponse.ToXmlRpcResponse(); | 218 | //return logResponse.ToXmlRpcResponse(); |
219 | } | 219 | } |
@@ -225,10 +225,9 @@ namespace OpenSim.Framework.UserManagement | |||
225 | 225 | ||
226 | return logResponse.ToXmlRpcResponse(); | 226 | return logResponse.ToXmlRpcResponse(); |
227 | } | 227 | } |
228 | 228 | catch (Exception e) | |
229 | catch (Exception E) | ||
230 | { | 229 | { |
231 | MainLog.Instance.Verbose("LOGIN", E.ToString()); | 230 | m_log.Info("[LOGIN]: " + e.ToString()); |
232 | } | 231 | } |
233 | //} | 232 | //} |
234 | } | 233 | } |
@@ -265,9 +264,7 @@ namespace OpenSim.Framework.UserManagement | |||
265 | userProfile = GetTheUser(firstname, lastname); | 264 | userProfile = GetTheUser(firstname, lastname); |
266 | if (userProfile == null) | 265 | if (userProfile == null) |
267 | { | 266 | { |
268 | MainLog.Instance.Verbose( | 267 | m_log.Info("[LOGIN]: Could not find a profile for " + firstname + " " + lastname); |
269 | "LOGIN", | ||
270 | "Could not find a profile for " + firstname + " " + lastname); | ||
271 | 268 | ||
272 | return logResponse.CreateLoginFailedResponseLLSD(); | 269 | return logResponse.CreateLoginFailedResponseLLSD(); |
273 | } | 270 | } |
@@ -345,7 +342,7 @@ namespace OpenSim.Framework.UserManagement | |||
345 | } | 342 | } |
346 | catch (Exception ex) | 343 | catch (Exception ex) |
347 | { | 344 | { |
348 | MainLog.Instance.Verbose("LOGIN", ex.ToString()); | 345 | m_log.Info("[LOGIN]: " + ex.ToString()); |
349 | return logResponse.CreateDeadRegionResponseLLSD(); | 346 | return logResponse.CreateDeadRegionResponseLLSD(); |
350 | } | 347 | } |
351 | 348 | ||
@@ -359,7 +356,7 @@ namespace OpenSim.Framework.UserManagement | |||
359 | } | 356 | } |
360 | catch (Exception ex) | 357 | catch (Exception ex) |
361 | { | 358 | { |
362 | MainLog.Instance.Verbose("LOGIN", ex.ToString()); | 359 | m_log.Info("[LOGIN]: " + ex.ToString()); |
363 | return logResponse.CreateFailedResponseLLSD(); | 360 | return logResponse.CreateFailedResponseLLSD(); |
364 | } | 361 | } |
365 | } | 362 | } |
@@ -458,7 +455,7 @@ namespace OpenSim.Framework.UserManagement | |||
458 | string redirectURL = "about:blank?redirect-http-hack=" + System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + | 455 | string redirectURL = "about:blank?redirect-http-hack=" + System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + |
459 | lastname + | 456 | lastname + |
460 | "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); | 457 | "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); |
461 | //MainLog.Instance.Verbose("WEB", "R:" + redirectURL); | 458 | //m_log.Info("[WEB]: R:" + redirectURL); |
462 | returnactions["int_response_code"] = statuscode; | 459 | returnactions["int_response_code"] = statuscode; |
463 | returnactions["str_redirect_location"] = redirectURL; | 460 | returnactions["str_redirect_location"] = redirectURL; |
464 | returnactions["str_response_string"] = "<HTML><BODY>GoodLogin</BODY></HTML>"; | 461 | returnactions["str_response_string"] = "<HTML><BODY>GoodLogin</BODY></HTML>"; |
@@ -604,27 +601,22 @@ namespace OpenSim.Framework.UserManagement | |||
604 | public virtual bool AuthenticateUser(UserProfileData profile, string password) | 601 | public virtual bool AuthenticateUser(UserProfileData profile, string password) |
605 | { | 602 | { |
606 | bool passwordSuccess = false; | 603 | bool passwordSuccess = false; |
607 | MainLog.Instance.Verbose( | 604 | m_log.Info( |
608 | "LOGIN", "Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID); | 605 | String.Format("[LOGIN]: Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID)); |
609 | 606 | ||
610 | // Web Login method seems to also occasionally send the hashed password itself | 607 | // Web Login method seems to also occasionally send the hashed password itself |
611 | 608 | ||
612 | |||
613 | // we do this to get our hash in a form that the server password code can consume | 609 | // we do this to get our hash in a form that the server password code can consume |
614 | // when the web-login-form submits the password in the clear (supposed to be over SSL!) | 610 | // when the web-login-form submits the password in the clear (supposed to be over SSL!) |
615 | if (!password.StartsWith("$1$")) | 611 | if (!password.StartsWith("$1$")) |
616 | password = "$1$" + Util.Md5Hash(password); | 612 | password = "$1$" + Util.Md5Hash(password); |
617 | 613 | ||
618 | |||
619 | |||
620 | password = password.Remove(0, 3); //remove $1$ | 614 | password = password.Remove(0, 3); //remove $1$ |
621 | 615 | ||
622 | |||
623 | |||
624 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); | 616 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); |
625 | // Testing... | 617 | // Testing... |
626 | //MainLog.Instance.Verbose("LOGIN", "SubHash:" + s + " userprofile:" + profile.passwordHash); | 618 | //m_log.Info("[LOGIN]: SubHash:" + s + " userprofile:" + profile.passwordHash); |
627 | //MainLog.Instance.Verbose("LOGIN", "userprofile:" + profile.passwordHash + " SubCT:" + password); | 619 | //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); |
628 | 620 | ||
629 | passwordSuccess = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) | 621 | passwordSuccess = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) |
630 | || profile.passwordHash.Equals(password,StringComparison.InvariantCultureIgnoreCase)); | 622 | || profile.passwordHash.Equals(password,StringComparison.InvariantCultureIgnoreCase)); |
@@ -635,8 +627,8 @@ namespace OpenSim.Framework.UserManagement | |||
635 | public virtual bool AuthenticateUser(UserProfileData profile, LLUUID webloginkey) | 627 | public virtual bool AuthenticateUser(UserProfileData profile, LLUUID webloginkey) |
636 | { | 628 | { |
637 | bool passwordSuccess = false; | 629 | bool passwordSuccess = false; |
638 | MainLog.Instance.Verbose( | 630 | m_log.Info( |
639 | "LOGIN", "Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID); | 631 | String.Format("[LOGIN]: Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID)); |
640 | 632 | ||
641 | // Match web login key unless it's the default weblogin key LLUUID.Zero | 633 | // Match web login key unless it's the default weblogin key LLUUID.Zero |
642 | passwordSuccess = ((profile.webLoginKey==webloginkey) && profile.webLoginKey != LLUUID.Zero); | 634 | passwordSuccess = ((profile.webLoginKey==webloginkey) && profile.webLoginKey != LLUUID.Zero); |