Merge branch 'master' of ssh://MyConnection/var/git/opensim

remotes/origin/0.6.7-post-fixes
Teravus Ovares (Dan Olivares) 2009-09-06 16:15:20 -04:00
commit 8797a82098
19 changed files with 334 additions and 239 deletions

View File

@ -94,14 +94,24 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
regionLoader = new RegionLoaderWebServer(); regionLoader = new RegionLoaderWebServer();
} }
m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations...");
regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule()); m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
m_log.Info("[LOADREGIONSPLUGIN]: Done.");
if (!CheckRegionsForSanity(regionsToLoad)) if (!CheckRegionsForSanity(regionsToLoad))
{ {
m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data
{
public class UserAccountData
{
public UUID PrincipalID;
public UUID ScopeID;
public Dictionary<string, object> Data;
}
/// <summary>
/// An interface for connecting to the authentication datastore
/// </summary>
public interface IUserAccountData
{
UserAccountData Get(UUID principalID, UUID ScopeID);
List<UserAccountData> Query(UUID principalID, UUID ScopeID, string query);
bool Store(UserAccountData data);
bool SetDataItem(UUID principalID, string item, string value);
}
}

View File

@ -0,0 +1,180 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
using MySql.Data.MySqlClient;
namespace OpenSim.Data.MySQL
{
public class MySqlUserAccountData : MySqlFramework, IUserAccountData
{
private string m_Realm;
private List<string> m_ColumnNames = null;
private int m_LastExpire = 0;
public MySqlUserAccountData(string connectionString, string realm)
: base(connectionString)
{
m_Realm = realm;
Migration m = new Migration(m_Connection, GetType().Assembly, "UserStore");
m.Update();
}
public List<UserAccountData> Query(UUID principalID, UUID scopeID, string query)
{
return null;
}
public UserAccountData Get(UUID principalID, UUID scopeID)
{
UserAccountData ret = new UserAccountData();
ret.Data = new Dictionary<string, object>();
string command = "select * from `"+m_Realm+"` where UUID = ?principalID";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
MySqlCommand cmd = new MySqlCommand(command);
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
IDataReader result = ExecuteReader(cmd);
if (result.Read())
{
ret.PrincipalID = principalID;
UUID scope;
UUID.TryParse(result["ScopeID"].ToString(), out scope);
ret.ScopeID = scope;
if (m_ColumnNames == null)
{
m_ColumnNames = new List<string>();
DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
m_ColumnNames.Add(row["ColumnName"].ToString());
}
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
if (s == "ScopeID")
continue;
ret.Data[s] = result[s].ToString();
}
result.Close();
CloseReaderCommand(cmd);
return ret;
}
result.Close();
CloseReaderCommand(cmd);
return null;
}
public bool Store(UserAccountData data)
{
if (data.Data.ContainsKey("UUID"))
data.Data.Remove("UUID");
if (data.Data.ContainsKey("ScopeID"))
data.Data.Remove("ScopeID");
string[] fields = new List<string>(data.Data.Keys).ToArray();
MySqlCommand cmd = new MySqlCommand();
string update = "update `"+m_Realm+"` set ";
bool first = true;
foreach (string field in fields)
{
if (!first)
update += ", ";
update += "`" + field + "` = ?"+field;
first = false;
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
}
update += " where UUID = ?principalID";
if (data.ScopeID != UUID.Zero)
update += " and ScopeID = ?scopeID";
cmd.CommandText = update;
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString());
if (ExecuteNonQuery(cmd) < 1)
{
string insert = "insert into `" + m_Realm + "` (`UUID`, `ScopeID`, `" +
String.Join("`, `", fields) +
"`) values ( ?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")";
cmd.CommandText = insert;
if (ExecuteNonQuery(cmd) < 1)
{
cmd.Dispose();
return false;
}
}
cmd.Dispose();
return true;
}
public bool SetDataItem(UUID principalID, string item, string value)
{
MySqlCommand cmd = new MySqlCommand("update `" + m_Realm +
"` set `" + item + "` = ?" + item + " where UUID = ?UUID");
cmd.Parameters.AddWithValue("?"+item, value);
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
return false;
}
}
}

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE users add scopeID char(36) not null default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -78,6 +78,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
foreach (IConfig config in source.Configs) foreach (IConfig config in source.Configs)
{ {
//m_log.Info("[REGIONLOADERFILESYSTEM]: Creating RegionInfo for " + config.Name);
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
regionInfos.Add(regionInfo); regionInfos.Add(regionInfo);
i++; i++;

View File

@ -313,7 +313,7 @@ namespace OpenSim.Region.Communications.Hypergrid
public bool IsForeignUser(UUID userID, out string userServerURL) public bool IsForeignUser(UUID userID, out string userServerURL)
{ {
userServerURL = string.Empty; userServerURL = m_commsManager.NetworkServersInfo.UserURL;
CachedUserInfo uinfo = m_commsManager.UserProfileCacheService.GetUserDetails(userID); CachedUserInfo uinfo = m_commsManager.UserProfileCacheService.GetUserDetails(userID);
if (uinfo != null) if (uinfo != null)
{ {

View File

@ -112,7 +112,7 @@ namespace OpenSim.Region.Communications.OGS1
parameters.Add(param); parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters); XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters);
XmlRpcResponse resp = req.Send(GetUserServerURL(userId), 6000); XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 6000);
Hashtable respData = (Hashtable)resp.Value; Hashtable respData = (Hashtable)resp.Value;
if (respData.Contains("error_type")) if (respData.Contains("error_type"))
{ {

View File

@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private IUserAccountDataService m_UserService; private IUserAccountService m_UserService;
private bool m_Enabled = false; private bool m_Enabled = false;
@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
Object[] args = new Object[] { source }; Object[] args = new Object[] { source };
m_UserService = m_UserService =
ServerUtils.LoadPlugin<IUserAccountDataService>(serviceDll, ServerUtils.LoadPlugin<IUserAccountService>(serviceDll,
args); args);
if (m_UserService == null) if (m_UserService == null)
@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
if (!m_Enabled) if (!m_Enabled)
return; return;
scene.RegisterModuleInterface<IUserAccountDataService>(m_UserService); scene.RegisterModuleInterface<IUserAccountService>(m_UserService);
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)

View File

@ -37,7 +37,7 @@ using OpenSim.Services.Connectors;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
{ {
public class RemoteUserServicesConnector : UserServicesConnector, public class RemoteUserServicesConnector : UserServicesConnector,
ISharedRegionModule, IUserAccountDataService ISharedRegionModule, IUserAccountService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User
if (!m_Enabled) if (!m_Enabled)
return; return;
scene.RegisterModuleInterface<IUserAccountDataService>(this); scene.RegisterModuleInterface<IUserAccountService>(this);
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)

View File

@ -220,11 +220,12 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_scripts_enabled = true; private bool m_scripts_enabled = true;
private string m_defaultScriptEngine; private string m_defaultScriptEngine;
private int m_LastLogin = 0; private int m_LastLogin = 0;
private Thread HeartbeatThread; private Thread HeartbeatThread = null;
private volatile bool shuttingdown = false; private volatile bool shuttingdown = false;
private int m_lastUpdate = Environment.TickCount; private int m_lastUpdate = Environment.TickCount;
private int m_maxPrimsPerFrame = 200; private int m_maxPrimsPerFrame = 200;
private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object(); private object m_deleting_scene_object = new object();
@ -876,6 +877,13 @@ namespace OpenSim.Region.Framework.Scenes
//m_heartbeatTimer.Enabled = true; //m_heartbeatTimer.Enabled = true;
//m_heartbeatTimer.Interval = (int)(m_timespan * 1000); //m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
//m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
if (HeartbeatThread != null)
{
ThreadTracker.Remove(HeartbeatThread);
HeartbeatThread.Abort();
HeartbeatThread = null;
}
m_lastUpdate = Environment.TickCount;
HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
HeartbeatThread.SetApartmentState(ApartmentState.MTA); HeartbeatThread.SetApartmentState(ApartmentState.MTA);
HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
@ -911,10 +919,17 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void Heartbeat(object sender) private void Heartbeat(object sender)
{
try
{ {
Update(); Update();
m_lastUpdate = Environment.TickCount; m_lastUpdate = Environment.TickCount;
m_firstHeartbeat = false;
}
catch (ThreadAbortException)
{
}
} }
/// <summary> /// <summary>
@ -2307,6 +2322,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="client"></param> /// <param name="client"></param>
public override void AddNewClient(IClientAPI client) public override void AddNewClient(IClientAPI client)
{ {
CheckHeartbeat();
SubscribeToClientEvents(client); SubscribeToClientEvents(client);
ScenePresence presence; ScenePresence presence;
@ -2831,6 +2847,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
{ {
CheckHeartbeat();
AvatarAppearance appearance = null; AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance); GetAvatarAppearance(client, out appearance);
@ -2873,6 +2890,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="agentID"></param> /// <param name="agentID"></param>
public override void RemoveClient(UUID agentID) public override void RemoveClient(UUID agentID)
{ {
CheckHeartbeat();
bool childagentYN = false; bool childagentYN = false;
ScenePresence avatar = GetScenePresence(agentID); ScenePresence avatar = GetScenePresence(agentID);
if (avatar != null) if (avatar != null)
@ -4380,6 +4398,8 @@ namespace OpenSim.Region.Framework.Scenes
else else
return health; return health;
CheckHeartbeat();
return health; return health;
} }
@ -4565,5 +4585,14 @@ namespace OpenSim.Region.Framework.Scenes
return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
} }
private void CheckHeartbeat()
{
if (m_firstHeartbeat)
return;
if (System.Environment.TickCount - m_lastUpdate > 2000)
StartTimer();
}
} }
} }

View File

@ -90,31 +90,16 @@ namespace OpenSim.Services.AuthenticationService
throw new Exception("Could not find a storage interface in the given module"); throw new Exception("Could not find a storage interface in the given module");
} }
public virtual byte[] GetPublicKey()
{
return new byte[0];
}
public bool Verify(UUID principalID, string token, int lifetime) public bool Verify(UUID principalID, string token, int lifetime)
{ {
return m_Database.CheckToken(principalID, token, lifetime); return m_Database.CheckToken(principalID, token, lifetime);
} }
public bool VerifyEncrypted(byte[] cyphertext, byte[] key)
{
return false;
}
public virtual bool Release(UUID principalID, string token) public virtual bool Release(UUID principalID, string token)
{ {
return m_Database.CheckToken(principalID, token, 0); return m_Database.CheckToken(principalID, token, 0);
} }
public virtual bool ReleaseEncrypted(byte[] cyphertext, byte[] key)
{
return false;
}
protected string GetToken(UUID principalID, int lifetime) protected string GetToken(UUID principalID, int lifetime)
{ {
UUID token = UUID.Random(); UUID token = UUID.Random();

View File

@ -76,10 +76,5 @@ namespace OpenSim.Services.AuthenticationService
return String.Empty; return String.Empty;
} }
public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key)
{
return new byte[0];
}
} }
} }

View File

@ -56,10 +56,5 @@ namespace OpenSim.Services.AuthenticationService
{ {
return String.Empty; return String.Empty;
} }
public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key)
{
return new byte[0];
}
} }
} }

View File

@ -39,7 +39,7 @@ using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class UserServicesConnector : IUserAccountDataService public class UserServicesConnector : IUserAccountService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -81,153 +81,34 @@ namespace OpenSim.Services.Connectors
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
} }
public UserAccountData GetUserAccountData(UUID scopeID, string firstName, string lastName) public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
{ {
string uri = m_ServerURI + "/users/";
UserAccountData data = new UserAccountData();
data.FirstName = firstName;
data.LastName = lastName;
data.ScopeID = scopeID;
data.UserID = UUID.Zero;
try
{
data = SynchronousRestObjectRequester.
MakeRequest<UserAccountData, UserAccountData>("POST", uri, data);
}
catch (Exception e)
{
m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
return null; return null;
} }
if (data.UserID == UUID.Zero) public UserAccount GetUserAccount(UUID scopeID, UUID userID)
return null;
return data;
}
public UserAccountData GetUserAccountData(UUID scopeID, UUID userID)
{ {
string uri = m_ServerURI + "/users/";
UserAccountData data = new UserAccountData();
data.FirstName = String.Empty;
data.LastName = String.Empty;
data.ScopeID = scopeID;
data.UserID = userID;
try
{
data = SynchronousRestObjectRequester.
MakeRequest<UserAccountData, UserAccountData>("POST", uri, data);
}
catch (Exception e)
{
m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
return null; return null;
} }
if (data.UserID == UUID.Zero) public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret)
return null;
return data;
}
public bool SetHomePosition(UserAccountData data, UUID regionID, UUID regionSecret)
{ {
string uri = m_ServerURI + "/user/";
bool result = false;
UserAccountDataMessage msg = new UserAccountDataMessage();
msg.Data = data;
msg.RegionID = regionID;
msg.RegionSecret = regionSecret;
try
{
result = SynchronousRestObjectRequester.
MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg);
}
catch (Exception e)
{
m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
return false; return false;
} }
return result; public bool SetUserAccount(UserAccount data, UUID principalID, string token)
}
public bool SetUserAccountData(UserAccountData data, UUID principalID, UUID sessionID)
{ {
string uri = m_ServerURI + "/user/";
bool result = false;
UserAccountDataMessage msg = new UserAccountDataMessage();
msg.Data = data;
msg.PrincipalID = principalID;
msg.SessionID = sessionID;
try
{
result = SynchronousRestObjectRequester.
MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg);
}
catch (Exception e)
{
m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
return false; return false;
} }
return result; public bool CreateUserAccount(UserAccount data, UUID principalID, string token)
}
public bool CreateUserAccountData(UserAccountData data, UUID principalID, UUID sessionID)
{ {
string uri = m_ServerURI + "/newuser/";
bool result = false;
UserAccountDataMessage msg = new UserAccountDataMessage();
msg.Data = data;
msg.PrincipalID = principalID;
msg.SessionID = sessionID;
try
{
result = SynchronousRestObjectRequester.
MakeRequest<UserAccountDataMessage, bool>("POST", uri, msg);
}
catch (Exception e)
{
m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
return false; return false;
} }
return result; public List<UserAccount> GetUserAccount(UUID scopeID, string query)
}
public List<UserAccountData> GetUserAccountData(UUID scopeID, string query)
{ {
string uri = m_ServerURI + "/userlist/";
UserAccountData data = new UserAccountData();
data.FirstName = query;
data.ScopeID = scopeID;
List<UserAccountData> result;
try
{
result = SynchronousRestObjectRequester.
MakeRequest<UserAccountData, List<UserAccountData>>("POST", uri, data);
}
catch (Exception e)
{
m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message);
return null; return null;
} }
return result;
}
} }
} }

View File

@ -38,40 +38,13 @@ namespace OpenSim.Services.Interfaces
// //
public interface IAuthenticationService public interface IAuthenticationService
{ {
//////////////////////////////////////////////////////
// PKI Zone!
//
// HG2 authentication works by using a cryptographic
// exchange.
// This method must provide a public key, the other
// crypto methods must understand hoow to deal with
// messages encrypted to it.
//
// If the public key is of zero length, you will
// get NO encryption and NO security.
//
// For non-HG installations, this is not relevant
//
// Implementors who are not using PKI can treat the
// cyphertext as a string and provide a zero-length
// key. Encryptionless implementations will not
// interoperate with implementations using encryption.
// If one side uses encryption, both must do so.
//
byte[] GetPublicKey();
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Authentication // Authentication
// //
// These methods will return a token, which can be used to access // These methods will return a token, which can be used to access
// various services. // various services.
// //
// The encrypted versions take the received cyphertext and
// the public key of the peer, which the connector must have
// obtained using a remote GetPublicKey call.
//
string Authenticate(UUID principalID, string password, int lifetime); string Authenticate(UUID principalID, string password, int lifetime);
byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Verification // Verification
@ -81,12 +54,7 @@ namespace OpenSim.Services.Interfaces
// Tokens expire after 30 minutes and can be refreshed by // Tokens expire after 30 minutes and can be refreshed by
// re-verifying. // re-verifying.
// //
// If encrypted authentication was used, encrypted verification
// must be used to refresh. Unencrypted verification is still
// performed, but doesn't refresh token lifetime.
//
bool Verify(UUID principalID, string token, int lifetime); bool Verify(UUID principalID, string token, int lifetime);
bool VerifyEncrypted(byte[] cyphertext, byte[] key);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Teardown // Teardown
@ -95,11 +63,7 @@ namespace OpenSim.Services.Interfaces
// invalidates it and it can not subsequently be used // invalidates it and it can not subsequently be used
// or refreshed. // or refreshed.
// //
// Tokens created by encrypted authentication must
// be returned by encrypted release calls;
//
bool Release(UUID principalID, string token); bool Release(UUID principalID, string token);
bool ReleaseEncrypted(byte[] cyphertext, byte[] key);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Grid // Grid

View File

@ -30,13 +30,13 @@ using OpenMetaverse;
namespace OpenSim.Services.Interfaces namespace OpenSim.Services.Interfaces
{ {
public class UserAccountData public class UserAccount
{ {
public UserAccountData() public UserAccount()
{ {
} }
public UserAccountData(UUID userID, UUID homeRegionID, float homePositionX, public UserAccount(UUID userID, UUID homeRegionID, float homePositionX,
float homePositionY, float homePositionZ, float homeLookAtX, float homePositionY, float homePositionZ, float homeLookAtX,
float homeLookAtY, float homeLookAtZ) float homeLookAtY, float homeLookAtZ)
{ {
@ -78,41 +78,26 @@ namespace OpenSim.Services.Interfaces
}; };
public class UserAccountDataMessage public interface IUserAccountService
{ {
public UserAccountData Data; UserAccount GetUserAccount(UUID scopeID, UUID userID);
UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName);
// Set to the region's ID and secret when updating home location
//
public UUID RegionID;
public UUID RegionSecret;
// Set to the auth info of the user requesting creation/update
//
public UUID PrincipalID;
public UUID SessionID;
};
public interface IUserAccountDataService
{
UserAccountData GetUserAccountData(UUID scopeID, UUID userID);
UserAccountData GetUserAccountData(UUID scopeID, string FirstName, string LastName);
// Returns the list of avatars that matches both the search // Returns the list of avatars that matches both the search
// criterion and the scope ID passed // criterion and the scope ID passed
// //
List<UserAccountData> GetUserAccountData(UUID scopeID, string query); List<UserAccount> GetUserAccount(UUID scopeID, string query);
// This will set only the home region portion of the data! // This will set only the home region portion of the data!
// Can't be used to set god level, flags, type or change the name! // Can't be used to set god level, flags, type or change the name!
// //
bool SetHomePosition(UserAccountData data, UUID RegionID, UUID RegionSecret); bool SetHomePosition(UserAccount data, UUID RegionID, UUID RegionSecret);
// Update all updatable fields // Update all updatable fields
// //
bool SetUserAccountData(UserAccountData data, UUID PrincipalID, UUID SessionID); bool SetUserAccount(UserAccount data, UUID PrincipalID, string token);
// Creates a user data record // Creates a user data record
bool CreateUserAccountData(UserAccountData data, UUID PrincipalID, UUID SessionID); bool CreateUserAccount(UserAccount data, UUID PrincipalID, string token);
} }
} }

View File

@ -35,39 +35,39 @@ using OpenMetaverse;
namespace OpenSim.Services.UserAccountService namespace OpenSim.Services.UserAccountService
{ {
public class UserAccountService : UserAccountServiceBase, IUserAccountDataService public class UserAccountService : UserAccountServiceBase, IUserAccountService
{ {
public UserAccountService(IConfigSource config) : base(config) public UserAccountService(IConfigSource config) : base(config)
{ {
} }
public UserAccountData GetUserAccountData(UUID scopeID, string firstName, public UserAccount GetUserAccount(UUID scopeID, string firstName,
string lastName) string lastName)
{ {
return null; return null;
} }
public UserAccountData GetUserAccountData(UUID scopeID, UUID userID) public UserAccount GetUserAccount(UUID scopeID, UUID userID)
{ {
return null; return null;
} }
public bool SetHomePosition(UserAccountData data, UUID regionID, UUID regionSecret) public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret)
{ {
return false; return false;
} }
public bool SetUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) public bool SetUserAccount(UserAccount data, UUID principalID, string token)
{ {
return false; return false;
} }
public bool CreateUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) public bool CreateUserAccount(UserAccount data, UUID principalID, string token)
{ {
return false; return false;
} }
public List<UserAccountData> GetUserAccountData(UUID scopeID, public List<UserAccount> GetUserAccount(UUID scopeID,
string query) string query)
{ {
return null; return null;

View File

@ -36,7 +36,7 @@ namespace OpenSim.Services.UserAccountService
{ {
public class UserAccountServiceBase: ServiceBase public class UserAccountServiceBase: ServiceBase
{ {
protected IUserDataPlugin m_Database = null; protected IUserAccountData m_Database = null;
public UserAccountServiceBase(IConfigSource config) : base(config) public UserAccountServiceBase(IConfigSource config) : base(config)
{ {
@ -53,12 +53,12 @@ namespace OpenSim.Services.UserAccountService
string connString = userConfig.GetString("ConnectionString", string connString = userConfig.GetString("ConnectionString",
String.Empty); String.Empty);
m_Database = LoadPlugin<IUserDataPlugin>(dllName); string realm = userConfig.GetString("Realm", "users");
m_Database = LoadPlugin<IUserAccountData>(dllName, new Object[] {connString, realm});
if (m_Database == null) if (m_Database == null)
throw new Exception("Could not find a storage interface in the given module"); throw new Exception("Could not find a storage interface in the given module");
m_Database.Initialise(connString);
} }
} }
} }

View File

@ -60,3 +60,13 @@ StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=grid;User ID=grid;Password=grid;" ConnectionString = "Data Source=localhost;Database=grid;User ID=grid;Password=grid;"
; Realm = "auth" ; Realm = "auth"
; * This is the new style user service.
; * "Realm" is the table that is used for user lookup.
; * It defaults to "users", which uses the legacy tables
; *
[UserAccountService]
AuthenticationServiceModule = "OpenSim.Services.UserService.dll:UserAccountService"
StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=grid;User ID=grid;Password=grid;"
; Realm = "users"