From d167686adb2d4a08759cf7c23ced9d9edd209b77 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 2 Mar 2010 21:12:53 -0800 Subject: Better error handling on PasswordAuthenticationService --- .../PasswordAuthenticationService.cs | 32 ++++++++++++---------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 021dcf3..2fc9248 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -47,9 +47,9 @@ namespace OpenSim.Services.AuthenticationService public class PasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService { - //private static readonly ILog m_log = - // LogManager.GetLogger( - // MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); public PasswordAuthenticationService(IConfigSource config) : base(config) @@ -59,23 +59,27 @@ namespace OpenSim.Services.AuthenticationService public string Authenticate(UUID principalID, string password, int lifetime) { AuthenticationData data = m_Database.Get(principalID); - - if (!data.Data.ContainsKey("passwordHash") || - !data.Data.ContainsKey("passwordSalt")) + + if (data != null && data.Data != null) { - return String.Empty; - } + if (!data.Data.ContainsKey("passwordHash") || + !data.Data.ContainsKey("passwordSalt")) + { + return String.Empty; + } - string hashed = Util.Md5Hash(password + ":" + - data.Data["passwordSalt"].ToString()); + string hashed = Util.Md5Hash(password + ":" + + data.Data["passwordSalt"].ToString()); - //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); + //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); - if (data.Data["passwordHash"].ToString() == hashed) - { - return GetToken(principalID, lifetime); + if (data.Data["passwordHash"].ToString() == hashed) + { + return GetToken(principalID, lifetime); + } } + m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); return String.Empty; } } -- cgit v1.1 From 9fda5c51acf6b8b1f6cbb072e4bf72a05d35b491 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 2 Mar 2010 22:20:44 -0800 Subject: More debug. --- OpenSim/Services/LLLoginService/LLLoginService.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 1d734eb..ee93f73 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -247,6 +247,7 @@ namespace OpenSim.Services.LLLoginService LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, friendsList, m_LibraryService, where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP); + m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); return response; } catch (Exception e) -- cgit v1.1 From aee887afaf3982253a2a5bf0724828a6718a406b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 3 Mar 2010 09:16:21 -0800 Subject: Added empty service URLs upon account creation. --- OpenSim/Services/UserAccountService/UserAccountService.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index e498bd5..ca6e44a 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -280,6 +280,15 @@ namespace OpenSim.Services.UserAccountService if (null == account) { account = new UserAccount(UUID.Zero, firstName, lastName, email); + if (account.ServiceURLs == null) + { + account.ServiceURLs = new Dictionary(); + account.ServiceURLs["HomeURI"] = string.Empty; + account.ServiceURLs["GatekeeperURI"] = string.Empty; + account.ServiceURLs["InventoryServerURI"] = string.Empty; + account.ServiceURLs["AssetServerURI"] = string.Empty; + } + if (StoreUserAccount(account)) { bool success = false; -- cgit v1.1 From 296c68a9de2d8253bdb88c67529619398d8ec6c9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Mar 2010 18:28:30 +0000 Subject: Make the service loader pump out the error to the log (in red) and include the dll/interface/args that caused the problem This gives people more of a fighting chance of finding out what went wrong --- OpenSim/Services/Base/ServiceBase.cs | 20 ++++++++++++++++++-- OpenSim/Services/Friends/FriendsServiceBase.cs | 9 ++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Base/ServiceBase.cs b/OpenSim/Services/Base/ServiceBase.cs index 8e24d85..91d5c56 100644 --- a/OpenSim/Services/Base/ServiceBase.cs +++ b/OpenSim/Services/Base/ServiceBase.cs @@ -26,7 +26,9 @@ */ using System; +using System.Collections.Generic; using System.Reflection; +using log4net; using Nini.Config; using OpenSim.Services.Interfaces; @@ -34,6 +36,8 @@ namespace OpenSim.Services.Base { public class ServiceBase { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public T LoadPlugin(string dllName) where T:class { return LoadPlugin(dllName, new Object[0]); @@ -61,8 +65,12 @@ namespace OpenSim.Services.Base { Assembly pluginAssembly = Assembly.LoadFrom(dllName); +// m_log.DebugFormat("[SERVICE BASE]: Found assembly {0}", dllName); + foreach (Type pluginType in pluginAssembly.GetTypes()) { +// m_log.DebugFormat("[SERVICE BASE]: Found type {0}", pluginType); + if (pluginType.IsPublic) { if (className != String.Empty && @@ -86,7 +94,15 @@ namespace OpenSim.Services.Base } catch (Exception e) { - Console.WriteLine("XXX Exception " + e.StackTrace); + List strArgs = new List(); + foreach (Object arg in args) + strArgs.Add(arg.ToString()); + + m_log.Error( + string.Format( + "[SERVICE BASE]: Failed to load plugin {0} from {1} with args {2}", + interfaceName, dllName, string.Join(", ", strArgs.ToArray())), e); + return null; } } @@ -95,4 +111,4 @@ namespace OpenSim.Services.Base { } } -} +} \ No newline at end of file diff --git a/OpenSim/Services/Friends/FriendsServiceBase.cs b/OpenSim/Services/Friends/FriendsServiceBase.cs index 9858972..6ab0bff 100644 --- a/OpenSim/Services/Friends/FriendsServiceBase.cs +++ b/OpenSim/Services/Friends/FriendsServiceBase.cs @@ -27,13 +27,12 @@ using System; using System.Reflection; +using log4net; using Nini.Config; using OpenSim.Framework; using OpenSim.Data; using OpenSim.Services.Interfaces; using OpenSim.Services.Base; -using Nini.Config; -using log4net; namespace OpenSim.Services.Friends { @@ -80,7 +79,11 @@ namespace OpenSim.Services.Friends m_Database = LoadPlugin(dllName, new Object[] { connString, realm }); if (m_Database == null) - throw new Exception("Could not find a storage interface in the given module"); + { + throw new Exception( + string.Format( + "Could not find a storage interface {0} in the given StorageProvider {1}", "IFriendsData", dllName)); + } } } } -- cgit v1.1