diff options
16 files changed, 138 insertions, 8 deletions
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs index 906ba6c..bc7eda7 100644 --- a/OpenSim/Data/IUserAccountData.cs +++ b/OpenSim/Data/IUserAccountData.cs | |||
@@ -50,5 +50,6 @@ namespace OpenSim.Data | |||
50 | bool Store(UserAccountData data); | 50 | bool Store(UserAccountData data); |
51 | bool Delete(string field, string val); | 51 | bool Delete(string field, string val); |
52 | UserAccountData[] GetUsers(UUID scopeID, string query); | 52 | UserAccountData[] GetUsers(UUID scopeID, string query); |
53 | UserAccountData[] GetUsersWhere(UUID scopeID, string where); | ||
53 | } | 54 | } |
54 | } | 55 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs index e7c8dc5..f24b441 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs | |||
@@ -238,5 +238,10 @@ namespace OpenSim.Data.MSSQL | |||
238 | return DoQuery(cmd); | 238 | return DoQuery(cmd); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | |||
242 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
243 | { | ||
244 | return null; | ||
245 | } | ||
241 | } | 246 | } |
242 | } | 247 | } |
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index aa69d68..3b35222 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -80,5 +80,20 @@ namespace OpenSim.Data.MySQL | |||
80 | 80 | ||
81 | return DoQuery(cmd); | 81 | return DoQuery(cmd); |
82 | } | 82 | } |
83 | |||
84 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
85 | { | ||
86 | MySqlCommand cmd = new MySqlCommand(); | ||
87 | |||
88 | if (scopeID != UUID.Zero) | ||
89 | { | ||
90 | where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")"; | ||
91 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
92 | } | ||
93 | |||
94 | cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm); | ||
95 | |||
96 | return DoQuery(cmd); | ||
97 | } | ||
83 | } | 98 | } |
84 | } | 99 | } |
diff --git a/OpenSim/Data/Null/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs index ede23fb..772d821 100644 --- a/OpenSim/Data/Null/NullUserAccountData.cs +++ b/OpenSim/Data/Null/NullUserAccountData.cs | |||
@@ -156,5 +156,10 @@ namespace OpenSim.Data.Null | |||
156 | 156 | ||
157 | return false; | 157 | return false; |
158 | } | 158 | } |
159 | |||
160 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
161 | { | ||
162 | return null; | ||
163 | } | ||
159 | } | 164 | } |
160 | } | 165 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs index 7a5de50..4d580c0 100644 --- a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs | |||
@@ -81,5 +81,10 @@ namespace OpenSim.Data.SQLite | |||
81 | 81 | ||
82 | return DoQuery(cmd); | 82 | return DoQuery(cmd); |
83 | } | 83 | } |
84 | |||
85 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
86 | { | ||
87 | return null; | ||
88 | } | ||
84 | } | 89 | } |
85 | } | 90 | } |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs index 27553c6..41a0177 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs | |||
@@ -77,5 +77,10 @@ namespace OpenSim.Data.SQLiteLegacy | |||
77 | 77 | ||
78 | return DoQuery(cmd); | 78 | return DoQuery(cmd); |
79 | } | 79 | } |
80 | |||
81 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
82 | { | ||
83 | return null; | ||
84 | } | ||
80 | } | 85 | } |
81 | } | 86 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 30ebb21..9ecbcc6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -172,6 +172,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
172 | return m_UserService.GetUserAccount(scopeID, Email); | 172 | return m_UserService.GetUserAccount(scopeID, Email); |
173 | } | 173 | } |
174 | 174 | ||
175 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
176 | { | ||
177 | return null; | ||
178 | } | ||
179 | |||
175 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 180 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
176 | { | 181 | { |
177 | return m_UserService.GetUserAccounts(scopeID, query); | 182 | return m_UserService.GetUserAccounts(scopeID, query); |
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index edc1097..5980f0c 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | |||
@@ -31,6 +31,8 @@ using log4net; | |||
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Services.Base; | 33 | using OpenSim.Services.Base; |
34 | using OpenSim.Server.Base; | ||
35 | using OpenSim.Services.Interfaces; | ||
34 | using OpenSim.Data; | 36 | using OpenSim.Data; |
35 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
36 | 38 | ||
@@ -49,6 +51,12 @@ namespace OpenSim.Services.AuthenticationService | |||
49 | MethodBase.GetCurrentMethod().DeclaringType); | 51 | MethodBase.GetCurrentMethod().DeclaringType); |
50 | 52 | ||
51 | protected IAuthenticationData m_Database; | 53 | protected IAuthenticationData m_Database; |
54 | protected IUserAccountService m_UserAccountService = null; | ||
55 | |||
56 | public AuthenticationServiceBase(IConfigSource config, IUserAccountService acct) : this(config) | ||
57 | { | ||
58 | m_UserAccountService = acct; | ||
59 | } | ||
52 | 60 | ||
53 | public AuthenticationServiceBase(IConfigSource config) : base(config) | 61 | public AuthenticationServiceBase(IConfigSource config) : base(config) |
54 | { | 62 | { |
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 17619ff..cf7496f 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | |||
@@ -51,6 +51,12 @@ namespace OpenSim.Services.AuthenticationService | |||
51 | LogManager.GetLogger( | 51 | LogManager.GetLogger( |
52 | MethodBase.GetCurrentMethod().DeclaringType); | 52 | MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | public PasswordAuthenticationService(IConfigSource config, IUserAccountService userService) : | ||
55 | base(config, userService) | ||
56 | { | ||
57 | m_log.Debug("[AUTH SERVICE]: Started with User Account access"); | ||
58 | } | ||
59 | |||
54 | public PasswordAuthenticationService(IConfigSource config) : | 60 | public PasswordAuthenticationService(IConfigSource config) : |
55 | base(config) | 61 | base(config) |
56 | { | 62 | { |
@@ -58,28 +64,70 @@ namespace OpenSim.Services.AuthenticationService | |||
58 | 64 | ||
59 | public string Authenticate(UUID principalID, string password, int lifetime) | 65 | public string Authenticate(UUID principalID, string password, int lifetime) |
60 | { | 66 | { |
67 | m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}, user account service present: {1}", principalID, m_UserAccountService != null); | ||
61 | AuthenticationData data = m_Database.Get(principalID); | 68 | AuthenticationData data = m_Database.Get(principalID); |
69 | UserAccount user = null; | ||
70 | if (m_UserAccountService != null) | ||
71 | user = m_UserAccountService.GetUserAccount(UUID.Zero, principalID); | ||
72 | |||
73 | if (data == null || data.Data == null) | ||
74 | { | ||
75 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); | ||
76 | return String.Empty; | ||
77 | } | ||
78 | |||
79 | if (!data.Data.ContainsKey("passwordHash") || | ||
80 | !data.Data.ContainsKey("passwordSalt")) | ||
81 | { | ||
82 | return String.Empty; | ||
83 | } | ||
84 | |||
85 | string hashed = Util.Md5Hash(password + ":" + | ||
86 | data.Data["passwordSalt"].ToString()); | ||
87 | |||
88 | m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); | ||
62 | 89 | ||
63 | if (data != null && data.Data != null) | 90 | if (data.Data["passwordHash"].ToString() == hashed) |
64 | { | 91 | { |
65 | if (!data.Data.ContainsKey("passwordHash") || | 92 | return GetToken(principalID, lifetime); |
93 | } | ||
94 | |||
95 | if (user == null) | ||
96 | { | ||
97 | m_log.DebugFormat("[PASS AUTH]: No user record for {0}", principalID); | ||
98 | return String.Empty; | ||
99 | } | ||
100 | |||
101 | int impersonateFlag = 1 << 6; | ||
102 | |||
103 | if ((user.UserFlags & impersonateFlag) == 0) | ||
104 | return String.Empty; | ||
105 | |||
106 | List<UserAccount> accounts = m_UserAccountService.GetUserAccountsWhere(UUID.Zero, "UserLevel >= 200"); | ||
107 | if (accounts == null || accounts.Count == 0) | ||
108 | return String.Empty; | ||
109 | |||
110 | foreach (UserAccount a in accounts) | ||
111 | { | ||
112 | data = m_Database.Get(a.PrincipalID); | ||
113 | if (data == null || data.Data == null || | ||
114 | !data.Data.ContainsKey("passwordHash") || | ||
66 | !data.Data.ContainsKey("passwordSalt")) | 115 | !data.Data.ContainsKey("passwordSalt")) |
67 | { | 116 | { |
68 | return String.Empty; | 117 | continue; |
69 | } | 118 | } |
70 | 119 | ||
71 | string hashed = Util.Md5Hash(password + ":" + | 120 | hashed = Util.Md5Hash(password + ":" + |
72 | data.Data["passwordSalt"].ToString()); | 121 | data.Data["passwordSalt"].ToString()); |
73 | 122 | ||
74 | m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); | ||
75 | |||
76 | if (data.Data["passwordHash"].ToString() == hashed) | 123 | if (data.Data["passwordHash"].ToString() == hashed) |
77 | { | 124 | { |
125 | m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID); | ||
78 | return GetToken(principalID, lifetime); | 126 | return GetToken(principalID, lifetime); |
79 | } | 127 | } |
80 | } | 128 | } |
81 | 129 | ||
82 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); | 130 | m_log.DebugFormat("[PASS AUTH]: Impersonation of {0} failed", principalID); |
83 | return String.Empty; | 131 | return String.Empty; |
84 | } | 132 | } |
85 | } | 133 | } |
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index d1a5b0f..6d9aae3 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs | |||
@@ -47,6 +47,11 @@ namespace OpenSim.Services.AuthenticationService | |||
47 | // LogManager.GetLogger( | 47 | // LogManager.GetLogger( |
48 | // MethodBase.GetCurrentMethod().DeclaringType); | 48 | // MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | public WebkeyAuthenticationService(IConfigSource config, IUserAccountService userService) : | ||
51 | base(config, userService) | ||
52 | { | ||
53 | } | ||
54 | |||
50 | public WebkeyAuthenticationService(IConfigSource config) : | 55 | public WebkeyAuthenticationService(IConfigSource config) : |
51 | base(config) | 56 | base(config) |
52 | { | 57 | { |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 9c150ee..394c2b7 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -191,6 +191,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
191 | return accounts; | 191 | return accounts; |
192 | } | 192 | } |
193 | 193 | ||
194 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
195 | { | ||
196 | return null; | ||
197 | } | ||
198 | |||
194 | public bool StoreUserAccount(UserAccount data) | 199 | public bool StoreUserAccount(UserAccount data) |
195 | { | 200 | { |
196 | m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); | 201 | m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index 2a5df83..205a4aa 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs | |||
@@ -187,6 +187,11 @@ namespace OpenSim.Services.Connectors | |||
187 | return accounts; | 187 | return accounts; |
188 | } | 188 | } |
189 | 189 | ||
190 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
191 | { | ||
192 | return null; // Not implemented for regions | ||
193 | } | ||
194 | |||
190 | public virtual bool StoreUserAccount(UserAccount data) | 195 | public virtual bool StoreUserAccount(UserAccount data) |
191 | { | 196 | { |
192 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 197 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index c580078..2c09a2e 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs | |||
@@ -150,6 +150,7 @@ namespace OpenSim.Services.Interfaces | |||
150 | /// <param name="query"></param> | 150 | /// <param name="query"></param> |
151 | /// <returns></returns> | 151 | /// <returns></returns> |
152 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); | 152 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); |
153 | List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where); | ||
153 | 154 | ||
154 | /// <summary> | 155 | /// <summary> |
155 | /// Store the data given, wich replaces the stored data, therefore must be complete. | 156 | /// Store the data given, wich replaces the stored data, therefore must be complete. |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 35adf0f..b26cd6e 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -113,7 +113,8 @@ namespace OpenSim.Services.LLLoginService | |||
113 | Object[] args = new Object[] { config }; | 113 | Object[] args = new Object[] { config }; |
114 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | 114 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); |
115 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); | 115 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); |
116 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); | 116 | Object[] authArgs = new Object[] { config, m_UserAccountService }; |
117 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, authArgs); | ||
117 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); | 118 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); |
118 | 119 | ||
119 | if (gridService != string.Empty) | 120 | if (gridService != string.Empty) |
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index f376cf8..de6d32c 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -282,6 +282,21 @@ namespace OpenSim.Services.UserAccountService | |||
282 | return ret; | 282 | return ret; |
283 | } | 283 | } |
284 | 284 | ||
285 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
286 | { | ||
287 | UserAccountData[] d = m_Database.GetUsersWhere(scopeID, where); | ||
288 | |||
289 | if (d == null) | ||
290 | return new List<UserAccount>(); | ||
291 | |||
292 | List<UserAccount> ret = new List<UserAccount>(); | ||
293 | |||
294 | foreach (UserAccountData data in d) | ||
295 | ret.Add(MakeUserAccount(data)); | ||
296 | |||
297 | return ret; | ||
298 | } | ||
299 | |||
285 | #endregion | 300 | #endregion |
286 | 301 | ||
287 | #region Console commands | 302 | #region Console commands |
diff --git a/prebuild.xml b/prebuild.xml index 85b31da..f08d0d3 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -1091,6 +1091,7 @@ | |||
1091 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | 1091 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> |
1092 | <Reference name="OpenSim.Services.Interfaces"/> | 1092 | <Reference name="OpenSim.Services.Interfaces"/> |
1093 | <Reference name="OpenSim.Services.Base"/> | 1093 | <Reference name="OpenSim.Services.Base"/> |
1094 | <Reference name="OpenSim.Server.Base"/> | ||
1094 | <Reference name="OpenSim.Services.Connectors"/> | 1095 | <Reference name="OpenSim.Services.Connectors"/> |
1095 | <Reference name="OpenSim.Data"/> | 1096 | <Reference name="OpenSim.Data"/> |
1096 | <Reference name="Nini" path="../../../bin/"/> | 1097 | <Reference name="Nini" path="../../../bin/"/> |