aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2007-12-15 21:58:07 +0000
committerJustin Clarke Casey2007-12-15 21:58:07 +0000
commit019d6626068920283b700440e780c86c162ca7c6 (patch)
tree7c0a9ec1ca185257cee0463a73feef882be23878
parentmore dorking around with exporter. Still far (diff)
downloadopensim-SC_OLD-019d6626068920283b700440e780c86c162ca7c6.zip
opensim-SC_OLD-019d6626068920283b700440e780c86c162ca7c6.tar.gz
opensim-SC_OLD-019d6626068920283b700440e780c86c162ca7c6.tar.bz2
opensim-SC_OLD-019d6626068920283b700440e780c86c162ca7c6.tar.xz
Put out a more comprehensible message when user authentication fails than the current NullReferenceException based one
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs63
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs16
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs23
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteUserData.cs23
-rw-r--r--OpenSim/Framework/IUserData.cs11
-rw-r--r--OpenSim/Framework/IUserService.cs2
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs12
-rw-r--r--bin/mysql_connection.ini8
8 files changed, 40 insertions, 118 deletions
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 0e5e782..a82a58d 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -37,6 +37,9 @@ using OpenSim.Framework.Console;
37 37
38namespace OpenSim.Framework.UserManagement 38namespace OpenSim.Framework.UserManagement
39{ 39{
40 /// <summary>
41 /// Base class for user management (create, read, etc)
42 /// </summary>
40 public abstract class UserManagerBase : IUserService 43 public abstract class UserManagerBase : IUserService
41 { 44 {
42 public UserConfig _config; 45 public UserConfig _config;
@@ -84,22 +87,23 @@ namespace OpenSim.Framework.UserManagement
84 /// Loads a user profile from a database by UUID 87 /// Loads a user profile from a database by UUID
85 /// </summary> 88 /// </summary>
86 /// <param name="uuid">The target UUID</param> 89 /// <param name="uuid">The target UUID</param>
87 /// <returns>A user profile</returns> 90 /// <returns>A user profile. Returns null if no user profile is found.</returns>
88 public UserProfileData GetUserProfile(LLUUID uuid) 91 public UserProfileData GetUserProfile(LLUUID uuid)
89 { 92 {
90 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 93 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
91 { 94 {
92 try 95 UserProfileData profile = plugin.Value.GetUserByUUID(uuid);
96
97 if (null != profile)
93 { 98 {
94 UserProfileData profile = plugin.Value.GetUserByUUID(uuid);
95 profile.currentAgent = getUserAgent(profile.UUID); 99 profile.currentAgent = getUserAgent(profile.UUID);
96 return profile; 100 return profile;
97 } 101 }
98 catch (Exception e)
99 {
100 MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
101 }
102 } 102 }
103
104 MainLog.Instance.Notice(
105 "USERSTORAGE",
106 "Could not find user " + uuid.ToStringHyphenated() + " in persistent storage.");
103 107
104 return null; 108 return null;
105 } 109 }
@@ -123,55 +127,28 @@ namespace OpenSim.Framework.UserManagement
123 return pickerlist; 127 return pickerlist;
124 } 128 }
125 129
126
127 /// <summary>
128 /// Loads a user profile by name
129 /// </summary>
130 /// <param name="name">The target name</param>
131 /// <returns>A user profile</returns>
132 public UserProfileData GetUserProfile(string name)
133 {
134 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
135 {
136 try
137 {
138 UserProfileData profile = plugin.Value.GetUserByName(name);
139 profile.currentAgent = getUserAgent(profile.UUID);
140 return profile;
141 }
142 catch (Exception e)
143 {
144 MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
145 }
146 }
147
148 return null;
149 }
150
151 /// <summary> 130 /// <summary>
152 /// Loads a user profile by name 131 /// Loads a user profile by name
153 /// </summary> 132 /// </summary>
154 /// <param name="fname">First name</param> 133 /// <param name="fname">First name</param>
155 /// <param name="lname">Last name</param> 134 /// <param name="lname">Last name</param>
156 /// <returns>A user profile</returns> 135 /// <returns>A user profile. Returns null if no profile is found</returns>
157 public UserProfileData GetUserProfile(string fname, string lname) 136 public UserProfileData GetUserProfile(string fname, string lname)
158 { 137 {
159 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 138 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
160 { 139 {
161 try 140 UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
162 {
163 UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
164 141
142 if (profile != null)
143 {
165 profile.currentAgent = getUserAgent(profile.UUID); 144 profile.currentAgent = getUserAgent(profile.UUID);
166
167 return profile; 145 return profile;
168 } 146 }
169 catch (Exception e)
170 {
171 MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
172 }
173 } 147 }
174 148
149 MainLog.Instance.Notice(
150 "USERSTORAGE", "Could not find user " + fname + " " + lname + " in persistent storage.");
151
175 return null; 152 return null;
176 } 153 }
177 154
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index c235e96..80b65c1 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -62,16 +62,6 @@ namespace OpenSim.Framework.Data.MSSQL
62 } 62 }
63 63
64 /// <summary> 64 /// <summary>
65 /// Searches the database for a specified user profile
66 /// </summary>
67 /// <param name="name">The account name of the user</param>
68 /// <returns>A user profile</returns>
69 public UserProfileData GetUserByName(string name)
70 {
71 return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
72 }
73
74 /// <summary>
75 /// Searches the database for a specified user profile by name components 65 /// Searches the database for a specified user profile by name components
76 /// </summary> 66 /// </summary>
77 /// <param name="user">The first part of the account name</param> 67 /// <param name="user">The first part of the account name</param>
@@ -188,11 +178,7 @@ namespace OpenSim.Framework.Data.MSSQL
188 return returnlist; 178 return returnlist;
189 } 179 }
190 180
191 /// <summary> 181 // See IUserData
192 /// Searches the database for a specified user profile by UUID
193 /// </summary>
194 /// <param name="uuid">The account ID</param>
195 /// <returns>The users profile</returns>
196 public UserProfileData GetUserByUUID(LLUUID uuid) 182 public UserProfileData GetUserByUUID(LLUUID uuid)
197 { 183 {
198 try 184 try
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index e5cbe45..6a7cf49 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -113,23 +113,8 @@ namespace OpenSim.Framework.Data.MySQL
113 } 113 }
114 114
115 #endregion 115 #endregion
116
117 /// <summary>
118 /// Searches the database for a specified user profile
119 /// </summary>
120 /// <param name="name">The account name of the user</param>
121 /// <returns>A user profile</returns>
122 public UserProfileData GetUserByName(string name)
123 {
124 return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
125 }
126 116
127 /// <summary> 117 // see IUserData
128 /// Searches the database for a specified user profile by name components
129 /// </summary>
130 /// <param name="user">The first part of the account name</param>
131 /// <param name="last">The second part of the account name</param>
132 /// <returns>A user profile</returns>
133 public UserProfileData GetUserByName(string user, string last) 118 public UserProfileData GetUserByName(string user, string last)
134 { 119 {
135 try 120 try
@@ -244,11 +229,7 @@ namespace OpenSim.Framework.Data.MySQL
244 return returnlist; 229 return returnlist;
245 } 230 }
246 231
247 /// <summary> 232 // see IUserData
248 /// Searches the database for a specified user profile by UUID
249 /// </summary>
250 /// <param name="uuid">The account ID</param>
251 /// <returns>The users profile</returns>
252 public UserProfileData GetUserByUUID(LLUUID uuid) 233 public UserProfileData GetUserByUUID(LLUUID uuid)
253 { 234 {
254 try 235 try
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
index da27277..346febc 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
@@ -72,11 +72,7 @@ namespace OpenSim.Framework.Data.SQLite
72 return; 72 return;
73 } 73 }
74 74
75 /// <summary> 75 // see IUserData
76 /// Loads a specified user profile from a UUID
77 /// </summary>
78 /// <param name="uuid">The user's UUID</param>
79 /// <returns>A user profile</returns>
80 public UserProfileData GetUserByUUID(LLUUID uuid) 76 public UserProfileData GetUserByUUID(LLUUID uuid)
81 { 77 {
82 lock (ds) 78 lock (ds)
@@ -99,22 +95,7 @@ namespace OpenSim.Framework.Data.SQLite
99 } 95 }
100 } 96 }
101 97
102 /// <summary> 98 // see IUserData
103 /// Returns a user by searching for its name
104 /// </summary>
105 /// <param name="name">The user's account name</param>
106 /// <returns>A matching user profile</returns>
107 public UserProfileData GetUserByName(string name)
108 {
109 return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
110 }
111
112 /// <summary>
113 /// Returns a user by searching for its name
114 /// </summary>
115 /// <param name="fname">The first part of the user's account name</param>
116 /// <param name="lname">The second part of the user's account name</param>
117 /// <returns>A matching user profile</returns>
118 public UserProfileData GetUserByName(string fname, string lname) 99 public UserProfileData GetUserByName(string fname, string lname)
119 { 100 {
120 string select = "surname = '" + lname + "' and username = '" + fname + "'"; 101 string select = "surname = '" + lname + "' and username = '" + fname + "'";
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index a32bf6c..0679a68 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -38,18 +38,11 @@ namespace OpenSim.Framework
38 /// <summary> 38 /// <summary>
39 /// Returns a user profile from a database via their UUID 39 /// Returns a user profile from a database via their UUID
40 /// </summary> 40 /// </summary>
41 /// <param name="user">The accounts UUID</param> 41 /// <param name="user">The user's UUID</param>
42 /// <returns>The user data profile</returns> 42 /// <returns>The user data profile. Returns null if no user is found</returns>
43 UserProfileData GetUserByUUID(LLUUID user); 43 UserProfileData GetUserByUUID(LLUUID user);
44 44
45 /// <summary> 45 /// <summary>
46 /// Returns a users profile by searching their username
47 /// </summary>
48 /// <param name="name">The users username</param>
49 /// <returns>The user data profile</returns>
50 UserProfileData GetUserByName(string name);
51
52 /// <summary>
53 /// Returns a users profile by searching their username parts 46 /// Returns a users profile by searching their username parts
54 /// </summary> 47 /// </summary>
55 /// <param name="fname">Account firstname</param> 48 /// <param name="fname">Account firstname</param>
diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs
index 298bde5..3440e30 100644
--- a/OpenSim/Framework/IUserService.cs
+++ b/OpenSim/Framework/IUserService.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework
33 public interface IUserService 33 public interface IUserService
34 { 34 {
35 UserProfileData GetUserProfile(string firstName, string lastName); 35 UserProfileData GetUserProfile(string firstName, string lastName);
36 UserProfileData GetUserProfile(string name); 36 //UserProfileData GetUserProfile(string name);
37 UserProfileData GetUserProfile(LLUUID userId); 37 UserProfileData GetUserProfile(LLUUID userId);
38 void clearUserAgent(LLUUID avatarID); 38 void clearUserAgent(LLUUID avatarID);
39 List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID QueryID, string Query); 39 List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID QueryID, string Query);
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 103c76f..37cea1f 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -31,6 +31,7 @@ using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console;
34using OpenSim.Framework.UserManagement; 35using OpenSim.Framework.UserManagement;
35using InventoryFolder=OpenSim.Framework.InventoryFolder; 36using InventoryFolder=OpenSim.Framework.InventoryFolder;
36 37
@@ -72,7 +73,8 @@ namespace OpenSim.Region.Communications.Local
72 if (!authUsers) 73 if (!authUsers)
73 { 74 {
74 //no current user account so make one 75 //no current user account so make one
75 Console.WriteLine("No User account found so creating a new one "); 76 MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one.");
77
76 m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); 78 m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
77 79
78 profile = m_userManager.GetUserProfile(firstname, lastname); 80 profile = m_userManager.GetUserProfile(firstname, lastname);
@@ -91,12 +93,14 @@ namespace OpenSim.Region.Communications.Local
91 if (!authUsers) 93 if (!authUsers)
92 { 94 {
93 //for now we will accept any password in sandbox mode 95 //for now we will accept any password in sandbox mode
94 Console.WriteLine("authorising user"); 96 MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)");
97
95 return true; 98 return true;
96 } 99 }
97 else 100 else
98 { 101 {
99 Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); 102 MainLog.Instance.Notice(
103 "LOGIN", "Authenticating " + profile.username + " " + profile.surname);
100 104
101 password = password.Remove(0, 3); //remove $1$ 105 password = password.Remove(0, 3); //remove $1$
102 106
@@ -153,7 +157,7 @@ namespace OpenSim.Region.Communications.Local
153 } 157 }
154 else 158 else
155 { 159 {
156 Console.WriteLine("not found region " + currentRegion); 160 MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion);
157 } 161 }
158 } 162 }
159 163
diff --git a/bin/mysql_connection.ini b/bin/mysql_connection.ini
index c8c6c8c..7644f63 100644
--- a/bin/mysql_connection.ini
+++ b/bin/mysql_connection.ini
@@ -1,7 +1,7 @@
1[mysqlconnection] 1[mysqlconnection]
2hostname=localhost 2hostname=localhost
3database=database 3database=opensim
4username=username 4username=root
5password=password 5password=passw0rd
6pooling=false 6pooling=false
7port=3306 \ No newline at end of file 7port=3306