aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs10
-rw-r--r--OpenSim/Data/IUserAccountData.cs55
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs180
-rw-r--r--OpenSim/Data/MySQL/Resources/008_UserStore.sql5
-rw-r--r--OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs1
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGUserServices.cs2
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs35
-rw-r--r--OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs15
-rw-r--r--OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs5
-rw-r--r--OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs5
-rw-r--r--OpenSim/Services/Connectors/User/UserServiceConnector.cs145
-rw-r--r--OpenSim/Services/Interfaces/IAuthenticationService.cs36
-rw-r--r--OpenSim/Services/Interfaces/IUserService.cs35
-rw-r--r--OpenSim/Services/UserService/UserService.cs14
-rw-r--r--OpenSim/Services/UserService/UserServiceBase.cs8
18 files changed, 324 insertions, 239 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index dff4d48..6fd3d30 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -94,14 +94,24 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
94 regionLoader = new RegionLoaderWebServer(); 94 regionLoader = new RegionLoaderWebServer();
95 } 95 }
96 96
97 m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations...");
98
97 regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); 99 regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
98 RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); 100 RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
99 101
102 m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
103 m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
100 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); 104 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
105 m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule...");
101 m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule()); 106 m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
107 m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule...");
102 m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); 108 m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
109 m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
103 m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); 110 m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
111 m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
104 m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); 112 m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
113 m_log.Info("[LOADREGIONSPLUGIN]: Done.");
114
105 if (!CheckRegionsForSanity(regionsToLoad)) 115 if (!CheckRegionsForSanity(regionsToLoad))
106 { 116 {
107 m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); 117 m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs
new file mode 100644
index 0000000..6bec188
--- /dev/null
+++ b/OpenSim/Data/IUserAccountData.cs
@@ -0,0 +1,55 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Data
34{
35 public class UserAccountData
36 {
37 public UUID PrincipalID;
38 public UUID ScopeID;
39 public Dictionary<string, object> Data;
40 }
41
42 /// <summary>
43 /// An interface for connecting to the authentication datastore
44 /// </summary>
45 public interface IUserAccountData
46 {
47 UserAccountData Get(UUID principalID, UUID ScopeID);
48
49 List<UserAccountData> Query(UUID principalID, UUID ScopeID, string query);
50
51 bool Store(UserAccountData data);
52
53 bool SetDataItem(UUID principalID, string item, string value);
54 }
55}
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
new file mode 100644
index 0000000..39d60ca
--- /dev/null
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -0,0 +1,180 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Data;
32using OpenMetaverse;
33using OpenSim.Framework;
34using MySql.Data.MySqlClient;
35
36namespace OpenSim.Data.MySQL
37{
38 public class MySqlUserAccountData : MySqlFramework, IUserAccountData
39 {
40 private string m_Realm;
41 private List<string> m_ColumnNames = null;
42 private int m_LastExpire = 0;
43
44 public MySqlUserAccountData(string connectionString, string realm)
45 : base(connectionString)
46 {
47 m_Realm = realm;
48
49 Migration m = new Migration(m_Connection, GetType().Assembly, "UserStore");
50 m.Update();
51 }
52
53 public List<UserAccountData> Query(UUID principalID, UUID scopeID, string query)
54 {
55 return null;
56 }
57
58 public UserAccountData Get(UUID principalID, UUID scopeID)
59 {
60 UserAccountData ret = new UserAccountData();
61 ret.Data = new Dictionary<string, object>();
62
63 string command = "select * from `"+m_Realm+"` where UUID = ?principalID";
64 if (scopeID != UUID.Zero)
65 command += " and ScopeID = ?scopeID";
66
67 MySqlCommand cmd = new MySqlCommand(command);
68
69 cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
70 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
71
72 IDataReader result = ExecuteReader(cmd);
73
74 if (result.Read())
75 {
76 ret.PrincipalID = principalID;
77 UUID scope;
78 UUID.TryParse(result["ScopeID"].ToString(), out scope);
79 ret.ScopeID = scope;
80
81 if (m_ColumnNames == null)
82 {
83 m_ColumnNames = new List<string>();
84
85 DataTable schemaTable = result.GetSchemaTable();
86 foreach (DataRow row in schemaTable.Rows)
87 m_ColumnNames.Add(row["ColumnName"].ToString());
88 }
89
90 foreach (string s in m_ColumnNames)
91 {
92 if (s == "UUID")
93 continue;
94 if (s == "ScopeID")
95 continue;
96
97 ret.Data[s] = result[s].ToString();
98 }
99
100 result.Close();
101 CloseReaderCommand(cmd);
102
103 return ret;
104 }
105
106 result.Close();
107 CloseReaderCommand(cmd);
108
109 return null;
110 }
111
112 public bool Store(UserAccountData data)
113 {
114 if (data.Data.ContainsKey("UUID"))
115 data.Data.Remove("UUID");
116 if (data.Data.ContainsKey("ScopeID"))
117 data.Data.Remove("ScopeID");
118
119 string[] fields = new List<string>(data.Data.Keys).ToArray();
120
121 MySqlCommand cmd = new MySqlCommand();
122
123 string update = "update `"+m_Realm+"` set ";
124 bool first = true;
125 foreach (string field in fields)
126 {
127 if (!first)
128 update += ", ";
129 update += "`" + field + "` = ?"+field;
130
131 first = false;
132
133 cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
134 }
135
136 update += " where UUID = ?principalID";
137
138 if (data.ScopeID != UUID.Zero)
139 update += " and ScopeID = ?scopeID";
140
141 cmd.CommandText = update;
142 cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
143 cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString());
144
145 if (ExecuteNonQuery(cmd) < 1)
146 {
147 string insert = "insert into `" + m_Realm + "` (`UUID`, `ScopeID`, `" +
148 String.Join("`, `", fields) +
149 "`) values ( ?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")";
150
151 cmd.CommandText = insert;
152
153 if (ExecuteNonQuery(cmd) < 1)
154 {
155 cmd.Dispose();
156 return false;
157 }
158 }
159
160 cmd.Dispose();
161
162 return true;
163 }
164
165 public bool SetDataItem(UUID principalID, string item, string value)
166 {
167 MySqlCommand cmd = new MySqlCommand("update `" + m_Realm +
168 "` set `" + item + "` = ?" + item + " where UUID = ?UUID");
169
170
171 cmd.Parameters.AddWithValue("?"+item, value);
172 cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
173
174 if (ExecuteNonQuery(cmd) > 0)
175 return true;
176
177 return false;
178 }
179 }
180}
diff --git a/OpenSim/Data/MySQL/Resources/008_UserStore.sql b/OpenSim/Data/MySQL/Resources/008_UserStore.sql
new file mode 100644
index 0000000..4500bd5
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/008_UserStore.sql
@@ -0,0 +1,5 @@
1BEGIN;
2
3ALTER TABLE users add scopeID char(36) not null default '00000000-0000-0000-0000-000000000000';
4
5COMMIT;
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
index 44f44fe..63e09ae 100644
--- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
+++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
@@ -78,6 +78,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
78 78
79 foreach (IConfig config in source.Configs) 79 foreach (IConfig config in source.Configs)
80 { 80 {
81 //m_log.Info("[REGIONLOADERFILESYSTEM]: Creating RegionInfo for " + config.Name);
81 RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); 82 RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
82 regionInfos.Add(regionInfo); 83 regionInfos.Add(regionInfo);
83 i++; 84 i++;
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
index aaa1c78..f1a56ef 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
@@ -313,7 +313,7 @@ namespace OpenSim.Region.Communications.Hypergrid
313 313
314 public bool IsForeignUser(UUID userID, out string userServerURL) 314 public bool IsForeignUser(UUID userID, out string userServerURL)
315 { 315 {
316 userServerURL = string.Empty; 316 userServerURL = m_commsManager.NetworkServersInfo.UserURL;
317 CachedUserInfo uinfo = m_commsManager.UserProfileCacheService.GetUserDetails(userID); 317 CachedUserInfo uinfo = m_commsManager.UserProfileCacheService.GetUserDetails(userID);
318 if (uinfo != null) 318 if (uinfo != null)
319 { 319 {
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
index 92e6ae3..ec8512a 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Region.Communications.OGS1
112 parameters.Add(param); 112 parameters.Add(param);
113 XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters); 113 XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters);
114 114
115 XmlRpcResponse resp = req.Send(GetUserServerURL(userId), 6000); 115 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 6000);
116 Hashtable respData = (Hashtable)resp.Value; 116 Hashtable respData = (Hashtable)resp.Value;
117 if (respData.Contains("error_type")) 117 if (respData.Contains("error_type"))
118 { 118 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs
index fcd0304..cca5bb4 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
42 LogManager.GetLogger( 42 LogManager.GetLogger(
43 MethodBase.GetCurrentMethod().DeclaringType); 43 MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private IUserAccountDataService m_UserService; 45 private IUserAccountService m_UserService;
46 46
47 private bool m_Enabled = false; 47 private bool m_Enabled = false;
48 48
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
82 82
83 Object[] args = new Object[] { source }; 83 Object[] args = new Object[] { source };
84 m_UserService = 84 m_UserService =
85 ServerUtils.LoadPlugin<IUserAccountDataService>(serviceDll, 85 ServerUtils.LoadPlugin<IUserAccountService>(serviceDll,
86 args); 86 args);
87 87
88 if (m_UserService == null) 88 if (m_UserService == null)
@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
113 if (!m_Enabled) 113 if (!m_Enabled)
114 return; 114 return;
115 115
116 scene.RegisterModuleInterface<IUserAccountDataService>(m_UserService); 116 scene.RegisterModuleInterface<IUserAccountService>(m_UserService);
117 } 117 }
118 118
119 public void RemoveRegion(Scene scene) 119 public void RemoveRegion(Scene scene)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs
index a2b854b..cef9129 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs
@@ -37,7 +37,7 @@ using OpenSim.Services.Connectors;
37namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User 37namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
38{ 38{
39 public class RemoteUserServicesConnector : UserServicesConnector, 39 public class RemoteUserServicesConnector : UserServicesConnector,
40 ISharedRegionModule, IUserAccountDataService 40 ISharedRegionModule, IUserAccountService
41 { 41 {
42 private static readonly ILog m_log = 42 private static readonly ILog m_log =
43 LogManager.GetLogger( 43 LogManager.GetLogger(
@@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
96 if (!m_Enabled) 96 if (!m_Enabled)
97 return; 97 return;
98 98
99 scene.RegisterModuleInterface<IUserAccountDataService>(this); 99 scene.RegisterModuleInterface<IUserAccountService>(this);
100 } 100 }
101 101
102 public void RemoveRegion(Scene scene) 102 public void RemoveRegion(Scene scene)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 278091f..3b91dd0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -220,11 +220,12 @@ namespace OpenSim.Region.Framework.Scenes
220 private bool m_scripts_enabled = true; 220 private bool m_scripts_enabled = true;
221 private string m_defaultScriptEngine; 221 private string m_defaultScriptEngine;
222 private int m_LastLogin = 0; 222 private int m_LastLogin = 0;
223 private Thread HeartbeatThread; 223 private Thread HeartbeatThread = null;
224 private volatile bool shuttingdown = false; 224 private volatile bool shuttingdown = false;
225 225
226 private int m_lastUpdate = Environment.TickCount; 226 private int m_lastUpdate = Environment.TickCount;
227 private int m_maxPrimsPerFrame = 200; 227 private int m_maxPrimsPerFrame = 200;
228 private bool m_firstHeartbeat = true;
228 229
229 private object m_deleting_scene_object = new object(); 230 private object m_deleting_scene_object = new object();
230 231
@@ -876,6 +877,13 @@ namespace OpenSim.Region.Framework.Scenes
876 //m_heartbeatTimer.Enabled = true; 877 //m_heartbeatTimer.Enabled = true;
877 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); 878 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
878 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 879 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
880 if (HeartbeatThread != null)
881 {
882 ThreadTracker.Remove(HeartbeatThread);
883 HeartbeatThread.Abort();
884 HeartbeatThread = null;
885 }
886 m_lastUpdate = Environment.TickCount;
879 HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); 887 HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
880 HeartbeatThread.SetApartmentState(ApartmentState.MTA); 888 HeartbeatThread.SetApartmentState(ApartmentState.MTA);
881 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); 889 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
@@ -912,9 +920,16 @@ namespace OpenSim.Region.Framework.Scenes
912 /// <param name="e"></param> 920 /// <param name="e"></param>
913 private void Heartbeat(object sender) 921 private void Heartbeat(object sender)
914 { 922 {
915 Update(); 923 try
924 {
925 Update();
916 926
917 m_lastUpdate = Environment.TickCount; 927 m_lastUpdate = Environment.TickCount;
928 m_firstHeartbeat = false;
929 }
930 catch (ThreadAbortException)
931 {
932 }
918 } 933 }
919 934
920 /// <summary> 935 /// <summary>
@@ -2307,6 +2322,7 @@ namespace OpenSim.Region.Framework.Scenes
2307 /// <param name="client"></param> 2322 /// <param name="client"></param>
2308 public override void AddNewClient(IClientAPI client) 2323 public override void AddNewClient(IClientAPI client)
2309 { 2324 {
2325 CheckHeartbeat();
2310 SubscribeToClientEvents(client); 2326 SubscribeToClientEvents(client);
2311 ScenePresence presence; 2327 ScenePresence presence;
2312 2328
@@ -2831,6 +2847,7 @@ namespace OpenSim.Region.Framework.Scenes
2831 /// <returns></returns> 2847 /// <returns></returns>
2832 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) 2848 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
2833 { 2849 {
2850 CheckHeartbeat();
2834 AvatarAppearance appearance = null; 2851 AvatarAppearance appearance = null;
2835 GetAvatarAppearance(client, out appearance); 2852 GetAvatarAppearance(client, out appearance);
2836 2853
@@ -2873,6 +2890,7 @@ namespace OpenSim.Region.Framework.Scenes
2873 /// <param name="agentID"></param> 2890 /// <param name="agentID"></param>
2874 public override void RemoveClient(UUID agentID) 2891 public override void RemoveClient(UUID agentID)
2875 { 2892 {
2893 CheckHeartbeat();
2876 bool childagentYN = false; 2894 bool childagentYN = false;
2877 ScenePresence avatar = GetScenePresence(agentID); 2895 ScenePresence avatar = GetScenePresence(agentID);
2878 if (avatar != null) 2896 if (avatar != null)
@@ -4380,6 +4398,8 @@ namespace OpenSim.Region.Framework.Scenes
4380 else 4398 else
4381 return health; 4399 return health;
4382 4400
4401 CheckHeartbeat();
4402
4383 return health; 4403 return health;
4384 } 4404 }
4385 4405
@@ -4565,5 +4585,14 @@ namespace OpenSim.Region.Framework.Scenes
4565 4585
4566 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; 4586 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
4567 } 4587 }
4588
4589 private void CheckHeartbeat()
4590 {
4591 if (m_firstHeartbeat)
4592 return;
4593
4594 if (System.Environment.TickCount - m_lastUpdate > 2000)
4595 StartTimer();
4596 }
4568 } 4597 }
4569} 4598}
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
index 2ed177c..8904461 100644
--- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
+++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
@@ -90,31 +90,16 @@ namespace OpenSim.Services.AuthenticationService
90 throw new Exception("Could not find a storage interface in the given module"); 90 throw new Exception("Could not find a storage interface in the given module");
91 } 91 }
92 92
93 public virtual byte[] GetPublicKey()
94 {
95 return new byte[0];
96 }
97
98 public bool Verify(UUID principalID, string token, int lifetime) 93 public bool Verify(UUID principalID, string token, int lifetime)
99 { 94 {
100 return m_Database.CheckToken(principalID, token, lifetime); 95 return m_Database.CheckToken(principalID, token, lifetime);
101 } 96 }
102 97
103 public bool VerifyEncrypted(byte[] cyphertext, byte[] key)
104 {
105 return false;
106 }
107
108 public virtual bool Release(UUID principalID, string token) 98 public virtual bool Release(UUID principalID, string token)
109 { 99 {
110 return m_Database.CheckToken(principalID, token, 0); 100 return m_Database.CheckToken(principalID, token, 0);
111 } 101 }
112 102
113 public virtual bool ReleaseEncrypted(byte[] cyphertext, byte[] key)
114 {
115 return false;
116 }
117
118 protected string GetToken(UUID principalID, int lifetime) 103 protected string GetToken(UUID principalID, int lifetime)
119 { 104 {
120 UUID token = UUID.Random(); 105 UUID token = UUID.Random();
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
index 7fdbbf6..6c99b66 100644
--- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
@@ -76,10 +76,5 @@ namespace OpenSim.Services.AuthenticationService
76 76
77 return String.Empty; 77 return String.Empty;
78 } 78 }
79
80 public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key)
81 {
82 return new byte[0];
83 }
84 } 79 }
85} 80}
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
index 0118c91..8831c8a 100644
--- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
@@ -56,10 +56,5 @@ namespace OpenSim.Services.AuthenticationService
56 { 56 {
57 return String.Empty; 57 return String.Empty;
58 } 58 }
59
60 public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key)
61 {
62 return new byte[0];
63 }
64 } 59 }
65} 60}
diff --git a/OpenSim/Services/Connectors/User/UserServiceConnector.cs b/OpenSim/Services/Connectors/User/UserServiceConnector.cs
index fb03844..d418938 100644
--- a/OpenSim/Services/Connectors/User/UserServiceConnector.cs
+++ b/OpenSim/Services/Connectors/User/UserServiceConnector.cs
@@ -39,7 +39,7 @@ using OpenMetaverse;
39 39
40namespace OpenSim.Services.Connectors 40namespace OpenSim.Services.Connectors
41{ 41{
42 public class UserServicesConnector : IUserAccountDataService 42 public class UserServicesConnector : IUserAccountService
43 { 43 {
44 private static readonly ILog m_log = 44 private static readonly ILog m_log =
45 LogManager.GetLogger( 45 LogManager.GetLogger(
@@ -81,153 +81,34 @@ namespace OpenSim.Services.Connectors
81 m_ServerURI = serviceURI; 81 m_ServerURI = serviceURI;
82 } 82 }
83 83
84 public UserAccountData GetUserAccountData(UUID scopeID, string firstName, string lastName) 84 public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
85 { 85 {
86 string uri = m_ServerURI + "/users/"; 86 return null;
87 UserAccountData data = new UserAccountData();
88 data.FirstName = firstName;
89 data.LastName = lastName;
90 data.ScopeID = scopeID;
91 data.UserID = UUID.Zero;
92
93 try
94 {
95 data = SynchronousRestObjectRequester.
96 MakeRequest<UserAccountData, UserAccountData>("POST", uri, data);
97 }
98 catch (Exception e)
99 {
100 m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
101 return null;
102 }
103
104 if (data.UserID == UUID.Zero)
105 return null;
106
107 return data;
108 } 87 }
109 88
110 public UserAccountData GetUserAccountData(UUID scopeID, UUID userID) 89 public UserAccount GetUserAccount(UUID scopeID, UUID userID)
111 { 90 {
112 string uri = m_ServerURI + "/users/"; 91 return null;
113 UserAccountData data = new UserAccountData();
114 data.FirstName = String.Empty;
115 data.LastName = String.Empty;
116 data.ScopeID = scopeID;
117 data.UserID = userID;
118
119 try
120 {
121 data = SynchronousRestObjectRequester.
122 MakeRequest<UserAccountData, UserAccountData>("POST", uri, data);
123 }
124 catch (Exception e)
125 {
126 m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
127 return null;
128 }
129
130 if (data.UserID == UUID.Zero)
131 return null;
132
133 return data;
134 } 92 }
135 93
136 public bool SetHomePosition(UserAccountData data, UUID regionID, UUID regionSecret) 94 public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret)
137 { 95 {
138 string uri = m_ServerURI + "/user/"; 96 return false;
139 bool result = false;
140
141 UserAccountDataMessage msg = new UserAccountDataMessage();
142
143 msg.Data = data;
144 msg.RegionID = regionID;
145 msg.RegionSecret = regionSecret;
146
147 try
148 {
149 result = SynchronousRestObjectRequester.
150 MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg);
151 }
152 catch (Exception e)
153 {
154 m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
155 return false;
156 }
157
158 return result;
159 } 97 }
160 98
161 public bool SetUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) 99 public bool SetUserAccount(UserAccount data, UUID principalID, string token)
162 { 100 {
163 string uri = m_ServerURI + "/user/"; 101 return false;
164 bool result = false;
165
166 UserAccountDataMessage msg = new UserAccountDataMessage();
167
168 msg.Data = data;
169 msg.PrincipalID = principalID;
170 msg.SessionID = sessionID;
171
172 try
173 {
174 result = SynchronousRestObjectRequester.
175 MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg);
176 }
177 catch (Exception e)
178 {
179 m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
180 return false;
181 }
182
183 return result;
184 } 102 }
185 103
186 public bool CreateUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) 104 public bool CreateUserAccount(UserAccount data, UUID principalID, string token)
187 { 105 {
188 string uri = m_ServerURI + "/newuser/"; 106 return false;
189 bool result = false;
190
191 UserAccountDataMessage msg = new UserAccountDataMessage();
192
193 msg.Data = data;
194 msg.PrincipalID = principalID;
195 msg.SessionID = sessionID;
196
197 try
198 {
199 result = SynchronousRestObjectRequester.
200 MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg);
201 }
202 catch (Exception e)
203 {
204 m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
205 return false;
206 }
207
208 return result;
209 } 107 }
210 108
211 public List<UserAccountData> GetUserAccountData(UUID scopeID, string query) 109 public List<UserAccount> GetUserAccount(UUID scopeID, string query)
212 { 110 {
213 string uri = m_ServerURI + "/userlist/"; 111 return null;
214 UserAccountData data = new UserAccountData();
215 data.FirstName = query;
216 data.ScopeID = scopeID;
217 List<UserAccountData> result;
218
219 try
220 {
221 result = SynchronousRestObjectRequester.
222 MakeRequest<UserAccountData, List<UserAccountData>>("POST", uri, data);
223 }
224 catch (Exception e)
225 {
226 m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
227 return null;
228 }
229
230 return result;
231 } 112 }
232 } 113 }
233} 114}
diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs
index b448a14..9225773 100644
--- a/OpenSim/Services/Interfaces/IAuthenticationService.cs
+++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs
@@ -39,39 +39,12 @@ namespace OpenSim.Services.Interfaces
39 public interface IAuthenticationService 39 public interface IAuthenticationService
40 { 40 {
41 ////////////////////////////////////////////////////// 41 //////////////////////////////////////////////////////
42 // PKI Zone!
43 //
44 // HG2 authentication works by using a cryptographic
45 // exchange.
46 // This method must provide a public key, the other
47 // crypto methods must understand hoow to deal with
48 // messages encrypted to it.
49 //
50 // If the public key is of zero length, you will
51 // get NO encryption and NO security.
52 //
53 // For non-HG installations, this is not relevant
54 //
55 // Implementors who are not using PKI can treat the
56 // cyphertext as a string and provide a zero-length
57 // key. Encryptionless implementations will not
58 // interoperate with implementations using encryption.
59 // If one side uses encryption, both must do so.
60 //
61 byte[] GetPublicKey();
62
63 //////////////////////////////////////////////////////
64 // Authentication 42 // Authentication
65 // 43 //
66 // These methods will return a token, which can be used to access 44 // These methods will return a token, which can be used to access
67 // various services. 45 // various services.
68 // 46 //
69 // The encrypted versions take the received cyphertext and
70 // the public key of the peer, which the connector must have
71 // obtained using a remote GetPublicKey call.
72 //
73 string Authenticate(UUID principalID, string password, int lifetime); 47 string Authenticate(UUID principalID, string password, int lifetime);
74 byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key);
75 48
76 ////////////////////////////////////////////////////// 49 //////////////////////////////////////////////////////
77 // Verification 50 // Verification
@@ -81,12 +54,7 @@ namespace OpenSim.Services.Interfaces
81 // Tokens expire after 30 minutes and can be refreshed by 54 // Tokens expire after 30 minutes and can be refreshed by
82 // re-verifying. 55 // re-verifying.
83 // 56 //
84 // If encrypted authentication was used, encrypted verification
85 // must be used to refresh. Unencrypted verification is still
86 // performed, but doesn't refresh token lifetime.
87 //
88 bool Verify(UUID principalID, string token, int lifetime); 57 bool Verify(UUID principalID, string token, int lifetime);
89 bool VerifyEncrypted(byte[] cyphertext, byte[] key);
90 58
91 ////////////////////////////////////////////////////// 59 //////////////////////////////////////////////////////
92 // Teardown 60 // Teardown
@@ -95,11 +63,7 @@ namespace OpenSim.Services.Interfaces
95 // invalidates it and it can not subsequently be used 63 // invalidates it and it can not subsequently be used
96 // or refreshed. 64 // or refreshed.
97 // 65 //
98 // Tokens created by encrypted authentication must
99 // be returned by encrypted release calls;
100 //
101 bool Release(UUID principalID, string token); 66 bool Release(UUID principalID, string token);
102 bool ReleaseEncrypted(byte[] cyphertext, byte[] key);
103 67
104 ////////////////////////////////////////////////////// 68 //////////////////////////////////////////////////////
105 // Grid 69 // Grid
diff --git a/OpenSim/Services/Interfaces/IUserService.cs b/OpenSim/Services/Interfaces/IUserService.cs
index 35254a1..92bd8ef 100644
--- a/OpenSim/Services/Interfaces/IUserService.cs
+++ b/OpenSim/Services/Interfaces/IUserService.cs
@@ -30,13 +30,13 @@ using OpenMetaverse;
30 30
31namespace OpenSim.Services.Interfaces 31namespace OpenSim.Services.Interfaces
32{ 32{
33 public class UserAccountData 33 public class UserAccount
34 { 34 {
35 public UserAccountData() 35 public UserAccount()
36 { 36 {
37 } 37 }
38 38
39 public UserAccountData(UUID userID, UUID homeRegionID, float homePositionX, 39 public UserAccount(UUID userID, UUID homeRegionID, float homePositionX,
40 float homePositionY, float homePositionZ, float homeLookAtX, 40 float homePositionY, float homePositionZ, float homeLookAtX,
41 float homeLookAtY, float homeLookAtZ) 41 float homeLookAtY, float homeLookAtZ)
42 { 42 {
@@ -78,41 +78,26 @@ namespace OpenSim.Services.Interfaces
78 78
79 }; 79 };
80 80
81 public class UserAccountDataMessage 81 public interface IUserAccountService
82 { 82 {
83 public UserAccountData Data; 83 UserAccount GetUserAccount(UUID scopeID, UUID userID);
84 84 UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName);
85 // Set to the region's ID and secret when updating home location
86 //
87 public UUID RegionID;
88 public UUID RegionSecret;
89
90 // Set to the auth info of the user requesting creation/update
91 //
92 public UUID PrincipalID;
93 public UUID SessionID;
94 };
95
96 public interface IUserAccountDataService
97 {
98 UserAccountData GetUserAccountData(UUID scopeID, UUID userID);
99 UserAccountData GetUserAccountData(UUID scopeID, string FirstName, string LastName);
100 // Returns the list of avatars that matches both the search 85 // Returns the list of avatars that matches both the search
101 // criterion and the scope ID passed 86 // criterion and the scope ID passed
102 // 87 //
103 List<UserAccountData> GetUserAccountData(UUID scopeID, string query); 88 List<UserAccount> GetUserAccount(UUID scopeID, string query);
104 89
105 90
106 // This will set only the home region portion of the data! 91 // This will set only the home region portion of the data!
107 // Can't be used to set god level, flags, type or change the name! 92 // Can't be used to set god level, flags, type or change the name!
108 // 93 //
109 bool SetHomePosition(UserAccountData data, UUID RegionID, UUID RegionSecret); 94 bool SetHomePosition(UserAccount data, UUID RegionID, UUID RegionSecret);
110 95
111 // Update all updatable fields 96 // Update all updatable fields
112 // 97 //
113 bool SetUserAccountData(UserAccountData data, UUID PrincipalID, UUID SessionID); 98 bool SetUserAccount(UserAccount data, UUID PrincipalID, string token);
114 99
115 // Creates a user data record 100 // Creates a user data record
116 bool CreateUserAccountData(UserAccountData data, UUID PrincipalID, UUID SessionID); 101 bool CreateUserAccount(UserAccount data, UUID PrincipalID, string token);
117 } 102 }
118} 103}
diff --git a/OpenSim/Services/UserService/UserService.cs b/OpenSim/Services/UserService/UserService.cs
index 78793657..e8b9fc3 100644
--- a/OpenSim/Services/UserService/UserService.cs
+++ b/OpenSim/Services/UserService/UserService.cs
@@ -35,39 +35,39 @@ using OpenMetaverse;
35 35
36namespace OpenSim.Services.UserAccountService 36namespace OpenSim.Services.UserAccountService
37{ 37{
38 public class UserAccountService : UserAccountServiceBase, IUserAccountDataService 38 public class UserAccountService : UserAccountServiceBase, IUserAccountService
39 { 39 {
40 public UserAccountService(IConfigSource config) : base(config) 40 public UserAccountService(IConfigSource config) : base(config)
41 { 41 {
42 } 42 }
43 43
44 public UserAccountData GetUserAccountData(UUID scopeID, string firstName, 44 public UserAccount GetUserAccount(UUID scopeID, string firstName,
45 string lastName) 45 string lastName)
46 { 46 {
47 return null; 47 return null;
48 } 48 }
49 49
50 public UserAccountData GetUserAccountData(UUID scopeID, UUID userID) 50 public UserAccount GetUserAccount(UUID scopeID, UUID userID)
51 { 51 {
52 return null; 52 return null;
53 } 53 }
54 54
55 public bool SetHomePosition(UserAccountData data, UUID regionID, UUID regionSecret) 55 public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret)
56 { 56 {
57 return false; 57 return false;
58 } 58 }
59 59
60 public bool SetUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) 60 public bool SetUserAccount(UserAccount data, UUID principalID, string token)
61 { 61 {
62 return false; 62 return false;
63 } 63 }
64 64
65 public bool CreateUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) 65 public bool CreateUserAccount(UserAccount data, UUID principalID, string token)
66 { 66 {
67 return false; 67 return false;
68 } 68 }
69 69
70 public List<UserAccountData> GetUserAccountData(UUID scopeID, 70 public List<UserAccount> GetUserAccount(UUID scopeID,
71 string query) 71 string query)
72 { 72 {
73 return null; 73 return null;
diff --git a/OpenSim/Services/UserService/UserServiceBase.cs b/OpenSim/Services/UserService/UserServiceBase.cs
index c982c1a..fea8b01 100644
--- a/OpenSim/Services/UserService/UserServiceBase.cs
+++ b/OpenSim/Services/UserService/UserServiceBase.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Services.UserAccountService
36{ 36{
37 public class UserAccountServiceBase: ServiceBase 37 public class UserAccountServiceBase: ServiceBase
38 { 38 {
39 protected IUserDataPlugin m_Database = null; 39 protected IUserAccountData m_Database = null;
40 40
41 public UserAccountServiceBase(IConfigSource config) : base(config) 41 public UserAccountServiceBase(IConfigSource config) : base(config)
42 { 42 {
@@ -53,12 +53,12 @@ namespace OpenSim.Services.UserAccountService
53 string connString = userConfig.GetString("ConnectionString", 53 string connString = userConfig.GetString("ConnectionString",
54 String.Empty); 54 String.Empty);
55 55
56 m_Database = LoadPlugin<IUserDataPlugin>(dllName); 56 string realm = userConfig.GetString("Realm", "users");
57
58 m_Database = LoadPlugin<IUserAccountData>(dllName, new Object[] {connString, realm});
57 59
58 if (m_Database == null) 60 if (m_Database == null)
59 throw new Exception("Could not find a storage interface in the given module"); 61 throw new Exception("Could not find a storage interface in the given module");
60
61 m_Database.Initialise(connString);
62 } 62 }
63 } 63 }
64} 64}