* In Standalone, add a persistant account for the OGP user.

* Gridmode, this has no effect at all.
0.6.0-stable
Teravus Ovares 2008-09-25 08:42:48 +00:00
parent 85ff004fb5
commit 17be1b736d
4 changed files with 80 additions and 8 deletions

View File

@ -262,6 +262,24 @@ namespace OpenSim.Framework.Communications
} }
} }
public UUID AddUser(string firstName, string lastName, string password, uint regX, uint regY, UUID SetUUID)
{
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY, SetUUID);
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
if (userProf == null)
{
return UUID.Zero;
}
else
{
InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName);
return userProf.ID;
}
}
/// <summary> /// <summary>
/// Reset a user password /// Reset a user password
/// </summary> /// </summary>

View File

@ -37,6 +37,9 @@ namespace OpenSim.Framework.Communications
/// <param name="user"></param> /// <param name="user"></param>
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
// Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances!
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID setUUID);
/// <summary> /// <summary>
/// Reset a user password /// Reset a user password
/// </summary> /// </summary>

View File

@ -545,10 +545,15 @@ namespace OpenSim.Framework.Communications
/// </summary> /// </summary>
/// <param name="user"></param> /// <param name="user"></param>
public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
{
return AddUserProfile(firstName, lastName, pass, regX, regY, UUID.Random());
}
public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID SetUUID)
{ {
UserProfileData user = new UserProfileData(); UserProfileData user = new UserProfileData();
user.HomeLocation = new Vector3(128, 128, 100); user.HomeLocation = new Vector3(128, 128, 100);
user.ID = UUID.Random(); user.ID = SetUUID;
user.FirstName = firstName; user.FirstName = firstName;
user.SurName = lastName; user.SurName = lastName;
user.PasswordHash = pass; user.PasswordHash = pass;

View File

@ -37,6 +37,7 @@ using System.Web;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenMetaverse.Packets;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
@ -94,6 +95,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
private string httpsCN = ""; private string httpsCN = "";
private bool httpSSL = false; private bool httpSSL = false;
private uint httpsslport = 0; private uint httpsslport = 0;
private bool GridMode = false;
#region IRegionModule Members #region IRegionModule Members
@ -102,6 +104,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
bool enabled = false; bool enabled = false;
IConfig cfg = null; IConfig cfg = null;
IConfig httpcfg = null; IConfig httpcfg = null;
IConfig startupcfg = null;
try try
{ {
cfg = config.Configs["OpenGridProtocol"]; cfg = config.Configs["OpenGridProtocol"];
@ -118,6 +121,19 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
{ {
} }
try
{
startupcfg = config.Configs["Startup"];
}
catch (NullReferenceException)
{
}
if (startupcfg != null)
{
GridMode = enabled = cfg.GetBoolean("gridmode", false);
}
if (cfg != null) if (cfg != null)
{ {
@ -182,7 +198,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
// Of interest to this module potentially // Of interest to this module potentially
//scene.EventManager.OnNewClient += OnNewClient; //scene.EventManager.OnNewClient += OnNewClient;
//scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage; //scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
//scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; // scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
//scene.EventManager.OnMakeChildAgent += MakeChildAgent; //scene.EventManager.OnMakeChildAgent += MakeChildAgent;
//scene.EventManager.OnClientClosed += ClientLoggedOut; //scene.EventManager.OnClientClosed += ClientLoggedOut;
} }
@ -193,6 +209,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
public void Close() public void Close()
{ {
//scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
} }
public string Name public string Name
@ -516,7 +533,20 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
userProfile.WebLoginKey = UUID.Random(); userProfile.WebLoginKey = UUID.Random();
// Do caps registration // Do caps registration
// get seed cap // get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode)
{
homeScene.CommsManager.AddUser(agentData.firstname, agentData.lastname, CreateRandomStr(7), homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID);
UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID);
if (userProfile2 != null)
{
userProfile = userProfile2;
userProfile.AboutText = "OGP USER";
userProfile.FirstLifeAboutText = "OGP USER";
homeScene.CommsManager.UserService.UpdateUserProfile(userProfile);
}
}
// Stick our data in the cache so the region will know something about us // Stick our data in the cache so the region will know something about us
homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(agentData.AgentID, userProfile); homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(agentData.AgentID, userProfile);
@ -576,6 +606,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
CapsLoginID.Add(rezAvatarPath, agentData); CapsLoginID.Add(rezAvatarPath, agentData);
} }
} }
//System.Console.WriteLine("Response:" + responseMap.ToString()); //System.Console.WriteLine("Response:" + responseMap.ToString());
return responseMap; return responseMap;
} }
@ -733,6 +764,8 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
responseMap["connect"] = LLSD.FromBoolean(true); responseMap["connect"] = LLSD.FromBoolean(true);
m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString()); m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString());
} }
} }
@ -1162,6 +1195,18 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
} }
} }
private string CreateRandomStr(int len)
{
Random rnd = new Random(System.Environment.TickCount);
string returnstring = "";
string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
for (int i = 0; i < len; i++)
{
returnstring += chars.Substring(rnd.Next(chars.Length), 1);
}
return returnstring;
}
// Temporary hack to allow teleporting to and from Vaak // Temporary hack to allow teleporting to and from Vaak
private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{ {
@ -1206,6 +1251,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
} }
} }
} }
} }
public class MonoCert : ICertificatePolicy public class MonoCert : ICertificatePolicy